1function updateBrowseResults() { 2 $("#loading").addClass("spinner-active"); 3 $("#results-section").addClass("overlay-active"); 4 setTimeout(function () { 5 $("#results-section").removeClass("overlay-active"); 6 $("#loading").removeClass("spinner-active"); 7 }, 1000); 8 9 $("#no-filters").css("display", "none"); 10} 11 12/* map for browse results page */ 13function makeMap(mapId) { 14 try { 15 browseMap = L.map(mapId).setView([53.3836, -1.4669], 6); 16 17 layer = L.tileLayer("https://{s}.tile.osm.org/{z}/{x}/{y}.png", { 18 attribution: 19 '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors', 20 }).addTo(browseMap); 21 22 browseMap.scrollWheelZoom.disable(); 23 } catch (e) { 24 console.error(e); 25 } 26} 27 28/* additions for tenure */ 29function showLinkTypes() { 30 $(".cross-ref").addClass("show-link-type"); 31 $(".cross-ref").each(function () { 32 if ($(this).hasClass("person")) { 33 iconType = "user"; 34 tooltip = "Person: " + $(this).text(); 35 } else if ($(this).hasClass("place")) { 36 tooltip = "Place: " + $(this).text(); 37 iconType = "map-marker"; 38 } else if ($(this).hasClass("manor")) { 39 tooltip = "Manor: " + $(this).text(); 40 iconType = "home"; 41 } 42 if ($("#link-types-on").parent().hasClass("active")) { 43 $(this).append( 44 '<span class="text icon-' + 45 iconType + 46 '" data-tooltip="" title="' + 47 tooltip + 48 '"></span>' 49 ); 50 } 51 }); 52 53 $tenure = $(".serviceTenure"); 54 $tenure.each(function () { 55 tooltip = "Tenure"; 56 $(this).addClass("show-link-type"); 57 $(this).append( 58 '<span class="text icon-hand-up" data-tooltip="" title="' + 59 tooltip + 60 '"></span>' 61 ); 62 }); 63} 64 65function hideLinkTypes() { 66 $(".cross-ref").removeClass("show-link-type"); 67 $(".cross-ref").each(function () { 68 $(this).find("span").remove(); 69 }); 70 $(".serviceTenure").each(function () { 71 $(this).find("span").remove(); 72 }); 73} 74/* end additions for tenure */ 75function hideSectionHeads() { 76 $(".section-head").toggleClass("visible"); 77} 78 79function showSectionHeads() { 80 $(".section-head").toggleClass("visible"); 81} 82 83function makeCitation() { 84 var author = "King's College London"; 85 var title = $("title").text(); 86 var date = new Date(); 87 var month = date.getMonth() + 1; 88 var day = date.getDate(); 89 var year = date.getFullYear(); 90 var fullDate = day + "/" + month + "/" + year; 91 92 var domain = "http://www.inquisitionspostmortem.ac.uk"; 93 var url = domain + window.location.pathname; 94 95 var bibtex_citation = 96 author + 97 ", 2014. " + 98 title + 99 " [online]. Available at " + 100 url + 101 " [Accessed: " + 102 fullDate + 103 "]"; 104 105 $("#citation-panel").append(bibtex_citation); 106} 107 108$(document).ready(function () { 109 if ($("#citation-modal").length) { 110 makeCitation(); 111 } 112 113 $("#map-section").click(function () { 114 setTimeout(function () { 115 makeMap("map"); 116 }, 500); 117 }); 118 119 /* map on other content pages */ 120 if ($("#map").length > 0) { 121 makeMap("map"); 122 } 123 if ($("#holdings-map").length > 0) { 124 $("#holdings-map").empty(); 125 makeMap("holdings-map"); 126 } 127 128 function showHideAll(state, areas) { 129 // if all areas are expanded or hidden, change the show/hide all icon in the header: to do 130 areas.each(function () { 131 expandLink = $(this).find("a.ctrl"); 132 if (state == "show") { 133 expandLink.removeClass("expand").addClass("collapse"); 134 expandLink 135 .find("span") 136 .removeClass("icon-caret-right") 137 .addClass("icon-caret-down"); 138 $(this) 139 .find(".list-content") 140 .slideDown(400, function () {}); 141 } else if (state == "hide") { 142 $(this).find(".list-content").slideUp(); 143 expandLink.removeClass("collapse").addClass("expand"); 144 expandLink 145 .find("span") 146 .removeClass("icon-caret-down") 147 .addClass("icon-caret-right"); 148 } 149 }); 150 } 151 152 /* Expand all in a section */ 153 $("a.ctrl.expand-all").click(function () { 154 expandableGroup = $(this).attr("data-expandable-group"); 155 areasToExpand = $( 156 "[data-expandable-group-member='" + expandableGroup + "']" 157 ); 158 if ($(this).hasClass("expand-all")) {
159 $(this).removeClass("expand-all").addClass("collapse-all"); 160 $(this) 161 .find("span") 162 .removeClass("icon-plus-sign") 163 .addClass("icon-minus-sign"); 164 // expand all 165 showHideAll("show", areasToExpand); 166 } else { 167 $(this).removeClass("collapse-all").addClass("expand-all"); 168 $(this) 169 .find("span") 170 .removeClass("icon-minus-sign") 171 .addClass("icon-plus-sign"); 172 // collapse all 173 showHideAll("hide", areasToExpand); 174 } 175 176 return false; 177 }); 178 179 $(".ctrl.on-off-toggle").click(function () { 180 $(this).parent().parent().find("dd").toggleClass("active"); 181 linkID = $(this).attr("id"); 182 switch (linkID) { 183 case "link-types-on": 184 hideLinkTypes(); 185 showLinkTypes(); 186 return false; 187 break; 188 189 case "link-types-off": 190 hideLinkTypes(); 191 return false; 192 break; 193 194 case "section-heads-off": 195 hideSectionHeads(); 196 return false; 197 break; 198 199 case "section-heads-on": 200 showSectionHeads(); 201 return false; 202 break; 203 204 case "use-dropdown": 205 /* show dropdown, hide slider */ 206 $("#dates-slider").removeClass("hidden").hide(); 207 $("#dates-input").show(); 208 return false; 209 break; 210 211 case "use-slider": 212 $("#dates-input").hide(); 213 $("#dates-slider").show(); 214 return false; 215 break; 216 } 217 }); 218 219 $(".modal-button").click(function () { 220 feedbackID = "#" + $(this).attr("data-feedback-id"); 221 $(this).fadeOut(400, function () { 222 $(".citation-format").css("display", "none"); 223 $(feedbackID).fadeIn(400); 224 }); 225 }); 226 227 $(".modal-success").click(function () { 228 $(".reveal-modal").foundation("reveal", "close"); 229 }); 230 231 $(".ctrl.cite").click(function () { 232 modalID = $(this).attr("href"); 233 $(".feedback").css("display", "none"); 234 $(".modal-button").css("display", "block"); 235 $(".citation-format").css("display", "block"); 236 $(modalID).foundation("reveal", "open"); 237 }); 238 239 $("#quick-search, #main-quick-search").keypress(function (event) { 240 if (event.keyCode == 13) { 241 const quickQry = $(this).val(); 242 navigateToInquisition(quickQry); 243 } 244 }); 245 246 function navigateToInquisition(inqId) { 247 window.location.href = `/browse/inquisitions/?q=${inqId}`; 248 } 249 250 $(".icon-search").on("click", function () { 251 const quickQry = $("#quick-search").val(); 252 if (quickQry == "") { 253 quickQry = $("#main-quick-search").val(); 254 } 255 navigateToInquisition(quickQry); 256 }); 257 258 $(".ctrl.print").click(function () { 259 window.print(); 260 return false; 261 }); 262}); 263 264var monthLkp = { 265 "01": "Jan", 266 "02": "Feb", 267 "03": "Mar", 268 "04": "Apr", 269 "05": "May", 270 "06": "Jun", 271 "07": "Jul", 272 "08": "Aug", 273 "09": "Sep", 274 10: "Oct", 275 11: "Nov", 276 12: "Dec", 277}; 278 279function dateDisplayParse(str) { 280 try { 281 dateParts = str.split("-"); 282 year = dateParts[0];
283 month = monthLkp[dateParts[1]]; 284 day = dateParts[2].split("T")[0]; 285 return day + " " + month + " " + year; 286 } catch (e) { 287 return "None"; 288 } 289} 290 291function toTitleCase(str) { 292 if (!str) { 293 return ""; 294 } 295 296 return str.replace(/\w\S*/g, function (txt) { 297 return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); 298 }); 299} 300 301/* 302 * jQuery Highlight plugin 303 * 304 * Based on highlight v3 by Johann Burkard 305 * http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html 306 * 307 * Code a little bit refactored and cleaned (in my humble opinion). 308 * Most important changes: 309 * - has an option to highlight only entire words (wordsOnly - false by default), 310 * - has an option to be case sensitive (caseSensitive - false by default) 311 * - highlight element tag and class names can be specified in options 312 * 313 * Usage: 314 * // wrap every occurrance of text 'lorem' in content 315 * // with <span class='highlight'> (default options) 316 * $('#content').highlight('lorem'); 317 * 318 * // search for and highlight more terms at once 319 * // so you can save some time on traversing DOM 320 * $('#content').highlight(['lorem', 'ipsum']); 321 * $('#content').highlight('lorem ipsum'); 322 * 323 * // search only for entire word 'lorem' 324 * $('#content').highlight('lorem', { wordsOnly: true }); 325 * 326 * // don't ignore case during search of term 'lorem' 327 * $('#content').highlight('lorem', { caseSensitive: true }); 328 * 329 * // wrap every occurrance of term 'ipsum' in content 330 * // with <em class='important'> 331 * $('#content').highlight('ipsum', { element: 'em', className: 'important' }); 332 * 333 * // remove default highlight 334 * $('#content').unhighlight(); 335 * 336 * // remove custom highlight 337 * $('#content').unhighlight({ element: 'em', className: 'important' }); 338 * 339 * 340 * Copyright (c) 2009 Bartek Szopka 341 * 342 * Licensed under MIT license. 343 * 344 */ 345jQuery.extend({ 346 highlight: function (node, re, nodeName, className) { 347 if (node.nodeType === 3) { 348 var match = node.data.match(re); 349 if (match) { 350 var highlight = document.createElement(nodeName || "span"); 351 highlight.className = className || "highlight"; 352 var wordNode = node.splitText(match.index); 353 wordNode.splitText(match[0].length); 354 var wordClone = wordNode.cloneNode(true); 355 highlight.appendChild(wordClone); 356 wordNode.parentNode.replaceChild(highlight, wordNode); 357 return 1; //skip added node in parent 358 } 359 } else if ( 360 node.nodeType === 1 && 361 node.childNodes && 362 // only element nodes that have children 363 !/(script|style)/i.test(node.tagName) && 364 // ignore script and style nodes 365 !(node.tagName === nodeName.toUpperCase() && node.className === className) 366 ) { 367 // skip if already highlighted 368 for (var i = 0; i < node.childNodes.length; i++) { 369 i += jQuery.highlight(node.childNodes[i], re, nodeName, className); 370 } 371 } 372 return 0; 373 }, 374}); 375 376jQuery.fn.unhighlight = function (options) { 377 var settings = { className: "highlight", element: "span" }; 378 jQuery.extend(settings, options); 379 380 return this.find(settings.element + "." + settings.className) 381 .each(function () { 382 var parent = this.parentNode; 383 parent.replaceChild(this.firstChild, this); 384 parent.normalize(); 385 }) 386 .end(); 387}; 388 389jQuery.fn.highlight = function (words, options) { 390 var settings = { 391 className: "highlight", 392 element: "span", 393 caseSensitive: false, 394 wordsOnly: false, 395 }; 396 jQuery.extend(settings, options); 397 398 if (words.constructor === String) { 399 words = [words]; 400 } 401 words = jQuery.grep(words, function (word, i) { 402 return word != ""; 403 }); 404 words = jQuery.map(words, function (word, i) { 405 return word.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); 406 }); 407 if (words.length == 0) { 408 return this; 409 } 410 411 var flag = settings.caseSensitive ? "" : "i"; 412 var pattern = "(" + words.join("|") + ")"; 413 if (settings.wordsOnly) { 414 pattern = "\\b" + pattern + "\\b"; 415 } 416 var re = new RegExp(pattern, flag); 417 418 return this.each(function () { 419 jQuery.highlight(this, re, settings.element, settings.className); 420 }); 421};
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.