1// Camera slideshow - a jQuery slideshow with many effects, transitions, easy to customize, using canvas and mobile ready, based on jQuery 1.4+ 2// Copyright (c) 2012 by Manuel Masia - www.pixedelic.com 3// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 4// Updated by Cédric KEIFLIN - https://www.joomlack.fr - https://www.ceikay.com 5 6// v1.4.28 - 08/07/25 : add accessibility 7// v1.4.27 - 07/03/25 : add breakpoints feature 8// v1.4.26 - 05/03/25 : fix issue with google source and mobile resolution 9// v1.4.25 - 21/10/24 : add alias option for direct slide link feature 10// v1.4.24 - 02/04/24 : add option for the 11// v1.4.23 - 16/10/23 : fix issue with responsive caption and multiple slideshows 12// v1.4.22 - 15/10/22 : fix issue with alt tags on images 13// v1.4.21 - 22/04/22 : add option for title in thumbs 14// v1.4.20 - 09/01/22 : fix issue with joomla 4 when user is logged on 15// v1.4.19 - 13/12/21 : fix issue when there is only 1 image and a video 16// v1.4.18 - 18/11/21 : fix issue when there is only 1 image 17// v1.4.17 - 07/12/20 : add compatibility with VH unit 18// v1.4.16 - 12/10/20 : add aria-current attribute for accessibility 19// v1.4.15 - 23/04/20 : add video tag html5 and autoplay feature compatibility 20// v1.4.14 - 11/02/20 : add compat with Page Builder CK animations 21// v1.4.13 - 13/11/19 : fix issue with fade from bottom and middle layout 22// v1.4.12 - 13/06/19 : fix issue on thumbs container width 23// v1.4.11 - 12/06/19 : add aria-label on anchor links 24// v1.4.10 - 11/06/19 : update for the V2 of slideshow CK, modify the margin bottom on thumbs 25// , remove the effect on the caption is no effect is selected 26// v1.4.9 - 04/11/18 : check if the html code exists in the page 27// v1.4.8 - 02/05/18 : fix issue with fullpage background and image dimensions 28// v1.4.7 - 12/03/18 : add option for keyboard controls, arrows left - right and P 29// v1.4.6 - 09/01/18 : fix issue with image alignment option when using fullpage option 30// v1.4.5 - 08/01/18 : add accessibility with tabuliation and enter keypress : Thanks to Adam ! 31// v1.4.4 - 14/09/17 : fix issue when the instance is called multiple times on the same slideshow 32// v1.4.3 - 23/06/17 : remove the time stamp in image url (again) 33// v1.4.2 - 03/05/17 : add the alt tag on images 34// v1.4.1 - 22/02/17 : improve the load as container background feature to work in the same way as full page background 35// v1.4.0 - 16/02/17 : separate the slideshow instance from the jQuery instance. Load it as object and not as jquery plugin 36// v1.3.18 - 22/11/16 : add the event cameraupdate 37// v1.3.17 - 08/11/16 : improve the transition in full page background mode 38// v1.3.16 - 06/10/16 : remove the time stamp in image url 39// v1.3.15 - 03/10/16 : improve the full background ratios and display again 40// v1.3.14 - 28/03/16 : improve the full background ratios and display 41// v1.3.13 - 04/03/16 : remove dependency to jquery mobile, add custom touch event handler 42// v1.3.12 - 28/09/15 : added KenBurns effect 43// v1.3.11 - 18/06/15 : fix an issue with the squeezebox if not loaded 44// v1.3.10 - 10/02/15 : fix an issue with the thumb container width 45// v1.3.9 - 22/12/14 : added option to load the slideshow as background of any container 46// v1.3.8 - 03/07/13 : added option to load specific images depending on the resolution of the screen 47// v1.3.7 : improved the loading time of the first image and the slideshow height at start, fix an issue with the lightbox 48// v1.3.6 : added lightbox support 49// v1.3.5 : update for jQuery1.9 50// from cedric keiflin alias ced1870 51;(function($){ 52 53var Slideshowck = function (container, opts, callback) { 54// $.fn.camera = function(opts, callback) { 55 56 var defaults = { 57 alignment : 'center', //topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight 58 59 autoAdvance : true, //true, false 60 61 mobileAutoAdvance : true, //true, false. Auto-advancing for mobile devices 62 63 barDirection : 'leftToRight', //'leftToRight', 'rightToLeft', 'topToBottom', 'bottomToTop' 64 65 barPosition : 'bottom', //'bottom', 'left', 'top', 'right' 66 67 cols : 6, 68 69 easing : 'easeInOutExpo', //for the complete list http://jqueryui.com/demos/effect/easing.html 70 71 mobileEasing : '', //leave empty if you want to display the same easing on mobile devices and on desktop etc. 72 73 fx : 'random', //'random','simpleFade', 'curtainTopLeft', 'curtainTopRight', 'curtainBottomLeft', 'curtainBottomRight', 'curtainSliceLeft', 'curtainSliceRight', 'blindCurtainTopLeft', 'blindCurtainTopRight', 'blindCurtainBottomLeft', 'blindCurtainBottomRight', 'blindCurtainSliceBottom', 'blindCurtainSliceTop', 'stampede', 'mosaic', 'mosaicReverse', 'mosaicRandom', 'mosaicSpiral', 'mosaicSpiralReverse', 'topLeftBottomRight', 'bottomRightTopLeft', 'bottomLeftTopRight', 'bottomLeftTopRight', 'kenburns' 74 //you can also use more than one effect, just separate them with commas: 'simpleFade, scrollRight, scrollBottom' 75 76 mobileFx : '', //leave empty if you want to display the same effect on mobile devices and on desktop etc. 77 78 gridDifference : 250, //to make the grid blocks slower than the slices, this value must be smaller than transPeriod 79 80 height : '50%', //here you can type pixels (for instance '300px'), a percentage (relative to the width of the slideshow, for instance '50%') or 'auto' 81 82 imagePath : 'images/', //he path to the image folder (it serves for the blank.gif, when you want to display videos) 83 84 hover : true, //true, false. Puase on state hover. Not available for mobile devices 85 86 loader : 'pie', //pie, bar, none (even if you choose "pie", old browsers like IE8- can't display it... they will display always a loading bar) 87 88 loaderColor : '#eeeeee', 89 90 loaderBgColor : '#222222', 91 92 loaderOpacity : .8, //0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1 93 94 loaderPadding : 2, //how many empty pixels you want to display between the loader and its background 95 96 loaderStroke : 7, //the thickness both of the pie loader and of the bar loader. Remember: for the pie, the loader thickness must be less than a half of the pie diameter 97 98 minHeight : '200px', //you can also leave it blank 99 100 navigation : true, //true or false, to display or not the navigation buttons 101 102 navigationHover : true, //if true the navigation button (prev, next and play/stop buttons) will be visible on hover state only, if false they will be visible always 103 104 mobileNavHover : true, //same as above, but only for mobile devices 105 106 opacityOnGrid : false, //true, false. Decide to apply a fade effect to blocks and slices: if your slideshow is fullscreen or simply big, I recommend to set it false to have a smoother effect 107 108 overlayer : true, //a layer on the images to prevent the users grab them simply by clicking the right button of their mouse (.camera_overlayer) 109 110 pagination : true, 111 112 playPause : false, //true or false, to display or not the play/pause buttons 113 114 pauseOnClick : true, //true, false. It stops the slideshow when you click the sliders. 115 116 pieDiameter : 38, 117 118 piePosition : 'rightTop', //'rightTop', 'leftTop', 'leftBottom', 'rightBottom' 119 120 portrait : false, //true, false. Select true if you don't want that your images are cropped 121 122 rows : 4, 123 124 slicedCols : 12, //if 0 the same value of cols 125 126 slicedRows : 8, //if 0 the same value of rows 127 128 slideOn : 'random', //next, prev, random: decide if the transition effect will be applied to the current (prev) or the next slide 129 130 thumbnails : false, 131 132 thumbheight : '100', 133 134 thumbwidth : '75', 135 136 time : 7000, //milliseconds between the end of the sliding effect and the start of the nex one 137 138 transPeriod : 1500, //lenght of the sliding effect in milliseconds 139 140 fullpage : false, 141 142 lightbox : 'none', 143 144 mobileimageresolution: 0, 145 146 container : '', 147 148 responsiveCaption : false, 149 150 keyboardNavigation : false, 151 152 titleInThumbs : false, 153 154 captionTime : 0, 155 156 captionOutEffect : 'default', 157 158 captionOutEffectTime : 600, 159 160 alias : 'slideshow', 161 162 breakpoints : '{"800" : "80%"}', 163
164////////callbacks 165 166 onEndTransition : function() { }, //this callback is invoked when the transition effect ends 167 168 onLoaded : function() { }, //this callback is invoked when the image on a slide has completely loaded 169 170 onStartLoading : function() { }, //this callback is invoked when the image on a slide start loading 171 172 onStartTransition : function() { } //this callback is invoked when the transition effect starts 173 174 }; 175 176 // check if the slideshow does not exists in the page 177 if (! $(container).length) return; 178 179 if (!(this instanceof Slideshowck)) return new Slideshowck(container, opts, callback); 180 var slideshowcks = window.slideshowcks || []; 181 if (slideshowcks.indexOf(container) > -1) return; 182 slideshowcks.push(container); 183 window.slideshowcks = slideshowcks; 184 185 186 function isMobile() { 187 if( navigator.userAgent.match(/Android/i) || 188 navigator.userAgent.match(/webOS/i) || 189 navigator.userAgent.match(/iPad/i) || 190 navigator.userAgent.match(/iPhone/i) || 191 navigator.userAgent.match(/iPod/i) 192 ){ 193 return true; 194 } 195 } 196 197 var opts = $.extend({}, defaults, opts); 198 opts.initialHeight = opts.height; // save the value for use with breakpoints 199 200 var wrap = $(container).addClass('camera_wrap'); 201 202 if (opts.fullpage == true) { 203 $(document.body).css('background','none').prepend(wrap); 204 wrap.css({ 205 'height' : '100%', 206 'margin-left' : 0, 207 'margin-right' : 0, 208 'margin-top' : 0, 209 'position' : 'fixed', 210 'visibility' : 'visible', 211 'left' : 0, 212 'right' : 0, 213 'top' : 0, 214 'min-width': '100%', 215 'min-height' : '100%', 216 'width' : '100%', 217 'z-index' : '-1' 218 }); 219 } else if (opts.container != false) { 220 $(opts.container).css('background','none').prepend('<div class="slideshowck_container_wrap"></div>'); //v1.3.9 221 $('.slideshowck_container_wrap', opts.container).prepend(wrap); 222 if ($(opts.container).css('position') != 'relative' && $(opts.container).css('position') != 'absolute') { 223 $(opts.container).css('position', 'relative').css('z-index', '0'); 224 } 225 wrap.parent('.slideshowck_container_wrap').css({ 226 'height' : '100%', 227 'margin-left' : 0, 228 'margin-right' : 0, 229 'margin-top' : 0, 230 'position' : 'absolute', 231 'visibility' : 'visible', 232 'left' : 0, 233 'right' : 0, 234 'min-width': '100%', 235 'min-height' : '100%', 236 'width' : '100%', 237 'overflow' : 'hidden', 238 'z-index' : '-1' 239 }); 240 } 241 242 wrap.wrapInner( 243 '<div class="camera_src" />' 244 ).wrapInner( 245 '<div class="camera_fakehover" />' 246 ); 247 248 var fakeHover = $('.camera_fakehover',wrap); 249 250 fakeHover.append( 251 '<div class="camera_target"></div>' 252 ); 253 if(opts.overlayer == true){ 254 fakeHover.append( 255 '<div class="camera_overlayer"></div>' 256 ) 257 } 258 fakeHover.append( 259 '<div class="camera_target_content"></div>' 260 ); 261 262 var loader; 263 264 if ((navigator.userAgent.match(/MSIE 8.0/i) 265 || navigator.userAgent.match(/MSIE 7.0/i) 266 || navigator.userAgent.match(/MSIE 6.0/i)) 267 && opts.loader != 'none'){ 268// if(opts.loader=='pie' && $.browser.msie && $.browser.version < 9){ 269 loader = 'bar'; 270 } else { 271 loader = opts.loader; 272 } 273 274 if(loader == 'pie'){ 275 fakeHover.append( 276 '<div class="camera_pie"></div>' 277 ) 278 } else if (loader == 'bar') { 279 fakeHover.append( 280 '<div class="camera_bar"></div>' 281 ) 282 } else { 283 fakeHover.append( 284 '<div class="camera_bar" style="display:none"></div>' 285 ) 286 } 287 288 if(opts.playPause==true){ 289 fakeHover.append( 290 '<div class="camera_commands"></div>' 291 ) 292 } 293 294 if(opts.navigation==true){ 295 fakeHover.append( 296 '<div class="camera_prev" role="button" tabindex="0" aria-label="' + Joomla.JText._('SLIDESHOWCK_PREVIOUS') + '"><span></span></div>' 297 ).append( 298 '<div class="camera_next" role="button" tabindex="0" aria-label="' + Joomla.JText._('SLIDESHOWCK_NEXT') + '"><span></span></div>' 299 ); 300 } 301 302 if(opts.thumbnails==true){ 303 wrap.append( 304 '<div class="camera_thumbs_cont" />' 305 ); 306 } 307 308 if(opts.thumbnails==true && opts.pagination!=true){ 309 $('.camera_thumbs_cont',wrap).wrap( 310 '<div />' 311 ).wrap( 312 '<div class="camera_thumbs" />' 313 ).wrap( 314 '<div />' 315 ).wrap( 316 '<div class="camera_command_wrap" />' 317 ); 318 } 319 320 if(opts.pagination==true){ 321 wrap.append( 322 '<div class="camera_pag"></div>' 323 ); 324 } 325 326 wrap.append( 327 '<div class="camera_loader"></div>' 328 ); 329 330 $('.camera_caption',wrap).each(function(){ 331 $(this).wrapInner('<div />'); 332 }); 333 334 335 var pieID = 'pie_'+wrap.attr('id'), // modif ced1870 version e 336 elem = $('.camera_src',wrap), 337 target = $('.camera_target',wrap), 338 content = $('.camera_target_content',wrap), 339 pieContainer = $('.camera_pie',wrap), 340 barContainer = $('.camera_bar',wrap), 341 prevNav = $('.camera_prev',wrap), 342 nextNav = $('.camera_next',wrap), 343 commands = $('.camera_commands',wrap), 344 pagination = $('.camera_pag',wrap), 345 thumbs = $('.camera_thumbs_cont',wrap); 346 347 348 var w, 349 h; 350 351 opts.breakpoints = JSON.parse(opts.breakpoints); 352 353 var screenwidth = parseInt($(document.body).width()); 354 // var imageprefix = ''; 355 // if (opts.mobileimageresolution && screenwidth <= opts.mobileimageresolution) imageprefix = opts.mobileimageresolution + '_'; 356 357 imgresolution = 0; 358 if (opts.mobileimageresolution) { 359 var resolutions = opts.mobileimageresolution.split(','); 360 for (i=0; i < resolutions.length ; i++) { 361 if (screenwidth <= resolutions[i] && 362 ( (imgresolution != 0 && resolutions[i] <= imgresolution) 363 || (imgresolution == 0 && screenwidth < Math.max.apply( Math, resolutions )) ) 364 ) { 365 imgresolution = resolutions[i]; 366 } 367 } 368 } 369 370 var allImg = new Array(); 371 var allImgName = new Array(); 372 var imgsrc; 373 $('> div[data-src]', elem).each( function() { 374 imgsrc = $(this).attr('data-src'); 375 imgsrctmp = imgsrc.split('\/'); 376 imgnametmp = imgsrctmp[imgsrctmp.length - 1]; 377 if (imgresolution 378 && imgsrc.search('lh3.googleusercontent') === -1 // do not use resized images for Google source 379 ) { 380 imgsrctmp[imgsrctmp.length - 1] = imgresolution + '/' + imgnametmp; 381 imgsrc = imgsrctmp.join('\/'); 382 } else if (imgresolution 383 && imgsrc.search('lh3.googleusercontent') !== -1 // do not use resized images for Google source 384 ) { 385 googleimgsrctmp = imgsrc.split('='); 386 imgsrc = googleimgsrctmp[0] + '=w' + imgresolution; 387 } 388 allImg.push(imgsrc); 389 allImgName.push(imgnametmp); 390 }); 391 392// newImg = new Image(); // test pour afficher image directement au chargement de la page, mais manque dimensions 393// newImg.src = allImg[0]; 394// wrap.append(newImg); 395 396 var allLinks = new Array(); 397 var allRels = new Array(); 398 var allTitles = new Array(); 399 var allAlts = new Array(); 400 $('> div[data-src]', elem).each( function(i) { 401 if($(this).attr('data-link')){ 402 allLinks.push($(this).attr('data-link')); 403 } else { 404 allLinks.push(''); 405 } 406 if($(this).attr('data-rel')){
407 allRels.push('rel="'+$(this).attr('data-rel')+'" '); 408 } else { 409 allRels.push(''); 410 } 411 if($(this).attr('data-title')){ 412 allTitles.push('title="'+$(this).attr('data-title')+'" '); 413 } else { 414 allTitles.push(''); 415 } 416 if($(this).attr('data-alt')){ 417 allAlts.push($(this).attr('data-alt')); 418 } else { 419 allAlts.push(allImgName[i]); 420 } 421 }); 422 423 var allTargets = new Array(); 424 $('> div[data-src]', elem).each( function() { 425 if($(this).attr('data-target')){ 426 allTargets.push($(this).attr('data-target')); 427 } else { 428 allTargets.push(''); 429 } 430 }); 431 432 var allPor = new Array(); 433 $('> div[data-src]', elem).each( function() { 434 if($(this).attr('data-portrait')){ 435 allPor.push($(this).attr('data-portrait')); 436 } else { 437 allPor.push(''); 438 } 439 }); 440 441 var allAlign= new Array(); 442 $('> div[data-src]', elem).each( function() { 443 if($(this).attr('data-alignment')){ 444 allAlign.push($(this).attr('data-alignment')); 445 } else { 446 allAlign.push(''); 447 } 448 }); 449 450 451 var allThumbs = new Array(); 452 $('> div[data-src]', elem).each( function() { 453 if($(this).attr('data-thumb')){ 454 allThumbs.push($(this).attr('data-thumb')); 455 } else { 456 allThumbs.push(''); 457 } 458 }); 459 460 var amountSlide = allImg.length; 461 462 $(content).append('<div class="cameraContents" />'); 463 var loopMove; 464 for (loopMove=0;loopMove<amountSlide;loopMove++) 465 { 466 $('.cameraContents',content).append('<div class="cameraContent" />'); 467 if(allLinks[loopMove]!=''){ 468 //only for Wordpress plugin 469 var dataBox = $('> div ',elem).eq(loopMove).attr('data-box'); 470 if(typeof dataBox !== 'undefined' && dataBox !== false && dataBox != '') { 471 dataBox = 'data-box="'+$('> div ',elem).eq(loopMove).attr('data-box')+'"'; 472 } else { 473 dataBox = ''; 474 } 475 $('.camera_target_content .cameraContent:eq('+loopMove+')',wrap).append('<a class="camera_link" aria-label="' + Joomla.JText._('SLIDESHOWCK_LINK_FOR') + ' : ' + allAlts[loopMove] + '" '+allRels[loopMove]+allTitles[loopMove]+'href="'+allLinks[loopMove]+'" '+dataBox+' target="'+allTargets[loopMove]+'"></a>'); 476 } 477 478 } 479 var allAltText = new Array(); 480 var allCaptions = new Array(); 481 $('.camera_caption',wrap).each(function(){ 482 var ind = $(this).parent().index(), 483 cont = wrap.find('.cameraContent').eq(ind); 484 var title = $(this).find('.camera_caption_title').text().trim(); 485 var desc = $(this).find('.camera_caption_desc').text().trim(); 486 var altText = title.length ? title : (desc ? desc : allImg[ind]); 487 allAltText.push(altText); 488 allCaptions.push(cont); 489 $(this).find('.animateck').removeClass('animateck'); 490 $(this).appendTo(cont); 491 }); 492 493 target.append('<div class="cameraCont" />'); 494 var cameraCont = $('.cameraCont',wrap); 495 496 497 498 var loop; 499 for (loop=0;loop<amountSlide;loop++) 500 { 501 cameraCont.append('<div class="cameraSlide cameraSlide_'+loop+'" />'); 502 var div = $('> div:eq('+loop+')',elem); 503 target.find('.cameraSlide_'+loop).clone(div); 504 } 505 506 507 function thumbnailVisible() { 508 calculateThumbsWidth(); 509 var wTh = $(thumbs).width(); 510 $('li', thumbs).removeClass('camera_visThumb'); 511 $('li', thumbs).each(function(){ 512 var pos = $(this).position(), 513 ulW = $('ul', thumbs).outerWidth(), 514 offUl = $('ul', thumbs).offset().left, 515 offDiv = $('> div',thumbs).offset().left, 516 ulLeft = offDiv-offUl; 517// if(ulLeft>0){ 518 $('.camera_prevThumbs',camera_thumbs_wrap).removeClass('hideNav').css('visibility','visible'); 519// } else { 520// $('.camera_prevThumbs',camera_thumbs_wrap).addClass('hideNav'); 521// } 522// if((ulW-ulLeft)>wTh){ 523 $('.camera_nextThumbs',camera_thumbs_wrap).removeClass('hideNav').css('visibility','visible'); 524// } else { 525// $('.camera_nextThumbs',camera_thumbs_wrap).addClass('hideNav'); 526// } 527 var left = pos.left, 528 right = pos.left+($(this).width()); 529 if(right-ulLeft<=wTh && left-ulLeft>=0){ 530 $(this).addClass('camera_visThumb'); 531 } 532 }); 533 } 534 535 $(window).bind('load resize pageshow',function(){ 536 thumbnailPos(); 537 thumbnailVisible(); 538 if (opts.responsiveCaption) resizeFont(); 539 }); 540 541 // trigger to update the slideshow width 542 $(window).bind('cameraupdate',function(){ 543 calculateThumbsWidth(); 544 $(window).trigger('resize'); 545 }); 546 547 function calculateThumbsWidth() { 548 ulthumbwidth = 0; 549 $.each(allThumbs, function(i, val) { 550 ulthumbwidth += parseFloat($('li.pix_thumb_'+i,thumbs).outerWidth()) + parseFloat($('li.pix_thumb_'+i,thumbs).css('marginLeft')) + parseFloat($('li.pix_thumb_'+i,thumbs).css('marginRight')); 551 }); 552 $('ul', thumbs).width(ulthumbwidth + 2); 553 } 554 cameraCont.append('<div class="cameraSlide cameraSlide_'+loop+'" />'); 555 556 557 var started; 558 559 wrap.show(); 560 var w = target.width(); 561 var h = target.height(); 562 var setPause; 563 564 setHeightOptionForBreakpoint(); 565 566 $(window).bind('resize pageshow',function(){ 567 if(started == true) { 568 resizeImage(); 569 // addLightbox(); 570 } 571 572 setHeightOptionForBreakpoint(); 573 574 $('ul', thumbs).animate({'margin-top':0},0,thumbnailPos); 575 if(!elem.hasClass('paused')){ 576 elem.addClass('paused'); 577 if($('.camera_stop',camera_thumbs_wrap).length){ 578 $('.camera_stop',camera_thumbs_wrap).hide() 579 $('.camera_play',camera_thumbs_wrap).show(); 580 if(loader!='none'){ 581 $('#'+pieID).hide(); 582 } 583 } else { 584 if(loader!='none'){ 585 $('#'+pieID).hide(); 586 } 587 } 588 clearTimeout(setPause); 589 setPause = setTimeout(function(){ 590 elem.removeClass('paused'); 591 if($('.camera_play',camera_thumbs_wrap).length){ 592 $('.camera_play',camera_thumbs_wrap).hide(); 593 $('.camera_stop',camera_thumbs_wrap).show(); 594 if(loader!='none'){ 595 $('#'+pieID).fadeIn(); 596 } 597 } else { 598 if(loader!='none'){ 599 $('#'+pieID).fadeIn(); 600 } 601 } 602 },1500); 603 } 604 }); 605 606 function setHeightOptionForBreakpoint() { 607 // adapt the height at the breakpoints 608 if (opts.breakpoints) { 609 var isBreakpoint = false; 610 var winW = $(window).width(); 611 612 for (const breakpoint in opts.breakpoints) { 613 if (winW <= parseInt(breakpoint)) { 614 opts.height = opts.breakpoints[breakpoint]; 615 isBreakpoint = true; 616 } 617 } 618 if (!isBreakpoint) { 619 opts.height = opts.initialHeight 620 } 621 } 622 } 623 624 function resizeFont() { 625 var fontRatio = wrap.width() / 700; 626 $('.camera_caption > div', wrap).css('font-size', fontRatio + 'em'); 627 } 628 629 function goToDirectSlide(hashtag) { 630// var hashtag = window.location.hash; 631 if (hashtag) { 632 var anchorAlias = '#' + opts.alias + '-'; 633 var anchorAliasReg = new RegExp(anchorAlias, "g"); 634 if (hashtag.substr(0, anchorAlias.length) == anchorAlias ) { 635 var index = hashtag.toLowerCase().replace(anchorAliasReg, ''); 636 nextSlide(index); 637 return true; 638 } else { 639 return false; 640 } 641 } else { 642 return false; 643 } 644 } 645 646 function goToDirectSlideWithLink() { 647 var links = document.querySelectorAll('a.slideshowck'); 648 links.forEach(function(link) { 649 var hashtag = link.hash; 650 if (hashtag) { 651 link.addEventListener('click', function() { 652 goToDirectSlide(hashtag); 653 }); 654 } 655 }); 656 } 657 658 function addLightbox() { 659 if (opts.lightbox == 'mediaboxck' && typeof(Mediabox) != "undefined") { 660 Mediabox.scanPage(); 661 } else if (opts.lightbox == 'squeezebox' && typeof(SqueezeBox) != "undefined") { 662 SqueezeBox.initialize({}); 663 SqueezeBox.assign($$('a.camera_link[rel=lightbox]'), { 664 /*parse: 'rel'*/ 665 }); 666 } 667 } 668 669 setWrappersize(); 670 671 function setWrappersize() { 672 w = wrap.width(); 673 if(opts.height.indexOf('%')!=-1) { 674 var startH = Math.round(w / (100/parseFloat(opts.height))); 675 if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){ 676 h = parseFloat(opts.minHeight); 677 } else { 678 h = startH; 679 } 680 wrap.css({height:h}); 681 } else if (opts.height.indexOf('vh')!=-1) { 682 var startH = ($(window).height()/100) * parseFloat(opts.height); 683 if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){ 684 h = parseFloat(opts.minHeight); 685 } else { 686 h = startH; 687 } 688 wrap.css({height:h}); 689 }else if (opts.height=='auto') { 690 h = wrap.height(); 691 } else { 692 h = parseFloat(opts.height); 693 wrap.css({height:h}); 694 } 695 if (opts.fullpage == true) { 696 h = $(window).height(); 697 wrap.css({height:h}); 698 } 699 else if (opts.container != false) { 700 h = $(opts.container).height(); 701 702 } 703 wrap.css({height:h}); 704 } 705 706 function resizeImage(){ 707 var res; 708 function resizeImageWork(){ 709 w = wrap.width(); 710 setWrappersize(); 711 $('.camerarelative',target).css({'width':w,'height':h}); 712 $('.imgLoaded',target).each(function(){ 713 var t = $(this), 714 wT = t.attr('width'), 715 hT = t.attr('height'), 716 imgLoadIn = t.index(), 717 mTop, 718 mLeft,
719 alignment = t.attr('data-alignment'), 720 portrait = t.attr('data-portrait'); 721 722 if (opts.fx == 'kenburns') { 723 t.css({ 724 'position' : 'absolute', 725 'visibility' : 'visible', 726 }); 727 } else { 728 if(typeof alignment === 'undefined' || alignment === false || alignment === ''){ 729 alignment = opts.alignment; 730 } 731 732 if(typeof portrait === 'undefined' || portrait === false || portrait === ''){ 733 portrait = opts.portrait; 734 } 735 736 if (opts.fullpage == true) { // modif ced1870 rev c 737 // var imgRatio = h/w; 738 var imgRatio = hT/wT; 739 var winH = $(window).height(); 740 var winW = $(window).width(); 741 var windowRatio = winH/winW; 742// mTop = 0; 743 // calculate mTop to position the image 744 var r = w / wT; 745 var d = (Math.abs(h - (hT*r)))*0.5; 746 switch(alignment){ 747 case 'topLeft': 748 mTop = 0; 749 break; 750 case 'topCenter': 751 mTop = 0; 752 break; 753 case 'topRight': 754 mTop = 0; 755 break; 756 case 'centerLeft': 757 mTop = '-'+d+'px'; 758 break; 759 case 'center': 760 mTop = '-'+d+'px'; 761 break; 762 case 'centerRight': 763 mTop = '-'+d+'px'; 764 break; 765 case 'bottomLeft': 766 mTop = '-'+d*2+'px'; 767 break; 768 case 'bottomCenter': 769 mTop = '-'+d*2+'px'; 770 break; 771 case 'bottomRight': 772 mTop = '-'+d*2+'px'; 773 break; 774 } 775 if (windowRatio > imgRatio) { 776 imgH = winH - (2*parseInt(mTop)); 777 imgW = imgH / imgRatio; 778 mLeft = Math.abs((winW - imgW) / 2); 779// mTop = 0; 780 } else { 781 imgW = winW; 782 imgH = imgW * imgRatio; 783 mLeft = 0; 784// mTop = 0; 785 } 786 t.css({ 787 'height' : imgH, 788 'margin-left' : -mLeft, 789 'margin-right' : -mLeft, 790 'margin-top' : mTop, 791 'position' : 'absolute', 792 'visibility' : 'visible', 793 'left' : 0, 794 'top' : 0, 795 'width' : imgW 796 }); 797 } 798 else if (opts.container != false) { 799 var imgRatio = hT/wT; 800 var winH = $(opts.container).height(); 801 var winW = $(opts.container).width(); 802 var windowRatio = winH/winW; 803 mTop = 0; 804 if (windowRatio > imgRatio) { 805 imgH = winH; 806 imgW = imgH / imgRatio; 807 mLeft = Math.abs((winW - imgW) / 2); 808 mTop = 0; 809 } else { 810 imgW = winW; 811 imgH = imgW * imgRatio; 812 mLeft = 0; 813 mTop = 0; 814 } 815 t.css({ 816 'height' : imgH, 817 'margin-left' : -mLeft, 818 'margin-right' : -mLeft, 819 'margin-top' : mTop, 820 'position' : 'absolute', 821 'visibility' : 'visible', 822 'left' : 0, 823 'top' : 0, 824 'width' : imgW 825 }); 826 } 827 else if(portrait==false||portrait=='false'){ 828 if((wT/hT)<(w/h)) { 829 var r = w / wT; 830 var d = (Math.abs(h - (hT*r)))*0.5; 831 switch(alignment){ 832 case 'topLeft': 833 mTop = 0; 834 break; 835 case 'topCenter': 836 mTop = 0; 837 break; 838 case 'topRight': 839 mTop = 0; 840 break; 841 case 'centerLeft': 842 mTop = '-'+d+'px'; 843 break; 844 case 'center': 845 mTop = '-'+d+'px'; 846 break; 847 case 'centerRight': 848 mTop = '-'+d+'px'; 849 break; 850 case 'bottomLeft': 851 mTop = '-'+d*2+'px'; 852 break; 853 case 'bottomCenter': 854 mTop = '-'+d*2+'px'; 855 break; 856 case 'bottomRight': 857 mTop = '-'+d*2+'px'; 858 break; 859 } 860// if (opts.fullpage == true) { // modif ced1870 rev c 861// t.css({ 862//// 'height' : hT*r, 863// 'height' : $(window).height(), 864// 'margin-left' : mLeft, 865// 'margin-right' : mLeft, 866// 'margin-top' : mTop, 867// 'position' : 'absolute', 868// 'visibility' : 'visible', 869// 'left' : 0, // ced1870 870// 'width' : wT*r2 871// });
872// } else { 873 t.css({ 874 'height' : hT*r, 875 'margin-left' : 0, 876 'margin-right' : 0, 877 'margin-top' : mTop, 878 'position' : 'absolute', 879 'visibility' : 'visible', 880 'width' : w 881 }); 882// } 883 } 884 else { 885 var r = h / hT; 886 var d = (Math.abs(w - (wT*r)))*0.5; 887 switch(alignment){ 888 case 'topLeft': 889 mLeft = 0; 890 break; 891 case 'topCenter': 892 mLeft = '-'+d+'px'; 893 break; 894 case 'topRight': 895 mLeft = '-'+d*2+'px'; 896 break; 897 case 'centerLeft': 898 mLeft = 0; 899 break; 900 case 'center': 901 mLeft = '-'+d+'px'; 902 break; 903 case 'centerRight': 904 mLeft = '-'+d*2+'px'; 905 break; 906 case 'bottomLeft': 907 mLeft = 0; 908 break; 909 case 'bottomCenter': 910 mLeft = '-'+d+'px'; 911 break; 912 case 'bottomRight': 913 mLeft = '-'+d*2+'px'; 914 break; 915 } 916 t.css({ 917 'height' : h, 918 'margin-left' : mLeft, 919 'margin-right' : mLeft, 920 'margin-top' : 0, 921 'position' : 'absolute', 922 'visibility' : 'visible', 923 'width' : wT*r 924 });
925 } 926 } else { 927 if((wT/hT)<(w/h)) { 928 var r = h / hT; 929 var d = (Math.abs(w - (wT*r)))*0.5; 930 switch(alignment){ 931 case 'topLeft': 932 mLeft = 0; 933 break; 934 case 'topCenter': 935 mLeft = d+'px'; 936 break; 937 case 'topRight': 938 mLeft = d*2+'px'; 939 break; 940 case 'centerLeft': 941 mLeft = 0; 942 break; 943 case 'center': 944 mLeft = d+'px'; 945 break; 946 case 'centerRight': 947 mLeft = d*2+'px'; 948 break; 949 case 'bottomLeft': 950 mLeft = 0; 951 break; 952 case 'bottomCenter': 953 mLeft = d+'px'; 954 break; 955 case 'bottomRight': 956 mLeft = d*2+'px'; 957 break; 958 } 959 t.css({ 960 'height' : h, 961 'margin-left' : mLeft, 962 'margin-right' : mLeft, 963 'margin-top' : 0, 964 'position' : 'absolute', 965 'visibility' : 'visible', 966 'width' : wT*r 967 });
968 } 969 else { 970 var r = w / wT; 971 var d = (Math.abs(h - (hT*r)))*0.5; 972 switch(alignment){ 973 case 'topLeft': 974 mTop = 0; 975 break; 976 case 'topCenter': 977 mTop = 0; 978 break; 979 case 'topRight': 980 mTop = 0; 981 break; 982 case 'centerLeft': 983 mTop = d+'px'; 984 break; 985 case 'center': 986 mTop = d+'px'; 987 break; 988 case 'centerRight': 989 mTop = d+'px'; 990 break; 991 case 'bottomLeft': 992 mTop = d*2+'px'; 993 break; 994 case 'bottomCenter': 995 mTop = d*2+'px'; 996 break; 997 case 'bottomRight': 998 mTop = d*2+'px'; 999 break; 1000 } 1001 t.css({ 1002 'height' : hT*r, 1003 'margin-left' : 0, 1004 'margin-right' : 0, 1005 'margin-top' : mTop, 1006 'position' : 'absolute', 1007 'visibility' : 'visible', 1008 'width' : w 1009 }); 1010 } 1011 } 1012 } 1013 }); 1014 } 1015 if (started == true) { 1016 clearTimeout(res); 1017 res = setTimeout(resizeImageWork,200); 1018 } else { 1019 resizeImageWork(); 1020 } 1021 1022 started = true; 1023 } 1024 1025 1026 var u, 1027 setT; 1028 1029 var clickEv, 1030 autoAdv, 1031 navHover, 1032 commands, 1033 pagination; 1034 1035 var videoHover, 1036 videoPresent; 1037 1038 if(isMobile() && opts.mobileAutoAdvance!=''){ 1039 autoAdv = opts.mobileAutoAdvance; 1040 } else { 1041 autoAdv = opts.autoAdvance; 1042 } 1043 1044 if(autoAdv==false){ 1045 elem.addClass('paused'); 1046 } 1047 1048 if(isMobile() && opts.mobileNavHover!=''){ 1049 navHover = opts.mobileNavHover; 1050 } else { 1051 navHover = opts.navigationHover; 1052 } 1053 1054 if(elem.length!=0){ 1055 1056 var selector = $('.cameraSlide',target); 1057 selector.wrapInner('<div class="camerarelative" />'); 1058 1059 var navSlide; 1060 1061 var barDirection = opts.barDirection; 1062 1063 var camera_thumbs_wrap = wrap; 1064 1065 1066 $('iframe, video',fakeHover).each(function(){ 1067 var t = $(this); 1068 var src = t.attr('src'); 1069 t.attr('data-src',src); 1070 var divInd = t.parent().index('#'+wrap.attr('id')+' .camera_src > div'); // ced1870 modif in subversion a 1071 $('.camera_target_content .cameraContent:eq('+divInd+')',wrap).append(t); 1072 }); 1073 function imgFake() { 1074 $('iframe, video',fakeHover).each(function(){ 1075 $('.camera_caption',fakeHover).show(); 1076 var t = $(this); 1077 var cloneSrc = t.attr('data-src'); 1078 t.attr('src',cloneSrc); 1079 var imgFakeUrl = opts.imagePath+'blank.gif'; 1080 var imgFake = new Image(); 1081 imgFake.src = imgFakeUrl; 1082 setWrappersize(); 1083 // if(opts.height.indexOf('%')!=-1) { 1084 // var startH = Math.round(w / (100/parseFloat(opts.height))); 1085 // if(opts.minHeight != '' && startH < parseFloat(opts.minHeight)){ 1086 // h = parseFloat(opts.minHeight); 1087 // } else { 1088 // h = startH; 1089 // } 1090 // } else if (opts.height=='auto') { 1091 // h = wrap.height(); 1092 // } else { 1093 // h = parseFloat(opts.height); 1094 // } 1095 t.after($(imgFake).attr({'class':'imgFake','width':w,'height':h})); 1096 var clone = t.clone(); 1097 t.remove(); 1098 // 1099 if (this.tagName.toLowerCase() == 'video') { 1100 $(imgFake).css('pointer-events','none'); 1101 } 1102 $(imgFake).bind('click',function(){ 1103 if($(this).css('position')=='absolute') { 1104 $(this).remove(); 1105 autoplay = ''; 1106 if(cloneSrc.indexOf('vimeo') != -1 || cloneSrc.indexOf('youtube') != -1) { 1107 if(cloneSrc.indexOf('?') != -1){ 1108 autoplay = '&autoplay=1'; 1109 } else { 1110 autoplay = '?autoplay=1'; 1111 } 1112 } else if(cloneSrc.indexOf('dailymotion') != -1) { 1113 if(cloneSrc.indexOf('?') != -1){ 1114 autoplay = '&autoPlay=1'; 1115 } else { 1116 autoplay = '?autoPlay=1'; 1117 } 1118 } 1119 clone.attr('src',cloneSrc+autoplay); 1120 videoPresent = true; 1121 } else { 1122 $(this).css({position:'absolute',top:0,left:0,zIndex:10}).after(clone); 1123 clone.css({position:'absolute',top:0,left:0,zIndex:9}); 1124 } 1125 }); 1126 }); 1127 } 1128 1129 imgFake(); 1130 1131 1132 if(opts.hover==true){ 1133 if(!isMobile() && opts.fx != 'kenburns'){ 1134 fakeHover.hover(function(){ 1135 elem.addClass('hovered'); 1136 },function(){ 1137 elem.removeClass('hovered'); 1138 }); 1139 } 1140 } 1141 1142 if(navHover==true){ 1143 $(prevNav,wrap).animate({opacity:0}
1143,0); 1144 $(nextNav,wrap).animate({opacity:0},0); 1145 $(commands,wrap).animate({opacity:0},0); 1146 if(isMobile()){ 1147 fakeHover.on('vmouseover',function(){ 1148 $(prevNav,wrap).animate({opacity:1},200); 1149 $(nextNav,wrap).animate({opacity:1},200); 1150 $(commands,wrap).animate({opacity:1},200); 1151 }); 1152 fakeHover.on('vmouseout',function(){ 1153 $(prevNav,wrap).delay(500).animate({opacity:0},200); 1154 $(nextNav,wrap).delay(500).animate({opacity:0},200); 1155 $(commands,wrap).delay(500).animate({opacity:0},200); 1156 }); 1157 } else { 1158 fakeHover.hover(function(){ 1159 $(prevNav,wrap).animate({opacity:1},200); 1160 $(nextNav,wrap).animate({opacity:1},200); 1161 $(commands,wrap).animate({opacity:1},200); 1162 },function(){ 1163 $(prevNav,wrap).animate({opacity:0},200); 1164 $(nextNav,wrap).animate({opacity:0},200); 1165 $(commands,wrap).animate({opacity:0},200); 1166 }); 1167 } 1168 } 1169 1170 1171 camera_thumbs_wrap.on('click keypress','.camera_stop',function(e){ 1172 if ((e.type == 'keypress' && e.which == 13) || e.type == 'click') { 1173 stop(); 1174 } 1175 }); 1176 1177 camera_thumbs_wrap.on('click keypress','.camera_play',function(e){ 1178 if ((e.type == 'keypress' && e.which == 13) || e.type == 'click') { 1179 play(); 1180 } 1181 }); 1182 1183 function play() { 1184 autoAdv = true; 1185 elem.removeClass('paused'); 1186 if($('.camera_play',camera_thumbs_wrap).length){ 1187 $('.camera_play',camera_thumbs_wrap).hide(); 1188 $('.camera_stop',camera_thumbs_wrap).show(); 1189 if(loader!='none'){ 1190 $('#'+pieID).show(); 1191 } 1192 } else { 1193 if(loader!='none'){ 1194 $('#'+pieID).show(); 1195 } 1196 } 1197 } 1198 1199 function stop() { 1200 autoAdv = false; 1201 elem.addClass('paused'); 1202 if($('.camera_stop',camera_thumbs_wrap).length){ 1203 $('.camera_stop',camera_thumbs_wrap).hide() 1204 $('.camera_play',camera_thumbs_wrap).show(); 1205 if(loader!='none'){ 1206 $('#'+pieID).hide(); 1207 } 1208 } else { 1209 if(loader!='none'){ 1210 $('#'+pieID).hide(); 1211 } 1212 } 1213 } 1214 1215 // add keyboard navigation left/right 1216 if (opts.keyboardNavigation == true) { 1217 $(document).keydown(function(e){ 1218 if ( (e.which == 37 || e.which == 39 || e.which == 80) && checkIsVisible()) { 1219 // 37 = left, 39 = right, 80 = P 1220 if ((e.type == 'keydown' && e.which == 37)) { 1221 prev(); 1222 } 1223 if ((e.type == 'keydown' && e.which == 39)) { 1224 next(); 1225 } 1226 if ((e.type == 'keydown' && e.which == 80)) { 1227 if (elem.hasClass('paused')) { 1228 play(); 1229 } else { 1230 stop(); 1231 } 1232 } 1233 } 1234 }); 1235 } 1236 1237 function checkIsVisible() { 1238 var $window = $(window); 1239 var winY = $window.scrollTop(); 1240 var slideshowPosTop = wrap.offset().top; 1241 1242 var isNotUpper = slideshowPosTop + (wrap.height() /2) > winY; 1243 var isNotLower = slideshowPosTop + (wrap.height() /2) < winY + $window.height(); 1244 1245 return (isNotUpper && isNotLower); 1246 } 1247 1248 if(opts.pauseOnClick==true){ 1249 $('.camera_target_content',fakeHover).mouseup(function(){ 1250 autoAdv = false; 1251 elem.addClass('paused'); 1252 $('.camera_stop',camera_thumbs_wrap).hide() 1253 $('.camera_play',camera_thumbs_wrap).show(); 1254 $('#'+pieID).hide(); 1255 }); 1256 } 1257 1258 $('.cameraContent, .imgFake',fakeHover).hover(function(){ 1259 videoHover = true; 1260 },function(){ 1261 videoHover = false; 1262 }); 1263 1264 $('.cameraContent, .imgFake',fakeHover).bind('click',function(){ 1265 if(videoPresent == true && videoHover == true) { 1266 autoAdv = false; 1267 $('.camera_caption',fakeHover).hide(); 1268 elem.addClass('paused'); 1269 $('.camera_stop',camera_thumbs_wrap).hide() 1270 $('.camera_play',camera_thumbs_wrap).show(); 1271 $('#'+pieID).hide(); 1272 } 1273 }); 1274 1275 1276 } 1277 1278 1279 function shuffle(arr) { 1280 for( 1281 var j, x, i = arr.length; i; 1282 j = parseInt(Math.random() * i), 1283 x = arr[--i], arr[i] = arr[j], arr[j] = x 1284 ); 1285 return arr; 1286 } 1287 1288 function isInteger(s) { 1289 return Math.ceil(s) == Math.floor(s); 1290 } 1291 1292 if (loader != 'pie') { 1293 barContainer.append('<span class="camera_bar_cont" />'); 1294 $('.camera_bar_cont',barContainer) 1295 .animate({opacity:opts.loaderOpacity},0) 1296 .css({'position':'absolute', 'left':0, 'right':0, 'top':0, 'bottom':0, 'background-color':opts.loaderBgColor}) 1297 .append('<span id="'+pieID+'" />'); 1298 $('#'+pieID).animate({opacity:0}
1298,0); 1299 var canvas = $('#'+pieID); 1300 canvas.css({'position':'absolute', 'background-color':opts.loaderColor}); 1301 switch(opts.barPosition){ 1302 case 'left': 1303 barContainer.css({right:'auto',width:opts.loaderStroke}); 1304 break; 1305 case 'right': 1306 barContainer.css({left:'auto',width:opts.loaderStroke}); 1307 break; 1308 case 'top': 1309 barContainer.css({bottom:'auto',height:opts.loaderStroke}); 1310 break; 1311 case 'bottom': 1312 barContainer.css({top:'auto',height:opts.loaderStroke}); 1313 break; 1314 } 1315 switch(barDirection){ 1316 case 'leftToRight': 1317 canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding}); 1318 break; 1319 case 'rightToLeft': 1320 canvas.css({'left':0, 'right':0, 'top':opts.loaderPadding, 'bottom':opts.loaderPadding}); 1321 break; 1322 case 'topToBottom': 1323 canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0}); 1324 break; 1325 case 'bottomToTop': 1326 canvas.css({'left':opts.loaderPadding, 'right':opts.loaderPadding, 'top':0, 'bottom':0}); 1327 break; 1328 } 1329 } else { 1330 pieContainer.append('<canvas id="'+pieID+'"></canvas>'); 1331 var G_vmlCanvasManager; 1332 var canvas = document.getElementById(pieID); 1333 canvas.setAttribute("width", opts.pieDiameter); 1334 canvas.setAttribute("height", opts.pieDiameter); 1335 var piePosition; 1336 switch(opts.piePosition){ 1337 case 'leftTop' : 1338 piePosition = 'left:0; top:0;'; 1339 break; 1340 case 'rightTop' : 1341 piePosition = 'right:0; top:0;'; 1342 break; 1343 case 'leftBottom' : 1344 piePosition = 'left:0; bottom:0;'; 1345 break; 1346 case 'rightBottom' : 1347 piePosition = 'right:0; bottom:0;'; 1348 break; 1349 } 1350 canvas.setAttribute("style", "position:absolute; z-index:1002; "+piePosition); 1351 var rad; 1352 var radNew; 1353 1354 if (canvas && canvas.getContext) { 1355 var ctx = canvas.getContext("2d"); 1356 ctx.rotate(Math.PI*(3/2)); 1357 ctx.translate(-opts.pieDiameter,0); 1358 } 1359 1360 } 1361 if(loader=='none' || autoAdv==false) { 1362 $('#'+pieID).hide(); 1363 $('.camera_canvas_wrap',camera_thumbs_wrap).hide(); 1364 } 1365 1366 if($(pagination).length) { 1367 $(pagination).append('<ul class="camera_pag_ul" />'); 1368 var li; 1369 for (li = 0; li < amountSlide; li++){ 1370 $('.camera_pag_ul',wrap).append('<li class="pag_nav_'+li+'" style="position:relative; z-index:1002" role="button" tabindex="0" aria-label="' + Joomla.JText._('SLIDESHOWCK_SHOw_SLIDE') + ' '+(li+1)+'"><span><span>'+li+'</span></span></li>'); 1371 } 1372 $('.camera_pag_ul li',wrap).hover(function(){ 1373 $(this).addClass('camera_hover'); 1374 if($('.camera_thumb',this).length){ 1375 var wTh = $('.camera_thumb',this).outerWidth(), 1376 hTh = $('.camera_thumb',this).outerHeight(), 1377 wTt = $(this).outerWidth(); 1378 $('.camera_thumb',this).show().css({'top':'-'+hTh+'px','left':'-'+(wTh-wTt)/2+'px'}).animate({'opacity':1,'margin-top':'-3px'},200); 1379 $('.thumb_arrow',this).show().animate({'opacity':1,'margin-top':'-3px'},200); 1380 } 1381 },function(){ 1382 $(this).removeClass('camera_hover'); 1383 $('.camera_thumb',this).animate({'margin-top':'-20px','opacity':0},200,function(){ 1384 $(this).css({marginTop:'5px'}).hide(); 1385 }); 1386 $('.thumb_arrow',this).animate({'margin-top':'-20px','opacity':0},200,function(){ 1387 $(this).css({marginTop:'5px'}).hide(); 1388 }); 1389 }); 1390 } 1391 opts.onStartLoading.call(this); 1392 // enable direct link using #slideshow-index 1393 if (! goToDirectSlide(window.location.hash)) { 1394 // default behavior 1395 nextSlide(); 1396 } 1397 goToDirectSlideWithLink(); 1398 loadThumbs(); 1399 1400 function loadThumbs() { 1401 if($(thumbs).length) { 1402 var thumbUrl; 1403 if(!$(pagination).length) { 1404 $(thumbs).append('<div />'); 1405 $(thumbs).before('<div class="camera_prevThumbs hideNav"><div></div></div>').before('<div class="camera_nextThumbs hideNav"><div></div></div>'); 1406 $('> div',thumbs).append('<ul />'); 1407 $('ul', thumbs).width(allThumbs.length * (parseInt(opts.thumbwidth)+2)); // added by ced1870 v1.3.5 1408 $('ul', thumbs).height(parseInt(opts.thumbheight)); // added by ced1870 v1.3.5 1409 ulthumbwidth = 0; // added by ced1870 v1.3.10 1410 $.each(allThumbs, function(i, val) { 1411 if($('> div[data-src]', elem).eq(i).attr('data-thumb')!='') { 1412 var thumbUrl = $('> div[data-src]', elem).eq(i).attr('data-thumb'), 1413 newImg = new Image(); 1414 newImg.src = thumbUrl; 1415 $('ul',thumbs).append('<li class="pix_thumb pix_thumb_'+i+'" />'); 1416 $('li.pix_thumb_'+i,thumbs).append($(newImg).attr('class','camera_thumb')); 1417 1418 if (opts.titleInThumbs && allCaptions[i]) { 1419 var title = allCaptions[i].clone(); 1420 title.find('.camera_caption_desc').remove(); 1421 title.css('display', ''); 1422 if (title) $('li.pix_thumb_'+i,thumbs).append(title); 1423 } 1424 ulthumbwidth += parseFloat($('li.pix_thumb_'+i,thumbs).outerWidth()) + parseFloat($('li.pix_thumb_'+i,thumbs).css('marginLeft')) + parseFloat($('li.pix_thumb_'+i,thumbs).css('marginRight')); // added by ced1870 v1.3.10 1425 } 1426 });
1427 $('ul', thumbs).width(ulthumbwidth); // added by ced1870 v1.3.10 1428 } else { 1429 $.each(allThumbs, function(i, val) { 1430 if($('> div[data-src]', elem).eq(i).attr('data-thumb')!='') { 1431 var thumbUrl = $('> div[data-src]', elem).eq(i).attr('data-thumb'), 1432 newImg = new Image(); 1433 newImg.src = thumbUrl; 1434 $('li.pag_nav_'+i,pagination).append($(newImg).attr('class','camera_thumb').css({'position':'absolute'}).animate({opacity:0},0)); 1435 $('li.pag_nav_'+i+' > img',pagination).after('<div class="thumb_arrow" />'); 1436 $('li.pag_nav_'+i+' > .thumb_arrow',pagination).animate({opacity:0},0); 1437 } 1438 }); 1439 wrap.css({marginBottom:$(pagination).outerHeight()}); 1440 } 1441 } else if(!$(thumbs).length && $(pagination).length) { 1442 wrap.css({marginBottom:$(pagination).outerHeight()}); 1443 } 1444 } 1445 1446 1447 var firstPos = true; 1448 1449 function thumbnailPos() { 1450 if($(thumbs).length && !$(pagination).length) { 1451 var wTh = $(thumbs).outerWidth(), 1452 owTh = $('ul > li',thumbs).outerWidth(), 1453 pos = $('li.cameracurrent', thumbs).length ? $('li.cameracurrent', thumbs).position() : '', 1454 ulW = ($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth()), 1455 offUl = $('ul', thumbs).offset().left, 1456 offDiv = $('> div', thumbs).offset().left, 1457 ulLeft; 1458 1459 if(offUl<0){ 1460 ulLeft = '-'+ (offDiv-offUl); 1461 } else { 1462 ulLeft = offDiv-offUl; 1463 } 1464 1465 1466 1467 if(firstPos == true) { 1468 // $('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth()); 1469 ulthumbwidth = 0; // added by ced1870 v1.3.10 1470 $.each(allThumbs, function(i, val) { // added by ced1870 v1.3.10 1471 ulthumbwidth += parseFloat($('li.pix_thumb_'+i,thumbs).outerWidth()) + parseFloat($('li.pix_thumb_'+i,thumbs).css('marginLeft')) + parseFloat($('li.pix_thumb_'+i,thumbs).css('marginRight')); 1472 }); 1473 $('ul', thumbs).width(ulthumbwidth + 2); // added by ced1870 v1.3.10 1474 if($(thumbs).length && !$(pagination).length) { 1475 wrap.css({paddingBottom:$(thumbs).outerHeight()}); 1476 } 1477 thumbnailVisible(); 1478 /*I repeat this two lines because of a problem with iPhones*/ 1479 // $('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth()); // removed by ced1870 v1.3.5 1480 if($(thumbs).length && !$(pagination).length) { 1481 wrap.css({paddingBottom:$(thumbs).outerHeight()}); 1482 } 1483 /*...*/ 1484 } 1485 firstPos = false; 1486 1487 var left = $('li.cameracurrent', thumbs).length ? pos.left : '', 1488 right = $('li.cameracurrent', thumbs).length ? pos.left+($('li.cameracurrent', thumbs).outerWidth()) : ''; 1489 if(left<$('li.cameracurrent', thumbs).outerWidth()) { 1490 left = 0; 1491 } 1492 // ced1870 dev 1493 //$(document.body).click(function(){$('ul', thumbs).animate({'margin-left':'-'+($('ul', thumbs).outerWidth())+'px'},500,thumbnailVisible);}); 1494 if(right-ulLeft>wTh){ 1495 if((left+wTh)<ulW){ 1496 $('ul', thumbs).animate({'margin-left':'-'+(left)+'px'},500,thumbnailVisible); 1497 } else { 1498 $('ul', thumbs).animate({'margin-left':'-'+($('ul', thumbs).outerWidth()-wTh)+'px'},500,thumbnailVisible); 1499 } 1500 } else if(left-ulLeft<0) { 1501 $('ul', thumbs).animate({'margin-left':'-'+(left)+'px'},500,thumbnailVisible); 1502 } else { 1503 $('ul', thumbs).css({'margin-left':'auto', 'margin-right':'auto'}); 1504 setTimeout(thumbnailVisible,100); 1505 } 1506 1507 } 1508 } 1509 1510 if($(commands).length) { 1511 $(commands).append('<div class="camera_play" role="button" tabindex="0" aria-label="' + Joomla.JText._('SLIDESHOWCK_PLAY') + '"></div>').append('<div class="camera_stop" role="button" tabindex="0" aria-label="' + Joomla.JText._('SLIDESHOWCK_PAUSE') + '"></div>'); 1512 if(autoAdv==true){ 1513 $('.camera_play',camera_thumbs_wrap).hide(); 1514 $('.camera_stop',camera_thumbs_wrap).show(); 1515 } else { 1516 $('.camera_stop',camera_thumbs_wrap).hide(); 1517 $('.camera_play',camera_thumbs_wrap).show(); 1518 } 1519 1520 } 1521 1522 1523 function canvasLoader() { 1524 rad = 0; 1525 var barWidth = $('.camera_bar_cont',camera_thumbs_wrap).width(), 1526 barHeight = $('.camera_bar_cont',camera_thumbs_wrap).height(); 1527 1528 if (loader != 'pie') { 1529 switch(barDirection){ 1530 case 'leftToRight': 1531 $('#'+pieID).css({'right':barWidth}
1531); 1532 break; 1533 case 'rightToLeft': 1534 $('#'+pieID).css({'left':barWidth}); 1535 break; 1536 case 'topToBottom': 1537 $('#'+pieID).css({'bottom':barHeight}); 1538 break; 1539 case 'bottomToTop': 1540 $('#'+pieID).css({'top':barHeight}); 1541 break; 1542 } 1543 } else { 1544 ctx.clearRect(0,0,opts.pieDiameter,opts.pieDiameter); 1545 } 1546 } 1547 1548 1549 canvasLoader(); 1550 1551 1552 $('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom',fakeHover).each(function(){ 1553 $(this).css('visibility','hidden'); 1554 }); 1555 1556 // opts.onStartLoading.call(this); 1557 1558 // nextSlide(); 1559 addLightbox(); 1560 1561 1562 /*************************** FUNCTION nextSlide() ***************************/ 1563 1564 function nextSlide(navSlide){ 1565 elem.addClass('camerasliding'); 1566 1567 videoPresent = false; 1568 var vis = parseFloat($('div.cameraSlide.cameracurrent',target).index()); 1569 1570 if(navSlide>0){ 1571 var slideI = navSlide-1; 1572 } else if (vis == amountSlide-1) { 1573 var slideI = 0; 1574 } else { 1575 var slideI = vis+1; 1576 } 1577 1578 // stop if there is only 1 image 1579 if (allImg.length === 1 && navSlide === 1 && opts.autoAdvance == true) return; 1580 1581 var slide = $('.cameraSlide:eq('+slideI+')',target); 1582 var slideNext = $('.cameraSlide:eq('+(slideI+1)+')',target).addClass('cameranext'); 1583 if( vis != slideI+1 ) { 1584 slideNext.hide(); 1585 } 1586 1587// $('.cameraContent',fakeHover).fadeOut(600); 1588 if (opts.captionOutEffect !== 'default') { 1589 $('.cameraContent',fakeHover).removeClass('cameravisible').fadeOut(opts.captionOutEffectTime); 1590 } else { 1591 $('.cameraContent',fakeHover).removeClass('cameravisible').hide(); 1592 } 1593 $('.camera_caption',fakeHover).show(); 1594 1595 $('.camerarelative',slide).append($('> div ',elem).eq(slideI).find('> div.camera_effected')); 1596 1597 $('.camera_target_content .cameraContent:eq('+slideI+')',wrap).append($('> div ',elem).eq(slideI).find('> div')); 1598 1599 if(!$('.imgLoaded',slide).length){ 1600 var imgUrl = allImg[slideI]; 1601 var imgLoaded = new Image(); 1602 // imgLoaded.src = imgUrl +"?"+ new Date().getTime(); 1603 imgLoaded.src = imgUrl; 1604 slide.css('visibility','hidden'); 1605 slide.prepend($(imgLoaded).attr('class','imgLoaded').css('visibility','hidden')); 1606 var wT, hT; 1607 if (!$(imgLoaded).get(0).complete || wT == '0' || hT == '0' || typeof wT === 'undefined' || wT === false || typeof hT === 'undefined' || hT === false) { 1608 $('.camera_loader',wrap).delay(500).fadeIn(400); 1609 imgLoaded.onload = function() { 1610 wT = imgLoaded.naturalWidth; 1611 hT = imgLoaded.naturalHeight; 1612 $(imgLoaded).attr('data-alignment',allAlign[slideI]).attr('data-portrait',allPor[slideI]); 1613 $(imgLoaded).attr('width',wT); 1614 $(imgLoaded).attr('height',hT); 1615 $(imgLoaded).attr('alt', (allAltText[slideI] ? allAltText[slideI] : allAlts[slideI]) ); 1616 target.find('.cameraSlide_'+slideI).css('visibility','visible'); 1617 resizeImage(); 1618 nextSlide(slideI+1); 1619 if($('.camera_loader',wrap).is(':visible')){ 1620 $('.camera_loader',wrap).fadeOut(400); 1621 } else { 1622 $('.camera_loader',wrap).css({'visibility':'hidden'}); 1623 $('.camera_loader',wrap).fadeOut(400,function(){ 1624 $('.camera_loader',wrap).css({'visibility':'visible'}); 1625 }); 1626 } 1627 }; 1628 } 1629 } else { 1630 if( allImg.length > (slideI+1) && !$('.imgLoaded',slideNext).length ){ 1631 var imgUrl2 = allImg[(slideI+1)]; 1632 var imgLoaded2 = new Image(); 1633 imgLoaded2.src = imgUrl2; 1634 slideNext.prepend($(imgLoaded2).attr('class','imgLoaded').css('visibility','hidden')); 1635 imgLoaded2.onload = function() { 1636 wT = imgLoaded2.naturalWidth; 1637 hT = imgLoaded2.naturalHeight; 1638 $(imgLoaded2).attr('data-alignment',allAlign[slideI+1]).attr('data-portrait',allPor[slideI+1]); 1639 $(imgLoaded2).attr('width',wT); 1640 $(imgLoaded2).attr('height',hT); 1641 $(imgLoaded2).attr('alt', (allAltText[slideI+1] ? allAltText[slideI+1] : allAlts[slideI+1]) ); 1642 resizeImage(); 1643 }; 1644 } 1645 opts.onLoaded.call(this); 1646 var rows = opts.rows,
1647 cols = opts.cols, 1648 couples = 1, 1649 difference = 0, 1650 dataSlideOn, 1651 time, 1652 transPeriod, 1653 fx, 1654 easing, 1655 randomFx = new Array('simpleFade','curtainTopLeft','curtainTopRight','curtainBottomLeft','curtainBottomRight','curtainSliceLeft','curtainSliceRight','blindCurtainTopLeft','blindCurtainTopRight','blindCurtainBottomLeft','blindCurtainBottomRight','blindCurtainSliceBottom','blindCurtainSliceTop','stampede','mosaic','mosaicReverse','mosaicRandom','mosaicSpiral','mosaicSpiralReverse','topLeftBottomRight','bottomRightTopLeft','bottomLeftTopRight','topRightBottomLeft','scrollLeft','scrollRight','scrollTop','scrollBottom','scrollHorz'); 1656 marginLeft = 0, 1657 marginTop = 0, 1658 opacityOnGrid = 0; 1659 1660 if(opts.opacityOnGrid==true){ 1661 opacityOnGrid = 0; 1662 } else { 1663 opacityOnGrid = 1; 1664 } 1665 1666 1667 1668 var dataFx = $(' > div',elem).eq(slideI).attr('data-fx'); 1669 1670 if(isMobile()&&opts.mobileFx!=''&&opts.mobileFx!='default'){ 1671 fx = opts.mobileFx; 1672 } else { 1673 if(typeof dataFx !== 'undefined' && dataFx!== false && dataFx!== 'default'){ 1674 fx = dataFx; 1675 } else { 1676 fx = opts.fx; 1677 } 1678 } 1679 1680 if(fx=='random') { 1681 fx = shuffle(randomFx); 1682 fx = fx[0]; 1683 } else { 1684 fx = fx; 1685 if(fx.indexOf(',')>0){ 1686 fx = fx.replace(/ /g,''); 1687 fx = fx.split(','); 1688 fx = shuffle(fx); 1689 fx = fx[0]; 1690 } 1691 } 1692 1693 dataEasing = $(' > div',elem).eq(slideI).attr('data-easing'); 1694 mobileEasing = $(' > div',elem).eq(slideI).attr('data-mobileEasing'); 1695 1696 if(isMobile()&&opts.mobileEasing!=''&&opts.mobileEasing!='default'){ 1697 if(typeof mobileEasing !== 'undefined' && mobileEasing!== false && mobileEasing!== 'default') { 1698 easing = mobileEasing; 1699 } else { 1700 easing = opts.mobileEasing; 1701 } 1702 } else { 1703 if(typeof dataEasing !== 'undefined' && dataEasing!== false && dataEasing!== 'default') { 1704 easing = dataEasing; 1705 } else { 1706 easing = opts.easing; 1707 } 1708 } 1709 1710 dataSlideOn = $(' > div',elem).eq(slideI).attr('data-slideOn'); 1711 if(typeof dataSlideOn !== 'undefined' && dataSlideOn!== false){ 1712 slideOn = dataSlideOn; 1713 } else { 1714 if(opts.slideOn=='random'){ 1715 var slideOn = new Array('next','prev'); 1716 slideOn = shuffle(slideOn); 1717 slideOn = slideOn[0]; 1718 } else { 1719 slideOn = opts.slideOn; 1720 } 1721 } 1722 1723 var dataTime = $(' > div',elem).eq(slideI).attr('data-time'); 1724 if(typeof dataTime !== 'undefined' && dataTime!== false && dataTime!== ''){ 1725 time = parseFloat(dataTime); 1726 } else { 1727 time = opts.time; 1728 } 1729 1730 var dataTransPeriod = $(' > div',elem).eq(slideI).attr('data-transPeriod'); 1731 if(typeof dataTransPeriod !== 'undefined' && dataTransPeriod!== false && dataTransPeriod!== ''){ 1732 transPeriod = parseFloat(dataTransPeriod); 1733 } else { 1734 transPeriod = opts.transPeriod; 1735 } 1736 1737 if(!$(elem).hasClass('camerastarted')){ 1738 if (fx != 'kenburns') fx = 'simpleFade'; 1739 slideOn = 'next'; 1740 easing = ''; 1741 transPeriod = 400; 1742 $(elem).addClass('camerastarted') 1743 } 1744 1745 switch(fx){ 1746 case 'simpleFade': 1747 cols = 1; 1748 rows = 1; 1749 break; 1750 case 'kenburns': 1751 cols = 1; 1752 rows = 1; 1753 break; 1754 case 'curtainTopLeft': 1755 if(opts.slicedCols == 0) { 1756 cols = opts.cols; 1757 } else { 1758 cols = opts.slicedCols; 1759 } 1760 rows = 1; 1761 break; 1762 case 'curtainTopRight': 1763 if(opts.slicedCols == 0) { 1764 cols = opts.cols; 1765 } else { 1766 cols = opts.slicedCols; 1767 } 1768 rows = 1; 1769 break; 1770 case 'curtainBottomLeft': 1771 if(opts.slicedCols == 0) { 1772 cols = opts.cols; 1773 } else { 1774 cols = opts.slicedCols; 1775 } 1776 rows = 1; 1777 break; 1778 case 'curtainBottomRight': 1779 if(opts.slicedCols == 0) { 1780 cols = opts.cols; 1781 } else { 1782 cols = opts.slicedCols; 1783 } 1784 rows = 1; 1785 break; 1786 case 'curtainSliceLeft': 1787 if(opts.slicedCols == 0) { 1788 cols = opts.cols; 1789 } else { 1790 cols = opts.slicedCols; 1791 } 1792 rows = 1; 1793 break; 1794 case 'curtainSliceRight': 1795 if(opts.slicedCols == 0) {
1796 cols = opts.cols; 1797 } else { 1798 cols = opts.slicedCols; 1799 } 1800 rows = 1; 1801 break; 1802 case 'blindCurtainTopLeft': 1803 if(opts.slicedRows == 0) { 1804 rows = opts.rows; 1805 } else { 1806 rows = opts.slicedRows; 1807 } 1808 cols = 1; 1809 break; 1810 case 'blindCurtainTopRight': 1811 if(opts.slicedRows == 0) { 1812 rows = opts.rows; 1813 } else { 1814 rows = opts.slicedRows; 1815 } 1816 cols = 1; 1817 break; 1818 case 'blindCurtainBottomLeft': 1819 if(opts.slicedRows == 0) { 1820 rows = opts.rows; 1821 } else { 1822 rows = opts.slicedRows; 1823 } 1824 cols = 1; 1825 break; 1826 case 'blindCurtainBottomRight': 1827 if(opts.slicedRows == 0) { 1828 rows = opts.rows; 1829 } else { 1830 rows = opts.slicedRows; 1831 } 1832 cols = 1; 1833 break; 1834 case 'blindCurtainSliceTop': 1835 if(opts.slicedRows == 0) { 1836 rows = opts.rows; 1837 } else { 1838 rows = opts.slicedRows; 1839 } 1840 cols = 1; 1841 break; 1842 case 'blindCurtainSliceBottom': 1843 if(opts.slicedRows == 0) { 1844 rows = opts.rows; 1845 } else { 1846 rows = opts.slicedRows; 1847 } 1848 cols = 1; 1849 break; 1850 case 'stampede': 1851 difference = '-'+transPeriod; 1852 break; 1853 case 'mosaic': 1854 difference = opts.gridDifference; 1855 break; 1856 case 'mosaicReverse': 1857 difference = opts.gridDifference; 1858 break; 1859 case 'mosaicRandom': 1860 break; 1861 case 'mosaicSpiral': 1862 difference = opts.gridDifference; 1863 couples = 1.7; 1864 break; 1865 case 'mosaicSpiralReverse': 1866 difference = opts.gridDifference; 1867 couples = 1.7; 1868 break; 1869 case 'topLeftBottomRight': 1870 difference = opts.gridDifference; 1871 couples = 6; 1872 break; 1873 case 'bottomRightTopLeft': 1874 difference = opts.gridDifference; 1875 couples = 6; 1876 break; 1877 case 'bottomLeftTopRight': 1878 difference = opts.gridDifference; 1879 couples = 6; 1880 break; 1881 case 'topRightBottomLeft': 1882 difference = opts.gridDifference; 1883 couples = 6; 1884 break; 1885 case 'scrollLeft': 1886 cols = 1; 1887 rows = 1; 1888 break; 1889 case 'scrollRight': 1890 cols = 1; 1891 rows = 1; 1892 break; 1893 case 'scrollTop': 1894 cols = 1; 1895 rows = 1; 1896 break; 1897 case 'scrollBottom': 1898 cols = 1; 1899 rows = 1; 1900 break; 1901 case 'scrollHorz': 1902 cols = 1; 1903 rows = 1; 1904 break; 1905 } 1906 1907 var cycle = 0; 1908 var blocks = rows*cols; 1909 var leftScrap = w-(Math.floor(w/cols)*cols); 1910 var topScrap = h-(Math.floor(h/rows)*rows); 1911 var addLeft; 1912 var addTop; 1913 var tAppW = 0; 1914 var tAppH = 0; 1915 var arr = new Array(); 1916 var delay = new Array(); 1917 var order = new Array(); 1918 while(cycle < blocks){ 1919 arr.push(cycle); 1920 delay.push(cycle); 1921 cameraCont.append('<div class="cameraappended" style="display:none; overflow:hidden; position:absolute; z-index:1000" />'); 1922 var tApp = $('.cameraappended:eq('+cycle+')',target); 1923 if(fx=='scrollLeft' || fx=='scrollRight' || fx=='scrollTop' || fx=='scrollBottom' || fx=='scrollHorz'){ 1924 selector.eq(slideI).clone().show().appendTo(tApp); 1925 } else if(fx != 'kenburns') { 1926 if(slideOn=='next'){ 1927 selector.eq(slideI).clone().show().appendTo(tApp); 1928 } else { 1929 selector.eq(vis).clone().show().appendTo(tApp); 1930 } 1931 } 1932 1933 if(cycle%cols<leftScrap){ 1934 addLeft = 1; 1935 } else { 1936 addLeft = 0; 1937 } 1938 if(cycle%cols==0){ 1939 tAppW = 0; 1940 } 1941 if(Math.floor(cycle/cols)<topScrap){ 1942 addTop = 1; 1943 } else { 1944 addTop = 0; 1945 } 1946 tApp.css({ 1947 'height': Math.floor((h/rows)+addTop+1), 1948 'left': tAppW, 1949 'top': tAppH, 1950 'width': Math.floor((w/cols)+addLeft+1) 1951 }); 1952 $('> .cameraSlide', tApp).css({ 1953 'height': h, 1954 'margin-left': '-'+tAppW+'px', 1955 'margin-top': '-'+tAppH+'px', 1956 'width': w 1957 }); 1958 tAppW = tAppW+tApp.width()-1; 1959 if(cycle%cols==cols-1){ 1960 tAppH = tAppH + tApp.height() - 1; 1961 } 1962 cycle++; 1963 } 1964 1965 1966 1967 switch(fx){ 1968 case 'curtainTopLeft': 1969 break; 1970 case 'curtainBottomLeft': 1971 break; 1972 case 'curtainSliceLeft': 1973 break; 1974 case 'curtainTopRight': 1975 arr = arr.reverse(); 1976 break; 1977 case 'curtainBottomRight': 1978 arr = arr.reverse(); 1979 break; 1980 case 'curtainSliceRight': 1981 arr = arr.reverse(); 1982 break; 1983 case 'blindCurtainTopLeft': 1984 break; 1985 case 'blindCurtainBottomLeft': 1986 arr = arr.reverse(); 1987 break; 1988 case 'blindCurtainSliceTop': 1989 break; 1990 case 'blindCurtainTopRight': 1991 break; 1992 case 'blindCurtainBottomRight': 1993 arr = arr.reverse(); 1994 break; 1995 case 'blindCurtainSliceBottom': 1996 arr = arr.reverse(); 1997 break; 1998 case 'stampede': 1999 arr = shuffle(arr); 2000 break; 2001 case 'mosaic': 2002 break; 2003 case 'mosaicReverse': 2004 arr = arr.reverse(); 2005 break; 2006 case 'mosaicRandom': 2007 arr = shuffle(arr); 2008 break; 2009 case 'mosaicSpiral': 2010 var rows2 = rows/2, x, y, z, n=0; 2011 for (z = 0; z < rows2; z++){ 2012 y = z; 2013 for (x = z; x < cols - z - 1; x++) { 2014 order[n++] = y * cols + x; 2015 } 2016 x = cols - z - 1; 2017 for (y = z; y < rows - z - 1; y++) { 2018 order[n++] = y * cols + x; 2019 } 2020 y = rows - z - 1; 2021 for (x = cols - z - 1; x > z; x--) { 2022 order[n++] = y * cols + x; 2023 } 2024 x = z; 2025 for (y = rows - z - 1; y > z; y--) { 2026 order[n++] = y * cols + x; 2027 } 2028 } 2029 2030 arr = order; 2031 2032 break; 2033 case 'mosaicSpiralReverse': 2034 var rows2 = rows/2, x, y, z, n=blocks-1; 2035 for (z = 0; z < rows2; z++){ 2036 y = z; 2037 for (x = z; x < cols - z - 1; x++) { 2038 order[n--] = y * cols + x; 2039 } 2040 x = cols - z - 1; 2041 for (y = z; y < rows - z - 1; y++) { 2042 order[n--] = y * cols + x; 2043 } 2044 y = rows - z - 1; 2045 for (x = cols - z - 1; x > z; x--) { 2046 order[n--] = y * cols + x; 2047 } 2048 x = z; 2049 for (y = rows - z - 1; y > z; y--) { 2050 order[n--] = y * cols + x; 2051 } 2052 } 2053 2054 arr = order; 2055 2056 break; 2057 case 'topLeftBottomRight': 2058 for (var y = 0; y < rows; y++) 2059 for (var x = 0; x < cols; x++) { 2060 order.push(x + y); 2061 }
2062 delay = order; 2063 break; 2064 case 'bottomRightTopLeft': 2065 for (var y = 0; y < rows; y++) 2066 for (var x = 0; x < cols; x++) { 2067 order.push(x + y); 2068 } 2069 delay = order.reverse(); 2070 break; 2071 case 'bottomLeftTopRight': 2072 for (var y = rows; y > 0; y--) 2073 for (var x = 0; x < cols; x++) { 2074 order.push(x + y); 2075 } 2076 delay = order; 2077 break; 2078 case 'topRightBottomLeft': 2079 for (var y = 0; y < rows; y++) 2080 for (var x = cols; x > 0; x--) { 2081 order.push(x + y); 2082 } 2083 delay = order; 2084 break; 2085 } 2086 2087 2088 2089 $.each(arr, function(index, value) { 2090 2091 if(value%cols<leftScrap){ 2092 addLeft = 1; 2093 } else { 2094 addLeft = 0; 2095 } 2096 if(value%cols==0){ 2097 tAppW = 0; 2098 } 2099 if(Math.floor(value/cols)<topScrap){ 2100 addTop = 1; 2101 } else { 2102 addTop = 0; 2103 } 2104 2105 switch(fx){ 2106 case 'simpleFade': 2107 height = h; 2108 width = w; 2109 opacityOnGrid = 0; 2110 break; 2111 case 'kenburns': 2112 height = h; 2113 width = w; 2114 opacityOnGrid = 0; 2115 break; 2116 case 'curtainTopLeft': 2117 height = 0, 2118 width = Math.floor((w/cols)+addLeft+1), 2119 marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px'; 2120 break; 2121 case 'curtainTopRight': 2122 height = 0, 2123 width = Math.floor((w/cols)+addLeft+1), 2124 marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px'; 2125 break; 2126 case 'curtainBottomLeft': 2127 height = 0, 2128 width = Math.floor((w/cols)+addLeft+1), 2129 marginTop = Math.floor((h/rows)+addTop+1)+'px'; 2130 break; 2131 case 'curtainBottomRight': 2132 height = 0, 2133 width = Math.floor((w/cols)+addLeft+1), 2134 marginTop = Math.floor((h/rows)+addTop+1)+'px'; 2135 break; 2136 case 'curtainSliceLeft': 2137 height = 0, 2138 width = Math.floor((w/cols)+addLeft+1); 2139 if(value%2==0){ 2140 marginTop = Math.floor((h/rows)+addTop+1)+'px'; 2141 } else { 2142 marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px'; 2143 } 2144 break; 2145 case 'curtainSliceRight': 2146 height = 0, 2147 width = Math.floor((w/cols)+addLeft+1); 2148 if(value%2==0){ 2149 marginTop = Math.floor((h/rows)+addTop+1)+'px'; 2150 } else { 2151 marginTop = '-'+Math.floor((h/rows)+addTop+1)+'px'; 2152 } 2153 break; 2154 case 'blindCurtainTopLeft': 2155 height = Math.floor((h/rows)+addTop+1), 2156 width = 0, 2157 marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px'; 2158 break; 2159 case 'blindCurtainTopRight': 2160 height = Math.floor((h/rows)+addTop+1), 2161 width = 0, 2162 marginLeft = Math.floor((w/cols)+addLeft+1)+'px'; 2163 break; 2164 case 'blindCurtainBottomLeft': 2165 height = Math.floor((h/rows)+addTop+1), 2166 width = 0, 2167 marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px'; 2168 break; 2169 case 'blindCurtainBottomRight': 2170 height = Math.floor((h/rows)+addTop+1), 2171 width = 0, 2172 marginLeft = Math.floor((w/cols)+addLeft+1)+'px'; 2173 break; 2174 case 'blindCurtainSliceBottom': 2175 height = Math.floor((h/rows)+addTop+1), 2176 width = 0; 2177 if(value%2==0){ 2178 marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px'; 2179 } else { 2180 marginLeft = Math.floor((w/cols)+addLeft+1)+'px'; 2181 } 2182 break; 2183 case 'blindCurtainSliceTop': 2184 height = Math.floor((h/rows)+addTop+1), 2185 width = 0; 2186 if(value%2==0){ 2187 marginLeft = '-'+Math.floor((w/cols)+addLeft+1)+'px'; 2188 } else { 2189 marginLeft = Math.floor((w/cols)+addLeft+1)+'px'; 2190 } 2191 break; 2192 case 'stampede': 2193 height = 0; 2194 width = 0; 2195 marginLeft = (w*0.2)*(((index)%cols)-(cols-(Math.floor(cols/2))))+'px'; 2196 marginTop = (h*0.2)*((Math.floor(index/cols)+1)-(rows-(Math.floor(rows/2))))+'px'; 2197 break; 2198 case 'mosaic': 2199 height = 0; 2200 width = 0; 2201 break; 2202 case 'mosaicReverse': 2203 height = 0; 2204 width = 0; 2205 marginLeft = Math.floor((w/cols)+addLeft+1)+'px'; 2206 marginTop = Math.floor((h/rows)+addTop+1)+'px'; 2207 break; 2208 case 'mosaicRandom': 2209 height = 0; 2210 width = 0; 2211 marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px'; 2212 marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px'; 2213 break; 2214 case 'mosaicSpiral': 2215 height = 0; 2216 width = 0; 2217 marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px'; 2218 marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px'; 2219 break; 2220 case 'mosaicSpiralReverse': 2221 height = 0; 2222 width = 0; 2223 marginLeft = Math.floor((w/cols)+addLeft+1)*0.5+'px'; 2224 marginTop = Math.floor((h/rows)+addTop+1)*0.5+'px'; 2225 break; 2226 case 'topLeftBottomRight': 2227 height = 0; 2228 width = 0; 2229 break; 2230 case 'bottomRightTopLeft': 2231 height = 0; 2232 width = 0; 2233 marginLeft = Math.floor((w/cols)+addLeft+1)+'px'; 2234 marginTop = Math.floor((h/rows)+addTop+1)+'px'; 2235 break; 2236 case 'bottomLeftTopRight': 2237 height = 0; 2238 width = 0; 2239 marginLeft = 0; 2240 marginTop = Math.floor((h/rows)+addTop+1)+'px'; 2241 break; 2242 case 'topRightBottomLeft': 2243 height = 0; 2244 width = 0; 2245 marginLeft = Math.floor((w/cols)+addLeft+1)+'px'; 2246 marginTop = 0; 2247 break; 2248 case 'scrollRight': 2249 height = h; 2250 width = w; 2251 marginLeft = -w; 2252 break; 2253 case 'scrollLeft': 2254 height = h; 2255 width = w; 2256 marginLeft = w; 2257 break; 2258 case 'scrollTop': 2259 height = h; 2260 width = w; 2261 marginTop = h; 2262 break; 2263 case 'scrollBottom': 2264 height = h; 2265 width = w; 2266 marginTop = -h; 2267 break; 2268 case 'scrollHorz': 2269 height = h; 2270 width = w; 2271 if(vis==0 && slideI==amountSlide-1) { 2272 marginLeft = -w; 2273 } else if(vis<slideI || (vis==amountSlide-1 && slideI==0)) { 2274 marginLeft = w; 2275 } else { 2276 marginLeft = -w; 2277 } 2278 break; 2279 } 2280 2281 2282 var tApp = $('.cameraappended:eq('+value+')',target); 2283 2284 if(typeof u !== 'undefined'){ 2285 clearInterval(u); 2286 clearTimeout(setT); 2287 setT = setTimeout(canvasLoader,transPeriod+difference); 2288 } 2289 2290 2291 if($(pagination).length){ 2292 $('.camera_pag li',wrap).removeClass('cameracurrent').removeAttr('aria-current'); 2293 $('.camera_pag li',wrap).eq(slideI).addClass('cameracurrent').attr('aria-current', 'true'); 2294 } 2295 2296 if($(thumbs).length){ 2297 $('li', thumbs).removeClass('cameracurrent').removeAttr('aria-current'); 2298 $('li', thumbs).eq(slideI).addClass('cameracurrent').attr('aria-current', 'true'); 2299 $('li', thumbs).not('.cameracurrent').find('img').animate({opacity:.5},0); 2300 $('li.cameracurrent img', thumbs).animate({opacity:1},0); 2301 $('li', thumbs).hover(function(){
2302 $('img',this).stop(true,false).animate({opacity:1},150); 2303 },function(){ 2304 if(!$(this).hasClass('cameracurrent')){ 2305 $('img',this).stop(true,false).animate({opacity:.5},150); 2306 } 2307 }); 2308 } 2309 2310 2311 var easedTime = parseFloat(transPeriod)+parseFloat(difference); 2312 2313 function cameraeased() { 2314$('.cameravisible').removeClass('cameravisible'); 2315 $(this).addClass('cameraeased'); 2316 if($('.cameraeased',target).length>=0){ 2317 $(thumbs).css({visibility:'visible'}); 2318 } 2319 if($('.cameraeased',target).length==blocks){ 2320 2321 thumbnailPos(); 2322 2323 $('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom',fakeHover).each(function(){ 2324 $(this).css('visibility','hidden'); 2325 }); 2326 2327 selector.eq(slideI).show().css('z-index','999').removeClass('cameranext').addClass('cameracurrent').attr('aria-current', 'true'); 2328 selector.eq(vis).css('z-index','1').removeClass('cameracurrent').removeAttr('aria-current'); 2329 $('.cameraContent',fakeHover).eq(slideI).addClass('cameracurrent').attr('aria-current', 'true'); 2330 if (vis >= 0) { 2331 $('.cameraContent',fakeHover).eq(vis).removeClass('cameracurrent').removeAttr('aria-current'); 2332 $('.cameraContent',fakeHover).eq(vis).find('.rowck, .blockck').removeClass('animateck'); 2333 } 2334 2335 opts.onEndTransition.call(this); 2336 2337 if($('> div[data-src]', elem).eq(slideI).attr('data-video')!='hide' && $('.cameraContent.cameracurrent .imgFake',fakeHover).length ){ 2338 $('.cameraContent.cameracurrent .imgFake',fakeHover).click(); 2339 var slideVideo = $('.cameraContent.cameracurrent video',fakeHover); 2340 if (slideVideo.length && slideVideo.attr('data-autoplay') && slideVideo.attr('data-autoplay') == '1') { 2341 $('.cameraContent.cameracurrent .imgFake',fakeHover).css('pointer-events','none'); 2342 slideVideo[0].volume = 0; 2343 slideVideo[0].play(); 2344// setTimeout(() => { 2345// slideVideo[0].volume = 1; 2346// }, "1000"); // ne marche pas, il faut attendre une intéraction utilisateur 2347// slideVideo.removeAttr('muted'); 2348 } 2349 } 2350 2351 2352 var lMoveIn = selector.eq(slideI).find('.fadeIn').length; 2353 var lMoveInContent = $('.cameraContent',fakeHover).eq(slideI).find('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom').length; 2354 2355 if (lMoveIn!=0){ 2356 $('.cameraSlide.cameracurrent .fadeIn',fakeHover).each(function(){ 2357 if($(this).attr('data-easing')!=''){ 2358 var easeMove = $(this).attr('data-easing'); 2359 } else { 2360 var easeMove = easing; 2361 } 2362 var t = $(this); 2363 if(typeof t.attr('data-outerWidth') === 'undefined' || t.attr('data-outerWidth') === false || t.attr('data-outerWidth') === '') { 2364 var wMoveIn = t.outerWidth(); 2365 t.attr('data-outerWidth',wMoveIn); 2366 } else { 2367 var wMoveIn = t.attr('data-outerWidth'); 2368 } 2369 if(typeof t.attr('data-outerHeight') === 'undefined' || t.attr('data-outerHeight') === false || t.attr('data-outerHeight') === '') { 2370 var hMoveIn = t.outerHeight(); 2371 t.attr('data-outerHeight',hMoveIn); 2372 } else { 2373 var hMoveIn = t.attr('data-outerHeight'); 2374 } 2375 //t.css('width',wMoveIn); 2376 var pos = t.position(); 2377 var left = pos.left; 2378 var top = pos.top; 2379 var tClass = t.attr('class'); 2380 var ind = t.index(); 2381 var hRel = t.parents('.camerarelative').outerHeight(); 2382 var wRel = t.parents('.camerarelative').outerWidth(); 2383 if(tClass.indexOf("fadeIn") != -1) { 2384 t.animate({opacity:0}
2384,0).css('visibility','visible').delay((time/lMoveIn)*(0.1*(ind-1))).animate({opacity:1},(time/lMoveIn)*0.15,easeMove); 2385 } else { 2386 t.css('visibility','visible'); 2387 } 2388 }); 2389 } 2390 2391 // compatibility with Page Builder CK animations 2392 $('.cameraContent.cameracurrent',fakeHover).show(0, function() {$(this).find('.rowck,.blockck').addClass('animateck');}).addClass('cameravisible'); 2393 2394 if (lMoveInContent!=0){ 2395 2396 $('.cameraContent.cameracurrent .moveFromLeft, .cameraContent.cameracurrent .moveFromRight, .cameraContent.cameracurrent .moveFromTop, .cameraContent.cameracurrent .moveFromBottom, .cameraContent.cameracurrent .fadeIn, .cameraContent.cameracurrent .fadeFromLeft, .cameraContent.cameracurrent .fadeFromRight, .cameraContent.cameracurrent .fadeFromTop, .cameraContent.cameracurrent .fadeFromBottom',fakeHover).each(function(){ 2397 if($(this).attr('data-easing')!=''){ 2398 var easeMove = $(this).attr('data-easing'); 2399 } else { 2400 var easeMove = easing; 2401 } 2402 var t = $(this); 2403 var pos = t.position(); 2404 var left = pos.left; 2405 var top = pos.top; 2406 var tClass = t.attr('class'); 2407 var ind = t.index(); 2408 var thisH = t.outerHeight(); 2409 var transfY = 0; 2410 var captionTime = opts.captionTime ? opts.captionTime : (time/lMoveInContent)*0.15; 2411 if (t.css('transform') && t.css('transform').split(',').length == 6) { 2412 transfY = parseFloat(t.css('transform').split(',')[5]); 2413 } 2414 if(tClass.indexOf("moveFromLeft") != -1) { 2415 t.css({'left':'-'+(w)+'px','right':'auto'}); 2416 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left},captionTime,easeMove); 2417 } else if(tClass.indexOf("moveFromRight") != -1) { 2418 t.css({'left':w+'px','right':'auto'}); 2419 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left},captionTime,easeMove); 2420 } else if(tClass.indexOf("moveFromTop") != -1) { 2421 t.css({'top':'-'+h+'px','bottom':'auto'}); 2422 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top - transfY},captionTime,easeMove,function(){ 2423 t.css({top:'auto',bottom:0}); 2424 }); 2425 } else if(tClass.indexOf("moveFromBottom") != -1) { 2426 t.css({'top':h+'px','bottom':'auto'}); 2427 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top - transfY},captionTime,easeMove); 2428 } else if(tClass.indexOf("fadeFromLeft") != -1) { 2429 t.animate({opacity:0}
2429,0).css({'left':'-'+(w)+'px','right':'auto'}); 2430 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},captionTime,easeMove); 2431 } else if(tClass.indexOf("fadeFromRight") != -1) { 2432 t.animate({opacity:0},0).css({'left':(w)+'px','right':'auto'}); 2433 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'left':pos.left,opacity:1},captionTime,easeMove); 2434 } else if(tClass.indexOf("fadeFromTop") != -1) { 2435 t.animate({opacity:0},0).css({'top':'-'+(h)+'px','bottom':'auto'}); 2436 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'top':pos.top - transfY,opacity:1},captionTime,easeMove,function(){ 2437 t.css({top:'auto',bottom:0}); 2438 }); 2439 } else if(tClass.indexOf("fadeFromBottom") != -1) { 2440 t.animate({opacity:0},0).css({'bottom':'-'+thisH+'px'}); 2441 t.css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({'bottom':'0',opacity:1},captionTime,easeMove); 2442 } else if(tClass.indexOf("fadeIn") != -1) { 2443 t.animate({opacity:0}
2443,0).css('visibility','visible').delay((time/lMoveInContent)*(0.1*(ind-1))).animate({opacity:1},captionTime,easeMove); 2444 } else { 2445 t.css('visibility','visible'); 2446 } 2447 }); 2448 } 2449 2450 2451 $('.cameraappended',target).remove(); 2452 elem.removeClass('camerasliding'); 2453 selector.eq(vis).hide(); 2454 var barWidth = $('.camera_bar_cont',camera_thumbs_wrap).width(), 2455 barHeight = $('.camera_bar_cont',camera_thumbs_wrap).height(), 2456 radSum; 2457 if (loader != 'pie') { 2458 radSum = 0.05; 2459 } else { 2460 radSum = 0.005; 2461 } 2462 $('#'+pieID).animate({opacity:opts.loaderOpacity},200); 2463 u = setInterval( 2464 function(){ 2465 if(elem.hasClass('stopped')){ 2466 clearInterval(u); 2467 } 2468 if (loader != 'pie') { 2469 if(rad<=1.002 && !elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')){ 2470 rad = (rad+radSum); 2471 } else if (rad<=1 && (elem.hasClass('stopped') || elem.hasClass('paused') || elem.hasClass('stopped') || elem.hasClass('hovered'))){ 2472 rad = rad; 2473 } else { 2474 if(!elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) { 2475 clearInterval(u); 2476 imgFake(); 2477 $('#'+pieID).animate({opacity:0}
2477,200,function(){ 2478 clearTimeout(setT); 2479 setT = setTimeout(canvasLoader,easedTime); 2480 nextSlide(); 2481 opts.onStartLoading.call(this); 2482 }); 2483 } 2484 } 2485 switch(barDirection){ 2486 case 'leftToRight': 2487 $('#'+pieID).animate({'right':barWidth-(barWidth*rad)},(time*radSum),'linear'); 2488 break; 2489 case 'rightToLeft': 2490 $('#'+pieID).animate({'left':barWidth-(barWidth*rad)},(time*radSum),'linear'); 2491 break; 2492 case 'topToBottom': 2493 $('#'+pieID).animate({'bottom':barHeight-(barHeight*rad)},(time*radSum),'linear'); 2494 break; 2495 case 'bottomToTop': 2496 $('#'+pieID).animate({'bottom':barHeight-(barHeight*rad)},(time*radSum),'linear'); 2497 break; 2498 } 2499 2500 } else { 2501 radNew = rad; 2502 ctx.clearRect(0,0,opts.pieDiameter,opts.pieDiameter); 2503 ctx.globalCompositeOperation = 'destination-over'; 2504 ctx.beginPath(); 2505 ctx.arc((opts.pieDiameter)/2, (opts.pieDiameter)/2, (opts.pieDiameter)/2-opts.loaderStroke,0,Math.PI*2,false); 2506 ctx.lineWidth = opts.loaderStroke; 2507 ctx.strokeStyle = opts.loaderBgColor; 2508 ctx.stroke(); 2509 ctx.closePath(); 2510 ctx.globalCompositeOperation = 'source-over'; 2511 ctx.beginPath(); 2512 ctx.arc((opts.pieDiameter)/2, (opts.pieDiameter)/2, (opts.pieDiameter)/2-opts.loaderStroke,0,Math.PI*2*radNew,false); 2513 ctx.lineWidth = opts.loaderStroke-(opts.loaderPadding*2); 2514 ctx.strokeStyle = opts.loaderColor; 2515 ctx.stroke(); 2516 ctx.closePath(); 2517 2518 if(rad<=1.002 && !elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')){ 2519 rad = (rad+radSum); 2520 } else if (rad<=1 && (elem.hasClass('stopped') || elem.hasClass('paused') || elem.hasClass('hovered'))){ 2521 rad = rad; 2522 } else { 2523 if(!elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) { 2524 clearInterval(u); 2525 imgFake(); 2526 $('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
2526,200,function(){ 2527 clearTimeout(setT); 2528 setT = setTimeout(canvasLoader,easedTime); 2529 nextSlide(); 2530 opts.onStartLoading.call(this); 2531 }); 2532 } 2533 } 2534 } 2535 },time*radSum 2536 ); 2537 } 2538 2539 } 2540 2541 2542 2543 if (fx != 'kenburns') { 2544 if(fx=='scrollLeft' || fx=='scrollRight' || fx=='scrollTop' || fx=='scrollBottom' || fx=='scrollHorz'){ 2545 opts.onStartTransition.call(this); 2546 easedTime = 0; 2547 tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({ 2548 'display' : 'block', 2549 'height': height, 2550 'margin-left': marginLeft, 2551 'margin-top': marginTop, 2552 'width': width 2553 }).animate({ 2554 'height': Math.floor((h/rows)+addTop+1), 2555 'margin-top' : 0, 2556 'margin-left' : 0, 2557 'width' : Math.floor((w/cols)+addLeft+1) 2558 },(transPeriod-difference),easing,cameraeased); 2559 selector.eq(vis).delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).animate({ 2560 'margin-left': marginLeft*(-1), 2561 'margin-top': marginTop*(-1) 2562 },(transPeriod-difference),easing,function(){ 2563 $(this).css({'margin-top' : 0,'margin-left' : 0}); 2564 }); 2565 } else { 2566 opts.onStartTransition.call(this); 2567 easedTime = parseFloat(transPeriod)+parseFloat(difference); 2568 if(slideOn=='next'){ 2569 tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({ 2570 'display' : 'block', 2571 'height': height, 2572 'margin-left': marginLeft, 2573 'margin-top': marginTop, 2574 'width': width, 2575 'opacity' : opacityOnGrid 2576 }).animate({ 2577 'height': Math.floor((h/rows)+addTop+1), 2578 'margin-top' : 0, 2579 'margin-left' : 0, 2580 'opacity' : 1, 2581 'width' : Math.floor((w/cols)+addLeft+1) 2582 },(transPeriod-difference),easing,cameraeased); 2583 } else { 2584 selector.eq(slideI).show().css('z-index','999').addClass('cameracurrent').attr('aria-current', 'true'); 2585 selector.eq(vis).css('z-index','1').removeClass('cameracurrent').removeAttr('aria-current'); 2586 $('.cameraContent',fakeHover).eq(slideI).addClass('cameracurrent').attr('aria-current', 'true'); 2587 $('.cameraContent',fakeHover).eq(vis).removeClass('cameracurrent').removeAttr('aria-current'); 2588 tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({ 2589 'display' : 'block', 2590 'height': Math.floor((h/rows)+addTop+1), 2591 'margin-top' : 0, 2592 'margin-left' : 0, 2593 'opacity' : 1, 2594 'width' : Math.floor((w/cols)+addLeft+1) 2595 }).animate({ 2596 'height': height, 2597 'margin-left': marginLeft, 2598 'margin-top': marginTop, 2599 'width': width, 2600 'opacity' : opacityOnGrid 2601 },(transPeriod-difference),easing,cameraeased); 2602 } 2603 } 2604 } else { 2605 opts.onStartTransition.call(this); 2606 easedTime = 0; 2607 tApp.delay((((transPeriod+difference)/blocks)*delay[index]*couples)*0.5).css({ 2608 'display' : 'block', 2609 'margin-left': marginLeft, 2610 'margin-top': marginTop, 2611 }).animate({ 2612 'margin-top' : 0, 2613 'margin-left' : 0, 2614 },(transPeriod-difference),easing,cameraeased); 2615 2616 // selector.eq(vis).animate({ 2617 // 'margin-left': '-50px', 2618 // 'margin-top': '-50px' 2619 // },(transPeriod-difference),easing,function(){ 2620 // $(this).css({'margin-top' : 0,'margin-left' : 0}); 2621 // }); 2622 var dirh = Math.random()<.5; 2623 if (dirh) { 2624 var left = '0'; 2625 var right = 'auto'; 2626 } else { 2627 var left = 'auto'; 2628 var right = '0'; 2629 } 2630 2631 var dirv = Math.random()<.5; 2632 if (dirv) { 2633 var top = '0'; 2634 var bottom = 'auto'; 2635 } else { 2636 var top = 'auto'; 2637 var bottom = '0'; 2638 } 2639 selector.eq(slideI).css({ 2640 'opacity': '0', 2641 'display' : 'block', 2642 'z-index': selector.eq(vis).css('z-index')+1, 2643 // 'margin-top' : '0', 2644 // 'margin-left' : '0', 2645 }).animate({ 2646 'opacity': '1', 2647 }, { 2648 duration: (transPeriod-difference), 2649 easing : 'linear', 2650 complete: function() { 2651 cameraeased(); 2652 // $( this ).after( "<div>Animation complete.</div>" ); 2653 }, 2654 start: function( now, fx ) { 2655 $(this).find('img').stop(true,true).css({ 2656 'width': '100%', 2657 'height': '100%', 2658 'margin-top' : '0', 2659 'margin-left' : '0', 2660 'left' : left, 2661 'right' : right, 2662 'top' : top, 2663 'bottom' : bottom, 2664 }).animate({ 2665 'width': '130%', 2666 'height': '130%', 2667 // 'margin-top' : '0', 2668 // 'margin-left' : '0', 2669 }, time*2); 2670 } 2671 });
2672 } 2673 2674 2675 2676 2677 2678 }); 2679 2680 2681 2682 2683 } 2684 } 2685 2686 2687 if ($(prevNav).length){ 2688 $(prevNav).on('click keypress', function(e){ 2689 if ((e.type == 'keypress' && e.which == 13) || e.type == 'click') { 2690 prev(); 2691 } 2692 }); 2693 } 2694 2695 2696 2697 if($(nextNav).length){ 2698 $(nextNav).on('click keypress', function(e){ 2699 if ((e.type == 'keypress' && e.which == 13) || e.type == 'click') { 2700 next(); 2701 } 2702 }); 2703 } 2704 2705 function prev() { 2706 if(!elem.hasClass('camerasliding')){ 2707 var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 2708 clearInterval(u); 2709 imgFake(); 2710 $('#'+pieID+', .camera_canvas_wrap',wrap).animate({opacity:0},0); 2711 canvasLoader(); 2712 if(idNum!=0){ 2713 nextSlide(idNum); 2714 } else { 2715 nextSlide(amountSlide); 2716 } 2717 opts.onStartLoading.call(this); 2718 } 2719 } 2720 2721 function next() { 2722 if(!elem.hasClass('camerasliding')){ 2723 var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 2724 clearInterval(u); 2725 imgFake(); 2726 $('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
2726,0); 2727 canvasLoader(); 2728 if(idNum==amountSlide-1){ 2729 nextSlide(1); 2730 } else { 2731 nextSlide(idNum+2); 2732 } 2733 opts.onStartLoading.call(this); 2734 } 2735 } 2736/*==================== Touch swipe functions =================*/ 2737 2738// method to get the touch device interaction 2739 // TOUCH-EVENTS SINGLE-FINGER SWIPE-SENSING JAVASCRIPT 2740 // Courtesy of PADILICIOUS.COM and MACOSXAUTOMATION.COM 2741 // win8 : MSPointerDown // TODO : check if it works 2742 2743 var triggerElementID = null; // this variable is used to identity the triggering element 2744 var fingerCount = 0; 2745 var startX = 0; 2746 var startY = 0; 2747 var curX = 0; 2748 var curY = 0; 2749 var deltaX = 0; 2750 var deltaY = 0; 2751 var horzDiff = 0; 2752 var vertDiff = 0; 2753 var minLength = 72; // the shortest distance the user may swipe 2754 var swipeLength = 0; 2755 var swipeAngle = null; 2756 var swipeDirection = null; 2757 var initialPosX = null; 2758 var initialPosY = null; 2759 var imageMarginLeft = 0; 2760 var imageMarginTop = 0; 2761 2762 // The 4 Touch Event Handlers 2763 2764 // NOTE: the touchStart handler should also receive the ID of the triggering element 2765 // make sure its ID is passed in the event call placed in the element declaration, like: 2766 2767 function touchStart(event) { 2768 // disable the standard ability to select the touched object 2769 // event.preventDefault(); 2770 // get the total number of fingers touching the screen 2771 fingerCount = event.touches.length; 2772 // since we're looking for a swipe (single finger) and not a gesture (multiple fingers), 2773 // check that only one finger was used 2774 if ( fingerCount == 1 ) { 2775 // get the coordinates of the touch 2776 startX = event.touches[0].pageX; 2777 startY = event.touches[0].pageY; 2778 // store the triggering element ID 2779 triggerElementID = ''; 2780 } else { 2781 // more than one finger touched so cancel 2782 touchCancel(event); 2783 } 2784 } 2785 2786 function touchMove(event) { 2787 // event.preventDefault(); 2788 if ( event.touches.length == 1 ) { 2789 curX = event.touches[0].pageX; 2790 curY = event.touches[0].pageY; 2791 } else { 2792 touchCancel(event); 2793 } 2794 } 2795 2796 function touchEnd(event) { 2797 // event.preventDefault(); 2798 // check to see if more than one finger was used and that there is an ending coordinate 2799 if ( fingerCount == 1 && curX != 0 ) { 2800 // use the Distance Formula to determine the length of the swipe 2801 swipeLength = Math.round(Math.sqrt(Math.pow(curX - startX,2) + Math.pow(curY - startY,2))); 2802 // if the user swiped more than the minimum length, perform the appropriate action 2803 if ( swipeLength >= minLength) { 2804 caluculateAngle(); 2805 determineSwipeDirection(); 2806 processingRoutine(); 2807 touchCancel(event); // reset the variables 2808 } else { 2809 touchCancel(event); 2810 } 2811 } else { 2812 touchCancel(event); 2813 } 2814 } 2815 2816 function touchCancel(event) { 2817 // reset the variables back to default values 2818 fingerCount = 0; 2819 startX = 0; 2820 startY = 0; 2821 curX = 0; 2822 curY = 0; 2823 deltaX = 0; 2824 deltaY = 0; 2825 horzDiff = 0; 2826 vertDiff = 0; 2827 swipeLength = 0; 2828 swipeAngle = null; 2829 swipeDirection = null; 2830 triggerElementID = null; 2831 initialPosX = null; 2832 initialPosY = null; 2833 } 2834 2835 function caluculateAngle() { 2836 var X = startX-curX; 2837 var Y = curY-startY; 2838 var Z = Math.round(Math.sqrt(Math.pow(X,2)+Math.pow(Y,2))); //the distance - rounded - in pixels 2839 var r = Math.atan2(Y,X); //angle in radians (Cartesian system) 2840 swipeAngle = Math.round(r*180/Math.PI); //angle in degrees 2841 if ( swipeAngle < 0 ) { swipeAngle = 360 - Math.abs(swipeAngle); } 2842 } 2843 2844 function determineSwipeDirection() { 2845 if ( (swipeAngle <= 45) && (swipeAngle >= 0) ) { 2846 swipeDirection = 'left'; 2847 } else if ( (swipeAngle <= 360) && (swipeAngle >= 315) ) { 2848 swipeDirection = 'left'; 2849 } else if ( (swipeAngle >= 135) && (swipeAngle <= 225) ) { 2850 swipeDirection = 'right'; 2851 } else if ( (swipeAngle > 45) && (swipeAngle < 135) ) { 2852 swipeDirection = 'down'; 2853 } else { 2854 swipeDirection = 'up'; 2855 } 2856 } 2857 2858 function processingRoutine() { 2859 if ( swipeDirection == 'left' ) { 2860 if(!elem.hasClass('camerasliding')){ 2861 var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 2862 clearInterval(u); 2863 imgFake(); 2864 $('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
2864,0); 2865 canvasLoader(); 2866 if(idNum==amountSlide-1){ 2867 nextSlide(1); 2868 } else { 2869 nextSlide(idNum+2); 2870 } 2871 opts.onStartLoading.call(this); 2872 } 2873 } else if ( swipeDirection == 'right' ) { 2874 if(!elem.hasClass('camerasliding')){ 2875 var idNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 2876 clearInterval(u); 2877 imgFake(); 2878 $('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0); 2879 canvasLoader(); 2880 if(idNum!=0){ 2881 nextSlide(idNum); 2882 } else { 2883 nextSlide(amountSlide); 2884 } 2885 opts.onStartLoading.call(this); 2886 } 2887 } 2888 } 2889 2890/*===================== End touch swipe =======================*/ 2891 2892 if(isMobile()){ 2893 fakeHover[0].addEventListener("touchstart", touchStart, false); 2894 fakeHover[0].addEventListener("touchmove", touchMove, false); 2895 fakeHover[0].addEventListener("touchend", touchEnd, false); 2896 fakeHover[0].addEventListener("touchcancel", touchCancel, false); 2897 } 2898 2899 if($(pagination).length){ 2900 $('.camera_pag li',wrap).on('click keypress', function(e){ 2901 if ((e.type == 'keypress' && e.which == 13) || e.type == 'click') { 2902 if(!elem.hasClass('camerasliding')){ 2903 var idNum = parseFloat($(this).index()); 2904 var curNum = parseFloat($('.cameraSlide.cameracurrent',target).index()); 2905 if(idNum!=curNum) { 2906 clearInterval(u); 2907 imgFake(); 2908 $('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0}
2908,0); 2909 canvasLoader(); 2910 nextSlide(idNum+1); 2911 opts.onStartLoading.call(this); 2912 } 2913 } 2914 } 2915 }); 2916 } 2917 2918 if($(thumbs).length) { 2919 2920 $('.pix_thumb img',thumbs).click(function(){ 2921 if(!elem.hasClass('camerasliding')){ 2922 var idNum = parseFloat($(this).parents('li').index()); 2923 var curNum = parseFloat($('.cameracurrent',target).index()); 2924 if(idNum!=curNum) { 2925 clearInterval(u); 2926 imgFake(); 2927 $('#'+pieID+', .camera_canvas_wrap',camera_thumbs_wrap).animate({opacity:0},0); 2928 $('.pix_thumb',thumbs).removeClass('cameracurrent').removeAttr('aria-current'); 2929 $(this).parents('li').addClass('cameracurrent').attr('aria-current', 'true'); 2930 canvasLoader(); 2931 nextSlide(idNum+1); 2932 thumbnailPos(); 2933 opts.onStartLoading.call(this); 2934 } 2935 } 2936 }); 2937 2938 $('.camera_thumbs_cont .camera_prevThumbs',camera_thumbs_wrap).hover(function(){ 2939 $(this).stop(true,false).animate({opacity:1},250); 2940 },function(){ 2941 $(this).stop(true,false).animate({opacity:.7},250); 2942 }); 2943 $('.camera_prevThumbs',camera_thumbs_wrap).click(function(){ 2944 var sum = 0, 2945 wTh = $(thumbs).outerWidth(), 2946 offUl = $('ul', thumbs).offset().left, 2947 offDiv = $('> div', thumbs).offset().left, 2948 ulLeft = offDiv-offUl; 2949 $('.camera_visThumb',thumbs).each(function(){ 2950 var tW = $(this).outerWidth(); 2951 sum = sum+tW; 2952 }); 2953 if(ulLeft-sum>0){ 2954 $('ul', thumbs).animate({'margin-left':'-'+(ulLeft-sum)+'px'},500,thumbnailVisible); 2955 } else { 2956 $('ul', thumbs).animate({'margin-left':0},500,thumbnailVisible); 2957 } 2958 }); 2959 2960 $('.camera_thumbs_cont .camera_nextThumbs',camera_thumbs_wrap).hover(function(){ 2961 $(this).stop(true,false).animate({opacity:1},250); 2962 },function(){ 2963 $(this).stop(true,false).animate({opacity:.7},250); 2964 }); 2965 $('.camera_nextThumbs',camera_thumbs_wrap).click(function(){ 2966 var sum = 0, 2967 wTh = $(thumbs).outerWidth(), 2968 ulW = $('ul', thumbs).outerWidth(), 2969 offUl = $('ul', thumbs).offset().left, 2970 offDiv = $('> div', thumbs).offset().left, 2971 ulLeft = offDiv-offUl; 2972 $('.camera_visThumb',thumbs).each(function(){ 2973 var tW = $(this).outerWidth(); 2974 sum = sum+tW; 2975 }); 2976 if(ulLeft+sum+sum<ulW){ 2977 $('ul', thumbs).animate({'margin-left':'-'+(ulLeft+sum)+'px'},500,thumbnailVisible); 2978 } else { 2979 $('ul', thumbs).animate({'margin-left':'-'+(ulW-wTh)+'px'},500,thumbnailVisible); 2980 } 2981 }); 2982 2983 } 2984 2985} 2986 2987window.Slideshowck = Slideshowck; 2988})(jQuery); 2989 2990;(function($){$.fn.cameraStop = function() { 2991 var wrap = $(this), 2992 elem = $('.camera_src',wrap), 2993 pieID = 'pie_'+wrap.index(); 2994 elem.addClass('stopped'); 2995 if($('.camera_showcommands').length) { 2996 var camera_thumbs_wrap = $('.camera_thumbs_wrap',wrap); 2997 } else { 2998 var camera_thumbs_wrap = wrap; 2999 } 3000} 3001})(jQuery); 3002 3003;(function($){$.fn.cameraPause = function() { 3004 var wrap = $(this); 3005 var elem = $('.camera_src',wrap); 3006 elem.addClass('paused'); 3007} 3008})(jQuery); 3009 3010;(function($){$.fn.cameraResume = function() { 3011 var wrap = $(this); 3012 var elem = $('.camera_src',wrap); 3013 if(typeof autoAdv === 'undefined' || autoAdv!==true){ 3014 elem.removeClass('paused'); 3015 } 3016} 3017})(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.