1/*! 2 * lightgallery | 2.2.1 | September 4th 2021 3 * http://www.lightgalleryjs.com/ 4 * Copyright (c) 2020 Sachin Neravath; 5 * @license GPLv3 6 */ 7 8(function (global, factory) { 9 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 10 typeof define === 'function' && define.amd ? define(factory) : 11 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.lgFullscreen = factory()); 12}(this, (function () { 'use strict'; 13 14 /*! ***************************************************************************** 15 Copyright (c) Microsoft Corporation. 16 17 Permission to use, copy, modify, and/or distribute this software for any 18 purpose with or without fee is hereby granted. 19 20 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 21 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 22 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 23 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 24 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 25 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 26 PERFORMANCE OF THIS SOFTWARE. 27 ***************************************************************************** */ 28 29 var __assign = function() { 30 __assign = Object.assign || function __assign(t) { 31 for (var s, i = 1, n = arguments.length; i < n; i++) { 32 s = arguments[i]; 33 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 34 } 35 return t; 36 }; 37 return __assign.apply(this, arguments); 38 }; 39 40 var fullscreenSettings = { 41 fullScreen: true, 42 }; 43 44 var FullScreen = /** @class */ (function () { 45 function FullScreen(instance, $LG) { 46 // get lightGallery core plugin instance 47 this.core = instance; 48 this.$LG = $LG; 49 // extend module default settings with lightGallery core settings 50 this.settings = __assign(__assign({}, fullscreenSettings), this.core.settings); 51 return this; 52 } 53 FullScreen.prototype.init = function () { 54 var fullScreen = ''; 55 if (this.settings.fullScreen) { 56 // check for fullscreen browser support 57 if (!document.fullscreenEnabled && 58 !document.webkitFullscreenEnabled && 59 !document.mozFullScreenEnabled && 60 !document.msFullscreenEnabled) { 61 return; 62 } 63 else { 64 fullScreen = 65 '<button type="button" aria-label="Toggle fullscreen" class="lg-fullscreen lg-icon"></button>'; 66 this.core.$toolbar.append(fullScreen); 67 this.fullScreen(); 68 } 69 } 70 }; 71 FullScreen.prototype.isFullScreen = function () { 72 return (document.fullscreenElement || 73 document.mozFullScreenElement || 74 document.webkitFullscreenElement || 75 document.msFullscreenElement); 76 }; 77 FullScreen.prototype.requestFullscreen = function () { 78 var el = document.documentElement; 79 if (el.requestFullscreen) { 80 el.requestFullscreen(); 81 } 82 else if (el.msRequestFullscreen) { 83 el.msRequestFullscreen(); 84 } 85 else if (el.mozRequestFullScreen) { 86 el.mozRequestFullScreen(); 87 } 88 else if (el.webkitRequestFullscreen) { 89 el.webkitRequestFullscreen(); 90 } 91 }; 92 FullScreen.prototype.exitFullscreen = function () { 93 if (document.exitFullscreen) { 94 document.exitFullscreen(); 95 } 96 else if (document.msExitFullscreen) { 97 document.msExitFullscreen(); 98 } 99 else if (document.mozCancelFullScreen) { 100 document.mozCancelFullScreen(); 101 } 102 else if (document.webkitExitFullscreen) { 103 document.webkitExitFullscreen(); 104 } 105 }; 106 // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode 107 FullScreen.prototype.fullScreen = function () { 108 var _this = this; 109 this.$LG(document).on("fullscreenchange.lg.global" + this.core.lgId + " \n webkitfullscreenchange.lg.global" + this.core.lgId + " \n mozfullscreenchange.lg.global" + this.core.lgId + " \n MSFullscreenChange.lg.global" + this.core.lgId, function () { 110 if (!_this.core.lgOpened) 111 return; 112 _this.core.outer.toggleClass('lg-fullscreen-on'); 113 }); 114 this.core.outer 115 .find('.lg-fullscreen') 116 .first() 117 .on('click.lg', function () { 118 if (_this.isFullScreen()) { 119 _this.exitFullscreen(); 120 } 121 else { 122 _this.requestFullscreen(); 123 } 124 }); 125 }; 126 FullScreen.prototype.closeGallery = function () { 127 // exit from fullscreen if activated 128 if (this.isFullScreen()) { 129 this.exitFullscreen(); 130 } 131 }; 132 FullScreen.prototype.destroy = function () { 133 this.$LG(document).off("fullscreenchange.lg.global" + this.core.lgId + " \n webkitfullscreenchange.lg.global" + this.core.lgId + " \n mozfullscreenchange.lg.global" + this.core.lgId + " \n MSFullscreenChange.lg.global" + this.core.lgId); 134 }; 135 return FullScreen;
136 }()); 137 138 return FullScreen; 139 140}))); 141//# sourceMappingURL=lg-fullscreen.umd.js.map
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.