1(function($, Drupal, once) { 2 'use strict'; 3 4 var scrollPosition = 0; 5 Drupal.behaviors.meGalleryGridColorbox = { 6 attach: function(context, settings) { 7 $(once('me-gallery-grid-colorbox', '.me-gallery-grid', context)).each(function (index) { 8 assign_colorbox(this); 9 assign_swipe(); 10 }); 11 } 12 }; 13 14 Drupal.behaviors.meGallerySliderColorbox = { 15 attach: function(context, settings) { 16 $(once('me-gallery-slider-colorbox', '.me-gallery-slider .swiper-wrapper', context)).each(function (index) { 17 assign_colorbox(this); 18 assign_swipe(); 19 }); 20 } 21 }; 22 23 function assign_colorbox(element) { 24 var colorboxEl = $(element).find('a').colorbox({ 25 transition: "fade", 26 inline: true, 27 href: function() { 28 return $(this).data('colorbox-inline'); 29 }, 30 rel: function() { 31 return $(this).data('colorbox-gallery'); 32 }, 33 width: $(window).innerWidth(), 34 height: $(window).innerHeight(), 35 current: '', 36 previous: '', 37 next: '', 38 opacity: 0.95, 39 onOpen: onOpenColorbox, 40 onLoad: onLoadColorbox, 41 onComplete: completeColorbox 42 }); 43 } 44 45 function assign_swipe() { 46 $(document).bind('cbox_open', function() { 47 $('#colorbox').swipe({ 48 //Generic swipe handler for all directions 49 swipeLeft: function(event, direction, distance, duration, fingerCount) { 50 $.colorbox.next(); 51 }, 52 swipeRight: function(event, direction, distance, duration, fingerCount) { 53 $.colorbox.prev(); 54 }, 55 //Default is 75px, set to 0 for demo so any distance triggers swipe 56 threshold: 75, 57 }); 58 }) 59 } 60 61 function onOpenColorbox() { 62 // Get the current scroll position. 63 scrollPosition = document.documentElement.scrollTop || document.body.scrollTop; 64 } 65 66 function onLoadColorbox() { 67 document.documentElement.scrollTop = document.body.scrollTop = scrollPosition; 68 } 69 70 function completeColorbox() { 71 //if ($(window).innerWidth() < 768) { 72 if ($('#cboxOverlay').is(':visible')) { 73 $.colorbox.resize({ width: $(window).width(), height: 'auto' }); 74 $.colorbox.resize(); 75 } 76 //} 77 $('<span class="animation-arrow"></span>').appendTo($('#cboxPrevious')); 78 $('<span class="animation-arrow"></span>').appendTo($('#cboxNext')); 79 } 80 81 var resizeTimer; 82 83 function resizeColorbox() { 84 if (resizeTimer) clearTimeout(resizeTimer); 85 resizeTimer = setTimeout(function() { 86 if ($('#cboxOverlay').is(':visible')) { 87 $.colorbox.resize({ width: $(window).width(), height: $(window).height() }); 88 $.colorbox.resize(); 89 } 90 }, 100) 91 } 92 $(window).resize(resizeColorbox); 93 window.addEventListener("orientationchange", resizeColorbox, false); 94 95})(jQuery, Drupal, once)
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.