Srch.U object (DisplayTemplatesSrch)
The Srch.Uobject provides a range of JavaScript methods and enumerations to help you in your work with display templates customization in SharePoint 2013. All of the methods and enumerations provided can be found in: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\Search.ClientControls.debug.js. The methods in Srch.U are generic helper methods that you can use across all rendering functionalities both in the Search Center and in a ContentBySearchWebPart (CSWP) that uses client side code to render the UI.
var object = new Srch.U()
Members
The U object has the following members.
Methods
The U object has the following methods.
Method |
Description |
---|---|
Adds an event handler for the given element. |
|
Used for animations on the hover panel. |
|
Used for search results animation. |
|
Appends an element to an array. |
|
Appends a script to a list of scripts to be loaded. |
|
Appends a key-value pair of parameters to the query string. |
|
Gets an HTML formatted String which represents the refiner’s title. This String is ready to be injected into the DOM. |
|
Concatenates two URL segments together. |
|
Returns a shallow copy of the source dictionary. |
|
Copies a given link to the clipboard. |
|
Creates an object that represents the error. |
|
Creates an XML documentation from the given XML string. |
|
Indicates whether the string is null or empty. |
|
Ensures that the given URL protocol value is allowed. |
|
Ensures the element has an assigned CSS class. |
|
Ensures the element does not have an assigned CSS class. |
|
Ensures that the given value is not null, undefined or empty; throws an exception otherwise. |
|
Ensures that the given value is not null or undefined; throws an exception otherwise. |
|
Fills a KeywordQuery from a data provider. |
|
Retrieves the result item/table object for a DOM element. |
|
Splits the string into an array of strings using the semi colon (";") as a separator. |
|
Gets the calendar type as specified in the site or by the user. If no calendar type is available, None() will be returned. |
|
Gets the client control component that is the DOM ancestor of the given element. |
|
Retrieves an HTTP cookie for the given name. |
|
Formats the links list into an HTML UL list. |
|
Gets the display name from the Author field of the search result. |
|
Gets the given field for the object. |
|
Gets the image URL for a folder. |
|
Gets the formatted time from seconds. |
|
Gets a friendly name for the given file extension. For example "file_Word" instead of "DOCX". |
|
Gets a relative date time string using GetRelativeDateTimeString in SP.DateTime.Util. |
|
Gets a string that can be evaluated to hide the hover panel. |
|
Gets the highlighted property for the current results based on the given key. |
|
Extracts the host name for the current page. |
|
Gets the URL for the HTML page’s associated PNG image. |
|
Gets the icon URL associated with the file extension. If no information on the file extension can be found, the icon URL associated with the HTML page will be returned. |
|
Gets the image markup for the given height and width. |
|
Gets multiple hit-highlighted XML nodes. |
|
Gets the field value of the object. If no field exists, a field will be created with the default values provided. |
|
Gets the attribute value of the closest parent element for the given attribute name. |
|
Gets the closest parent element with the given tag name. |
|
Gets a render template by name. |
|
Gets an array of registered render templates. |
|
Gets the result object for the current element. |
|
Gets the URL for the results page. |
|
Gets a string that can be evaluated to show the hover panel. |
|
Gets a string that can be evaluated to show the hover panel. |
|
Gets a single hit-highlighted XML node. |
|
Gets the field value for the given object. |
|
Gets the first table of the given type in a result table collection. |
|
Gets the given property value from a property bag. |
|
Gets the template file URL for the given template function or context object. |
|
Trims the hit-highlighted string; adds an ellipsis at the end if required. |
|
Trims the given string based on the given cut off value; adds an ellipsis if required. |
|
Gets a trimmed string that is un-encoded containing multi-valued results. |
|
Gets the username from the Author field. The username is expected to be either in NT Auth, FBA, or Windows claims format. |
|
Gets the IMG formatted tag for a video. |
|
Gets the default workspace (s4-workspace) element. |
|
Hides the given DOM element by setting its display attribute to hidden. |
|
Registers the style link. |
|
Registers the language script. |
|
Registers the script. |
|
Indicates whether the specified object is an array or not. |
|
Indicates whether the specified URL contains an image path for the site logo. |
|
Indicates whether the current page is the default site search page (osssearchresults.aspx). |
|
Indicates whether the specified element is a descendant for the container. |
|
Indicates whether the specified key code is the Enter button’s code or not. |
|
Indicates whether the first result in the result table is promoted. |
|
Indicates whether the first result in the result table is ranked. |
|
Indicates whether the specified item is in the array. |
|
Indicates whether the specified table is an intent table. |
|
Indicates whether the current page is in edit mode. |
|
Indicates whether the current page is in MDS mode. |
|
Indicates whether the current page is in partial load mode. |
|
Indicates whether the given object is a function, complex project. |
|
Indicates whether the specified protocol is allowed. |
|
Indicates whether the document has the RTL attribute. |
|
Indicates whether the given URL contains the same hostname. |
|
Indicates whether the given table is a substrate table. |
|
Indicates whether the given table matches tableTypeName. |
|
Indicates whether the given page URL is relative. |
|
Indicates whether the given URL is relative. |
|
Indicates whether the given URL is server-relative. |
|
Indicates whether the given file extension is a web page. |
|
Gets the string value from the given string resource. |
|
Gets the string value from the given string resource. |
|
Batch loads the given list of scripts. |
|
A helper for object click logging. |
|
Appends the error message to the list of errors for the context object. |
|
Parses and translates the MediaDuration refiner value so that it can be correctly used by the standard refiner. |
|
Indicates whether the given object is null or undefined. |
|
Moves the element to the right or to the left as specified by offset. |
|
Converts hit-highlighted XML string to HTML. |
|
Registers the given scripts as loaded. |
|
Registers the render template. |
|
Registers the resource dictionary. If a dictionary with the same name exists, the new dictionary will be appended; otherwise a new dictionary will be created. |
|
Removes an item from the array. |
|
Removes the attached event handler for the given element. |
|
Sets the cookie. |
|
Sets the field value for the given object. |
|
setItemRenderWrapper |
|
In a tabbing scenario, expands and selects the shortened URL in the search result item when you press Enter; restores the URL to its shortened form when you press Tab. |
|
Stores the result item or table for the current element. |
|
Indicates whether the animation should occur or not. |
|
Shows the DOM element. |
|
Converts the file size to either Kilobytes (KB), Megabytes (MB), or Gigabytes (GB). |
|
Converts the date format to the given format. The default format is LongDatePattern. For more information see DateOptions. |
|
Converts the number format to the given format. |
|
Formats the number based on ranges from 0-999, 1000-99,999 and >99,999 by inserting commas. |
|
Writes a trace message to the trace console. |
|
Writes a formatted trace message to the trace console. |
|
Trims extra space characters from the string. |
|
Trims the given title. If the title’s length is more than maximumLengthInChars, the title will be trimmed and an ellipsis will be appended. |
|
Trims the given string based on the given cut off value; adding an ellipsis if required. |
|
Truncates the highlighted URL. The URL should be encoded. |
|
Truncates the given URL. The URL should not be encoded. |
|
Expands the URL token for JavaScript or CSS links. |
|
Indicates whether the given string is null, undefined, or empty. |
Objects
The U object has the following objects.
Object |
Description |
---|---|
Specifies the suffixes for elements. |
|
Specifies the script loading states. |
|
Specifies the scripts that are loading and their corresponding states. |
|
Specifies the property names. |