1var Themibox = {}; 2 3(function($) { 4 5 Themibox = { 6 UpdateQueryString : function(a,b,c) { 7 c||(c=window.location.href);var d=RegExp("([?|&])"+a+"=.*?(&|#|$)(.*)","gi");if(d.test(c))return b!==void 0&&null!==b?c.replace(d,"$1"+a+"="+b+"$2$3"):c.replace(d,"$1$3").replace(/(&|\?)$/,"");if(b!==void 0&&null!==b){var e=-1!==c.indexOf("?")?"&":"?",f=c.split("#");return c=f[0]+e+a+"="+b,f[1]&&(c+="#"+f[1]),c}return c 8 }, 9 10 init: function(config) { 11 // private 12 this.isFrameLoading = false; 13 this.lightboxOpen = false; 14 15 // public 16 this.config = config; 17 this.bindEvents(); 18 this.setupLightbox(); 19 }, 20 21 bindEvents: function() { 22 var $body = $('body'); 23 24 $body.on('click', '.themify-lightbox', this.clickLightBox); 25 $body.on('click', '.close-lightbox', this.closeLightBox); 26 27 // lightbox navigation 28 $body.on('click', '.lightbox-prev', this.clickLightBoxPrev); 29 $body.on('click', '.lightbox-next', this.clickLightBoxNext); 30 31 $(document).keyup(this.keyUp); 32 33 // Set up overlay 34 if($('#overlay').length===0){ 35 $('<div id="overlay" class="overlay" />').appendTo('body'); 36 } 37 $('#overlay').on('click', function(e){ 38 e.preventDefault(); 39 if ( Themibox.isFrameLoading ) { 40 Themibox.cancelLightBox(e); 41 } else { 42 Themibox.closeLightBox(e); 43 } 44 }); 45 }, 46 47 setupLightbox: function() { 48 if($('#post-lightbox-wrap').length===0){ 49 $('<div class="clone-wrap"></div><div id="post-lightbox-wrap" class="album-lightbox"></div>') 50 .hide() 51 .prependTo('body'); 52 } 53 }, 54 55 clickLightBox: function(e) { 56 e.preventDefault(); 57 58 // update status 59 Themibox.isFrameLoading = true; 60 Themibox.lightboxOpen = true; 61 62 var $link = $(this), 63 url = Themibox.UpdateQueryString( 'post_in_lightbox', 1, $link.data('album') ); 64 65 66 var offset = $link.find('img').offset(); 67 var posY = offset.top; 68 var posX = offset.left; 69 $link.find('img').clone().addClass('clone').prependTo('.clone-wrap'); 70 $('.clone-wrap').css({ 71 'top' : posY, 72 'left' : posX 73 }); 74 $('body').addClass('post-lightbox'); 75 $('.overlay').hide().fadeIn(800); 76 $('<div id="loader"><div class="themify-loader"><div class="themify-loader_1 themify-loader_blockG"></div><div class="themify-loader_2 themify-loader_blockG"></div><div class="themify-loader_3 themify-loader_blockG"></div></div></div>').appendTo('body'); 77 setTimeout(function(){ 78 $('.clone-wrap').addClass('moved'); 79 $('.clone').addClass('image-clone'); 80 $('#post-lightbox-wrap').empty().load(url + ' .album-container', function(){ 81 if ( Themibox.lightboxOpen ) { 82 83 $('#loader').remove(); 84 85 var $self = $(this); 86 $self.show(); 87 88 $('.image-clone').on('transitionend webkitTransitionEnd otransitionend oTransitionEnd MSTransitionEnd', function(){ 89 $self.addClass('flipped'); 90 }).addClass('flipped'); 91 92 $('.lightbox-direction-nav').show(); 93 94 var prev = $(this).contents().find('.post-nav .prev a'); 95 var next = $(this).contents().find('.post-nav .next a'); 96 97 if(prev.length == 0){ 98 $('.lightbox-prev').hide(); 99 } 100 101 if(next.length == 0){ 102 $('.lightbox-next').hide(); 103 } 104 105 // also for the form should exit the lightbox 106 $(this).contents().find("form").attr('target', '_top'); 107 108 // update current status 109 Themibox.isFrameLoading = false; 110 111 } 112 113 // ((((( Broadcast Event )))))) 114 $('body').trigger('themiboxloaded'); 115 116 }).iframeAutoHeight(); 117 }, 5); 118 }, 119 120 closeLightBox: function(e) { 121 122 e.preventDefault(); 123 $('.image-clone').remove(); 124 $('.clone-wrap').removeClass('moved').css({ 125 'top' : '', 126 'left' : '' 127 }); 128 129 $('#post-lightbox-wrap').removeClass('flipped'); 130 // Animation complete. 131 $('.overlay').fadeOut(800, function(){ 132 $('body').removeClass('post-lightbox'); 133 $('#post-lightbox-wrap').empty().hide(); 134 $('.lightbox-direction-nav').hide(); 135 136 Themibox.lightboxOpen = false; // update current status 137 138 // ((((( Broadcast Event )))))) 139 $('body').trigger('themiboxclosed'); 140 $(window).resize();
140 // fix issue 141 }); 142 143 }, 144 145 getDocHeight: function(){ 146 var D = document; 147 return Math.max( 148 Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), 149 Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), 150 Math.max(D.body.clientHeight, D.documentElement.clientHeight) 151 ); 152 }, 153 154 clickLightBoxPrev: function(e) { 155 var link = $('#post-lightbox-wrap').contents().find('.post-nav .prev a').attr('href'); 156 link = Themibox.UpdateQueryString( 'post_in_lightbox', 1, link ); 157 158 if($(this).hasClass('click-disabled')){ 159 return false; 160 } 161 162 $(this).addClass('click-disabled'); 163 164 Themibox.loadLightboxPost(link); 165 166 e.preventDefault(); 167 }, 168 169 clickLightBoxNext: function(e) { 170 var link = $('#post-lightbox-wrap').contents().find('.post-nav .next a').attr('href'); 171 link = Themibox.UpdateQueryString( 'post_in_lightbox', 1, link ); 172 173 if($(this).hasClass('click-disabled')){ 174 return false; 175 } 176 177 $(this).addClass('click-disabled'); 178 179 Themibox.loadLightboxPost(link); 180 e.preventDefault(); 181 }, 182 183 loadLightboxPost: function(url) { 184 $('<div/>', {id: 'loader'}).appendTo('body'); 185 Themibox.isFrameLoading = true; 186 187 $('#post-lightbox-wrap, .lightbox-direction-nav').hide(); 188 189 $('#post-lightbox-wrap').empty().load(url + ' #pagewrap', function(){ 190 $('#loader').remove(); 191 192 $(this) 193 .show() 194 .css('top', Themibox.getDocHeight()) 195 .animate({ 196 top: 0 197 }, 800 ); 198 199 $('.lightbox-direction-nav').removeClass('click-disabled').show(); 200 201 var prev = $(this).contents().find('.post-nav .prev a'); 202 var next = $(this).contents().find('.post-nav .next a'); 203 204 if(prev.length == 0){ 205 $('.lightbox-prev').hide(); 206 } 207 208 if(next.length == 0){ 209 $('.lightbox-next').hide(); 210 } 211 212 // also for the form should exit the lightbox 213 $(this).contents().find("form").attr('target', '_top'); 214 215 Themibox.isFrameLoading = false; 216 217 }).iframeAutoHeight(); 218 }, 219 220 keyUp: function(e) { 221 if(Themibox.isFrameLoading && e.keyCode == 27){ 222 Themibox.cancelLightBox(); 223 } 224 225 if (Themibox.lightboxOpen && e.keyCode == 27) { 226 $('.close-lightbox').trigger('click'); 227 $('#loader').remove(); 228 } 229 }, 230 231 cancelLightBox: function(e) { 232 e.preventDefault(); 233 $('.image-clone, #loader').remove(); 234 $('.clone-wrap').removeClass('moved').css({ 235 'top' : '', 236 'left' : '' 237 }); 238 239 $('#post-lightbox-wrap').removeClass('flipped'); 240 // Animation complete. 241 $('.overlay').fadeOut(800, function(){ 242 $('body').removeClass('post-lightbox'); 243 $('#post-lightbox-wrap').empty().hide(); 244 $('.lightbox-direction-nav').hide(); 245 $(window).resize(); // fix issue 246 }); 247 248 // ((((( Broadcast Event )))))) 249 $('body').trigger('themiboxcanceled'); 250 251 // update status 252 Themibox.isFrameLoading = false; 253 Themibox.lightboxOpen = false; 254 255 // ((((( Broadcast Event )))))) 256 $('body').trigger('themiboxclosed'); 257 } 258 }; 259})(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.