1$(document).ready(function() { 2 3 /* Bootstrap affix 4 * ----------------------------------------------------- */ 5 // Mobile 6 $('#nav-mobile').affix({ 7 offset: { top: $('#nav-mobile').height() } 8 }); 9 10 // Desktop 11 $('#nav-desktop').affix({ 12 offset: { top: $('#nav-desktop').height() } 13 }); 14 15 /* Toggle accordion icons 16 * ----------------------------------------------------- */ 17 $(function() { 18 $('.accordion-group-toggle').on('click', function() { 19 $('.fa', this) 20 .toggleClass('fa-caret-right') 21 .toggleClass('fa-caret-down'); 22 }); 23 }); 24 25 /* .nav-addon-toggable 26 * Used on pages: page_map.html, page_search-result_front.html, page_search-result_list.html 27 * ----------------------------------------------------- */ 28 $('.nav-addon-toggable-button').click(function() { 29 $('.nav-addon-toggable').toggleClass('visible'); 30 }); 31 32 // Although item is visible on start, hide it after a few seconds 33 setTimeout(function () { 34 $('.nav-addon-toggable').removeClass('visible'); 35 }, 5000); 36 37 /* 38 * ----------------------------------------------------- */ 39 /*$('.navbar-collapse').on('show.bs.collapse', function () { 40 $(this).closest('html').addClass('coat-content'); 41 }); 42 43 $('.navbar-collapse').on('hide.bs.collapse', function () { 44 $(this).closest('html').removeClass('coat-content'); 45 });*/ 46 47 /* Range Slider 48 * Source: https://refreshless.com/nouislider/examples/#section-keypress 49 * ----------------------------------------------------- */ 50 if ($('#form-search-expanded')[0]) { 51 var currentYear = (new Date).getFullYear(); 52 53 var keypressSlider = document.getElementById('keypress'); 54 var input0 = document.getElementById('input-with-keypress-0'); 55 var input1 = document.getElementById('input-with-keypress-1'); 56 var inputs = [input0, input1]; 57 58 noUiSlider.create(keypressSlider, { 59 start: [-640, 2017], 60 connect: true, 61 range: { 62 'min': [-640], 63 'max': currentYear 64 }, 65 format: wNumb({ 66 decimals: 0 67 }) 68 }); 69 70 keypressSlider.noUiSlider.on('update', function( values, handle ) { 71 inputs[handle].value = values[handle]; 72 }); 73 74 function setSliderHandle(i, value) { 75 var r = [null,null]; 76 r[i] = value; 77 keypressSlider.noUiSlider.set(r); 78 } 79 80 // Listen to keydown events on the input field. 81 inputs.forEach(function(input, handle) { 82 83 input.addEventListener('change', function(){ 84 setSliderHandle(handle, this.value); 85 }); 86 87 input.addEventListener('keydown', function( e ) { 88 89 var values = keypressSlider.noUiSlider.get(); 90 var value = Number(values[handle]); 91 92 // [[handle0_down, handle0_up], [handle1_down, handle1_up]] 93 var steps = keypressSlider.noUiSlider.steps(); 94 95 // [down, up] 96 var step = steps[handle]; 97 98 var position; 99 100 // 13 is enter, 101 // 38 is key up, 102 // 40 is key down. 103 switch ( e.which ) { 104 105 case 13: 106 setSliderHandle(handle, this.value); 107 break; 108 109 case 38: 110 111 // Get step to go increase slider value (up) 112 position = step[1]; 113 114 // false = no step is set 115 if ( position === false ) { 116 position = 1; 117 } 118 119 // null = edge of slider 120 if ( position !== null ) { 121 setSliderHandle(handle, value + position); 122 } 123 124 break; 125 126 case 40: 127 128 position = step[0]; 129 130 if ( position === false ) { 131 position = 1; 132 } 133 134 if ( position !== null ) { 135 setSliderHandle(handle, value - position); 136 } 137 138 break; 139 } 140 }); 141 }); 142 }; 143 144 /* Bootstrap Select 145 * Source: https://github.com/silviomoreto/bootstrap-select 146 * ----------------------------------------------------- */ 147 $('.selectpicker').selectpicker({ 148 style: 'form-control', 149 width: '100%', 150 dropupAuto: false 151 }); 152 153 /* Automatically play and un-play the video when there is one 154 * Source: https://coderwall.com/p/9jvoww/start-stop-youtube-video-in-bootstrap-modal 155 * ----------------------------------------------------- */
156 if ($('#modal-video')[0]) { 157 var youtubeFunc =''; 158 var outerDiv = document.getElementById("modal-video"); 159 var youtubeIframe = outerDiv.getElementsByTagName("iframe")[0].contentWindow; 160 $('#modal-video').on('hidden.bs.modal', function (e) { 161 youtubeFunc = 'pauseVideo'; 162 youtubeIframe.postMessage('{"event":"command","func":"' + youtubeFunc + '","args":""}', '*'); 163 }); 164 $('#modal-video').on('shown.bs.modal', function (e) { 165 youtubeFunc = 'playVideo'; 166 youtubeIframe.postMessage('{"event":"command","func":"' + youtubeFunc + '","args":""}', '*'); 167 }); 168 }; 169 170});
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.