https://inhabitat.com/wp-content/themes/inhabitatresponsive/js/modules/lightbox.js?ver=260806-145309
1(function($){ 2 // fancybox modal popup init 3 window.initLightbox = function() { 4 var fullWidthClass = 'full-lightbox'; 5 var bodyActiveClass = 'lightbox-opened'; 6 var scrollPageObj = { 7 init: function(){ 8 this.win = $(window); 9 this.page = $('html,body'); 10 this.enable = false; 11 this.scrollVal = this.win.scrollTop(); 12 this.attachEvents(); 13 }, 14 refresh: function(){ 15 this.scrollVal = this.win.scrollTop(); 16 }, 17 attachEvents: function(){ 18 var self = this; 19 this.win.on('resize orientationchange load',function(){ 20 self.refresh(); 21 }); 22 this.win.on('scroll',function(){ 23 if(self.enable){ 24 self.page.scrollTop(self.scrollVal); 25 } 26 else{ 27 self.refresh(); 28 } 29 }); 30 } 31 }; 32 scrollPageObj.init(); 33 34 35 $('figure:not(.gallery-skip) > .lightbox-opener, figure:not(.gallery-skip) > a .lightbox-opener, figure:not(.gallery-skip) > a.lightbox-opener, a.lightbox-opener, a[rel*="lightbox"], dt.gallery-icon a').each(function(){ 36 var link = $(this); 37 var id = link.attr('href'); 38 link.fancybox({ 39 padding: 0, 40 margin: 0, 41 cyclic: false, 42 autoScale: true, 43 overlayShow: true, 44 overlayOpacity: 0.65, 45 overlayColor: '#000000', 46 titlePosition: 'inside', 47 onStart: function(){ 48 if(link.hasClass(fullWidthClass)){ 49 $('#fancybox-wrap').addClass(fullWidthClass); 50 $('body').addClass(bodyActiveClass); 51 } 52 53 var idx = link.data('idx'), 54 $Lightbox = $( id + ' .gallery-extend.isLightbox'); 55 56 if(idx === undefined) { 57 idx = 0; 58 } 59 slideToStart = parseInt(idx); 60 window.slideshowStarted = false; 61 62 }, 63 onComplete: function(box) { 64 $(window).on('resize', function(){ 65 var $LightBox = $('#fancybox-content').find('.gallery'); 66 var $GSlideShow = $LightBox.find('.slide-show'); 67 var $GThumbnails = $LightBox.find('.thumbnails'); 68 69 size = 0; 70 if($GThumbnails.css('display') != "none") { 71 size = $GThumbnails.height(); 72 } 73 74 $GSlideShow.height($LightBox.height()-size-10); 75 }); 76 77 if(link.attr('href').indexOf('#') === 0) { 78 $('#fancybox-content').find('a.close').unbind('click.fb').bind('click.fb', function(e){ 79 jQuery.fancybox.close(); 80 e.preventDefault(); 81 }); 82 } 83 84 scrollPageObj.enable = true; 85 var delay = mainConfig.galleryDelay; 86 if(id) { 87 $(id+'.lightbox .gallery-extend').trigger('gallery:lightbox-open'); 88 $(id+'.lightbox .gallery-extend').trigger('gallery:refresh'); 89 var timeOutId = setTimeout(function(){ 90 $(id+'.lightbox .gallery-extend').trigger('gallery:start'); 91 timeOutId = null; 92 },delay); 93 94 //In case user clicks start slideshow cancel timer 95 $(id+'.lightbox .gallery-extend').on('gallery:start',function(){ 96 clearTimeout(timeOutId); 97 timeOutId = null; 98 }); 99 100 //In case user clicks any thumbnail, restart the timer 101 $("a.change-gallery").on('click',function(){ 102 if(timeOutId != null) { 103 clearTimeout(timeOutId); 104 timeOutId = setTimeout(function () { 105 $(id + '.lightbox .gallery-extend').trigger('gallery:start'); 106 timeOutId = null; 107 }, delay); 108 } 109 }); 110 //In case user click on prev or next, restart the timer 111 $('.btn.prev').on('click', function(){ 112 if(timeOutId != null) { 113 clearTimeout(timeOutId); 114 timeOutId = setTimeout(function () { 115 $(id + '.lightbox .gallery-extend').trigger('gallery:start') 116 timeOutId = null; 117 }, delay); 118 } 119 }); 120 $('.btn.next').on('click', function(){ 121 if(timeOutId != null) { 122 clearTimeout(timeOutId); 123 timeOutId = setTimeout(function () { 124 $(id + '.lightbox .gallery-extend').trigger('gallery:start') 125 timeOutId = null; 126 }, delay); 127 } 128 }); 129 130 } else { 131 $('.lightbox .gallery-extend').trigger('gallery:lightbox-open'); 132 $('.lightbox .gallery-extend').trigger('gallery:refresh'); 133 var timeOutId = setTimeout(function(){ 134 $('.lightbox .gallery-extend').trigger('gallery:start') 135 },delay); 136 137 //In case user clicks start slideshow cancel timer 138 $('.lightbox .gallery-extend').on('gallery:start',function(){ 139 clearTimeout(timeoutId); 140 }) 141 } 142 143 scrollPageObj.refresh(); 144 }, 145 onClosed: function(){ 146 if(link.hasClass(fullWidthClass)){ 147 $('#fancybox-wrap').removeClass(fullWidthClass); 148 $('body').removeClass(bodyActiveClass); 149 } 150 scrollPageObj.enable = false;
151 if(id){ 152 $(id + '.lightbox .gallery-extend').trigger('gallery:closed'); 153 }else{ 154 $('.lightbox .gallery-extend').trigger('gallery:closed'); 155 } 156 $(window).trigger("resize"); 157 158 if(history.replaceState && document.pageURL){ 159 window.history.replaceState({}, document.title, document.pageURL.replace("https:",window.location.protocol)); 160 } 161 162 if(window.galleryPostId) { 163 var slidesetId = '#slideset-'+window.galleryPostId; 164 var slideshowId = "#slideshow-"+window.galleryPostId+" "; 165 $(slidesetId).flexslider("stop"); 166 $(slideshowId+".action.ga-track").html("START"); 167 clearTimeout(window.slideshowTimeout); 168 } 169 } 170 }); 171 }); 172 173 $("div.adjacent-posts").on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){ 174 var $this = $(this); 175 176 if ($this.is(':hover') && !$this.hasClass('disabled')){ 177 $this.find('.post').css('opacity', 1); 178 179 }else { 180 $this.find('.post').css('opacity', 0); 181 } 182 183 }); 184 }; 185 186 $(document).ready(function() { 187 initLightbox(); 188 }); 189})(jQuery);
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.