1/*! PhotoSwipe Default UI - 4.1.2 - 2017-04-05 2* http://photoswipe.com 3* Copyright (c) 2017 Dmitry Semenov; */ 4/** 5* 6* UI on top of main sliding area (caption, arrows, close button, etc.). 7* Built just using public methods/properties of PhotoSwipe. 8* 9*/ 10(function (root, factory) { 11 if (typeof define === 'function' && define.amd) { 12 define(factory); 13 } else if (typeof exports === 'object') { 14 module.exports = factory(); 15 } else { 16 root.PhotoSwipeUI_Default = factory(); 17 } 18})(this, function () { 19 20 'use strict'; 21 22 23 24var PhotoSwipeUI_Default = 25 function(pswp, framework) { 26 27 var ui = this; 28 var _overlayUIUpdated = false, 29 _controlsVisible = true, 30 _fullscrenAPI, 31 _controls, 32 _captionContainer, 33 _fakeCaptionContainer, 34 _indexIndicator, 35 _shareButton, 36 _shareModal, 37 _shareModalHidden = true, 38 _initalCloseOnScrollValue, 39 _isIdle, 40 _listen, 41 42 _loadingIndicator, 43 _loadingIndicatorHidden, 44 _loadingIndicatorTimeout, 45 46 _galleryHasOneSlide, 47 48 _options, 49 _defaultUIOptions = { 50 barsSize: {top:44, bottom:'auto'}, 51 closeElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'], 52 timeToIdle: 4000, 53 timeToIdleOutside: 1000, 54 loadingIndicatorDelay: 1000, // 2s 55 56 addCaptionHTMLFn: function(item, captionEl /*, isFake */) { 57 if(!item.title) { 58 captionEl.children[0].innerHTML = ''; 59 return false; 60 } 61 captionEl.children[0].innerHTML = item.title; 62 return true; 63 }, 64 65 closeEl:true, 66 captionEl: true, 67 fullscreenEl: true, 68 zoomEl: true, 69 shareEl: true, 70 counterEl: true, 71 arrowEl: true, 72 preloaderEl: true, 73 74 tapToClose: false, 75 tapToToggleControls: true, 76 77 clickToCloseNonZoomable: true, 78 79 shareButtons: [ 80 {id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'}, 81 {id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'}, 82 {id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/'+ 83 '?url={{url}}&media={{image_url}}&description={{text}}'}, 84 {id:'download', label:'Download image', url:'{{raw_image_url}}', download:true} 85 ], 86 getImageURLForShare: function( /* shareButtonData */ ) { 87 return pswp.currItem.src || ''; 88 }, 89 getPageURLForShare: function( /* shareButtonData */ ) { 90 return window.location.href; 91 }, 92 getTextForShare: function( /* shareButtonData */ ) { 93 return pswp.currItem.title || ''; 94 }, 95 96 indexIndicatorSep: ' / ', 97 fitControlsWidth: 1200 98 99 }, 100 _blockControlsTap, 101 _blockControlsTapTimeout; 102 103 104 105 var _onControlsTap = function(e) { 106 if(_blockControlsTap) { 107 return true; 108 } 109 110 111 e = e || window.event; 112 113 if(_options.timeToIdle && _options.mouseUsed && !_isIdle) { 114 // reset idle timer 115 _onIdleMouseMove(); 116 } 117 118 119 var target = e.target || e.srcElement, 120 uiElement, 121 clickedClass = target.getAttribute('class') || '', 122 found; 123 124 for(var i = 0; i < _uiElements.length; i++) { 125 uiElement = _uiElements[i]; 126 if(uiElement.onTap && clickedClass.indexOf('pswp__' + uiElement.name ) > -1 ) { 127 uiElement.onTap(); 128 found = true; 129 130 } 131 } 132 133 if(found) { 134 if(e.stopPropagation) { 135 e.stopPropagation(); 136 } 137 _blockControlsTap = true; 138 139 // Some versions of Android don't prevent ghost click event 140 // when preventDefault() was called on touchstart and/or touchend. 141 // 142 // This happens on v4.3, 4.2, 4.1, 143 // older versions strangely work correctly, 144 // but just in case we add delay on all of them) 145 var tapDelay = framework.features.isOldAndroid ? 600 : 30; 146 _blockControlsTapTimeout = setTimeout(function() { 147 _blockControlsTap = false; 148 }, tapDelay); 149 } 150 151 }, 152 _fitControlsInViewport = function() { 153 return !pswp.likelyTouchDevice || _options.mouseUsed || screen.width > _options.fitControlsWidth; 154 }, 155 _togglePswpClass = function(el, cName, add) { 156 framework[ (add ? 'add' : 'remove') + 'Class' ](el, 'pswp__' + cName); 157 }, 158 159 // add class when there is just one item in the gallery 160 // (by default it hides left/right arrows and 1ofX counter) 161 _countNumItems = function() { 162 var hasOneSlide = (_options.getNumItemsFn() === 1); 163 164 if(hasOneSlide !== _galleryHasOneSlide) { 165 _togglePswpClass(_controls, 'ui--one-slide', hasOneSlide); 166 _galleryHasOneSlide = hasOneSlide; 167 } 168 }, 169 _toggleShareModalClass = function() { 170 _togglePswpClass(_shareModal, 'share-modal--hidden', _shareModalHidden); 171 }, 172 _toggleShareModal = function() { 173 174 _shareModalHidden = !_shareModalHidden; 175 176 177 if(!_shareModalHidden) { 178 _toggleShareModalClass(); 179 setTimeout(function() { 180 if(!_shareModalHidden) { 181 framework.addClass(_shareModal, 'pswp__share-modal--fade-in'); 182 } 183 }, 30); 184 } else { 185 framework.removeClass(_shareModal, 'pswp__share-modal--fade-in'); 186 setTimeout(function() { 187 if(_shareModalHidden) { 188 _toggleShareModalClass(); 189 } 190 }, 300); 191 } 192 193 if(!_shareModalHidden) { 194 _updateShareURLs(); 195 } 196 return false;
197 }, 198 199 _openWindowPopup = function(e) { 200 e = e || window.event; 201 var target = e.target || e.srcElement; 202 203 pswp.shout('shareLinkClick', e, target); 204 205 if(!target.href) { 206 return false; 207 } 208 209 if( target.hasAttribute('download') ) { 210 return true; 211 } 212 213 window.open(target.href, 'pswp_share', 'scrollbars=yes,resizable=yes,toolbar=no,'+ 214 'location=yes,width=550,height=420,top=100,left=' + 215 (window.screen ? Math.round(screen.width / 2 - 275) : 100) ); 216 217 if(!_shareModalHidden) { 218 _toggleShareModal(); 219 } 220 221 return false; 222 }, 223 _updateShareURLs = function() { 224 var shareButtonOut = '', 225 shareButtonData, 226 shareURL, 227 image_url, 228 page_url, 229 share_text; 230 231 for(var i = 0; i < _options.shareButtons.length; i++) { 232 shareButtonData = _options.shareButtons[i]; 233 234 image_url = _options.getImageURLForShare(shareButtonData); 235 page_url = _options.getPageURLForShare(shareButtonData); 236 share_text = _options.getTextForShare(shareButtonData); 237 238 shareURL = shareButtonData.url.replace('{{url}}', encodeURIComponent(page_url) ) 239 .replace('{{image_url}}', encodeURIComponent(image_url) ) 240 .replace('{{raw_image_url}}', image_url ) 241 .replace('{{text}}', encodeURIComponent(share_text) ); 242 243 shareButtonOut += '<a href="' + shareURL + '" target="_blank" '+ 244 'class="pswp__share--' + shareButtonData.id + '"' + 245 (shareButtonData.download ? 'download' : '') + '>' + 246 shareButtonData.label + '</a>'; 247 248 if(_options.parseShareButtonOut) { 249 shareButtonOut = _options.parseShareButtonOut(shareButtonData, shareButtonOut); 250 } 251 } 252 _shareModal.children[0].innerHTML = shareButtonOut; 253 _shareModal.children[0].onclick = _openWindowPopup; 254 255 }, 256 _hasCloseClass = function(target) { 257 for(var i = 0; i < _options.closeElClasses.length; i++) { 258 if( framework.hasClass(target, 'pswp__' + _options.closeElClasses[i]) ) { 259 return true; 260 } 261 } 262 }, 263 _idleInterval, 264 _idleTimer, 265 _idleIncrement = 0, 266 _onIdleMouseMove = function() { 267 clearTimeout(_idleTimer); 268 _idleIncrement = 0; 269 if(_isIdle) { 270 ui.setIdle(false); 271 } 272 }, 273 _onMouseLeaveWindow = function(e) { 274 e = e ? e : window.event; 275 var from = e.relatedTarget || e.toElement; 276 if (!from || from.nodeName === 'HTML') { 277 clearTimeout(_idleTimer); 278 _idleTimer = setTimeout(function() { 279 ui.setIdle(true); 280 }, _options.timeToIdleOutside); 281 } 282 }, 283 _setupFullscreenAPI = function() { 284 if(_options.fullscreenEl && !framework.features.isOldAndroid) { 285 if(!_fullscrenAPI) { 286 _fullscrenAPI = ui.getFullscreenAPI(); 287 } 288 if(_fullscrenAPI) { 289 framework.bind(document, _fullscrenAPI.eventK, ui.updateFullscreen); 290 ui.updateFullscreen(); 291 framework.addClass(pswp.template, 'pswp--supports-fs'); 292 } else { 293 framework.removeClass(pswp.template, 'pswp--supports-fs'); 294 } 295 } 296 }, 297 _setupLoadingIndicator = function() { 298 // Setup loading indicator 299 if(_options.preloaderEl) { 300 301 _toggleLoadingIndicator(true); 302 303 _listen('beforeChange', function() { 304 305 clearTimeout(_loadingIndicatorTimeout); 306 307 // display loading indicator with delay 308 _loadingIndicatorTimeout = setTimeout(function() { 309 310 if(pswp.currItem && pswp.currItem.loading) { 311 312 if( !pswp.allowProgressiveImg() || (pswp.currItem.img && !pswp.currItem.img.naturalWidth) ) { 313 // show preloader if progressive loading is not enabled, 314 // or image width is not defined yet (because of slow connection) 315 _toggleLoadingIndicator(false); 316 // items-controller.js function allowProgressiveImg 317 } 318 319 } else { 320 _toggleLoadingIndicator(true); // hide preloader 321 } 322 323 }, _options.loadingIndicatorDelay); 324 325 }); 326 _listen('imageLoadComplete', function(index, item) { 327 if(pswp.currItem === item) { 328 _toggleLoadingIndicator(true); 329 } 330 }); 331 332 } 333 }, 334 _toggleLoadingIndicator = function(hide) { 335 if( _loadingIndicatorHidden !== hide ) { 336 _togglePswpClass(_loadingIndicator, 'preloader--active', !hide); 337 _loadingIndicatorHidden = hide; 338 } 339 }, 340 _applyNavBarGaps = function(item) { 341 var gap = item.vGap; 342 343 if( _fitControlsInViewport() ) { 344 345 var bars = _options.barsSize; 346 if(_options.captionEl && bars.bottom === 'auto') { 347 if(!_fakeCaptionContainer) { 348 _fakeCaptionContainer = framework.createEl('pswp__caption pswp__caption--fake'); 349 _fakeCaptionContainer.appendChild( framework.createEl('pswp__caption__center') ); 350 _controls.insertBefore(_fakeCaptionContainer, _captionContainer); 351 framework.addClass(_controls, 'pswp__ui--fit'); 352 } 353 if( _options.addCaptionHTMLFn(item, _fakeCaptionContainer, true) ) { 354 355 var captionSize = _fakeCaptionContainer.clientHeight; 356 gap.bottom = parseInt(captionSize,10) || 44; 357 } else { 358 gap.bottom = bars.top;
358 // if no caption, set size of bottom gap to size of top 359 } 360 } else { 361 gap.bottom = bars.bottom === 'auto' ? 0 : bars.bottom; 362 } 363 364 // height of top bar is static, no need to calculate it 365 gap.top = bars.top; 366 } else { 367 gap.top = gap.bottom = 0; 368 } 369 }, 370 _setupIdle = function() { 371 // Hide controls when mouse is used 372 if(_options.timeToIdle) { 373 _listen('mouseUsed', function() { 374 375 framework.bind(document, 'mousemove', _onIdleMouseMove); 376 framework.bind(document, 'mouseout', _onMouseLeaveWindow); 377 378 _idleInterval = setInterval(function() { 379 _idleIncrement++; 380 if(_idleIncrement === 2) { 381 ui.setIdle(true); 382 } 383 }, _options.timeToIdle / 2); 384 }); 385 } 386 }, 387 _setupHidingControlsDuringGestures = function() { 388 389 // Hide controls on vertical drag 390 _listen('onVerticalDrag', function(now) { 391 if(_controlsVisible && now < 0.95) { 392 ui.hideControls(); 393 } else if(!_controlsVisible && now >= 0.95) { 394 ui.showControls(); 395 } 396 }); 397 398 // Hide controls when pinching to close 399 var pinchControlsHidden; 400 _listen('onPinchClose' , function(now) { 401 if(_controlsVisible && now < 0.9) { 402 ui.hideControls(); 403 pinchControlsHidden = true; 404 } else if(pinchControlsHidden && !_controlsVisible && now > 0.9) { 405 ui.showControls(); 406 } 407 }); 408 409 _listen('zoomGestureEnded', function() { 410 pinchControlsHidden = false; 411 if(pinchControlsHidden && !_controlsVisible) { 412 ui.showControls(); 413 } 414 }); 415 416 }; 417 418 419 420 var _uiElements = [ 421 { 422 name: 'caption', 423 option: 'captionEl', 424 onInit: function(el) { 425 _captionContainer = el; 426 } 427 }, 428 { 429 name: 'share-modal', 430 option: 'shareEl', 431 onInit: function(el) { 432 _shareModal = el; 433 }, 434 onTap: function() { 435 _toggleShareModal(); 436 } 437 }, 438 { 439 name: 'button--share', 440 option: 'shareEl', 441 onInit: function(el) { 442 _shareButton = el; 443 }, 444 onTap: function() { 445 _toggleShareModal(); 446 } 447 }, 448 { 449 name: 'button--zoom', 450 option: 'zoomEl', 451 onTap: pswp.toggleDesktopZoom 452 }, 453 { 454 name: 'counter', 455 option: 'counterEl', 456 onInit: function(el) { 457 _indexIndicator = el; 458 } 459 }, 460 { 461 name: 'button--close', 462 option: 'closeEl', 463 onTap: pswp.close 464 }, 465 { 466 name: 'button--arrow--left', 467 option: 'arrowEl', 468 onTap: pswp.prev 469 }, 470 { 471 name: 'button--arrow--right', 472 option: 'arrowEl', 473 onTap: pswp.next 474 }, 475 { 476 name: 'button--fs', 477 option: 'fullscreenEl', 478 onTap: function() { 479 if(_fullscrenAPI.isFullscreen()) { 480 _fullscrenAPI.exit(); 481 } else { 482 _fullscrenAPI.enter(); 483 } 484 } 485 }, 486 { 487 name: 'preloader', 488 option: 'preloaderEl', 489 onInit: function(el) { 490 _loadingIndicator = el; 491 } 492 } 493 494 ]; 495 496 var _setupUIElements = function() { 497 var item, 498 classAttr, 499 uiElement; 500 501 var loopThroughChildElements = function(sChildren) { 502 if(!sChildren) { 503 return; 504 } 505 506 var l = sChildren.length; 507 for(var i = 0; i < l; i++) { 508 item = sChildren[i]; 509 classAttr = item.className; 510 511 for(var a = 0; a < _uiElements.length; a++) { 512 uiElement = _uiElements[a]; 513 514 if(classAttr.indexOf('pswp__' + uiElement.name) > -1 ) { 515 516 if( _options[uiElement.option] ) { // if element is not disabled from options 517 518 framework.removeClass(item, 'pswp__element--disabled'); 519 if(uiElement.onInit) { 520 uiElement.onInit(item); 521 } 522 523 //item.style.display = 'block'; 524 } else { 525 framework.addClass(item, 'pswp__element--disabled'); 526 //item.style.display = 'none'; 527 } 528 } 529 } 530 } 531 }; 532 loopThroughChildElements(_controls.children); 533 534 var topBar = framework.getChildByClass(_controls, 'pswp__top-bar'); 535 if(topBar) { 536 loopThroughChildElements( topBar.children ); 537 } 538 }; 539 540 541 542 543 ui.init = function() { 544 545 // extend options 546 framework.extend(pswp.options, _defaultUIOptions, true); 547 548 // create local link for fast access 549 _options = pswp.options; 550 551 // find pswp__ui element 552 _controls = framework.getChildByClass(pswp.scrollWrap, 'pswp__ui'); 553 554 // create local link 555 _listen = pswp.listen; 556 557 558 _setupHidingControlsDuringGestures(); 559 560 // update controls when slides change 561 _listen('beforeChange', ui.update); 562 563 // toggle zoom on double-tap 564 _listen('doubleTap', function(point) {
565 var initialZoomLevel = pswp.currItem.initialZoomLevel; 566 if(pswp.getZoomLevel() !== initialZoomLevel) { 567 pswp.zoomTo(initialZoomLevel, point, 333); 568 } else { 569 pswp.zoomTo(_options.getDoubleTapZoom(false, pswp.currItem), point, 333); 570 } 571 }); 572 573 // Allow text selection in caption 574 _listen('preventDragEvent', function(e, isDown, preventObj) { 575 var t = e.target || e.srcElement; 576 if( 577 t && 578 t.getAttribute('class') && e.type.indexOf('mouse') > -1 && 579 ( t.getAttribute('class').indexOf('__caption') > 0 || (/(SMALL|STRONG|EM)/i).test(t.tagName) ) 580 ) { 581 preventObj.prevent = false; 582 } 583 }); 584 585 // bind events for UI 586 _listen('bindEvents', function() { 587 framework.bind(_controls, 'pswpTap click', _onControlsTap); 588 framework.bind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap); 589 590 if(!pswp.likelyTouchDevice) { 591 framework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver); 592 } 593 }); 594 595 // unbind events for UI 596 _listen('unbindEvents', function() { 597 if(!_shareModalHidden) { 598 _toggleShareModal(); 599 } 600 601 if(_idleInterval) { 602 clearInterval(_idleInterval); 603 } 604 framework.unbind(document, 'mouseout', _onMouseLeaveWindow); 605 framework.unbind(document, 'mousemove', _onIdleMouseMove); 606 framework.unbind(_controls, 'pswpTap click', _onControlsTap); 607 framework.unbind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap); 608 framework.unbind(pswp.scrollWrap, 'mouseover', ui.onMouseOver); 609 610 if(_fullscrenAPI) { 611 framework.unbind(document, _fullscrenAPI.eventK, ui.updateFullscreen); 612 if(_fullscrenAPI.isFullscreen()) { 613 _options.hideAnimationDuration = 0; 614 _fullscrenAPI.exit(); 615 } 616 _fullscrenAPI = null; 617 } 618 }); 619 620 621 // clean up things when gallery is destroyed 622 _listen('destroy', function() { 623 if(_options.captionEl) { 624 if(_fakeCaptionContainer) { 625 _controls.removeChild(_fakeCaptionContainer); 626 } 627 framework.removeClass(_captionContainer, 'pswp__caption--empty'); 628 } 629 630 if(_shareModal) { 631 _shareModal.children[0].onclick = null; 632 } 633 framework.removeClass(_controls, 'pswp__ui--over-close'); 634 framework.addClass( _controls, 'pswp__ui--hidden'); 635 ui.setIdle(false); 636 }); 637 638 639 if(!_options.showAnimationDuration) { 640 framework.removeClass( _controls, 'pswp__ui--hidden'); 641 } 642 _listen('initialZoomIn', function() { 643 if(_options.showAnimationDuration) { 644 framework.removeClass( _controls, 'pswp__ui--hidden'); 645 } 646 }); 647 _listen('initialZoomOut', function() { 648 framework.addClass( _controls, 'pswp__ui--hidden'); 649 }); 650 651 _listen('parseVerticalMargin', _applyNavBarGaps); 652 653 _setupUIElements(); 654 655 if(_options.shareEl && _shareButton && _shareModal) { 656 _shareModalHidden = true; 657 } 658 659 _countNumItems(); 660 661 _setupIdle(); 662 663 _setupFullscreenAPI(); 664 665 _setupLoadingIndicator(); 666 }; 667 668 ui.setIdle = function(isIdle) { 669 _isIdle = isIdle; 670 _togglePswpClass(_controls, 'ui--idle', isIdle); 671 }; 672 673 ui.update = function() { 674 // Don't update UI if it's hidden 675 if(_controlsVisible && pswp.currItem) { 676 677 ui.updateIndexIndicator(); 678 679 if(_options.captionEl) { 680 _options.addCaptionHTMLFn(pswp.currItem, _captionContainer); 681 682 _togglePswpClass(_captionContainer, 'caption--empty', !pswp.currItem.title); 683 } 684 685 _overlayUIUpdated = true; 686 687 } else { 688 _overlayUIUpdated = false; 689 } 690 691 if(!_shareModalHidden) { 692 _toggleShareModal(); 693 } 694 695 _countNumItems(); 696 }; 697 698 ui.updateFullscreen = function(e) { 699 700 if(e) { 701 // some browsers change window scroll position during the fullscreen 702 // so PhotoSwipe updates it just in case 703 setTimeout(function() { 704 pswp.setScrollOffset( 0, framework.getScrollY() ); 705 }, 50); 706 } 707 708 // toogle pswp--fs class on root element 709 framework[ (_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class' ](pswp.template, 'pswp--fs'); 710 }; 711 712 ui.updateIndexIndicator = function() { 713 if(_options.counterEl) { 714 _indexIndicator.innerHTML = (pswp.getCurrentIndex()+1) + 715 _options.indexIndicatorSep + 716 _options.getNumItemsFn(); 717 } 718 }; 719 720 ui.onGlobalTap = function(e) { 721 e = e || window.event; 722 var target = e.target || e.srcElement; 723 724 if(_blockControlsTap) { 725 return; 726 } 727 728 if(e.detail && e.detail.pointerType === 'mouse') { 729 730 // close gallery if clicked outside of the image 731 if(_hasCloseClass(target)) { 732 pswp.close(); 733 return; 734 } 735 736 if(framework.hasClass(target, 'pswp__img')) { 737 if(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) { 738 if(_options.clickToCloseNonZoomable) { 739 pswp.close(); 740 } 741 } else { 742 pswp.toggleDesktopZoom(e.detail.releasePoint); 743 } 744 } 745 746 } else { 747 748 // tap anywhere (except buttons) to toggle visibility of controls 749 if(_options.tapToToggleControls) { 750 if(_controlsVisible) { 751 ui.hideControls(); 752 } else { 753 ui.showControls(); 754 } 755 } 756 757 // tap to close gallery 758 if(_options.tapToClose && (framework.hasClass(target, 'pswp__img') || _hasCloseClass(target)) ) { 759 pswp.close(); 760 return; 761 } 762 763 } 764 }; 765 ui.onMouseOver = function(e) { 766 e = e || window.event; 767 var target = e.target || e.srcElement; 768 769 // add class when mouse is over an element that should close the gallery 770 _togglePswpClass(_controls, 'ui--over-close', _hasCloseClass(target)); 771 }; 772 773 ui.hideControls = function() { 774 framework.addClass(_controls,'pswp__ui--hidden'); 775 _controlsVisible = false;
776 }; 777 778 ui.showControls = function() { 779 _controlsVisible = true; 780 if(!_overlayUIUpdated) { 781 ui.update(); 782 } 783 framework.removeClass(_controls,'pswp__ui--hidden'); 784 }; 785 786 ui.supportsFullscreen = function() { 787 var d = document; 788 return !!(d.exitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen || d.msExitFullscreen); 789 }; 790 791 ui.getFullscreenAPI = function() { 792 var dE = document.documentElement, 793 api, 794 tF = 'fullscreenchange'; 795 796 if (dE.requestFullscreen) { 797 api = { 798 enterK: 'requestFullscreen', 799 exitK: 'exitFullscreen', 800 elementK: 'fullscreenElement', 801 eventK: tF 802 }; 803 804 } else if(dE.mozRequestFullScreen ) { 805 api = { 806 enterK: 'mozRequestFullScreen', 807 exitK: 'mozCancelFullScreen', 808 elementK: 'mozFullScreenElement', 809 eventK: 'moz' + tF 810 }; 811 812 813 814 } else if(dE.webkitRequestFullscreen) { 815 api = { 816 enterK: 'webkitRequestFullscreen', 817 exitK: 'webkitExitFullscreen', 818 elementK: 'webkitFullscreenElement', 819 eventK: 'webkit' + tF 820 }; 821 822 } else if(dE.msRequestFullscreen) { 823 api = { 824 enterK: 'msRequestFullscreen', 825 exitK: 'msExitFullscreen', 826 elementK: 'msFullscreenElement', 827 eventK: 'MSFullscreenChange' 828 }; 829 } 830 831 if(api) { 832 api.enter = function() { 833 // disable close-on-scroll in fullscreen 834 _initalCloseOnScrollValue = _options.closeOnScroll; 835 _options.closeOnScroll = false; 836 837 if(this.enterK === 'webkitRequestFullscreen') { 838 pswp.template[this.enterK]( Element.ALLOW_KEYBOARD_INPUT ); 839 } else { 840 return pswp.template[this.enterK](); 841 } 842 }; 843 api.exit = function() { 844 _options.closeOnScroll = _initalCloseOnScrollValue; 845 846 return document[this.exitK](); 847 848 }; 849 api.isFullscreen = function() { return document[this.elementK]; }; 850 } 851 852 return api; 853 }; 854 855 856 857}; 858return PhotoSwipeUI_Default; 859 860 861});
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.