1if (typeof (AIS) !== "object") { var AIS = new Object(); } 2if (typeof (AIS.Views) !== "object") { AIS.Views = new Object(); } 3if (typeof (AIS.Views.Shared) !== "object") { AIS.Views.Shared = new Object(); } 4 5AIS.Views.Shared.Master = function () { 6 return { 7 8 Init: function () { 9 $(document).ready(function () { 10 11 if (window.location.pathname.indexOf("/search") > 0) { 12 $("#ais-menu-item-menuSearch").addClass("active"); 13 } 14 15 $('#cookieConsent').cookieConsent(true); // if true then also GA 16 //$.removeCookie('ais-ui-culture', { path: '/' }); 17 18 //var nameEQ = "ais-ui-culture" + "="; 19 //var ca = document.cookie.split(';'); 20 //alert(ca.length); 21 //for (var i = 0; i < ca.length; i++) { 22 // var c = ca[i]; 23 // alert(ca[i]); 24 // while (c.charAt(0) == ' ') c = c.substring(1, c.length); 25 // //if (c.indexOf(nameEQ) == 0) alert(c.substring(nameEQ.length, c.length)); 26 //} 27 28 //$(".detailImage").on("click", function () { 29 // var currentNode = this; 30 // var uniqueId = currentNode.attributes["uniqueId"].value; 31 // $("." + uniqueId).dialog({ modal: true, width: 530 }); 32 //}); 33 $(".search-group.options").hide(); 34 var qSearchId = $("#q-search-id").val(); 35 var text = $("li[data-search-id='" + qSearchId + "']").text(); 36 $(".search-group.button > .label").text(text); 37 $(".search-group.button").on("click", function () { 38 $(".search-group.options").toggle(50); 39 }); 40 41 $(".search-group.options > ul > li").on("click", function () { 42 var container = $(this).parent().parent().parent(); 43 var selectedDataSearchIdValue = $(this).attr("data-search-id"); 44 container.find(".label").text(this.innerText); 45 var inputElement = $(this).parent().find("#q-search-id"); 46 inputElement.attr("value", selectedDataSearchIdValue); 47 $(".search-group.options").toggle(50); 48 }); 49 50 //$(".ais-helpsubject").html("help"); 51 //$("body").removeClass("ais-noscript"); 52 var counters = AIS.RecordSelection.SelectionCounter(); 53 counters.each(function () { 54 if ($(this).html().length > 0) { 55 $(this).addClass("ais-menu-item-tip-border"); 56 } 57 }); 58 59 //Default settings for Ajax requests 60 $.ajaxSetup({ 61 //type: "GET", 62 //contentType: "application/json; charset=utf-8", 63 //data: "{}", 64 //dataType: "json", 65 cache: false, 66 error: function (e) { 67 //Redirect to an error page 68 window.location = AIS.Helpers.ResolveUrl("/error"); 69 //alert("error:" + e); 70 } 71 }); 72 73 //if the ajax request takes more than 2 sec the loader box will show 74 $("body").ajaxStart(function () { 75 $(".ais-temporary-message-script").remove(); 76 AIS.Views.Shared.AjaxTimeout = setTimeout("$('.ais-loader').addClass('loading')", 500); 77 }).ajaxComplete(function () { 78 clearTimeout(AIS.Views.Shared.AjaxTimeout); 79 $(".ais-loader").removeClass("loading"); 80 }); 81 82 /*** Events ***/ 83 84 $('.ais-request-will').on("click", function (e) { 85 e.preventDefault(); 86 $.ajax({
87 url: AIS.Helpers.ResolveUrl("helper/GetSearchResult"), 88 dataType: "json", 89 data: { 90 Database: "research", 91 SearchStatement: "((s0=" + $('#ais-borrower-number').val() + " and not order.status = RETURNED_DESK) and not order.status = RETURNED_STORE) and order.status.date=Today&fields=priref,borrower.number", 92 Limit: 1, 93 Fields: "priref" 94 }, 95 success: function (data) { 96 var max = parseInt(data.Hits) > 0 ? data.Result.record[0]["borrower.number"][0]["borrower_category"]["maximum_loans"][0] : 100; 97 if (data === null) { 98 $('.ais-will-message').show().html('<span color="red" class="fas fa-times-circle"></span> Error'); 99 } else if (parseInt(data.Hits) >= parseInt(max)) { 100 $('.ais-will-message').show().html('<span color="red" class="fas fa-times-circle"></span> Max loans exceeded: ' + data.Hits); 101 } else if (parseInt(data.Hits) < parseInt(max)) { 102 window.location = AIS.Helpers.ResolveUrl("Request/Will"); 103 } else { 104 $('.ais-will-message').show().html('<span color="red" class="fas fa-times-circle"></span> ????'); 105 } 106 } 107 }); 108 }); 109 110 $('body').on("click", function () { 111 //hides the language selector in case it's open 112 $(".ais-language-list-element").hide(); 113 }); 114 115 $('.ais-language-open-list-script').keypress(function (event) { 116 var id = event.key || event.which || event.keyCode || 0; 117 if (id == 13 || id == 'Enter') { 118 $('.ais-language-open-list-script').trigger('click'); 119 event.preventDefault(); 120 event.stopPropagation(); 121 } 122 }); 123 //language selector 124 $(".ais-language-open-list-script").on("click", function (event) { 125 //stops the "body" click event 126 event.preventDefault(); 127 event.stopPropagation(); 128 $(".ais-language-list-element").toggle(); 129 }); 130 //removed for ergonomy 131 //$(".ais-language-open-list-script").hover(function (event) { 132 // event.preventDefault(); 133 // event.stopPropagation(); 134 // $(".ais-language-list-element").show(); 135 //}); 136 137 $(".ais-language-list-element").hover( 138 function (event) { }, 139 function (event) { 140 event.preventDefault(); 141 event.stopPropagation(); 142 $(".ais-language-list-element").hide(); 143 }) 144 145 //help subject 146 $(".ais-helpsubject.ais-helpsubject-script").removeAttr("target"); 147 $(".zais-helpsubject-script").on("click", function (event) { 148 149 event.preventDefault(); 150 151 var helpSubject = $(this).parent().find(".ais-helpsubject-value"); 152 var subjectSection = $(this).parent().find(".ais-helpsubjectsection-value"); 153 var helpType = $(this).parent().find(".ais-helpsubject-type-value"); 154 155 var expectedTypes = ["page", "field"]; 156 var defaultType = expectedTypes[0]; 157 158 if ($(helpSubject).length !== 0) { 159 160 var appendSection = ($(subjectSection).length !== 0) ? ("#" + subjectSection.val()) : ""; 161 var helpTypeValue = ""; 162 163 if ($(helpType).length === 0 || !$.inArray($(helpType).val().toString(), expectedTypes)) { 164 helpTypeValue = defaultType; 165 } else { 166 helpTypeValue = $(helpType).val().toString(); 167 } 168 169 var dimensions = null; 170 171 var position = "left=100,top=100"; 172 173 switch (helpTypeValue) { 174 case "page": dimensions = "width=640,height=480"; break; 175 case "field": dimensions = "width=300,height=450"; break; 176 } 177 178 var helpWindow = window.open( 179 AIS.Helpers.ResolveUrl("/helpers/gethelp?subject=" + $(helpSubject).val() + appendSection), 180 'Help', 181 'fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,' + 182 dimensions + ',' + position); 183 184 helpWindow.focus(); 185 186 } else { 187 alert("No topic found for this page."); 188 } 189 } 190 ); 191 192 //link activators 193 $(".ais-activator-script").on("click", function (event) { 194 195 event.preventDefault(); 196 197 var idToActivate = $(this).children("input[type='hidden'][class='ais-id-to-activate-value']").val(); 198 window.location.href = $("#" + idToActivate).attr('href'); 199 200 }); 201 202 AIS.Helpers.AttachDatePicker(); 203 AIS.Helpers.AttachTimePicker(); 204 205 //Set focus 206 AIS.Helpers.SetFocusFirstInput("form"); 207 208 // Actions to do on form submition 209 $("form").on("submit", function () { 210 211 //Append mailto to email fields when submiting the form 212 213 $.each( 214 $(".ais-field-type-email-script"), 215 function (field) { 216 217 var fieldValue = this.value; 218 219 if (fieldValue !== undefined) { 220 var emailValuePrefix = "mailto:"; 221 fieldValue = AIS.Helpers.Trim(fieldValue); 222 if (fieldValue.toLowerCase().indexOf(emailValuePrefix) < 0) { 223 fieldValue = emailValuePrefix + fieldValue; 224 this.value = fieldValue; 225 } 226 } 227 228 }); 229 230 }); 231 232 $("#ais-main").touchwipe({ 233 wipeLeft: function () { 234 $("#ais-main").addClass("swipe-left"); 235 var prevPageButton = $(".prev-page-script > a"); 236 if (prevPageButton !== undefined && prevPageButton.length >= 1) { 237 window.location.href = prevPageButton.attr("href"); 238 } 239 }, 240 wipeRight: function () { 241 $("#ais-main").addClass("swipe-right"); 242 var nextPageButton = $(".next-page-script > a"); 243 if (nextPageButton !== undefined && nextPageButton.length >= 1) { 244 window.location.href = nextPageButton.attr("href"); 245 } 246 }, 247 min_move_x: 20, 248 min_move_y: 20, 249 preventDefaultEvents: false 250 }); 251 252 }); 253 } 254 }; 255}(); 256 257AIS.Views.Shared.Master.Init(); 258 259 260
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.