PageSourceSearch

https://www.nashersculpturecenter.org/DesktopModules/DnnSharp/SearchBoost/static/sb-client.js?cdv=691

js nashersculpturecenter.org collected 2026-10-02 02:29:53 UTC 6,485 bytes, 128 lines download raw bytes

1// This function is obsolete and used for old xsl templates (default-obsolete-v3)
2function sbInitboxResults(clientId) {
3    var resultsRoot = $("#" + clientId),
4        url = window.location.href;
5
6    if (url.match(/&sb-sort=[^&]*/g)) {
7        var sortType = url.match(/&sb-sort=[^&]*/g)[0];
8        resultsRoot.find(".sort-sb-results > .dropdown-toggle.btn:first-child").html("Sort by: " + sortType.substr(sortType.indexOf("=") + 1)).append("<span class='caret' style='margin-left: 5px;'></span>");
9        resultsRoot.find('.sort-sb-results').attr('data-sort', sortType);
10    }
11
12    resultsRoot.find(".sort-sb-results > ul.dropdown-menu > li > a").click(function () {
13        $(this).parents().eq(2).find(".dropdown-toggle.btn:first-child").html("Sort by: " + $(this).text()).append("<span class='caret' style='margin-left: 5px;'></span>");
14        location.href = url.replace(/&sb-sort=[^&]*/, '') + '&sb-sort=' + $(this).attr('value');
15    });
16}
17
18dnnsf.api = dnnsf.api || {};
19dnnsf.api.searchboost = dnnsf.api.searchboost || {};
20dnnsf.api.searchboost = $.extend(dnnsf.api.searchboost, {
21    initInputBox: function (settings) {
22        var $searchDiv = $("#" + settings.ClientId);
23        var selBox = 'input.search-box, input.sb-search-box, input.searchBox, input.sb-searchbox';
24        var $searchInput = $searchDiv.find(selBox);
25        var $searchButton = $searchDiv.find('button.search-btn');
26
27        var inputSearchBox = $("#" + settings.ClientId).find(selBox);
28        $searchInput.keydown(function (event) {
29            if (event.keyCode == 13) {
30                searchRedirect($searchInput.val());
31                return false;
32            }
33        });
34        $searchButton.click(function (event) {
35            searchRedirect($searchInput.val());
36            return false;
37        })
38
39        function htmlEncode(value) {
40            //create a in-memory div, set it's inner text(which jQuery automatically encodes)
41            //then grab the encoded contents back out.  The div never exists on the page.
42            return $('<div/>').text(value).html();
43        }
44
45        function searchRedirect(term) {
46            if (!term)
47                return false;
48            if (settings.IsLiveSearch != true) {
49                var redirectUrl = dnnsf.getUrlParts(settings.FwdToSearchResultsPageApi);
50                redirectUrl.query["terms"] = htmlEncode($(inputSearchBox['1']).val() || $(inputSearchBox['0']).val());
51                if ($("#" + settings.ClientId).find('.portalFilter').length > 0)
52                    redirectUrl.query["portalFilterId"] = $("#" + settings.ClientId).find('.portalFilter').val();
53                redirectUrl.query["behaviorId"] = settings.BehaviorId;
54                redirectUrl.query["facets[0]"] = dnnsf.getUrlParts(window.location.href).query["sb-cat"] || '';
55
56                location.href = redirectUrl.getUrl();
57            }
58        }
59
60        if (settings.SuggestionCount != 0 && !settings.IsLiveSearch == true) {
61            var typingTimer;
62            var doneTypingInterval = 300;
63            $searchInput.typeahead11(
64                {
65                    hint: true,
66                    highlight: true,
67                    minLength: 1
68                }, {
69                    name: 'searchTerms',
70                    source: function (query, sync, async) {
71                        clearTimeout(typingTimer);
72                        if (htmlEncode($(inputSearchBox['1']).val() || $(inputSearchBox['0']).val())) {
73                            typingTimer = setTimeout(doneTyping, doneTypingInterval);
74                        }
75                        function doneTyping() {
76
77                            $.post(settings.SuggestionsApi + '?behaviorId=' + settings.BehaviorId + '&terms=' + htmlEncode($(inputSearchBox['1']).val() || $(inputSearchBox['0']).val()), function (data) {
78                                async(data);
79                            });
80                        }
81                    },
82                    limit: settings.SuggestionCount * 2
83                });
84        }
85        if (settings.IsLiveSearch == true) {
86            var liveTypingTimer;
87            var liveDoneTypingInterval = 300;
88
89            //on keyup, start the countdown
90            $searchInput.keyup(function () {
91                clearTimeout(liveTypingTimer);
92                if ($searchInput.val()) {
93                    liveTypingTimer = setTimeout(liveDoneTyping, liveDoneTypingInterval);
94                }
95            });
96
97            //user is "finished typing," do something
98            function liveDoneTyping() {
99                var liveRequest = dnnsf.getUrlParts(settings.RenderResultsApi);
100                liveRequest.query["behaviorId"] = settings.BehaviorId;
101                var requestData = {
102                    SearchTerms: htmlEncode(inputSearchBox.val()),
103                    FilerPortalId: $("#" + settings.ClientId).find('.portalFilter').val(),
104                    Sorting: $("#" + settings.ClientId).find('.sb-dspl-sort-btn').attr('data-sort'),
105                    PageSize: dnnsf.getUrlParts(window.location.href).query["sb-pagesize"] || '',
106                    SortingFieldName: $("#" + settings.ClientId).find('.sb-dspl-sort-btn').attr('data-sort')
107                }
108                if (dnnsf.getUrlParts(window.location.href).query["sb-cat"] != '') {
109                    requestData.Categories = [{ path: dnnsf.getUrlParts(window.location.href).query["sb-cat"] } || ''];
110                }
111
112                $.post(liveRequest.getUrl(),
113                    requestData,
114                    function (reponse) {
115                        $searchDiv.find('.sb-live-result').replaceWith(reponse);
116                        var windowHref = dnnsf.getUrlParts(window.location.href);
117                        windowHref.query[settings.SearchParam] = htmlEncode(inputSearchBox.val());
118                        windowHref.query["sb-cat"] = dnnsf.getUrlParts(window.location.href).query["sb-cat"] || '';
119                        windowHref.query["sb-sort"] = $("#" + settings.ClientId).find('.sb-dspl-sort-btn').attr('data-sort');
120                        windowHref.query["sb-pagesize"] = dnnsf.getUrlParts(window.location.href).query["sb-pagesize"] || '';
121
122                        history.replaceState(null, null, windowHref.getUrl());
123                    });
124            }
125        }
126
127    }
128})

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.