PageSourceSearch

https://www.opwglobal.com/ScriptResource.axd?d=tlTynJuwcuOdlotOppq…TZUxJJVhdmbMQLFen3WqxfeturcXPdl0&t=3b8182bb

js opwglobal.com collected 2026-10-02 03:03:37 UTC 9,899 bytes, 295 lines download raw bytes

1Type.registerNamespace("Telerik.Sitefinity.Services.Search.Web.UI.Public");
2
3Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox = function (element) {
4    Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox.initializeBase(this, [element]);
5
6    this._searchTextBox = null;
7    this._searchButton = null;
8    this._wordsMode = null;
9    this._resultsUrl = null;
10    this._indexCatalogue = null;
11    this._suggestionFields = null;
12    this._suggestionsRoute = null;
13    this._disableSuggestions = null;
14    this._minSuggestLength = null;
15    this._language = null;
16    this._siteId = null;
17
18    this._keyPressDelegate = null;
19    this._keyUpDelegate = null;
20    this._clickDelegate = null;
21    this._suggestionsSuccessDelegate = null;
22    this._suggestionSelectedDelegate = null;
23}
24
25Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox.prototype = {
26
27    initialize: function () {
28        Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox.callBaseMethod(this, "initialize");
29
30        if (this._searchTextBox) {
31            this._keyPressDelegate = Function.createDelegate(this, this._keyPressHandler);
32            $addHandler(this._searchTextBox, "keypress", this._keyPressDelegate);
33            this._keyUpDelegate = Function.createDelegate(this, this._keyUpHandler);
34            $addHandler(this._searchTextBox, "keyup", this._keyUpDelegate);
35        }
36
37        if (this._searchButton) {
38            this._clickDelegate = Function.createDelegate(this, this._clickHandler);
39            $addHandler(this._searchButton, "click", this._clickDelegate);
40        }
41
42        if (this._disableSuggestions != null && !this._disableSuggestions) {
43            this._suggestionsSuccessDelegate = Function.createDelegate(this, this._suggestionsSuccess);
44            this._suggestionSelectedDelegate = Function.createDelegate(this, this._suggestionSelected);
45
46            var that = this;
47            try{
48                $("#" + this._searchTextBox.id).kendoAutoComplete({
49                    dataSource:
50                        {
51                            serverFiltering: true,
52                            data: []
53                        },
54                    select: function (e) {
55                        $("#" + that._searchTextBox.id).val(this.dataItem(e.item.index()));
56                        that.navigateToResults(e);
57                    },
58                    minLength: this._minSuggestLength
59                });
60            } catch (e) {
61                // Fixes jQuery bug, causing IE7 to throw error "script3 member not found".
62                // The try/catch can be removed when the bug is fixed.
63            }
64        }
65    },
66
67    dispose: function () {
68        if (this._searchTextBox && this._keyPressDelegate) {
69            if (this._searchTextBox) {
70                $removeHandler(this._searchTextBox, "keypress", this._keyPressDelegate);
71                $removeHandler(this._searchTextBox, "keyup", this._keyUpDelegate);
72            }
73            delete this._keyPressDelegate;
74        }
75        if (this._searchButton && this._clickDelegate) {
76            if (this._searchButton) {
77                $removeHandler(this._searchButton, "click", this._clickDelegate);
78            }
79            delete this._clickDelegate;
80        }
81
82        Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox.callBaseMethod(this, "dispose");
83    },
84
85    /* -------------------- Public methods ---------------- */
86
87    navigateToResults: function (e) {
88        if (!e) var e = window.event;
89
90        if (e.stopPropagation) {
91            e.stopPropagation();
92        }
93        else {
94            e.cancelBubble = true;
95        }
96        if (e.preventDefault) {
97            e.preventDefault();
98        }
99        else {
100            e.returnValue = false;
101        }
102
103        if (this._searchTextBox.value && this._searchTextBox.value.trim() && this._indexCatalogue) {
104            this.sendSentence();
105            window.location = this.getLocation();
106        }
107    },
108
109    getLocation: function () {
110        var query = this._searchTextBox.value.trim();
111        var separator = (this._resultsUrl.indexOf("?") == -1) ? "?" : "&";
112        var indexCatalogue = String.format("{0}indexCatalogue={1}", separator, Url.encode(this._indexCatalogue));
113        var searchQuery = String.format("&searchQuery={0}", Url.encode(query));
114        var wordsMode = String.format("&wordsMode={0}", this._wordsMode);
115        var url = this._resultsUrl + indexCatalogue + searchQuery + wordsMode;
116
117        return url;
118    },
119
120    sendSentence: function () {
121        if (window.DataIntelligenceSubmitScript) {
122            DataIntelligenceSubmitScript._client.sentenceClient.writeSentence({
123                predicate: "Search for",
124                object: this._searchTextBox.value,
125                objectMetadata: [
126											{
127                                                'K': 'PageUrl',
128                                                'V': location.href
129                                            }
130                ]
131            });
132        }
133    },
134
135    /* -------------------- Event handlers ---------------- */
136
137    _keyPressHandler: function (e) {
138        if (!e) var e = window.event;
139
140        var keyCode = null;
141        if (e.keyCode) {
142            keyCode = e.keyCode;
143        }
144        else {
145            keyCode = e.charCode;
146        }
147
148        if (keyCode === 13) {
149            this.navigateToResults(e);
150        }
151    },
152
153    _keyUpHandler: function (e) {
154        if (!this._disableSuggestions
155            && e.keyCode !== 38 // up arrow
156            && e.keyCode !== 40 // down arrow
157            && e.keyCode !== 27 // esc
158            && e.keyCode !== 13) { // enter
159            var request = {};
160            var searchText = this._searchTextBox.value.trim();
161            if (searchText.length >= this._minSuggestLength) {
162                request.IndexName = this.get_indexCatalogue();
163                request.SuggestionFields = this._suggestionFields;
164                request.Text = searchText;
165                request.Language = this._language;
166                request.SiteId = this._siteId;
167
168                $.ajax({
169                    type: "GET",
170                    url: this._suggestionsRoute,
171                    dataType: 'json',
172                    data: request,
173                    success: this._suggestionsSuccessDelegate
174                });
175            }
176        }
177        else if (e.keyCode === 13) {
178            this.navigateToResults(e);
179        }
180    },
181
182    _suggestionsSuccess: function (result, args) {
183        var dataSource = new kendo.data.DataSource({
184            serverFiltering: true,
185            data: result.Suggestions
186        });
187
188        var autocomplete = $("#" + this._searchTextBox.id).data("kendoAutoComplete");
189        autocomplete.setDataSource(dataSource);
190        autocomplete.search(this._searchTextBox.value.trim());
191    },
192
193    _suggestionSelected: function (event, ui) {
194        var text = ui.item.value;
195        this._searchTextBox.value = text;
196
197        this.navigateToResults(event);
198    },
199
200    _clickHandler: function (e) {
201        this.navigateToResults(e);        
202    },
203
204    /* -------------------- properties ---------------- */
205
206    get_searchTextBox: function () {
207        return this._searchTextBox;
208    },
209    set_searchTextBox: function (value) {
210        this._searchTextBox = value;
211    },
212
213    get_searchButton: function () {
214        return this._searchButton;
215    },
216    set_searchButton: function (value) {
217        this._searchButton = value;
218    },
219
220    get_wordsMode: function () {
221        return this._wordsMode;
222    },
223    set_wordsMode: function (value) {
224        this._wordsMode = value;
225    },
226
227    get_resultsUrl: function () {
228        return this._resultsUrl;
229    },
230    set_resultsUrl: function (value) {
231        this._resultsUrl = value;
232    },
233
234    get_indexCatalogue: function () {
235        return this._indexCatalogue;
236    },
237    set_indexCatalogue: function (value) {
238        this._indexCatalogue = value;
239    },
240
241    get_suggestionFields: function () {
242        return this._suggestionFields;
243    },
244    set_suggestionFields: function (value) {
245        this._suggestionFields = value;
246    },
247
248    get_suggestionsRoute: function () {
249        return this._suggestionsRoute;
250    },
251    set_suggestionsRoute: function (value) {
252        this._suggestionsRoute = value;
253    },
254    
255    get_disableSuggestions: function () {
256        return this._disableSuggestions;
257    },
258    set_disableSuggestions: function (value) {
259        this._disableSuggestions = value;
260    },
261
262    get_minSuggestLength: function () {
263        return this._minSuggestLength;
264    },
265    set_minSuggestLength: function (value) {
266        this._minSuggestLength = value;
267    },
268
269    get_language: function () {
270        return this._language;
271    },
272    set_language: function (value) {
273        this._language = value;
274    },
275
276    get_siteId: function () {
277        return this._siteId;
278    },
279    set_siteId: function (value) {
280        this._siteId = value;
281    }
282};
283Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox.registerClass("Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox", Sys.UI.Control);
284
285Telerik.Sitefinity.Services.Search.Web.UI.Public.WordsMode = function () {
286    /// <summary>
287    /// Represents the different client side words modes
288    /// </summary>
289};
290
291Telerik.Sitefinity.Services.Search.Web.UI.Public.WordsMode.prototype = {
292    AllWords: 0,
293    AnyWord: 1
294};
295Telerik.Sitefinity.Services.Search.Web.UI.Public.WordsMode.registerEnum("Telerik.Sitefinity.Services.Search.Web.UI.Public.WordsMode");

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.