PageSourceSearch

https://www.nacdl.org/assets/js/nacdl_script.js

js nacdl.org collected 2026-09-24 08:43:25 UTC 4,679 bytes, 130 lines download raw bytes

1
2
3//start interrupter insert
4
5$(document).ready(function () {
6    "use strict";
7    $(".helpinsert").html('<section class="interrupter-wrapper blue-background"><div class="grid-container grid-x grid-padding-x align-center"><div class="component-container grid-x grid-padding-x align-center interrupter"><div class="cell small-12 medium-10"><div class="grid-x grid-padding-x"><div class="cell small-12 medium-3 large-3"><h2 class="h2-sans">@ViewBag.HelpTitle</h2></div><div class="cell small-12 medium-9 large-9 text-content"><p>@ViewBag.HelpMessage</p><a href="@ViewBag.HelpURL" class="button hollow">Learn More</a></div></div></div></div></div></section>');
8
9    $(".interrupterinsert").each(function () {
10        var linkvalue = $(this).children("a")[0].href;
11        var domain = window.location.protocol + "//" + window.location.hostname;
12
13        linkvalue = linkvalue.replace(domain, "");
14        linkvalue = linkvalue.replace("/interrupter/", "/Interrupter/Insert/");
15
16        //alert(linkvalue + "/insert");
17        $(this).load(linkvalue + "/insert");
18    });
19
20    $(".mediainsert").each(function () {
21        var linkvalue = $(this).children("a")[0].href;
22        var domain = window.location.protocol + "//" + window.location.hostname;
23
24        linkvalue = linkvalue.replace(domain, "");
25        linkvalue = linkvalue.replace("/Media/", "/Media/Insert/");
26
27
28        $(this).load(linkvalue + "/insert");
29    });
30
31    $(".pageinsert").each(function () {
32        var linkvalue = $(this).children("a")[0].href;
33        var domain = window.location.protocol + "//" + window.location.hostname;
34
35        linkvalue = linkvalue.replace(domain, "");
36        linkvalue = "/InsertWidget?path=" + encodeURIComponent(linkvalue);
37
38        $(this).load(linkvalue);
39    });
40
41});
42
43//end interrupter insert
44
45//start utility nav menu icon
46
47function uNavMenu() {
48    "use strict";
49    var menu = document.getElementById("unavcontainer");
50    menu.classList.toggle("change");
51}
52
53// end utility nav menu icon
54
55//start autocomplete
56
57var searchServiceName = "nacdlweb-search";
58var searchServiceApiKey = "";
59var indexName = "nacdlpagesearch";
60var apiVersion = "2017-11-11-Preview";
61
62var suggestUri = "https://" + searchServiceName + ".search.windows.net/indexes/" + indexName + "/docs/suggest?api-version=" + apiVersion;
63var autocompleteUri = "https://" + searchServiceName + ".search.windows.net/indexes/" + indexName + "/docs/autocomplete?api-version=" + apiVersion;
64var searchUri = "https://" + searchServiceName + ".search.windows.net/indexes/" + indexName + "/docs/search?api-version=" + apiVersion;
65
66$(function () {
67    "use strict";
68    var updateTextbox = function (event, ui) {
69        var result = ui.item.value.replace(/<\/?[^>]+(>|$)/g, "");
70        $("#UtilitySearchBox").val(result);
71        return false;
72    };
73
74    $("#UtilitySearchBox").autocomplete({
75        html: true,
76        source: function (request, response) {
77            $.ajax({
78                type: "POST",
79                url: suggestUri,
80                dataType: "json",
81                headers: {
82                    "api-key": searchServiceApiKey,
83                    "Content-Type": "application/json"
84                },
85                data: JSON.stringify({
86                    top: 5,
87                    fuzzy: false,
88                    suggesterName: "categorysuggestor",
89                    search: request.term,
90                    highlightPreTag: "<b>",
91                    highlightPostTag: "</b>"
92                }),
93                success: function (data) {
94                    if (data.value && data.value.length > 0) {
95                        response(data.value.map(x => x["@@search.text"]));
96                    }
97                }
98            });
99        },
100        minLength: 3,
101        position: {
102            my: "left top",
103            at: "left-23 bottom+10"
104        },
105        select: updateTextbox,
106        focus: updateTextbox
107    })._renderItem = function (ul, item) {
108        return $("<li></li>")
109            .data("item.autocomplete", item)
110            .append("<a>" + item.label + "</a>")
111            .appendTo(ul);
112    };
113});
114
115//end autocomplete
116
117
118//function to add customerid to form
119
120function addcustomerdatatoform(field, value, hide) {
121    "use strict";
122    var selectElement = document.querySelector('input[name$="' + field + '"]');
123    if (selectElement != null) {
124        var selectedValue = value;
125        selectElement.value = selectedValue;
126        if (hide == 1) {
127            selectElement.style.display = "none";
128        }
129    }
130}

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.