1 2/*! Concept Gallery v3.1.0 http://sam3.pl | all rights reserved 3Ostatnia modyfikacja: 42016-09-08 52017-05-18 - poprawka przy wejÅciu i wyjÅciu z peÅnego widku (znikaÅ opis galerii) 62017-05-26 - dopisanie opcji pobrania obrazka 72017-07-25 - przeróbka wersji mobilnej 8 9ZMIANY W WYWOÅYWANIU 10options.type = 'wall'; // typ w jakim bÄdzie uruchomiona: 'inlineSlideshow' 'wall' 'photoSlideshow' 11options.alignThumbnails = 'justify'; // align thumbnails in inline view (not fullscreen) 'left' 'right' 'center' 'justify' 'fill' - obecnie justify to to samo co fill 12op.inlineSlideshowPhotoFormat = '4:3'; // 4:3 3:2 16:9 - zasadniczo zadziaÅa wszystko, ale damy te 3 opcje 13op.thumbnailTitles = 'hover'; // tytuÅy zdjÄÄ na miniaturkach 14 // 'visible' - widoczne pod miniaturkÄ 15 // 'hover' - widoczne po najechaniu na miniaturkÄ 16 // 'hidden' - zawsze schowane 17op.showGalleryDescription = false; // pokaż zajawkÄ galerii pod tytuÅem 18op.allowImageDownload = true; // pozwala na ÅciÄ ganie zdjÄÄ poprzez dodanie ikonki pobierz 19 20 21 22 23options.type = 'wall'; // typ w jakim bÄdzie uruchomiona: 'inlineSlideshow' 'wall' 'photoSlideshow' 24options.rowLimit = 4; // limit rzÄdów jakie bÄdÄ na jednej stronie w przypadku Åciany 25options.thumbHeight = 100; // wysokoÅÄ miniaturki (dla kwadratowych tasama bÄdzie szerokoÅÄ 26options.thumbWidth = 0; // szerokoÅÄ miniaturki (jeÅli zero to zdjÄcia bÄdÄ zmniejszane na wysokoÅÄ o automatycznej szerokoÅci) 27options.inlineSlideshowPhotoHeight = 300; // wysokoÅÄ zdjÄcia w trybie inline slideshow 28options.allowLargeView=false; // czy można powiÄkszaÄ miniaturki (jeÅli false wstawione bÄdÄ tylko kafelki) 29options.startInFullMode = false; // czy uruchamiamy w divie czy peÅnym obszarze viewport 30options.allowFullMode = false; // czy może przeÅÄ czaÄ siÄ w tryb FullMode (wpÅywa także na FullScreen) 31options.buttonInactiveColor = '#dddddd'; // kolor nieaktywnego buttonu 32options.buttonActiveColor = '#000000'; // kolor aktywnego buttonu 33options.buttonHoverColor = '#888888'; // kolor hover buttonu 34options.buttonInactiveFsColor = '#eeeeee'; // kolor nieaktywnego buttonu fullscreen 35options.buttonActiveFsColor = '#000000'; // kolor aktywnego buttonu fullscreen 36options.buttonHoverFsColor = '#888888'; // kolor hover buttonu fullscreen 37options.backgroundOpacity = 0.8; // fullscreen mode background alpha 38options.interfaceImagesPath = "http://projekty.concept.net.pl/galerie/images-design/"; // path to folder with interface images 39options.alignThumbnails = 'justify'; // align thumbnails in inline view (not fullscreen) 'left' 'right' 'center' 'justify' 'justify left' 'fill' 40options.alignThumbnailsFillExtraQuality = 2; // ile razy wiÄksze miniaturki przygotowaÄ, by nastÄpnie po powiÄkszeniu ich w trybie FILL wyglÄ daÅy lepiej 41options.slideshowTime=4000; 42options.slideshowStart=false; 43options.showGalleryTitle=true; // wyÅwietl nazwÄ i opis galerii 44options.showPictureTitle=true; // wyÅwietl tytuÅy zdjÄÄ pod miniaturkami 45options.timThumbPath = 'tools/timthumb.php'; 46options.imagesPath = 'http://projekty.concept.net.pl/galerie/images/'; 47options.loaderUrl = '/images/sam3-loader.svg'; 48 49*/ 50 51 52 53if (typeof globalpause == 'undefined') { 54 globalPause=false; 55} 56 57function runConceptGallery(myel,op,$) { 58 //console.log(op); 59 //debugger; 60 //return 0; 61 62 63 var debounceTimeout = null; 64 function debounce3 (delay,targetFn){ 65 clearTimeout(debounceTimeout); 66 debounceTimeout = setTimeout(function(){ 67 updateSize(); 68 },delay); 69 }; 70 71 var oldWidth = 0; 72 73 /* --------------- NEW ---------- */ 74 op.squareThumbnails = false; 75 if (typeof op.inlineSlideshowPhotoFormat == 'undefined') 76 op.inlineSlideshowPhotoFormat = '4:3'; // 3:2 16:9 77 op.desktopFullMode = false; // czy chowaÄ interfejs systemu (F11 w przeglÄ darce) 78 if (typeof op.fsThumbnailsPosition == 'undefined') 79 op.fsThumbnailsPosition = 'visible'; // hover - zjÄcie peÅnej wielkoÅci - miniaturki niewidoczne, pokazujÄ siÄ na zdjÄciu po mouse hover - aktualnie nie ma znaczenia - o pozycjy decyduje zapisane cookie 80 // visible - pasek pod zdjÄciem widoczny 81 // hidden - schowane do ikonki 82 if (typeof op.thumbnailTitles == 'undefined') 83 op.thumbnailTitles = 'hover'; // tytuÅy zdjÄÄ na miniaturkach 84 // 'visible' - widoczne pod miniaturkÄ 85 // 'hover' - widoczne po najechaniu na miniaturkÄ 86 // 'hidden' - zawsze schowane 87 op.fsThumbWidth = null; // wysokoÅÄ miniaturek w trybie FullScreen
88 op.fsThumbHeight = 100; // wysokoÅÄ miniaturek w trybie FullScreen 89 op.noThumbnails = false; // jeÅli op.rowLimit == null to zmieniamy to na true- wówczas w INLINE SLIDESHOW jest samo zdjÄcie bez miniaturek 90 if (typeof op.showGalleryDescription == 'undefined') 91 op.showGalleryDescription = false; // pokaż zajawkÄ galerii pod tytuÅem 92 93 if (typeof op.allowImageDownload == 'undefined') 94 op.allowImageDownload = true; // pokazuje przycisk umożliwiajÄ cy pobranie zdjÄcia 95 96 97 98 /* --------------- NEW ---------- */ 99 100 101 /* --------------- TEMP ---------- */ 102 ///op.alignThumbnails = 'fill'; 103 //op.rowLimit = null; 104 //op.slideshowTime=6000; 105 //op.slideshowStart = true; 106 //op.type = "photoSlideshow"; 107 //op.showGalleryDescription = true; 108 /* --------------- TEMP ---------- */ 109 110 111 /* --------------- OVERWRITES ---------- */ 112 113 op.buttonActiveColor = 'rgba(0,0,0,0.6)'; 114 op.backgroundOpacity = 0.9; // fullscreen mode background alpha 115 op.speed1 = 0.3; 116 op.speed2 = 0.5; 117 op.scaleHover = 1.2; 118 op.photoBoxPadding = 20; // padding inside photoBox (border containing title image and image description) 119 //op.alignThumbnails = 'fill'; // align thumbnails in inline view (not fullscreen) 'left' 'right' 'center' 'justify' 'fill' 120 var css_active = jQuery("#css-active").height() > 0; 121 if(css_active){ 122 op.loaderUrl = ''; 123 //op.loaderUrl = '/images/sam3-loader.svg'; 124 } 125 126 op.alignThumbnailsFillExtraQuality = 2; 127 128 129 130 /* --------------- OVERWRITES ---------- */ 131 132 /* --------------- DEPRACATED ----------- 133 op.showPictureTitle 134 */ 135 136 var isMobile = false; //initiate as false 137 // device detection 138 if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) 139 || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.
139substr(0,4))) isMobile = true; 140 141 142 myel = $(myel); 143 var el=$(myel); 144 $(myel).wrap('<div class="concept-gallery-placeholder"></div>'); 145 var gal=$(myel).parent(); 146 147 var browserFullScreen = $(window).data('fullscreen-state'); 148 $(window).bind("fullscreen-on", function(e, state) { 149 browserFullScreen = true; 150 getScreenSize(); 151 fixView(); 152 }); 153 $(window).bind("fullscreen-off", function(e, state) { 154 browserFullScreen = false; 155 getViewportSize(); 156 fixView(); 157 }); 158 159 // get viewport size 160 var x=0,y=0; 161 var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0]; 162 var getViewportSize = function(){ 163 x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight; 164 } 165 var getScreenSize = function(){ 166 x=window.screen.width; 167 y=window.screen.height; 168 } 169 var getViewSize = function(){ 170 //cc('getViewSize browserFullScreen=',browserFullScreen); 171 if (browserFullScreen) 172 getScreenSize(); 173 else 174 getViewportSize(); 175 } 176 getViewSize(); 177 oldWidth = x; 178 TweenLite.defaultEase = Quad.easeOut; 179 180 // cookies 181 function setCookie(cname, cvalue, exdays) { 182 var d = new Date(); 183 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 184 var expires = "expires="+ d.toUTCString(); 185 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 186 } 187 function getCookie(cname) { 188 var name = cname + "="; 189 var ca = document.cookie.split(';'); 190 for(var i = 0; i <ca.length; i++) { 191 var c = ca[i]; 192 while (c.charAt(0)==' ') { 193 c = c.substring(1); 194 } 195 if (c.indexOf(name) == 0) { 196 return c.substring(name.length,c.length); 197 } 198 } 199 return ""; 200 } 201 202 203 var thumbnailsHammer; 204 var photoHammer; 205 206 /* *************************************************** 207 * Config 208 * ***************************************************/ 209 210 if (op.alignThumbnails == 'justify') op.alignThumbnails = 'fill'; 211 212 if (op.slideshowStart == true){ 213 if ( (op.type != 'inlineSlideshow') && 214 (op.type != 'photoSlideshow') ){ 215 op.slideshowStart = false;
216 } 217 } 218 219 if (op.rowLimit == null) { 220 op.rowLimit = 0; 221 } 222 op.rowLimit = parseInt(op.rowLimit); // limit rzÄdów jakie bÄdÄ na jednej stronie w przypadku Åciany 223 op.thumbHeight = parseInt(op.thumbHeight); // wysokoÅÄ miniaturki (dla kwadratowych tasama bÄdzie szerokoÅÄ 224 op.thumbWidth = parseInt(op.thumbWidth); // szerokoÅÄ miniaturki (jeÅli zero to zdjÄcia bÄdÄ zmniejszane na wysokoÅÄ o automatycznej szerokoÅci) 225 if (op.thumbWidth == 0) op.thumbWidth = null; 226 op.fsThumbHeight = parseInt(op.fsThumbHeight); 227 op.fsThumbWidth = parseInt(op.fsThumbWidth); 228 if (op.fsThumbWidth == 0) op.fsThumbWidth = null; 229 op.inlineSlideshowPhotoHeight = parseInt(op.inlineSlideshowPhotoHeight); // wysokoÅÄ zdjÄcia w trybie inline slideshow 230 231 232 if (op.type == 'photoSlideshow'){ 233 op.type = "inlineSlideshow"; 234 op.rowLimit = 0; 235 op.noThumbnails = true; 236 } 237 238 // ustal wielkoÅÄ zdjÄcia inlineSlideshow na podstawie proporcji z konfiguracji 239 switch (op.inlineSlideshowPhotoFormat) { 240 case '1': 241 op.inlineSlideshowPhotoFormat = '4:3'; 242 break; 243 case '2': 244 op.inlineSlideshowPhotoFormat = '3:2'; 245 break; 246 case '3': 247 op.inlineSlideshowPhotoFormat = '16:9'; 248 break; 249 } 250 var isphx = parseInt(op.inlineSlideshowPhotoFormat.split(':')[0]); 251 var isphy = parseInt(op.inlineSlideshowPhotoFormat.split(':')[1]); 252 op.inlineSlideshowPhotoHeight = $(gal).width()*isphy/isphx; 253 254 op.alignThumbnailsFillExtraQuality = parseInt(op.alignThumbnailsFillExtraQuality); // ile razy wiÄksze miniaturki przygotowaÄ, by nastÄpnie po powiÄkszeniu ich w trybie FILL wyglÄ daÅy lepiej 255 256 op.slideshowTime = parseInt(op.slideshowTime); 257 258 var smallGallery; 259 var largeGallery; 260 var largeGalleryGenerated=false; // is full screen in memory? 261 262 // get Cookie for fsThumbnailsPosition 263 var fsThumbnailsPosition = op.fsThumbnailsPosition; 264 fsThumbnailsPosition = getCookie('conceptGalleryFsThumbnailsPosition'); 265 if (fsThumbnailsPosition == '') { 266 fsThumbnailsPosition = 'visible'; 267 } 268 269 var currentPage = 0; // current thumbnail page 270 var currentPageInline = 0; 271 var currentPageFs = 0; 272 var pageCount = 0; 273 var currentPicture = 1; // current picture 274 var currentViewRowLimit = op.rowLimit; // limit used in current view 275 var fsgcurrentViewRowLimit = op.rowLimit; // limit used in current view 276 var centerThumbnails = false; 277 var fsgcenterThumbnails = false; 278 var slideshowRunning=false; 279 var slideshowTimer; 280 var displayText = true; // display text on picture 281 var fsgdisplayText = true; // display text on picture 282 var cancelLoad = false; // stops loading loop when switched to full screen before all thumbnails are loaded 283 var allThumbnailsLoaded = false; 284 var splitThumbnailsCounter = 0; // fixes problem when splitThumbnailsToPages function is executed twice 285 var fsMode = false; // full screen mode 286 var changingMode = false; 287 var displayPhotoView = false; // if in this view large photo should be displayed 288 var fsgdisplayPhotoView = false; // if in this view large photo should be displayed 289 var photoBoxImageOnly = false; // if photo box should have border title and description 290 var fsgphotoBoxImageOnly = false; // if photo box should have border title and description 291 292 var photoNextOverScale = 1; 293 var photoNextOutScale = 0.7; 294 295 // starting diemensions 296 var startHeight = $('.concept-gallery',gal).height(); 297 var startWidth = $('.concept-gallery',gal).width(); 298 var startMarginTop = $('.concept-gallery',gal).css('margin-top'); 299 var startMarginBottom = $('.concept-gallery',gal).css('margin-bottom'); 300 var fullScreenStartScrollTop = -1; 301 var photoAreaWidth = 0; 302 var photoAreaHeight = 0; 303 var fsgphotoAreaWidth = 0; 304 var fsgphotoAreaHeight = 0; 305 var currentViewMode = 'fsView'; //fsView fsWall inlineView inlineWall 306 307 var beforeFSWindowWidth = x; 308 var beforeFSWindowHeight = y; 309 310 // ************************ 311 // get image list and gallery data 312 var timthumbPath = op.timThumbPath; 313 var imagePath = op.imagesPath; 314 var imageFile = op.imagesFile; 315 var css_active = jQuery("#css-active").height() > 0; 316 if(css_active){ 317 var loaderUrl = op.loaderUrl; 318 } 319 // prepare image list config
320 var configString = $('.config', el).text(); 321 var cArray = configString.split("°"); 322 var images = new Array(); // array with image data 323 var photos = new Array(); // array with picture objects 324 var fsgphotos = new Array(); // array with picture objects 325 326 var galleryConfig = new Object(); 327 var temp = cArray[0].split('~'); 328 //console.log(temp); 329 galleryConfig.title = temp[0]; 330 galleryConfig.description = temp[1]; 331 galleryConfig.imagesUrl = temp[2]; 332 galleryConfig.imagesFile = temp[3]; 333 334 335 336 for (var i=1; i < cArray.length; i++) { 337 var temp = cArray[i].split('~'); 338 var img = new Object(); 339 img.url = temp[0]; 340 img.title = temp[1]; 341 img.alt = temp[2]; 342 img.desc = temp[3]; 343 img.id = temp[4]; 344 //img.description = temp[2]; 345 images[i] = img; 346 //console.table(temp); 347 } 348 349 imagePath = galleryConfig.imagesUrl; 350 imageFile = galleryConfig.imagesUrl+galleryConfig.imagesFile; 351 352 353 354 // array with configured src paths for thimthumb 355 var srcArray = new Array(); 356 var thumbnailsLoadedTotal = 0; 357 var thumbnails = new Array(); 358 var thumbnailContainers = new Array(); 359 var fsgthumbnails = new Array(); 360 var fsgthumbnailContainers = new Array(); 361 362 363 var preloadedPhots = $('.concept-gallery span.preloaded-photos',gal); 364 $('.concept-gallery',gal).text(''); 365 $('.concept-gallery',gal).parent().parent().parent().append(preloadedPhots ); 366 367 $('.concept-gallery',gal).addClass('concept-gallery initialised'); 368 if (isMobile) {$('.concept-gallery',gal).addClass('mobile');} 369 if(!op.allowLargeView){ 370 $('.concept-gallery',gal).addClass('unclickable'); 371 } 372 if(op.type=='inlineSlideshow'){ 373 $('.concept-gallery',gal).addClass('inline-slideshow'); 374 } 375 // wyÅÄ czamy prefix dla miniaturek przy widoku WALL 376 // if(op.type=='wall'){ 377 // op.thumbnailPrefix = 'thumb'; 378 // } 379 380 var galleryTitleStyle=''; 381 if (!op.showGalleryTitle) { 382 galleryTitleStyle="display:none;"; 383 } 384 var galleryDescriptionStyle=''; 385 if (!op.showGalleryDescription) { 386 galleryDescriptionStyle="display:none;"; 387 }
388 //galleryTitle=$('<div class="gallery-title" style="'+galleryTitleStyle+'"><h3>'+galleryConfig.title+'</h3></div><div class="gallery-description" style="'+galleryTitleStyle+'">'+galleryConfig.description+'</div>'); 389 galleryTitle=$('<div class="gallery-title" style="'+galleryTitleStyle+'"><h3>'+galleryConfig.title+'</h3></div>'); 390 galleryDesc = $('<div class="gallery-description" style="'+galleryDescriptionStyle+'">'+galleryConfig.description+'</div>'); 391 if (op.showGalleryDescription) { 392 $(gal).prepend(galleryDesc); 393 } 394 if (op.showGalleryTitle) { 395 $(gal).prepend(galleryTitle); 396 } 397 398 399 400 401 var bgd = $('<div class="page-background"></div>'); 402 $(bgd).css({background:'#000000',opacity:0,visibility:'hidden',position:'fixed',width:'100%',height:'100%'}); 403 $('.concept-gallery',gal).append(bgd); 404 var tc = $('<div class="thumbnail-container-bgd"></div><div class="thumbnail-container" style="position:absolute;"></div>'); 405 406 var ctrl='<div class="controls" style="position:absolute;bottom:0;"></div>'; 407 var pc; // pages container - for thumbnails 408 var fc = $('<div class="photo-container"></div>'); 409 $('.concept-gallery',gal).append(fc); 410 $('.concept-gallery',gal).append(tc); 411 $('.photo-container',gal).append('<div aria-hidden="true" class="photo-container-bgd" style="position:absolute;cursor:pointer;"></div>'); 412 var fb = $('<div class="photo-box"><div class="but-prev-container" tabindex="0" title="Poprzednie zdjÄcie"><div class="but-prev" style="transform:scale('+photoNextOutScale+');"><div class="icon-prev"></div></div></div><div class="photo-loader"></div><div class="photo-title"><div class="photo-title-icon" style="background: '+op.buttonActiveColor+'"><img src="'+op.interfaceImagesPath+'icon-title-reversed.png" alt="ikonka zdjÄcie" /></div><div class="photo-title-text"></div></div><div class="image-pre-thumbnail prev-image-thumbnail"></div><div class="image-pre-thumbnail next-image-thumbnail"></div><div class="photo-image" tabindex="0"></div><div class="photo-description"><div class="photo-description-text"></div></div><div class="but-next-container" tabindex="0" title="NastÄpne zdjÄcie"><div class="but-next" style="transform:scale('+photoNextOutScale+');"><div class="icon-next"></div></div></div>'); 413 $('.photo-container',gal).append(fb); 414 415 416 417 $('.photo-description', gal).mouseenter(function(){ 418 TweenLite.to($(this),op.speed1,{height:$('div',this).height()+14}); 419 }); 420 $('.photo-description', gal).mouseleave(function(){ 421 TweenLite.to($(this),op.speed1,{height:34}); 422 }); 423 424 425 $('.concept-gallery',gal).append('<div class="but-close-container" tabindex="0" title="Zamknij peÅen ekran"><div class="but-close"><div class="icon-close"></div></div>'); 426 427 $('.but-prev-container', gal).click(function(e){ 428 $(this).blur(); 429 currentPicture --; 430 if (currentPicture==0) 431 currentPicture = images.length-1; 432 changePhoto(); 433 }); 434 $('.but-prev-container', gal).on('keydown',function(e){ 435 if (e.which == 13) { 436 currentPicture --; 437 if (currentPicture==0) 438 currentPicture = images.length-1; 439 changePhoto(); 440 $('.but-prev-container', gal).focus(); 441 } 442 if (e.which === 9 && e.shiftKey) { 443 if (fsMode){ 444 e.preventDefault(); 445 $('.but-close-container',gal).focus(); 446 } 447 } 448 }); 449 450 $('.but-next-container', gal).click(function(){ 451 $(this).blur(); 452 currentPicture ++; 453 if (currentPicture==images.length) 454 currentPicture = 1; 455 changePhoto(); 456 }); 457 $('.but-next-container', gal).on('keypress',function(e){ 458 if (e.which == 13) { 459 currentPicture ++; 460 if (currentPicture==images.length) 461 currentPicture = 1; 462 changePhoto(); 463 } 464 }); 465 466 467 468 469 $('.photo-image', gal).on('keypress',function(e){ 470 if (e.which == 13) {//ENTER 471 if ((op.type=='inlineSlideshow') && 472 (!fsMode)) { 473 toggleFSMode(); 474 } 475 } 476 }); 477 $('.photo-image', gal).focusin(function(){ 478 if (fsMode) { 479 TweenLite.to($('.photo-description', gal),op.speed1,{height:$('.photo-description div',gal).height()+14}); 480 }; 481 }); 482 $('.photo-image', gal).focusout(function(){ 483 if (fsMode) { 484 TweenLite.to($('.photo-description', gal),op.speed1,{height:34}); 485 }; 486 }); 487 488 489 $('.photo-container-bgd',gal).click(function(){ 490 $(this).blur(); 491 if (currentViewMode!='fsWall'){ 492 toggleFSMode();
493 adjustBoxes(); 494 var $targetEle = jQuery('.galeria_najnowsze_wall'); 495 jQuery('html, body').stop().animate({'scrollTop': $targetEle.offset().top-200}, 500, 'swing'); 496 } 497 }); 498 $('.but-close-container', gal).click(function(){ 499 $(this).blur(); 500 toggleFSMode(); 501 adjustBoxes(); 502 var $targetEle = jQuery('.galeria_najnowsze_wall'); 503 jQuery('html, body').stop().animate({'scrollTop': $targetEle.offset().top-200}, 500, 'swing'); 504 505 }); 506 $('.but-close-container', gal).on('keydown',function(e){ 507 if (e.which == 13) { //ENTER 508 toggleFSMode(); 509 } 510 if (e.which === 9 && !e.shiftKey) { 511 e.preventDefault(); 512 $('.but-prev-container',gal).focus(); 513 } 514 }); 515 516 517 $(document).on('keyup',function(e){ 518 switch (e.which) { 519 case 27: //ESC 520 if (fsMode) { 521 toggleFSMode(); 522 } 523 break; 524 525 case 37: //LEFT 526 if (fsMode) { 527 $('.but-prev-container', gal).trigger('click'); 528 $('.but-prev-container', gal).focus(); 529 $('.but-prev-container', gal).blur(); 530 if (fsThumbnailsPosition=='hover'){ 531 TweenLite.to($('.thumbnail-container',gal),op.speed1,{opacity:0}); 532 } 533 } 534 break; 535 536 case 38: // UP 537 if (fsMode){ 538 if (fsThumbnailsPosition = 'hover') { 539 toggleThumbnailsPosition($('.button.thumbnails-position',gal)); 540 $('.controls .pager.button',gal).css({opacity:1}); 541 } 542 } 543 break; 544 545 case 39: //RIGHT 546 if (fsMode) { 547 $('.but-next-container', gal).trigger('click'); 548 $('.but-next-container', gal).focus(); 549 $('.but-next-container', gal).blur(); 550 if (fsThumbnailsPosition=='hover'){ 551 TweenLite.to($('.thumbnail-container',gal),op.speed1,{opacity:0}); 552 } 553 } 554 break; 555 556 case 40: // DOWN 557 if (fsMode){ 558 if (fsThumbnailsPosition = 'visible') { 559 toggleThumbnailsPosition($('.button.thumbnails-position',gal)); 560 $('.controls .pager.button',gal).css({opacity:1}); 561 } 562 } 563 } 564 }); 565 566 567 568 /* *************************************************** 569 * Load thumbnails 570 * ***************************************************/ 571 var thumbnailLoaded = function(i) { 572 //console.log(e); 573 //console.log('thumbnailLoaded('+i+')'); 574 //cc('thumbnailsLoadedTotal',thumbnailsLoadedTotal); 575 576 // fix bo numerujÄ zdjecia od jeden bo pod zerem jest tytuÅ i opis dla caÅej galerii a nie miniaturek 577 if (thumbnailsLoadedTotal == 0) { 578 thumbnailsLoadedTotal = 1; 579 } 580 581 thumbnailsLoadedTotal ++; 582 if (thumbnailsLoadedTotal < images.length) { 583 TweenLite.to($('.thumb-loader', thumbnailContainers[i]),op.speed1,{autoAlpha:0}); 584 $(thumbnails[i]).css({opacity:0,height:'100%',width:'auto'}); 585 $(thumbnails[i]).addClass('image-thumbnail'); 586 $('.thumb-pic',thumbnailContainers[i]).append(thumbnails[i]); 587 TweenLite.to($(thumbnails[i]),op.speed1,{opacity:1}); 588 TweenLite.to($('.thumb-pic',thumbnailContainers[i]),op.speed1,{width:$(thumbnails[i]).width()}); 589 //loadThumbnails(thumbnailsLoadedTotal,counter); 590 } 591 else { 592 // gdy wszystkie miniaturki wgrane (opóźniamy o animacjÄ rozszerzania aby siÄ rozÅożyÅy prawidÅowo w rzÄdach) 593 TweenLite.to($('.thumb-loader', thumbnailContainers[i]),op.speed1,{autoAlpha:0}); 594 $(thumbnails[i]).css({opacity:0,height:'100%',width:'auto'}); 595 $(thumbnails[i]).addClass('image-thumbnail'); 596 $('.thumb-pic',thumbnailContainers[i]).append(thumbnails[i]); 597 TweenLite.to($(thumbnails[i]),op.speed1,{opacity:1}); 598 TweenLite.to($('.thumb-pic',thumbnailContainers[i]),op.speed1,{width:$(thumbnails[i]).width(), onCompleteParams:[thumbnailsLoadedTotal],onComplete:splitThumbnailsToPages}); 599 TweenLite.to($('.thumbnail-loader-counter', el),op.speed1,{autoAlpha:0,delay:2}); 600 } 601 602 // update loader-countr 603 $('.thumbnail-loader-counter',gal).html((thumbnailsLoadedTotal-1)+' / '+(images.length-1)); 604 605 // add hover overlay 606 $('.thumb-pic',thumbnailContainers[i]).append('<div class="thumb-current" style="width:100%; height:100%; opacity:0;box-shadow:inset 0 0 0 5px '+op.buttonActiveColor+';-webkit-box-shadow:inset 0 0 0 5px '+op.buttonActiveColor+';visibility:hidden; display:none;"></div>'); 607 $('.thumb-pic',thumbnailContainers[i]).append('<div class="thumb-hover" style="height:100%;width:100%;"></div>'); 608 $('.thumb-pic',thumbnailContainers[i]).append('<div class="thumb-title" title="'+images[i].title+'" style="">'+images[i].title+'</div>'); 609 if ((op.thumbnailTitles=='visible')&& 610 (!fsMode)) { 611 $('.thumb-title',thumbnailContainers[i]).css({display:'none'}); 612 } 613 if (op.thumbnailTitles=='hidden') { 614 $('.thumb-title',thumbnailContainers[i]).css({display:'none'}); 615 } 616 $(thumbnailContainers[i]).append('<div class="thumb-outer-title" style="opacity:0;">'+images[i].title+'</div>'); 617 $('.thumb-pic, .thumb-hover, .thumb-title, .thumb-outer-title',thumbnailContainers[i]).attr('thumbId',i); 618 619 TweenLite.to($('.thumb-current',thumbnailContainers[i]),0,{boxShadow:"inset 0 0 0 10px "+op.buttonActiveColor,opacity:0}
619); 620 621 $(thumbnailContainers[i]).mouseenter(function(){ 622 //if (!$(this).hasClass('current')){ 623 TweenLite.to($('.thumb-hover, .thumb-title',this),op.speed1,{autoAlpha:1}); 624 TweenLite.to($('img',this),op.speed1,{scale:op.scaleHover}); 625 //} 626 }); 627 $(thumbnailContainers[i]).mouseleave(function(){ 628 TweenLite.to($('.thumb-hover, .thumb-title',this),op.speed1,{autoAlpha:0}); 629 TweenLite.to($('img',this),op.speed1,{scale:1}); 630 }); 631 $(thumbnailContainers[i]).focusin(function(){ 632 $(this).closest('.concept-gallery').scrollLeft(0); 633 if (!$(this).hasClass('current')){ 634 TweenLite.to($('.thumb-hover, .thumb-title',this),op.speed1,{autoAlpha:1}); 635 TweenLite.to($('img',this),op.speed1,{scale:op.scaleHover}); 636 } 637 currentPage = $(this).closest('.thumb-container').attr('page'); 638 changePage(); 639 }); 640 $(thumbnailContainers[i]).focusout(function(){ 641 TweenLite.to($('.thumb-hover, .thumb-title',this),op.speed1,{autoAlpha:0}); 642 TweenLite.to($('img',this),op.speed1,{scale:1}); 643 }); 644 645 } 646 var loadThumbnails = function(i,counter) { 647 //cc('loadThumbnails',111); 648 for (var i1=1; i1<(images.length-0); i1++){ 649 //cc('i1',i1); 650 //console.log(thumbnails[i1]); 651 if (thumbnails[i1]) { 652 $(thumbnails[i1]).off() 653 } 654 var imageObj = new Image(); 655 imageObj.id = i1; 656 thumbnails[i1] = imageObj; 657 658 $(imageObj).one('load',function(e){ 659 thumbnailLoaded(e.target.id); 660 }); 661 662 imageObj.src = srcArray[i1]; 663 664 if (images[i1].alt) { 665 imageObj.alt = images[i1].alt; 666 } 667 else { 668 imageObj.alt = ''; 669 //imageObj.title = images[i1].title; 670 } 671 //$(imageObj).attr('alt',''); 672 } 673 } 674 675 /* *************************************************** 676 * create controls 677 * ***************************************************/ 678 var createControls = function(){ 679 //cc('createControls()'); 680 $('.controls', gal).empty(); 681 $('.controls', gal).remove(); 682 $(ctrl).insertBefore('.but-close-container',gal); 683 $('.controls', gal).empty(); 684 $('.controls', gal).append('<div class="thumbnails-position button" style="opacity:0;" tabindex="0" title="PrzeÅÄ cz tryb wyÅwietlania miniatur"></div>'); 685 $('.controls', gal).append('<div class="full-screen button" style="opacity:0;" tabindex="0" title="PrzeÅÄ cz tryb peÅnoekranowy"></div>'); 686 if (op.allowImageDownload) { 687 $('.controls', gal).append('<a class="download-image button" style="opacity:0;" tabindex="0" title="Pobierz bieÅ¼Ä ce zdjÄcie" href="">Pobierz</a>'); 688 } 689 $('.controls', gal).append('<div class="slideshow-play button" style="opacity:0;" tabindex="0" title="Uruchom / zatrzymaj pokaz slajdów"><div class="play button"></div><div class="stop button"></div></div>'); 690 $('.controls', gal).append('<div class="thumbnail-loader-counter"></div>'); 691 692 if (fsThumbnailsPosition == 'hover') { 693 $('.thumbnails-position',gal).addClass('go-visible'); 694 $('.thumbnails-position',gal).removeClass('go-hover'); 695 } 696 else { 697 $('.thumbnails-position',gal).addClass('go-hover'); 698 $('.thumbnails-position',gal).removeClass('go-visible'); 699 } 700 701 if (fsMode) 702 TweenLite.to($('.thumbnails-position',gal),op.speed1,{opacity:1}); 703 else 704 $('.thumbnails-position',gal).css({display:'none'}); 705 706 TweenLite.to($('.download-image',gal),op.speed1,{opacity:1}); 707 708 if (op.allowLargeView) 709 TweenLite.to($('.full-screen',gal),op.speed1,{opacity:1}); 710 else 711 $('.full-screen',gal).css({display:'none'}); 712 713 TweenLite.to($('.slideshow-play',gal),op.speed1,{opacity:1}); 714 715 if (fsMode) { 716 $('.thumbnail-loader-counter',gal).css({right:40,color:'#ffffff',opacity:0}); 717 $('.controls', gal).css({bottom:10,left:10}); 718 } 719 720 correctThumbnailContainerHeight(); 721 } 722 723 var correctThumbnailContainerHeight=function(){ 724 //cc('correctThumbnailContainerHeight'); 725 $('.controls', gal).css({margin:0}); 726 if (thumbnailContainers[1]){ 727 var myPages = $('.pages-container',gal).children(); 728 var rowsH=0; 729 var maxRows = 0; 730 var maxPageH = 0; 731 for (var i=0;i<myPages.length;i++){ 732 rowsH=0; 733 var pRows=$(myPages[i]).children(); 734 735 for (var i3=0;i3<pRows.length;i3++){ 736 rowsH += $(pRows[i3]).height(); 737 } 738 if (rowsH>maxPageH){ 739 maxPageH=rowsH; 740 } 741 } 742 if (!fsMode) { 743 if (op.rowLimit!=0) {
744 myH = currentViewRowLimit*(op.thumbHeight+parseInt($(thumbnailContainers[1]).css('margin-bottom')))+0*$('.controls', gal).height(); 745 if (maxPageH!=myH){ 746 myH=maxPageH; 747 } 748 if ((op.alignThumbnails=='fill') && 749 (!fsMode)){ 750 if ($('.pages-container .p'+currentPage,gal).height()>myH){ 751 myH=$('.pages-container .p'+currentPage,gal).height()+0*$('.controls', gal).height(); 752 } 753 } 754 TweenLite.to($('.thumbnail-container', gal),op.speed1,{bottom:$('.controls', gal).height(),height:myH}); 755 if (op.type=='inlineSlideshow') { 756 myH+=op.inlineSlideshowPhotoHeight+10; 757 } 758 TweenLite.to($('.concept-gallery',gal),op.speed1,{height:myH+$('.controls', gal).height()}); 759 } 760 else if (op.rowLimit == 0) { 761 myH=$('.pages-container .p'+currentPage,gal).height()+0*$('.controls', gal).height(); 762 if (op.noThumbnails) { 763 myH=0*$('.controls', gal).height(); 764 TweenLite.to($('.thumbnail-container', gal),0,{height:0,opacity:0}); 765 } 766 if (op.type=='inlineSlideshow') { 767 myH+=op.inlineSlideshowPhotoHeight+10; 768 } 769 TweenLite.to($('.concept-gallery',gal),op.speed1,{height:myH+$('.controls', gal).height()}); 770 //TweenLite.to($('.concept-gallery',gal),op.speed1,{height:maxPageH+$('.controls', gal).height()}); 771 } 772 } 773 if (fsMode){ 774 if (!changingMode){ 775 $('.thumbnail-container', gal).css({height:'auto'}); 776 TweenLite.to($('.concept-gallery',gal),op.speed1,{height:y}); 777 } 778 else{ 779 changingMode=false; 780 } 781 } 782 } 783 } 784 785 786 /* *************************************************** 787 * build thumbnails 788 * ***************************************************/ 789 var buildingThumbnails = true; 790 var buildThumbnails = function(type,rows){ 791 //console.info('###buildThumbnails('+type+', '+rows+')'); 792 buildingThumbnails = true; 793 splitThumbnailsCounter++; 794 795 $('.pages-container',gal).children().remove(); 796 $('.thumbnail-container',gal).children().remove(); 797 $('.thumbnail-container', gal).children().remove(); 798 799 //$('.thumbnail-container', gal).css({opacity:0}); 800 TweenLite.to($('.thumbnail-container', gal),0,{opacity:0}); 801 802 currentViewRowLimit = rows; 803 804 // ************************** 805 // wall 806 807 srcArray = new Array(); 808 thumbnailContainers = new Array(); 809 for (var i=1;i<images.length;i++){ 810 var tw=''; 811 var th='&h='+op.thumbHeight; 812 if (op.thumbWidth>0) { 813 tw='&w='+op.thumbWidth; 814 } 815 if (op.squareThumbnails){ 816 tw='&w='+op.thumbHeight; 817 } 818 if (op.alignThumbnails=='fill'){ 819 if (op.squareThumbnails){ 820 tw='&w='+op.thumbHeight*op.alignThumbnailsFillExtraQuality; 821 } 822 else { 823 if (op.thumbWidth>0) { 824 tw='&w='+op.thumbWidth*op.alignThumbnailsFillExtraQuality; 825 } 826 } 827 th='&h='+op.thumbHeight*op.alignThumbnailsFillExtraQuality; 828 } 829 var imgSrc = timthumbPath+'?src='+imageFile+images[i].url+tw+th+'&q=85'; 830 831 // dla przyciÄtych miniaturek (thumbnailPrefix) 832 if (op.thumbnailPrefix != '') { 833 imgSrc = imageFile + op.thumbnailPrefix + '_' + images[i].url; 834 } 835 srcArray[i]=imgSrc; 836 837 var targetThumbWidth = parseInt(op.thumbWidth); 838 if (fsMode) targetThumbWidth = parseInt(op.fsThumbWidth); 839 var targetThumbHeight = parseInt(op.thumbHeight); 840 if (fsMode) targetThumbHeight = parseInt(op.fsThumbHeight); 841 thumbnailContainers[i] = $('<div class="thumb-container" style="float:left;"><div class="thumb-pic" style="width:'+targetThumbWidth+'px;height:'+targetThumbHeight+'px; float:left;" tabindex="0"></div></div>'); 842 $('.thumbnail-container', gal).append(thumbnailContainers[i]); 843 } 844 $('.thumbnail-container', gal).css({height:rows*(targetThumbHeight+parseInt(thumbnailContainers[1].css('margin-bottom')))}); 845 if (rows==0) { 846 $('.thumbnail-container', gal).css({height:'auto'}); 847 } 848 thumbnails = new Array(); 849 thumbnailsLoadedTotal = 0; 850 TweenLite.to($('.thumbnail-loader-counter',gal),op.speed1,{autoAlpha:1}); 851 852 loadThumbnails(1,splitThumbnailsCounter); 853 } 854 855 var addThumbnailFocusHandler = function(){ 856 // pokaż / ukryj miniaturki w trynie hover na focusie 857 $('.thumb-pic').focusin(function(e){ 858 //cc('focusin',333); 859 if (fsThumbnailsPosition == 'hover') { 860 TweenLite.to($('.thumbnail-container',gal),op.speed1,{opacity:1,overwrite:"all"}); 861 var controls = $('.controls .pager.button',gal); 862 $('.controls .pager.button',gal).css({opacity:1}); 863 } 864 }); 865 $('.thumb-pic').focusout(function(e){ 866 if ((fsThumbnailsPosition == 'hover') && 867 (fsMode) && 868 (!fsMouseOverThumbnails) ){ 869 TweenLite.to($('.thumbnail-container',gal),op.speed1,{opacity:0,delay:0.1}); 870 $('.controls .pager.button',gal).css({opacity:0}
870); 871 } 872 }); 873 } 874 875 876 var splitThumbnailsToPages = function(counter){ 877 //console.log('!!!!!!!!splitThumbnailsToPages'); 878 879 var rows = currentViewRowLimit; 880 var cGroup=0; 881 var cPage=0; 882 var cMaxGroups = 0; 883 var groupsTotal=0; 884 var prevOffset = $(thumbnailContainers[1]).offset().top; 885 886 // oznaczam miniaturki pod kÄ tem ustalenia na jakÄ stronÄ z miniaturkami ma trafiÄ 887 for (var i=1;i<thumbnailContainers.length;i++){ 888 var offset=$(thumbnailContainers[i]).offset(); 889 if (rows>=0){ 890 if (offset.top>prevOffset){ 891 if (cGroup>cMaxGroups){ 892 cMaxGroups=cGroup; 893 } 894 cGroup++; 895 groupsTotal++; 896 prevOffset=offset.top; 897 } 898 if ((cGroup==rows)&& 899 (rows>0)){ 900 cGroup=0; 901 cPage++; 902 } 903 } 904 $(thumbnailContainers[i]).addClass('tp'+cPage+' tg'+cGroup+' gt'+groupsTotal). 905 attr('page',cPage); 906 } 907 pageCount = cPage; 908 getViewSize(); 909 // tworzÄ containery stron 910 for (var i=0;i<=cPage;i++){ 911 $('.tp'+i,gal).wrapAll('<div class="page p'+i+'"></div>'); 912 if (centerThumbnails) { 913 var tumbs=$('.p'+i,gal).children(); 914 var total=0; 915 for (var c=0;c<tumbs.length;c++){ 916 total+=$(tumbs[c]).width(); 917 } 918 var firstThumbMarginRight = parseInt($(tumbs[0]).css('margin-right')); 919 920 total+=(tumbs.length-1)*(firstThumbMarginRight); 921 TweenLite.to($(tumbs[0]),op.speed1*0,{marginLeft:(x-total-40)/2,ease:Circ.easeOut}); 922 } 923 } 924 925 $('.page',gal).css({width:$('.concept-gallery',gal).width()}); 926 $('.page',gal).wrapAll('<div class="pages-container"></div>'); 927 pc=$('.pages-container',gal); 928 $('.pages-container',gal).css({width:(cPage+1)*$('.concept-gallery',gal).width()}); 929 930 // align thumbnails 931 for (var i=0;i<=groupsTotal;i++) { 932 $('.gt'+i,gal).wrapAll('<div class="thumbnail-row tr'+i+'"></div>'); 933 } 934 935 936 var myRows = $('.thumbnail-row',gal); 937 var alignType = op.alignThumbnails; 938 if (fsMode) { 939 alignType = ''; 940 } 941 var rowMaxHeight = 0; 942 943 for (var i=0;i<myRows.length;i++) { 944 //cc('rzÄ d',i); 945 var thumbs = $(myRows[i]).children(); 946 var thumbsOuterWidth = 0; 947 var thumbsInnerWidth = 0; 948 $(thumbs[thumbs.length-1]).css({marginRight:0}); 949 for (var i1=0;i1<thumbs.length;i1++){ 950 thumbsOuterWidth += $(thumbs[i1]).outerWidth(true); 951 thumbsInnerWidth += $(thumbs[i1]).outerWidth(); 952 } 953 954 switch (alignType) { 955 case 'left': 956 insertOuterTitles(); 957 break; 958 959 case 'right': 960 $(thumbs[0]).css({marginLeft:$(myRows[i]).width()-thumbsOuterWidth}); 961 TweenLite.to($(thumbs[0]),op.speed1,{marginLeft:$(myRows[i]).width()-thumbsOuterWidth,onComplete:insertOuterTitles}); 962 break; 963 964 case 'center': 965 $(thumbs[0]).css({marginLeft:($(myRows[i]).width()-thumbsOuterWidth)/2}); 966 insertOuterTitles(); 967 break; 968 969 case 'justify': 970 var marginCount = thumbs.length-1; 971 if (marginCount<=0){marginCount=1;} 972 var myMargin = ($(myRows[i]).width()-thumbsInnerWidth)/(marginCount); 973 $(thumbs[thumbs.length-1]).css({marginRight:0}); 974 if (i<(myRows.length-1)){ 975 TweenLite.to($('.thumb-container',myRows[i]).not('.thumb-container:last-child',myRows[i]),op.speed1,{marginRight:myMargin}); 976 } 977 else { 978 TweenLite.to($('.thumb-container',myRows[i]).not('.thumb-container:last-child',myRows[i]),op.speed1,{marginRight:myMargin,onComplete:insertOuterTitles}); 979 } 980 break; 981 982 case 'fill': 983 var correctLastThumbnail=function(i,thumbs,i1){ 984 for (var i2=0;i2<myRows.length;i2++){ 985 var myThumbs=$(myRows[i2]).children(); 986 if (myThumbs.length>1){ 987 if (($(myThumbs[myThumbs.length-1]).offset().top)!=($(myThumbs[myThumbs.length-2]).offset().top)){ 988 $(myThumbs[myThumbs.length-2]).css({marginRight:9}); 989 } 990 } 991 } 992 if (i==(myRows.length-1)){ 993 insertOuterTitles(); 994 } 995 }; 996 997 var extraWidth = ($(myRows[i]).width()-thumbsOuterWidth); 998 var per=(thumbsInnerWidth+extraWidth)/thumbsInnerWidth; 999 var thumbTargetH = $('.thumb-pic',thumbs[0]).height()*per; 1000 1001 // if not last row 1002 if (i < (myRows.length-1)) { 1003 if (thumbTargetH > rowMaxHeight) {rowMaxHeight = thumbTargetH;} 1004 } 1005 else { 1006 if (myRows.length > 1) { 1007 if (thumbTargetH > rowMaxHeight) { 1008 thumbTargetH = rowMaxHeight; 1009 } 1010 per = thumbTargetH / $('.thumb-pic',thumbs[0]).height(); 1011 } 1012 } 1013 for (var i1=0;i1<thumbs.length;i1++) { 1014 if (i1<(thumbs.length-1)){ 1015 TweenLite.to($('.thumb-pic',thumbs[i1]),op.speed1,{width:$('.thumb-pic',thumbs[i1]).width()*per,height:thumbTargetH}); 1016 } 1017 else{ 1018 TweenLite.to($('.thumb-pic',thumbs[i1]),op.speed1,{width:$('.thumb-pic',thumbs[i1]).width()*per,height:thumbTargetH,onComplete:correctLastThumbnail, onCompleteParams:[i,thumbs,i1]}); 1019 } 1020 } 1021 break; 1022 } 1023 } 1024 //insertOuterTitles(); 1025 1026 // pager 1027 if (cPage>0) { 1028 for (var i=0;i<=cPage;i++){ 1029 $('.controls', gal).append('<div class="pb'+i+' pager button"></div>'); 1030 $('.pb'+i,gal).attr('id',i); 1031 if (pageCount>1) { 1032 if ( !fsMode || 1033 ( fsMode && (fsThumbnailsPosition != 'hover') )) { 1034 TweenLite.to($('.pb'+i,gal),op.speed1,{opacity:1,delay:i*(op.speed1/2)}); 1035 } 1036 else { 1037 TweenLite.to($('.pb'+i,gal),0,{opacity:0}
1037); 1038 } 1039 } 1040 } 1041 // TODO: brzydki fix na wiele razy pojawiajÄ ce siÄ .controls 1042 var spareControls = $('.controls+.controls',gal); 1043 $.each(spareControls,function(i,c){$(c).remove();}); 1044 } 1045 $('.pb0',gal).addClass('active'); 1046 $('.button',gal).css({backgroundColor:op.buttonInactiveColor}); 1047 $('.pb0',gal).css({backgroundColor:op.buttonActiveColor}); 1048 $('.button',gal).mouseenter(function(){ 1049 if (!$(this).hasClass('active')) { 1050 TweenLite.to($(this),op.speed1/2,{backgroundColor:op.buttonHoverColor}); 1051 } 1052 if ($(this).parent().hasClass('slideshow-play')){ 1053 TweenLite.to($('.button',$(this).parent()),op.speed1/2,{backgroundColor:op.buttonHoverColor}); 1054 } 1055 }); 1056 $('.button',gal).mouseleave(function(){ 1057 if (!$(this).hasClass('active')) { 1058 TweenLite.to($(this),op.speed1,{backgroundColor:op.buttonInactiveColor}); 1059 } 1060 if ($(this).parent().hasClass('slideshow-play')){ 1061 TweenLite.to($('.button',$(this).parent()),op.speed1,{backgroundColor:op.buttonInactiveColor}); 1062 } 1063 }); 1064 $('.button.full-screen',gal).on('keypress',function(e){ 1065 if (e.which == 13){ 1066 toggleFSMode(); 1067 } 1068 }); 1069 $('.button.slideshow-play',gal).on('keypress',function(e){ 1070 if (e.which == 13){ 1071 if (op.type!='inlineSlideshow'){ 1072 TweenLite.to($('.button',$(this)),0,{backgroundColor:op.buttonInactiveColor}); 1073 1074 if (!fsMode){ 1075 slideshowRunning=true; 1076 toggleFSMode(); 1077 } 1078 else { 1079 toggleSlideshow(); 1080 } 1081 } 1082 else 1083 toggleSlideshow(); 1084 } 1085 }); 1086 $('.button.thumbnails-position',gal).on('keypress',function(e){ 1087 if (e.which == 13){ 1088 toggleThumbnailsPosition($(this)); 1089 } 1090 }); 1091 $('.button',gal).click(function(e){ 1092 $(this).blur(); 1093 var targetPage = currentPage; 1094 if ( !$(this).hasClass('active') && 1095 $(this).hasClass('pager') ) { 1096 targetPage=$(this).attr('id'); 1097 currentPage=targetPage; 1098 changePage(); 1099 } 1100 if ($(this).hasClass('thumbnails-position')) { 1101 //toggleThumbnailsPosition($(this)); 1102 } 1103 if ($(this).hasClass('full-screen')) { 1104 TweenLite.to($(this),0,{backgroundColor:op.buttonInactiveColor}); 1105 toggleFSMode(); 1106 } 1107 if ($(this).parent().hasClass('slideshow-play')) { 1108 if (op.type!='inlineSlideshow'){ 1109 TweenLite.to($('.button',$(this).parent()),0,{backgroundColor:op.buttonInactiveColor}); 1110 1111 if (!fsMode){ 1112 slideshowRunning=true; 1113 toggleFSMode(); 1114 } 1115 else { 1116 toggleSlideshow(); 1117 } 1118 } 1119 else 1120 toggleSlideshow(); 1121 } 1122 }); 1123 currentPage=0; 1124 if (pageCount==0){ 1125 cGroup=myRows.length; 1126 myH = (cGroup+1)*(op.thumbHeight+parseInt($(thumbnailContainers[1]).css('margin-bottom')))+$('.controls', gal).height(); 1127 TweenLite.to($('.concept-gallery',gal),op.speed1,{height:myH}); 1128 } 1129 if (displayPhotoView) 1130 markThumbnail(); 1131 fixView(); 1132 correctThumbnailContainerHeight(); 1133 if (slideshowRunning){ 1134 slideshowRunning = false; 1135 toggleSlideshow(); 1136 } 1137 if ( (fsThumbnailsPosition != 'hover') || 1138 (!fsMode) ){ 1139 if (!op.noThumbnails){ 1140 TweenLite.to($('.thumbnail-container',gal),op.speed1*2,{opacity:1}); 1141 } 1142 } 1143 if ( (fsThumbnailsPosition != 'hover') && 1144 (fsMode) ){ 1145 TweenLite.to($('.thumbnail-container',gal),op.speed1*2,{opacity:1}); 1146 } 1147 1148 addThumbnailFocusHandler(); 1149 buildingThumbnails = false; 1150 insertPreThumbnails(currentPicture); 1151 } 1152 var insertOuterTitles = function(){ 1153 //cc('insertOuterTitles'); 1154 if (op.thumbnailTitles=='visible'){ 1155 var myThumbs = $('.thumb-container',gal); 1156 for (var i=0;i<myThumbs.length;i++){ 1157 TweenLite.to($('.thumb-outer-title',myThumbs[i]),0,{top:$('.thumb-pic',myThumbs[i]).height(),opacity:1}); 1158 if (i<(myThumbs.length-1)){ 1159 TweenLite.to($(myThumbs[i]),op.speed1,{height:$('.thumb-pic',myThumbs[i]).height()+$('.thumb-outer-title',myThumbs[i]).height()}); 1160 } 1161 else { 1162 TweenLite.to($(myThumbs[i]),op.speed1,{height:$('.thumb-pic',myThumbs[i]).height()+$('.thumb-outer-title',myThumbs[i]).height(),onComplete:correctThumbnailContainerHeight}); 1163 } 1164 } 1165 } 1166 else { 1167 correctThumbnailContainerHeight(); 1168 } 1169 } 1170 var changePage = function(){ 1171 //console.log('changePage('+currentPage+')'); 1172 getViewSize(); 1173 $('.button:not(.pb'+currentPage+')',gal).removeClass('active'); 1174 $('.pb'+currentPage,gal).addClass('active'); 1175 TweenLite.to($('.pager.button:not(.pb'+currentPage+')',gal),op.speed1,{backgroundColor:op.buttonInactiveColor}); 1176 TweenLite.to($('.active',gal),op.speed1,{backgroundColor:op.buttonActiveColor,overwrite:'all'}); 1177 TweenLite.to($('.pages-container', gal),op.speed2/2,{marginLeft:-currentPage*$('.concept-gallery',gal).width()});
1178 correctThumbnailContainerHeight(); 1179 } 1180 1181 var markThumbnail = function(){ 1182 //cc('markThumbnail(currentPicture)',currentPicture); 1183 1184 $('.thumb-container',gal).removeClass('current'); 1185 $(thumbnailContainers[currentPicture],gal).addClass('current'); 1186 1187 currentPage = $(thumbnailContainers[currentPicture],gal).attr('page'); 1188 1189 if (displayPhotoView==true){ 1190 TweenLite.to($('.thumb-current',gal),op.speed1,{autoAlpha:0}); 1191 $('.thumb-current',thumbnailContainers[currentPicture]).css({display:'block'}); 1192 TweenLite.to($('.current .thumb-current',gal),op.speed1,{autoAlpha:1 }); 1193 1194 TweenLite.to($('.thumb-hover',thumbnailContainers[currentPicture]),op.speed1,{autoAlpha:0}); 1195 TweenLite.to($('img',thumbnailContainers[currentPicture]),op.speed1,{scale:1}); 1196 1197 currentPage = $(thumbnailContainers[currentPicture],gal).attr('page'); 1198 1199 changePage(); 1200 } 1201 }; 1202 1203 // clicking on thumbnail 1204 var thumbnailClick = function(e){ 1205 //cc('thumbnailClick'); 1206 $(e.target).blur(); 1207 if((!op.allowLargeView)&& 1208 (op.type!='inlineSlideshow')){ 1209 return; 1210 } 1211 if ($(e.target).attr('thumbId')){ 1212 target=$(e.target).attr('thumbId'); 1213 if (target!=currentPicture) { 1214 currentPicture = target; 1215 } 1216 if (op.type != 'inlineSlideshow') { 1217 if (!fsMode){ 1218 TweenLite.to($('.thumb-container img',gal),0,{scale:1}); 1219 TweenLite.to($('.thumb-container .thumb-hover, .thumb-container .thumb-title',gal),0,{opacity:0}); 1220 toggleFSMode(); 1221 } 1222 } 1223 changePhoto(); 1224 } 1225 } 1226 $('.thumbnail-container',gal).click(function(event){thumbnailClick(event)}); 1227 $('.thumbnail-container',gal).on('keypress',function(e){ 1228 if (e.which == 13) { 1229 thumbnailClick(event); 1230 $(e.target).focus(); 1231 } 1232 }); 1233 1234 1235 1236 // thumbnail position - hover / visible 1237 var toggleThumbnailsPosition = function(but){ 1238 //cc('toggleThumbnailsPosition()'); 1239 //cc('fsThumbnailsPosition',fsThumbnailsPosition); 1240 switch (fsThumbnailsPosition) { 1241 case 'hover': 1242 1243 fsThumbnailsPosition = 'visible'; 1244 $('.button.thumbnails-position').addClass('go-hover'); 1245 $('.button.thumbnails-position').removeClass('go-visible'); 1246 TweenLite.to($('.thumbnail-container',gal),op.speed1,{opacity:1}); 1247 $('.concept-gallery',gal).removeClass('hover-thumbnails'); 1248 setCookie('conceptGalleryFsThumbnailsPosition','visible',365); 1249 fixView(); 1250 resizePhotoBox(currentPicture); 1251 break; 1252 1253 case 'visible': 1254 fsThumbnailsPosition = 'hover'; 1255 $('.button.thumbnails-position').addClass('go-visible'); 1256 $('.button.thumbnails-position').removeClass('go-hover'); 1257 $('.concept-gallery',gal).addClass('hover-thumbnails'); 1258 setCookie('conceptGalleryFsThumbnailsPosition','hover',365); 1259 fixView(); 1260 resizePhotoBox(currentPicture); 1261 break; 1262 } 1263 } 1264 1265 1266 1267 // full screen 1268 var toggleFSMode = function(){ 1269 //console.log('toggleFSMode()'); 1270 if(!op.allowLargeView){ 1271 return; 1272 } 1273 changingMode=true; 1274 //thumbnailsLoadedTotal = 0; 1275 1276 if (!fsMode) { 1277 currentPageInline=currentPage; 1278 currentPage=currentPageFs; 1279 smallGallery=$('.concept-gallery',gal).clone(true); 1280 $(gal).css({height:$(gal).height()}); 1281 // go to full screen 1282 beforeFSWindowWidth = x; 1283 beforeFSWindowHeight = y; 1284 fsMode = true; 1285 displayPhotoView = true; 1286 centerThumbnails = true; 1287 displayText = true; 1288 1289 $('.concept-gallery',gal).addClass('full-screen'); 1290 $('body,html').addClass('full-screen gallery-full-screen'); 1291 1292 fullScreenStartScrollTop = $(window).scrollTop(); 1293 if (op.desktopFullMode) { 1294 goFullScreen(); 1295 } 1296 if (largeGalleryGenerated){ 1297 var restoreLargeGallery = function(){ 1298 //cc('restoreLargeGallery()'); 1299 $(largeGallery).css({opacity:0}); 1300 $(gal).empty().append(largeGallery); 1301 //$(gal).prepend(galleryTitle); 1302 if (op.showGalleryDescription) { 1303 $(gal).prepend(galleryDesc); 1304 } 1305 if (op.showGalleryTitle) { 1306 $(gal).prepend(galleryTitle); 1307 } 1308 rebuildGallery(); 1309 TweenLite.to($('.concept-gallery',gal),op.speed1,{autoAlpha:1}); 1310 generateLargeGallery(); 1311 fixView(); 1312 loadPhoto(currentPicture); 1313 1314 if (slideshowRunning){ 1315 slideshowRunning = false;
1316 toggleSlideshow(); 1317 } 1318 TweenLite.to($('.thumbnail-loader-counter',gal),op.speed1,{autoAlpha:0}); 1319 }; 1320 $('.concept-gallery',gal).css({height:$('.concept-gallery',gal).height()}); 1321 TweenLite.to($('.concept-gallery',gal),op.speed1,{autoAlpha:0,onComplete:restoreLargeGallery}); 1322 } 1323 else if (!largeGalleryGenerated){ 1324 generateLargeGallery(); 1325 } 1326 // mc.get('swipe').set({ direction: Hammer.DIRECTION_ALL }); 1327 } 1328 else if (fsMode) { 1329 // go out of full screen 1330 1331 currentPageFs=currentPage; 1332 currentPage=currentPageInline; 1333 largeGallery=$('.concept-gallery',gal).clone(true); 1334 1335 fsMode = false; 1336 1337 displayPhotoView = false; 1338 centerThumbnails = false; 1339 1340 $('.concept-gallery',gal).removeClass('full-screen'); 1341 $('body,html').removeClass('full-screen gallery-full-screen'); 1342 1343 if (op.desktopFullMode) { 1344 exitFullScreen(); 1345 } 1346 1347 if (op.type=='inlineSlideshow'){ 1348 displayText = false; 1349 displayPhotoView = true; 1350 photoAreawidth = startWidth; 1351 photoAreaHeight = op.inlineSlideshowPhotoHeight; 1352 } 1353 1354 var restoreGallery = function(){ 1355 //cc('restoreGallery - close FS'); 1356 $(smallGallery).css({opacity:0}); 1357 $(gal).empty().append(smallGallery); 1358 if (op.showGalleryDescription) { 1359 $(gal).prepend(galleryDesc); 1360 } 1361 if (op.showGalleryTitle) { 1362 $(gal).prepend(galleryTitle); 1363 } 1364 rebuildGallery(); 1365 $(gal).css({height:'auto'}); 1366 TweenLite.to($('.concept-gallery',gal),op.speed1,{autoAlpha:1}); 1367 loadPhoto(currentPicture); 1368 markThumbnail(); 1369 changePage(); 1370 1371 // check if widow was resized during FS Mode and rebuild gallery if it was 1372 if ( (beforeFSWindowWidth != x) || (beforeFSWindowHeight != y) ){ 1373 initGallery(); 1374 } 1375 }; 1376 TweenLite.to($('.concept-gallery',gal),op.speed1,{autoAlpha:0,onComplete:restoreGallery}); 1377 // mc.get('swipe').set({ direction: Hammer.DIRECTION_HORIZONTAL }); 1378 } 1379 }; 1380 1381 // next and previous Thumbnails 1382 var insertPreThumbnails = function(id){ 1383 // add prev / next thumbnails 1384 var prevId = id -1; 1385 if (prevId<=0) prevId = thumbnails.length - 1; 1386 var nextId = id +1; 1387 if (nextId>=thumbnails.length) nextId = 1; 1388 1389 if (thumbnails[prevId]) 1390 $('.prev-image-thumbnail',gal).empty().append($(thumbnails[prevId]).clone()); 1391 if (thumbnails[nextId]) 1392 $('.next-image-thumbnail',gal).empty().append($(thumbnails[nextId]).clone()); 1393 $('.image-pre-thumbnail img',gal).css({opacity:0}); 1394 //prev-image-thumbnail"></div><div class="image-pre-thumbnail next-image-thumbnail"></div> 1395 } 1396 1397 1398 // picture load 1399 var loadPhoto = function(id){ 1400 //console.info('loadPhoto()'+id); 1401 var photoObj = new Image(); 1402 photos[id] = photoObj; 1403 photoObj.onload = function() { 1404 photoLoaded(id); 1405 }; 1406 photoObj.src = imageFile+images[id].url; 1407 photoObj.title = 'PrzeÅÄ cz tryb peÅnoekranowy'; 1408 photoObj.alt = images[id].alt; 1409 1410 $('.download-image.button').attr('href','/galerie/download/media_id/'+images[id].id+'.html'); 1411 1412 insertPreThumbnails(id); 1413 }; 1414 1415 var photoLoaded = function(id){ 1416 //console.info('photoLoaded()'+id); 1417 if (id==currentPicture){ 1418 TweenLite.to($('.photo-loader',gal),op.speed1,{autoAlpha:0}); 1419 1420 // Pobieram oryginalny rozmiar zdjÄcia tylko raz (konieczne dla IE) 1421 if (typeof images[id].originalWidth == 'undefined'){ 1422 images[id].originalWidth = photos[id].width; 1423 images[id].originalHeight = photos[id].height; 1424 } 1425 1426 $('.photo-image',gal).text('').append(photos[id]); 1427 $('.photo-title-text',gal).text(images[id].title); 1428 $('.photo-description-text',gal).text(images[id].desc); 1429 if (!images[id].desc) { 1430 $('.photo-description-text',gal).text(''); 1431 } 1432 resizePhotoBox(id); 1433 } 1434 restSlideshowTimer(); 1435 }; 1436 var resizePhotoBox = function(id){ 1437 //console.log('resizePhotoBox()',id); 1438 1439 $('div, span',gal).css({transform:'translate3d(0,0,0)'}); 1440 if (displayPhotoView){ 1441 var boxElementsVerH = 24+20+24+20; 1442 if (displayText==false){ 1443 boxElementsVerH = 0; 1444 } 1445 var descriptionH = 10; 1446 var boxElementsW = 2*op.photoBoxPadding; 1447 if((op.type=='inlineSlideshow')&& 1448 (!fsMode)) { 1449 boxElementsW = 0; 1450 } 1451 1452 if (isMobile && fsMode) { 1453 boxElementsVerH = 0; 1454 descriptionH = 0; 1455 boxElementsW = 0; 1456 } 1457 1458 var maxPhotoHeight = $('.photo-container',gal).height()-boxElementsVerH; 1459 var maxPhotoWidth = $('.photo-container',gal).width()-boxElementsW; 1460 1461 if (images[id]) { 1462 // poprawka dla bÅÄdu IE 11 z szerokoÅciÄ 1463 images[id].width = images[id].originalWidth; 1464 images[id].height = images[id].originalHeight; 1465 1466 /* Przed bÅÄdem IE 11 z szerokoÅciÄ 1467 if (photos[id].height!=0){ 1468 images[id].height = photos[id].height; 1469 images[id].width = photos[id].width; 1470 } 1471 */ 1472 } 1473 1474 var photoScaleFactor = 0; 1475 photoScaleFactor = maxPhotoHeight/images[id].height; 1476 1477 var photoTargetWidth = images[id].width*photoScaleFactor; 1478 var photoTargetHeight = maxPhotoHeight; 1479 1480 // check if picture should have max height or max width to fit in area 1481 if ((photoTargetWidth+boxElementsW)>maxPhotoWidth){ 1482 photoTargetWidth = maxPhotoWidth-boxElementsW; 1483 photoTargetHeight = photoTargetWidth/images[id].width * images[id].height; 1484 } 1485 1486 var pbTargetWidth = photoTargetWidth+boxElementsW; 1487 var pbTargetHeight = photoTargetHeight+boxElementsVerH; 1488 1489 var photoBoxMarginTop = -pbTargetHeight/2; 1490 var photoBoxMarginLeft = -parseInt(pbTargetWidth/2); 1491 1492 var photoBoxTop = '50%'; 1493 var photoBoxLeft = '50%'; 1494 var imageMarginTop = 44; 1495 var imageMarginLeft = boxElementsW/2; 1496 1497 // mobilny fullscreen 1498 if (isMobile && fsMode) { 1499 imageMarginTop = 0; 1500 } 1501 1502 if (images[id].description != '') { 1503 descriptionH = $('.photo-description',gal).height()+20; 1504 } 1505 1506 if (displayText) { 1507 $('.photo-title, .photo-description',gal).css({display:'block'}); 1508 TweenLite.to($('.photo-box', gal),op.speed1,{border:'none',borderRadius:10,background:'#ffffff',left:photoBoxLeft,top:photoBoxTop,marginLeft:photoBoxMarginLeft,marginTop:photoBoxMarginTop}); 1509 } 1510 if (!displayText){ 1511 descriptionH=0; 1512 boxElementsVerH=0; 1513 boxElementsW=0; 1514 imageMarginTop = 0; 1515 imageMarginLeft = 0; 1516 if (op.type!='inlineSlideshow') { 1517 photoBoxMarginLeft = 0; 1518 photoBoxLeft = 0; 1519 } 1520 photoBoxMarginTop = (maxPhotoHeight - pbTargetHeight) /2; 1521 photoBoxTop = 0; 1522 $('.photo-title, .photo-description',gal).css({display:'none'}); 1523 TweenLite.to($('.photo-box', gal),op.speed1,{border:'none',borderRadius:0,background:'none',left:photoBoxLeft,top:photoBoxTop,marginLeft:photoBoxMarginLeft,marginTop:photoBoxMarginTop}); 1524 } 1525 1526 TweenLite.to($('.photo-title, .photo-description',gal),op.speed1,{autoAlpha:1}); 1527 TweenLite.to($('.photo-box', gal),op.speed1,{autoAlpha:1,width:pbTargetWidth,height:pbTargetHeight,marginTop:photoBoxMarginTop,marginLeft:photoBoxMarginLeft}); 1528 // UGLY FIX inline photo margin issue 1529 if (!fsMode) { 1530 $('.photo-box',gal).css({paddingLeft:boxElementsW/2}); 1531 } 1532 else { 1533 $('.photo-box',gal).css({paddingLeft:0}); 1534 } 1535 TweenLite.to($('.photo-image',gal),op.speed1,{width:photoTargetWidth,height:photoTargetHeight,marginTop:imageMarginTop,marginLeft:imageMarginLeft,autoAlpha:1}); 1536 } 1537 }; 1538 1539 var changePhoto = function(){ 1540 //cc('changePhoto'); 1541 getViewSize(); 1542 TweenLite.to($('.photo-box', gal),op.speed1,{autoAlpha:1}); 1543 TweenLite.to($('.photo-title, .photo-description, .photo-image',gal),op.speed1,{autoAlpha:0,onComplete:loadPhoto,onCompleteParams:[currentPicture]}); 1544 TweenLite.to($('.photo-loader',gal),op.speed1,{autoAlpha:1}); 1545 markThumbnail(); 1546 }; 1547 1548 // browser full screen 1549 var goFullScreen = function(){ 1550 //cc('goFullScreen'); 1551 var docElement, request; 1552 docElement = document.documentElement; 1553 request = docElement.requestFullScreen || docElement.webkitRequestFullScreen || docElement.mozRequestFullScreen || docElement.msRequestFullScreen; 1554 if(typeof request!="undefined" && request){ 1555 request.call(docElement); 1556 } 1557 $('body,html').css({overflow:'hidden'}); 1558 }; 1559 var exitFullScreen = function(){ 1560 //cc('exitFullScreen'); 1561 var docElement, request; 1562 1563 docElement = document; 1564 request = docElement.cancelFullScreen|| docElement.webkitCancelFullScreen || docElement.mozCancelFullScreen || docElement.msCancelFullScreen || docElement.exitFullscreen; 1565 if(typeof request!="undefined" && request){ 1566 request.call(docElement); 1567 } 1568 $('body,html').css({overflow:'auto'}); 1569 }; 1570 var fixView = function(){ 1571 //console.log('fixView'); 1572 getViewSize(); 1573 photoAreawidth = x-40;
1574 var targetThumbHeight = op.thumbHeight; 1575 if (fsMode) targetThumbHeight = op.fsThumbHeight; 1576 photoAreaHeight = y-24-targetThumbHeight-40-30; 1577 1578 if (isMobile && fsMode) { 1579 photoAreawidth = x; 1580 photoAreaHeight = y; 1581 } 1582 1583 if((op.type=='inlineSlideshow')&& 1584 (!fsMode)) { 1585 photoAreaHeight = op.inlineSlideshowPhotoHeight; 1586 photoAreawidth = $('.concept-gallery',gal).width(); 1587 } 1588 if ( $('.concept-gallery',gal).hasClass('no-thumbnails')){ 1589 //photoAreaHeight = y-24-40; 1590 } 1591 if ( $('.concept-gallery',gal).hasClass('hover-thumbnails')){ 1592 photoAreaHeight = y-40; 1593 1594 if (isMobile && fsMode) { 1595 photoAreaHeight = y; 1596 } 1597 1598 $('.thumbnail-container-bgd',gal).css({height:24+op.thumbHeight+40+15,opacity:0}) 1599 $('.thumbnail-container',gal).css({opacity:0}) 1600 } 1601 TweenLite.to($('.photo-container',gal),op.speed1/2,{width:photoAreawidth,height:photoAreaHeight,onComplete:function(){resizePhotoBox(currentPicture);}}); 1602 }; 1603 1604 var rebuildGallery = function(){ 1605 //cc('rebuildGallery'); 1606 thumbnailContainers = new Array(); 1607 var thumbs = $('.thumb-container',gal); 1608 for (var i=0;i<thumbs.length;i++){ 1609 thumbnailContainers[i+1]=$(thumbs[i]); 1610 } 1611 } 1612 1613 var toggleSlideshow = function(){ 1614 if (slideshowRunning){ 1615 //cc('stop'); 1616 clearInterval(slideshowTimer); 1617 TweenLite.to($('.slideshow-play .play',gal),op.speed1,{opacity:1}); 1618 TweenLite.to($('.slideshow-play .stop',gal),op.speed1,{opacity:0}); 1619 slideshowRunning=false; 1620 } 1621 else { 1622 //cc('start'); 1623 clearInterval(slideshowTimer); 1624 slideshowTimer = setInterval(function () {myTimer()}, op.slideshowTime); 1625 TweenLite.to($('.slideshow-play .play',gal),op.speed1,{opacity:0}); 1626 TweenLite.to($('.slideshow-play .stop',gal),op.speed1,{opacity:1}); 1627 slideshowRunning=true; 1628 } 1629 } 1630 var restSlideshowTimer = function(){ 1631 if (slideshowRunning){ 1632 toggleSlideshow(); 1633 toggleSlideshow(); 1634 } 1635 }; 1636 1637 var myTimer=function(){ 1638 if (!globalPause){ 1639 currentPicture ++; 1640 if (currentPicture==images.length) 1641 currentPicture = 1; 1642 changePhoto(); 1643 } 1644 } 1645 1646 var initGallery = function(){ 1647 //cc('initGallery'); 1648 op.inlineSlideshowPhotoHeight = $(gal).width()*isphy/isphx; 1649 if (op.type == 'inlineSlideshow') { 1650 displayPhotoView=true; 1651 displayText=false; 1652 photoBoxImageOnly=false; 1653 $('.photo-container',gal).css({ 1654 height:op.inlineSlideshowPhotoHeight, 1655 display:'block', 1656 visibility:'visible', 1657 opacity:1 1658 }); 1659 //$('.photo-container-bgd',gal).css({width:$('.photo-container',gal).width(),height:$('.photo-container',gal).height(),opacity:0,marginLeft:0,marginTop:0}); 1660 $('.thumbnail-container', gal).css({bottom:30,position:'absolute'}); 1661 1662 $('.but-prev',gal).css({left:-16}); 1663 if (op.type=="inlineSlideshow"){ 1664 $('.but-prev',gal).css({left:32}); 1665 } 1666 $('.but-next',gal).css({right:32}); 1667 $('.photo-image',gal).css({cursor:'pointer'}); 1668 } 1669 changePhoto(); 1670 buildThumbnails(op.type,op.rowLimit); 1671 createControls(); 1672 1673 if (op.slideshowStart){ 1674 toggleSlideshow(); 1675 } 1676 }; 1677 1678 1679 var updateSize = function() { 1680 //cc('updateSize'); 1681 getViewSize(); 1682 if (x != oldWidth) { 1683 oldWidth = x; 1684 if (fsMode) { 1685 largeGalleryGenerated = false; 1686 generateLargeGallery(); 1687 fixView(); 1688 } 1689 else { 1690 initGallery(); 1691 } 1692 } 1693 1694 }; 1695 1696 var generateLargeGallery = function() { 1697 $('.concept-gallery',gal).removeClass('no-thumbnails'); 1698 $('.concept-gallery',gal).css({ 1699 position:'fixed', 1700 width:'100%', 1701 height:'100%', 1702 top:0, 1703 left:0, 1704 bottom:0, 1705 margin:0 1706 }); 1707 $('.thumbnail-container', gal).css({margin:20,top:'auto',bottom:24,position:'absolute',opacity:0}); 1708 $('.controls', gal).css({margin:20,marginTop:-20}).empty(); 1709 1710 getViewSize(); 1711 photoAreawidth = x-40; 1712 photoAreaHeight = y-24-op.thumbHeight-40-30; 1713 if ( ((photoAreaHeight/op.thumbHeight)<2) || (fsThumbnailsPosition=='hover') ){ 1714 $('.concept-gallery',gal).addClass('no-thumbnails'); 1715 photoAreaHeight = y-24-40-30+30; 1716 if (fsThumbnailsPosition=='hover') { 1717 $('.concept-gallery',gal).addClass('hover-thumbnails'); 1718 $('.thumbnail-container', gal).css({opacity:0}); 1719 } 1720 else { 1721 $('.thumbnail-container', gal).css({opacity:1}); 1722 } 1723 } 1724 else { 1725 $('.thumbnail-container', gal).css({opacity:1}); 1726 } 1727 1728 1729 $('.controls', gal).children().remove(); 1730 TweenLite.to($('.page-background',gal),op.speed1,{autoAlpha:op.backgroundOpacity}); 1731 buildThumbnails(op.type,1); 1732 1733 // hide thumbnails on start 1734 $('.full-screen .thumbnail-container, .controls',gal).removeClass('visible'); 1735 $('.full-screen .thumbnail-container, .controls',gal).addClass('not-visible'); 1736 1737 createControls(); 1738 if (op.type=="inlineSlideshow"){ 1739 $('.photo-box', gal).css({top:'50%',left:'50%'}); 1740 photoBoxImageOnly = false;
1741 displayText = true; 1742 $('.but-prev',gal).css({left:0}); 1743 $('.but-next',gal).css({right:0}); 1744 } 1745 $('.photo-container',gal).css({ 1746 display:'block', 1747 marginLeft:0, 1748 marginTop:0, 1749 padding:20, 1750 top:0, 1751 right:0, 1752 bottom:0, 1753 left:0, 1754 opacity:0}); 1755 if (isMobile) { 1756 $('.photo-container',gal).css({ 1757 padding:0 1758 }); 1759 } 1760 $('.photo-container-bgd',gal).css({top:0,right:0,bottom:0,left:0}); 1761 TweenLite.to($('.photo-container',gal),op.speed1,{autoAlpha:1,delay:op.speed1*2.5}); 1762 TweenLite.to($('.but-close-container',gal),op.speed1,{autoAlpha:1}); 1763 $('.photo-image',gal).css({cursor:'default'}); 1764 loadPhoto(currentPicture); 1765 1766 largeGalleryGenerated=true; 1767 $('.photo-image',gal).focus().blur(); 1768 }; 1769 1770 1771 var fsMouseOverThumbnails = false; 1772 $(document).mousemove(function(e){ 1773 if ( (fsMode) && 1774 (e.clientY >= (y-op.fsThumbHeight-70)) && 1775 (!buildingThumbnails) ) { 1776 $('.full-screen .thumbnail-container, .controls',gal).addClass('visible'); 1777 $('.full-screen .thumbnail-container, .controls',gal).removeClass('not-visible'); 1778 TweenLite.to($('.full-screen .thumbnail-container, .full-screen .controls .pager.button',gal),op.speed1,{opacity:1}); 1779 fsMouseOverThumbnails = true; 1780 } 1781 else { 1782 if ($('.thumb-pic:focus',gal).length <=0){ 1783 $('.full-screen .thumbnail-container, .controls',gal).removeClass('visible'); 1784 $('.full-screen .thumbnail-container, .controls',gal).addClass('not-visible'); 1785 TweenLite.to($('.full-screen.hover-thumbnails .thumbnail-container, .full-screen.hover-thumbnails .controls .pager.button',gal),op.speed1*1.5,{opacity:0}); 1786 } 1787 fsMouseOverThumbnails = false; 1788 } 1789 }); 1790 1791 $(window).resize(function(){debounce3( 250, 'updateSize')}); 1792 1793 1794 1795 1796 initGallery(); 1797 1798 //scroll handler 1799 $(gal).on('mousewheel DOMMouseScroll', function(event){ 1800 getViewSize(); 1801 if ((pageCount>=0) && 1802 (fsMode)){ 1803 event.preventDefault(); 1804 if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) { 1805 // scroll up 1806 var target = $(event.target); 1807 if ( $(target).parents('.photo-box').length ) { // has parent } 1808 currentPicture --; 1809 if (currentPicture==0) 1810 currentPicture = images.length-1; 1811 changePhoto(); 1812 if (slideshowRunning){ 1813 toggleSlideshow(); 1814 } 1815 } 1816 if ( $(target).parents('.thumbnail-container').length ) { // has parent } 1817 currentPage --; 1818 if (currentPage<0) 1819 currentPage = $('.pages-container', gal).children().length-1; 1820 changePage(); 1821 } 1822 } 1823 else { 1824 // scroll down 1825 var target = $(event.target); 1826 if ( $(target).parents('.photo-box').length ) { // has parent } 1827 currentPicture ++; 1828 if (currentPicture==images.length) 1829 currentPicture = 1; 1830 changePhoto(); 1831 if (slideshowRunning){ 1832 toggleSlideshow(); 1833 } 1834 } 1835 if ( $(target).parents('.thumbnail-container').length ) { // has parent } 1836 currentPage ++; 1837 if (currentPage==($('.pages-container', gal).children().length)) 1838 currentPage = 0; 1839 changePage(); 1840 } 1841 } 1842 } 1843 }); 1844 1845 // swipe Handler 1846 var enableTouchGeastures = function(direction){ 1847 $(gal).each(function(){ 1848 mc = new Hammer(this); 1849 //mc.get('swipe').set({ direction: Hammer.DIRECTION_ALL }); 1850 mc.get('pan').set({ direction: Hammer.DIRECTION_HORIZONTAL, threshold: 50 }); 1851 mc.on('swipeleft swiperight swipedown swipeup tap panleft panright panend dragstart drag dragend',function(e){ 1852 //cc('touch',e.type); 1853 //cc('touch',e.target); 1854 if ($(e.target).closest('.photo-box').length>0){ 1855 // PHOTO 1856 switch (e.type) { 1857 1858 case 'panleft': 1859 if (e.pointerType != 'mouse'){ 1860 1861 if (fsMode){ 1862 var deltaX = e.deltaX; 1863 var maxDeltaX = x/2; 1864 if (deltaX<(-maxDeltaX)) deltaX=(-maxDeltaX); 1865 var opacityOffset = 1 - (Math.abs(deltaX) / maxDeltaX) * 0.95; 1866 $('.photo-image',gal).css('transform','translate3d('+deltaX+'px,0px,0px)'); 1867 $('.photo-image',gal).css('opacity',opacityOffset); 1868 1869 //thumbnails 1870 var deltaPercent = (Math.abs(deltaX) / maxDeltaX); 1871 var deltaReversedPercent = 1 - deltaPercent; 1872 var thumbnailsOpacityOffset = deltaPercent; 1873 var thumbnailsScaleOffset = 0.5 + deltaPercent; 1874 1875 //right thumbnail 1876 var thumbnailsWidthOffset = $('.next-image-thumbnail img',gal).width() * deltaReversedPercent; 1877 var thumbnailsLeftOffset = deltaReversedPercent * x/2 + thumbnailsWidthOffset; 1878 if (thumbnailsLeftOffset<0) thumbnailsLeftOffset=0; 1879 1880 if (e.deltaX < 0){ 1881 1882 $('.next-image-thumbnail img',gal).css({
1883 opacity:thumbnailsOpacityOffset 1884 }); 1885 $('.next-image-thumbnail',gal).css({ 1886 left:thumbnailsLeftOffset, 1887 transform:'scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)' 1888 }); 1889 } 1890 1891 //left thumbnail 1892 var thumbnailsWidthOffsetL = $('.prev-image-thumbnail img',gal).width() * deltaReversedPercent; 1893 var thumbnailsLeftOffsetL = -(deltaReversedPercent * x/2 + thumbnailsWidthOffsetL); 1894 if (thumbnailsLeftOffsetL>0) thumbnailsLeftOffsetL=0; 1895 if (e.deltaX > 0){ 1896 $('.prev-image-thumbnail img',gal).css({ 1897 opacity:thumbnailsOpacityOffset 1898 }); 1899 $('.prev-image-thumbnail',gal).css({ 1900 left:thumbnailsLeftOffsetL, 1901 transform:'scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)' 1902 }); 1903 } 1904 } 1905 } 1906 break; 1907 1908 case 'panright': 1909 if (e.pointerType != 'mouse'){ 1910 if (fsMode){ 1911 var deltaX = e.deltaX; 1912 var maxDeltaX = x/2; 1913 if (deltaX<(-maxDeltaX)) deltaX=(-maxDeltaX); 1914 var opacityOffset = 1 - (Math.abs(deltaX) / maxDeltaX) * 0.95; 1915 $('.photo-image',gal).css('transform','translate3d('+deltaX+'px,0px,0px)'); 1916 $('.photo-image',gal).css('opacity',opacityOffset); 1917 1918 //thumbnails 1919 var deltaPercent = (Math.abs(deltaX) / maxDeltaX); 1920 var deltaReversedPercent = 1 - deltaPercent; 1921 var thumbnailsOpacityOffset = deltaPercent; 1922 var thumbnailsScaleOffset = 0.5 + deltaPercent; 1923 1924 //right thumbnail 1925 var thumbnailsWidthOffset = $('.next-image-thumbnail img',gal).width() * deltaReversedPercent; 1926 var thumbnailsLeftOffset = deltaReversedPercent * x/2 + thumbnailsWidthOffset; 1927 if (thumbnailsLeftOffset<0) thumbnailsLeftOffset=0; 1928 if (e.deltaX < 0){ 1929 $('.next-image-thumbnail img',gal).css({ 1930 opacity:thumbnailsOpacityOffset 1931 }); 1932 $('.next-image-thumbnail',gal).css({ 1933 left:thumbnailsLeftOffset, 1934 transform:'scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)' 1935 }); 1936 } 1937 1938 //left thumbnail 1939 var thumbnailsWidthOffsetL = $('.prev-image-thumbnail img',gal).width() * deltaReversedPercent; 1940 var thumbnailsLeftOffsetL = -(deltaReversedPercent * x/2 + thumbnailsWidthOffsetL); 1941 if (thumbnailsLeftOffsetL>0) thumbnailsLeftOffsetL=0; 1942 if (e.deltaX > 0){ 1943 $('.prev-image-thumbnail img',gal).css({ 1944 opacity:thumbnailsOpacityOffset 1945 }); 1946 $('.prev-image-thumbnail',gal).css({ 1947 left:thumbnailsLeftOffsetL, 1948 transform:'scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)' 1949 }); 1950 } 1951 } 1952 } 1953 break; 1954 1955 case 'panend': 1956 if (e.pointerType != 'mouse'){ 1957 var deltaX = e.deltaX; 1958 var maxDeltaX = x/2; 1959 if (deltaX<(-maxDeltaX)) deltaX=(-maxDeltaX); 1960 1961 $('.photo-image',gal).css('transition-duration','0.3s'); 1962 setTimeout(function(){ 1963 $('.photo-image',gal).css('transform','translate3d(0px,0px,0px)'); 1964 $('.photo-image',gal).css('opacity','1'); 1965 },100); setTimeout(function(){ 1966 $('.photo-image',gal).css('transition-duration','0.0s'); 1967 },200); 1968 1969 // thumbnails 1970 var deltaPercent = (Math.abs(maxDeltaX) / maxDeltaX); 1971 var deltaReversedPercent = 1 - deltaPercent; 1972 1973 // right thumb 1974 var extraThumbnailsLeftOffset = x/2; 1975 var thumbnailsLeftOffset = (y/2)+0 + extraThumbnailsLeftOffset; 1976 if (thumbnailsLeftOffset<0) thumbnailsLeftOffset=0; 1977 1978 $('.next-image-thumbnail',gal).css('transition-duration','0.3s'); 1979 setTimeout(function(){ 1980 $('.next-image-thumbnail',gal).css('left',thumbnailsLeftOffset); 1981 $('.next-image-thumbnail',gal).css('transform','scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)'); 1982 TweenLite.to($('.next-image-thumbnail img',gal),op.speed1,{opacity:0}); 1983 },100); setTimeout(function(){ 1984 $('.next-image-thumbnail',gal).css('transition-duration','0.0s'); 1985 },200); 1986 1987 // left thumb 1988 var thumbnailsWidthOffsetL = $('.prev-image-thumbnail img',gal).width() * deltaReversedPercent; 1989 cc('thumbnailsWidthOffsetL',thumbnailsWidthOffsetL); 1990 var thumbnailsLeftOffsetL = -(1 * x/2 + thumbnailsWidthOffsetL); 1991 1992 $('.prev-image-thumbnail',gal).css('transition-duration','0.3s'); 1993 setTimeout(function(){ 1994 $('.prev-image-thumbnail',gal).css('left',thumbnailsLeftOffsetL); 1995 $('.prev-image-thumbnail',gal).css('transform','scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)'); 1996 TweenLite.to($('.prev-image-thumbnail img',gal),op.speed1,{opacity:0}
1996); 1997 },100); setTimeout(function(){ 1998 $('.prev-image-thumbnail',gal).css('transition-duration','0.0s'); 1999 },200); 2000 } 2001 break; 2002 2003 case 'swiperight': 2004 currentPicture --; 2005 if (currentPicture==0) 2006 currentPicture = images.length-1; 2007 changePhoto(); 2008 2009 if (e.pointerType!='mouse'){ 2010 // thumbnails 2011 var maxDeltaX = x/2; 2012 var deltaX = -maxDeltaX; 2013 if (deltaX<(-maxDeltaX)) deltaX=(-maxDeltaX); 2014 2015 var deltaPercent = (Math.abs(maxDeltaX) / maxDeltaX); 2016 var deltaReversedPercent = 1 - deltaPercent; 2017 var thumbnailsOpacityOffset = deltaPercent; 2018 var thumbnailsScaleOffset = 0.5 + deltaPercent; 2019 2020 //right thumbnail 2021 var thumbnailsWidthOffset = $('.next-image-thumbnail img',gal).width() * deltaReversedPercent; 2022 var thumbnailsLeftOffset = deltaReversedPercent * x/2 + thumbnailsWidthOffset; 2023 if (thumbnailsLeftOffset<0) thumbnailsLeftOffset=0; 2024 2025 // left thumbnail 2026 var thumbnailsWidthOffsetL = $('.prev-image-thumbnail img',gal).width() * deltaReversedPercent; 2027 var thumbnailsLeftOffsetL = -(deltaReversedPercent * x/2 + thumbnailsWidthOffsetL); 2028 if (thumbnailsLeftOffsetL>0) thumbnailsLeftOffsetL=0; 2029 if (e.deltaX > 0){ 2030 $('.prev-image-thumbnail',gal).css('transition-duration','0.3s'); 2031 setTimeout(function(){ 2032 $('.prev-image-thumbnail',gal).css('left',thumbnailsLeftOffset); 2033 $('.prev-image-thumbnail',gal).css('transform','scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)'); 2034 TweenLite.to($('.prev-image-thumbnail img',gal),op.speed1,{opacity:1}); 2035 },104); 2036 setTimeout(function(){ 2037 $('.prev-image-thumbnail',gal).css('transition-duration','0.0s'); 2038 },204); 2039 } 2040 } 2041 break; 2042 2043 case 'swipeleft': 2044 currentPicture ++; 2045 if (currentPicture==images.length) 2046 currentPicture = 1; 2047 changePhoto(); 2048 2049 if (e.pointerType!='mouse'){ 2050 var maxDeltaX = x/2; 2051 var deltaX = -maxDeltaX; 2052 if (deltaX<(-maxDeltaX)) deltaX=(-maxDeltaX); 2053 2054 // thumbnails 2055 var deltaPercent = (Math.abs(maxDeltaX) / maxDeltaX); 2056 var deltaReversedPercent = 1 - deltaPercent; 2057 var thumbnailsOpacityOffset = deltaPercent; 2058 var thumbnailsScaleOffset = 0.5 + deltaPercent; 2059 2060 //right thumbnail 2061 var thumbnailsWidthOffset = $('.next-image-thumbnail img',gal).width() * deltaReversedPercent; 2062 var thumbnailsLeftOffset = deltaReversedPercent * x/2 + thumbnailsWidthOffset; 2063 if (thumbnailsLeftOffset<0) thumbnailsLeftOffset=0; 2064 if (e.deltaX < 0){ 2065 $('.next-image-thumbnail',gal).css('transition-duration','0.3s'); 2066 setTimeout(function(){ 2067 $('.next-image-thumbnail',gal).css('left',thumbnailsLeftOffset); 2068 $('.next-image-thumbnail',gal).css('transform','scale3d('+thumbnailsScaleOffset+','+thumbnailsScaleOffset+',1)'); 2069 TweenLite.to($('.next-image-thumbnail img',gal),op.speed1,{opacity:1}); 2070 },104); 2071 setTimeout(function(){ 2072 $('.next-image-thumbnail',gal).css('transition-duration','0.0s'); 2073 },204); 2074 } 2075 } 2076 break; 2077 2078 2079 case 'tap': 2080 if ($(e.target).closest('.photo-image').length>0){ 2081 $(this).blur(); 2082 if ((op.type=='inlineSlideshow') && 2083 (!fsMode)) { 2084 toggleFSMode(); 2085 } 2086 } 2087 break; 2088 } 2089 } 2090 // THUMBNAILS 2091 if ($(e.target).closest('.thumbnail-container').length>0){ 2092 if (!(fsMode && fsThumbnailsPosition != 'visible')) 2093 switch (e.type) { 2094 case 'swiperight': 2095 currentPage --; 2096 if (currentPage<0) 2097 currentPage = 0; 2098 changePage(); 2099 break; 2100 2101 case 'swipeleft': 2102 currentPage ++; 2103 if (currentPage==($('.pages-container', gal).children().length)) 2104 currentPage = $('.pages-container', gal).children().length -1; 2105 changePage(); 2106 break; 2107 2108 case 'panleft': 2109 return 0; 2110 /* zakomentowane bo po returnie a przed breakem 2111 2112 console.log('panleft'); 2113 if (e.isFirst) console.log('isFirst'); 2114 if (e.pointerType != 'mouse'){ 2115 var deltaX = e.deltaX; 2116 var maxDeltaX = 200; 2117 if (deltaX<(-maxDeltaX)) deltaX=(-maxDeltaX); 2118 var opacityOffset = 1 - (Math.abs(deltaX) / maxDeltaX) * 0.5; 2119 $('.thumbnail-container',gal).css('transform','translate3d('+deltaX+'px,0px,0px)'); 2120 $('.thumbnail-container',gal).css('opacity',opacityOffset); 2121 } 2122 2123 */ 2124 break; 2125 2126 case 'panright': 2127 return 0; 2128 /* zakomentowane bo po returnie a przed breakem 2129 2130 console.log('panright'); 2131 if (e.pointerType != 'mouse'){ 2132 var deltaX = e.deltaX; 2133 var maxDeltaX = 200; 2134 var deltaX = e.deltaX; 2135 if (deltaX>(maxDeltaX)) deltaX=(maxDeltaX); 2136 var opacityOffset = 1 - (Math.abs(deltaX) / maxDeltaX) * 0.5; 2137 $('.thumbnail-container',gal).css('transform','translate3d('+deltaX+'px,0px,0px)'); 2138 $('.thumbnail-container',gal).css('opacity',opacityOffset); 2139 } 2140 2141 */ 2142 break; 2143 2144 case 'panend': 2145 //console.log('panend'); 2146 if (e.pointerType != 'mouse'){ 2147 $('.thumbnail-container',gal).css('transition-duration','0.3s'); 2148 setTimeout(function(){ 2149 $('.thumbnail-container',gal).css('transform','translate3d(0px,0px,0px)'); 2150 $('.thumbnail-container',gal).css('opacity','1'); 2151 },100); 2152 setTimeout(function(){ 2153 $('.thumbnail-container',gal).css('transition-duration','0.0s'); 2154 },200); 2155 } 2156 break; 2157 } 2158 } 2159 // FS MODE 2160 if (fsMode) { 2161 switch (e.type) { 2162 case 'swipedown': 2163 if (fsThumbnailsPosition = 'visible'){ 2164 toggleThumbnailsPosition($('.button.thumbnails-position',gal)); 2165 var controls = $('.controls .pager.button',gal); 2166 $('.controls .pager.button',gal).css({opacity:0}
2166); 2167 $('.photo-image',gal).blur(); 2168 $('.full-screen .thumbnail-container, .controls',gal).removeClass('visible'); 2169 $('.full-screen .thumbnail-container, .controls',gal).addClass('not-visible'); 2170 } 2171 break; 2172 2173 case 'swipeup': 2174 if (fsThumbnailsPosition = 'hover') { 2175 toggleThumbnailsPosition($('.button.thumbnails-position',gal)); 2176 $('.controls .pager.button',gal).css({opacity:1}); 2177 $('.photo-image',gal).blur(); 2178 $('.full-screen .thumbnail-container, .controls',gal).removeClass('not-visible'); 2179 $('.full-screen .thumbnail-container, .controls',gal).addClass('visible'); 2180 } 2181 break; 2182 } 2183 // THUMBNAILS MODE BUTTON TAP 2184 if ($(e.target).hasClass('thumbnails-position')){ 2185 //cc('else'); 2186 e.preventDefault(); 2187 toggleThumbnailsPosition($('.button.thumbnails-position',gal)); 2188 var controls = $('.controls .pager.button',gal); 2189 if (fsThumbnailsPosition == 'visible'){ 2190 $('.controls .pager.button',gal).css({opacity:1}); 2191 } 2192 else { 2193 $('.controls .pager.button',gal).css({opacity:0}); 2194 } 2195 } 2196 } 2197 }); 2198 }); 2199 }; 2200 enableTouchGeastures(); 2201 2202 jQuery(window).load(function () { 2203 setTimeout(function () { 2204 jQuery('.thumb-current').attr('aria-hidden','true'); 2205 jQuery('.thumb-hover').attr('aria-hidden','true'); 2206 jQuery('.thumb-title').attr('aria-hidden','true'); 2207 jQuery('.image-pre-thumbnail').attr('aria-hidden','true'); 2208 jQuery('.thumb-loader').attr('aria-hidden','true'); 2209 jQuery('.photo-box .image-thumbnail').attr('aria-hidden','true'); 2210 }, 1150); 2211 }); 2212}
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.