1var lists = { 2 3 init: function() { 4 window.galleries.lists.ajax.init(); 5 window.galleries.lists.ajax.rewrite_links(); 6 window.galleries.lists.cleanup_whitespace.init(); 7 window.galleries.lists.css_image_cropping.init(); 8 window.galleries.lists.lists_filter_reveal.init(); 9 }, 10 11 cleanup_whitespace: { 12 init: function() { 13 $('.remove_html_whitespace').each(function() { 14 $(this).html($(this).html().replace(/>\s+</g,'><')); 15 }); 16 } 17 }, 18 19 ajax: { 20 21 init: function() { 22 23 var ajax_list_loopcount = 0; 24 $('.records_list_ajax').each(function() { 25 if ($('ul li > a', this).length > 0) { 26 27 ajax_list_loopcount = ajax_list_loopcount + 1; 28 $(this).attr('data-relative', String(ajax_list_loopcount)); 29 30 var ajax_preview_area = '<div class="records_list_preview" data-relative="' + String(ajax_list_loopcount) + '"><div class="loader_simple">Loading</div><div class="ajax_content"></div></div>'; 31 32 if ($(this).closest('.records_list_ajax').attr('data-ajax-preview-position') == 'top') { 33 $(this).before(ajax_preview_area); 34 } else { 35 $(this).after(ajax_preview_area); 36 } 37 38 if ($(this).attr('data-ajax-list-type') == 'hover') { 39 $('ul li > a', this).each(function() { 40 var instance = $(this).closest('li'); 41 $(this) 42 .mouseover(function() { 43 $(this).closest('.records_list_ajax').stop().clearQueue(); 44 $(this).closest('.records_list_ajax').animate({'min-height': 0}, 300, function() { 45 window.galleries.lists.ajax.load(instance, '', true); 46 }); 47 return false; 48 }) 49 .mouseout(function() { 50 $(this).closest('.records_list_ajax').stop().clearQueue(); 51 }) 52 ; 53 }); 54 } else { 55 $('ul li > a', this).each(function() { 56 $(this).addClass('ajax_link').click(function() { 57 window.galleries.lists.ajax.load($(this).closest('li')); 58 return false; 59 }); 60 }); 61 } 62 63 if (window.location.hash && window.location.hash != '#' && window.location.hash != '#'+window.location.pathname && window.location.hash != '#undefined') { 64 var this_hash = window.location.hash.split('#')[1]; 65 if (this_hash != window.location.pathname) { 66 window.galleries.lists.ajax.load([], this_hash, false); 67 } 68 } else { 69 $('li:eq(0) > a', this).each(function() { 70 // Display the first one by default 71 window.galleries.lists.ajax.load($(this).closest('li'), '', true); 72 }); 73 } 74 75 } 76 }); 77 78 }, 79 80 load: function(instance, url, background_load, no_scroll) { 81 82 if (!$(instance).closest('li').hasClass('active') || url) { 83 84 if ($(instance).length) { 85 var url_method = $(instance).closest('.records_list_ajax').attr('data-ajax-list-url-type') && typeof $(instance).closest('.records_list_ajax').attr('data-ajax-list-url-type') != 'undefined' ? $(instance).closest('.records_list_ajax').attr('data-ajax-list-url-type') : 'hash'; 86 } 87 88 if (url) { 89 url = url; 90 var preview_area = $('.records_list_preview'); 91 } else { 92 url = $('a', instance).attr('href'); 93 $(instance).closest('.records_list_ajax').find('ul li').removeClass('active'); 94 $(instance).addClass('active'); 95 var preview_area = $('.records_list_preview[data-relative=' + $(instance).closest('.records_list_ajax').attr('data-relative') + ']'); 96 } 97 98 if ($(preview_area).is(':visible')) { 99 100 // Position the preview area so it can be seen by the user 101 if ($(instance).length > 0) { 102 var top_offset = $(window).scrollTop() - $(instance).closest('.records_list_ajax').offset().top + 140; 103 if (top_offset < 0) { 104 top_offset = 0; 105 } 106 $('.records_list_preview').animate({'padding-top': top_offset}, 0, 'easeInOutQuint'); 107 } 108 109 $('.loader_simple', preview_area).show(); 110 $('.ajax_content', preview_area).fadeTo(0, 0); 111 112 window.galleries.lists.ajax.before(instance, preview_area, url); 113 114 $.ajax({ 115 url: url, 116 data: 'modal=1', 117 cache: false, 118 dataType: 'html', 119 success: function(data) { 120 $('.loader_simple', preview_area).hide(); 121 $('.ajax_content', preview_area).html(data).fadeTo(500, 1); 122 $('#content, #content_module:not(.content_module), .content_module, #sidebar:not(.sidebar), .sidebar', preview_area).each(function() { 123 $(this).attr('id', $(this).attr('id') + '_ajax'); 124 }); 125 $('.navigation', preview_area).remove(); 126 127 if (!background_load) { 128 if ($(preview_area).offset().top > $(window).scrollTop() + ($(window).height() / 1.5)) { 129 // Scrolls to the preview area if it is out of view (e.g. responsive version) 130 $('html,body').animate( 131 {scrollTop: $(preview_area).offset().top + (-140)}, 132 800, 133 'easeInOutQuad' 134 ); 135 } 136 } 137 138 139 if (url_method == 'full_url') { 140 history.pushState(null, null, url); 141 } else { 142 window.location.hash = url; 143 } 144 window.galleries.lists.ajax.after(instance, preview_area, url); 145 } 146 }); 147 } 148 } 149 150 }, 151 152 before: function(original_instance, preview_area, url) { 153 154 }, 155 156 after: function(original_instance, preview_area, url) { 157 158 }, 159 160 rewrite_links: function() { 161 if (window.core.ajax_sections_link_rewrite) { 162 var t; 163 for (var i = 0; i < window.core.ajax_sections_link_rewrite.length; i ++) { 164 t = '/' + window.core.ajax_sections_link_rewrite[i] + '/'; 165 if (window.location.pathname.substring(0, t.length) != t) { 166 $("a[href^='" + t + "']").not("a[href='" + t + "']").not('.ajax_link').each(function() { 167 var new_href = '' + t + '#' + $(this).attr('href'); 168 $(this).attr('href', new_href); 169 }); 170 } 171 } 172 } 173 } 174 175 }, 176 177 css_image_cropping: { 178 /* 179 Simple polyfill for image grids that use object-fit css for 'soft' cropping. 180 Mostly required for all versions of Internet Explorer and older versions of Edge. 181 */ 182 init: function() { 183 184 var polyfill_images = '.records_list ul li img'; 185 var verbose = false;
186 if ($(polyfill_images).length){ 187 if (verbose){ 188 console.log('css_image_cropping -- grid imgs on page'); 189 } 190 var objectfitcover_on_page = $(polyfill_images).filter(function() { 191 // If css cropping is being used, we pass a flag - a font-family on an impossible pseudo-element (invisible) from user_custom.css 192 return window.getComputedStyle($(this)[0]).getPropertyValue('font-family') == ('object-fit'); 193 //return window.getComputedStyle($(this)[0], ':first-letter').getPropertyValue('font-family') == ('object-fit'); 194 }); 195 196 if (objectfitcover_on_page.length) { 197 if (verbose){ 198 console.log('css_image_cropping -- object-fit used in grid, polyfill checking for support'); 199 } 200 201 var supportsObjectfit; 202 203 // Detect whether '@supports' CSS is supported, preventing errors in IE 204 var supports_supportsCSS = !!((window.CSS && window.CSS.supports) || window.supportsCSS || false); 205 206 if (supports_supportsCSS){ 207 // Older Edge supports '@supports' but not object-fit 208 supportsObjectfit = CSS.supports('object-fit','cover'); 209 } else { 210 //IE doesn't support '@supports' or 'object-fit', so we can consider them the same 211 supportsObjectfit = false; 212 } 213 214 if (!supportsObjectfit || typeof supportsObjectfit == 'undefined') { 215 216 if (verbose){ 217 console.log('css_image_cropping -- polyfill running'); 218 } 219 $(polyfill_images).each(function() { 220 var $img = $(this); 221 if ($img.attr('data-src') && typeof $img.attr('data-src') != 'undefined') { 222 var imageURL = $img.attr('data-src'); 223 } else { 224 var imageURL = $img.attr('src'); 225 } 226 if (window.getComputedStyle($img[0], ':first-letter').getPropertyValue('font-family') == 'object-fit' && imageURL) { 227 var bg_positioning = '50% 50%'; 228 if ($img.css('object-position')) { 229 var positioning = $img.css('object-position'); 230 } 231 $img.parent().addClass('objectfit-fallback-bg').css({'background-image':'url('+imageURL+')','background-position':bg_positioning}); 232 $img.css('visibility','hidden'); 233 234 if (!$('body').hasClass('objectfit-polyfill-active')){ 235 $('body').addClass('objectfit-polyfill-active') 236 } 237 } 238 }); 239 } else { 240 if (verbose){ 241 console.log('css_image_cropping -- polyfill not required, object-fit supported'); 242 } 243 } 244 } 245 } 246 }, 247 }, 248 249 lists_filter_reveal: { 250 251 init: function() { 252 253 $(".subnav_dropdown").each(function(){ 254 255 var $this = $(this); 256 var $list = $this.find('ul'); 257 258 $this.closest('.heading_wrapper').addClass('display-subnav-as-dropdown'); 259 260 var dropdown_label = (($this.data().dropdownName && typeof $(".subnav_dropdown").data().dropdownName != 'undefined') ? $(".subnav_dropdown").data().dropdownName : 'Dropdown'); 261 262 $('<button id="loop1" class="reveal-subnav-dropdown-list">'+dropdown_label+'<span class="dropdown-arrow"></span></button>').insertBefore($this); 263 264 var $button = $this.prev(".reveal-subnav-dropdown-list"); 265 266 267 $button.click(function(event) { 268 269 event.preventDefault(); 270 271 if ($list.hasClass('open')) { 272 $list.removeClass('open'); 273 $button.removeClass('open'); 274 setTimeout(function() { 275 $list.slideUp(); 276 }, 100); 277 } else { 278 $button.addClass('open'); 279 $list.slideDown(100, function() { 280 $list.addClass('open'); 281 }); 282 } 283 }); 284 285 }); 286 287 }, 288 } 289} 290 291window.galleries = window.galleries || {}; 292window.galleries.lists = lists; 293export default lists;
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.