1var scripts = { 2 plugin_tweaks: { 3 src: 'galleries_js/plugin_tweaks.js', 4 condition: 1 5 }, 6 device: { 7 src: 'galleries_js/device.js', 8 condition: 1 9 }, 10 navigation: { 11 src: 'galleries_js/navigation.js', 12 condition: "!$('body').hasClass('quick-view-active') && ($('#sub_nav.navigation ul li, #exhibitions_nav.navigation ul li, .list_grid_control.navigation ul li').length || $('.navigation.navigation_expandable').length || $('#full_nav .ul_nested').length)" 13 }, 14 responsive: { 15 src: 'galleries_js/responsive.js', 16 condition: "$('body').hasClass('site-responsive')" 17 }, 18 layout: { 19 src: 'galleries_js/layout.js', 20 condition: 1 21 }, 22 lists: { 23 src: 'galleries_js/lists.js', 24 condition: "$('.records_list_ajax').length || window.core.ajax_sections_link_rewrite || $('.remove_html_whitespace').length || $('.records_list ul li img').length || $('.subnav_dropdown').length" 25 }, 26 slideshow: { 27 src: 'galleries_js/slideshow.js', 28 condition: "$('#parallax-hero_header').length || $('#mirror-slideshow ul, #slideshow ul').length || ($('body.homepage_slideshow_continuous_cycle').length && $('#slideshow .slideshow_pager.location_pagination_enabled .slideshow-pager-item-wrapper.slideshow-text .slideshow-pager-item').length)" 29 }, 30 vertical_homepage_slideshow: { 31 src: 'galleries_js/vertical_homepage_slideshow.js', 32 condition: "$('.fullscreen_vertical_slideshow').length" 33 }, 34 artworks: { 35 src: 'galleries_js/artworks.js', 36 condition: "$('#artworks_filter_panel').length || $('.roomview-image').length || $('#image_gallery .image[data-width]').length || $('.image_hover_zoom').length " 37 }, 38 artwork_filters: { 39 src: 'galleries_js/artwork_filters.js', 40 condition: "$('#filterpanel_form').data('artworks_api_enabled') !== true && ($('#filterpanel_form').length || $('.multi-range-slider').length || $('.clear_filters').length || $('.artwork-filter-open-btn').length)" 41 }, 42 image_gallery: { 43 src: 'galleries_js/image_gallery.js', 44 condition: "$('.image_gallery_multiple').length || $('#ig_slideshow').length || $('#ig_slider').length || $('.detail_expand_grid').length || $('.ig_slider').length || $('#image_gallery').length" 45 }, 46 artist_list_slideshow: { 47 src: 'galleries_js/artist_list_slideshow.js', 48 condition: "($('#artist_list_slideshow').length && !$('#artist_list_slideshow').hasClass('no-slideshow'))" 49 }, 50 cover_page_slideshow: { 51 src: 'galleries_js/cover_page_slideshow.js', 52 condition: "$('#cover_page_slideshow').length" 53 }, 54 slide_brightness: { 55 src: 'galleries_js/slide_brightness.js', 56 condition: "$('#slideshow.fullscreen_slideshow.override-slide-brightness ul, #slideshow.fullscreen_slideshow.detect-slide-brightness ul, #cover_page_slideshow.detect-slide-brightness ul, .fullscreen_vertical_slideshow').length" 57 }, 58 artist_list_preview: { 59 src: 'galleries_js/artist_list_preview.js', 60 condition: "($('#list_preview_slideshow').length && !$('#list_preview_slideshow').hasClass('no-slideshow'))" 61 }, 62 artist_list_columns: { 63 src: 'galleries_js/artist_list_columns.js', 64 condition: "$('.artists_list_dynamic_columns').length" 65 }, 66 image_popup: { 67 src: 'galleries_js/image_popup.js', 68 condition: "$('body.prevent_user_image_save').length || $('a.image_popup, a.fancybox').length" 69 }, 70 publications: { 71 src: 'galleries_js/publications.js', 72 condition: "$('a.fancybox_gallery').length" 73 }, 74 quicksearch: { 75 src: 'galleries_js/quicksearch.js', 76 condition: "$('.header_quick_search').length || $('#quicksearch_field').length" 77 }, 78 artist: { 79 src: 'galleries_js/artist.js', 80 condition: "$('#artist_enquire_form.errorOccurred') || $('#artist_enquire_form.captchaError').length" 81 }, 82 contact_form_popup: { 83 src: 'galleries_js/contact_form_popup.js', 84 condition: "$('a[href$=\"/contact/form/\"], .website_contact_form').length || $('#contact_form_inline, .section-contact.page-form').length || $('#contact_form_custom').length || $('#contact_form #contactForm').length" 85 }, 86 mailing_list_form: { 87 src: 'galleries_js/mailing_list_form.js', 88 condition: "$('#mailing_list_form, .mailing_list_form').length" 89 }, 90 feature_popup: { 91 src: 'galleries_js/feature_popup.js', 92 condition: "$('#feature_popup_container').length" 93 }, 94 pageload: { 95 src: 'galleries_js/pageload.js', 96 condition: "$('body').hasClass('pageload-splash-active') || $('body').hasClass('pageload-ajax-navigation-active')" 97 }, 98 pageload_load_more_pagination: { 99 src: 'galleries_js/pageload_load_more_pagination.js', 100 condition: "($('body').hasClass('pageload-ajax-navigation-active')) && $('.page_stats').length && $('.ajax_load_more_pagination_enabled').length" 101 }, 102 parallax: { 103 src: 'galleries_js/parallax.js', 104 condition: "$('.parallax-element').length" 105 }, 106 forms: { 107 src: 'galleries_js/forms.js', 108 condition: "$('.form').length" 109 }, 110 mailinglist_signup_form_popup: { 111 src: 'galleries_js/mailinglist_signup_form_popup.js', 112 condition: "$('a.mailinglist_signup_popup_link').length || $('#mailinglist_signup_close_popup_link').length" 113 }, 114 google_map_popup: { 115 src: 'galleries_js/google_map_popup.js', 116 condition: "$('#footer .website_map_popup').length" 117 }, 118 prevent_user_image_save: { 119 src: 'galleries_js/prevent_user_image_save.js',
120 condition: "$('body.prevent_user_image_save').length" 121 }, 122 cookie_notification: { 123 src: 'galleries_js/cookie_notification.js', 124 condition: "$('#cookie_notification').length" 125 }, 126 google_maps: { 127 src: 'galleries_js/google_maps.js', 128 condition: "$('[id*=\"map_basic\"]').length" 129 }, 130 misc: { 131 src: 'galleries_js/misc.js', 132 condition: "$('.button, .loader_simple, .button_loader, .loader_basic, .extended_click_area:not(.click_event_added)').length" 133 }, 134 accessibility: { 135 src: 'galleries_js/accessibility.js', 136 condition: 1 137 }, 138 scroll: { 139 src: 'galleries_js/scroll.js', 140 condition: 1 141 }, 142 sub_navigation: { 143 src: 'galleries_js/sub_navigation.js', 144 condition: "!$('body').hasClass('quick-view-active') && ($('.scroll_sub_nav_enabled').length && $('.scroll_section_container').length && $('.page-param-type-artist_id #sub_nav.navigation, .page-param-type-exhibition_id #sub_nav.navigation').length) || (!$('.scroll_section_container').length || !$('.page-param-type-artist_id, .page-param-type-exhibition_id').length)" 145 }, 146 scroll_sections: { 147 src: 'galleries_js/scroll_sections.js', 148 condition: "$('.record-page-content-combined, .advanced-content').length" 149 }, 150 global_analytics: { 151 src: 'galleries_js/global_a.js', 152 condition: "window.ga" 153 }, 154 viewing_room: { 155 src: 'galleries_js/viewing_room.js', 156 condition: "$('.countdown_clock').length" 157 }, 158 CryptoJS: { 159 src: 'plugins/crypto-js.js', 160 condition: "$('#cachedata').length" 161 }, 162 ar_artworks: { 163 src: 'galleries_js/ar_artworks.js', 164 condition: "$('.view-in-ar-button').length" 165 }, 166 // model_viewer: { 167 // src: 'galleries_js/model_viewer.js', 168 // condition: "$('.view-in-ar-button').length" 169 // }, 170 shipping_widget: { 171 src: 'galleries_js/shipping_widget.js', 172 condition: "$('.convelio-widget-button').length" 173 }, 174 additional: { 175 src: 'galleries_js/additional.js', 176 condition: 1 177 }, 178 image_brightness: { 179 src: 'galleries_js/image_brightness.js', 180 condition: 1 181 }, 182 image_attributes: { 183 src: 'galleries_js/image_attributes.js', 184 condition: "$('.slider_has_mobile_image').length" 185 }, 186 splide: { 187 src: 'galleries_js/splide.js', 188 condition: "$('.splide__track').length" 189 }, 190 splide_slideshow: { 191 src: 'galleries_js/splide_slideshow.js', 192 condition: "$('.splide__track').length" 193 } 194}; 195 196 197window.galleries = window.galleries || {}; 198async function loadGalleryModules() { 199 /** 200 * Checks the conditional expression of the script and loads if true. 201 * And runs the init function. 202 */ 203 204 var galleryModule = []; 205 window.galleries = window.galleries || {}; 206 207 for (var script in scripts) { 208 if ((secureEval(scripts[script].condition))) { 209 // The condition has passed so kick off the import and store the promise in 210 // the galleryModule array. This runs the requests in parallel and lets us 211 // run the init() functions in order, later. 212 // 213 // Each import is wrapped in .then/.catch so it ALWAYS resolves (never rejects). 214 // Previously a single failed module (e.g. a 404 on a versioned file after a 215 // deploy) rejected the Promise.all() below, which skipped the ENTIRE init loop 216 // and left none of the modules initialised. We keep the module name with the 217 // result so a failure can be logged and skipped without taking down the rest. 218 (function(script) { 219 var src = scripts[script].src; 220 galleryModule.push( 221 Artlogic.import(src) 222 .then(function(mod) { return { ok: true, name: script, mod: mod }; }) 223 .catch(function(err) { return { ok: false, name: script, src: src, err: err }; }) 224 ); 225 })(script) 226 } 227 } 228 229 // Wait for every import to settle (none can reject now), then run each successfully 230 // loaded module's init() in order. Each init() is isolated so one module throwing 231 // cannot prevent the others from initialising. 232 var passed = await Promise.all(galleryModule); 233 for (var m in passed) { 234 var result = passed[m]; 235 if (!result.ok) { 236 console.error('Gallery module failed to load: ' + result.src 237 + ' (build ' + (window.ARTLOGIC_ASSET_SUFFIX || 'n/a') + ')', result.err); 238 continue; 239 } 240 try { 241 var passed_mod = result.mod && result.mod.default; 242 if (passed_mod && typeof passed_mod.init == 'function') { 243 passed_mod.init(); 244 } 245 } catch (e) { 246 console.error('Gallery module init failed: ' + result.name, e); 247 } 248 } 249 250} 251 252window.galleries.init = loadGalleryModules; 253loadGalleryModules() 254 .then(function() { 255 $.getScript('/scripts/main.js', function() { 256 if (typeof window.modulesReady == 'function') window.modulesReady(); 257 }); 258 });
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.