2020-08-13 19:16:08 +08:00
|
|
|
((e,l)=>{"use strict";var n={fullScreen:!0};e.fn.lightGallery.modules.fullscreen=class{constructor(l){return this.core=e(l).data("lightGallery"),this.$el=e(l),this.core.s=e.extend({},n,this.core.s),this.init(),this}init(){var e="";if(this.core.s.fullScreen){if(!(l.fullscreenEnabled||l.webkitFullscreenEnabled||l.mozFullScreenEnabled||l.msFullscreenEnabled))return;e='<span class="lg-fullscreen lg-icon"></span>',this.core.$outer.find(".lg-toolbar").append(e),this.fullScreen()}}requestFullscreen(){var e=l.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}exitFullscreen(){l.exitFullscreen?l.exitFullscreen():l.msExitFullscreen?l.msExitFullscreen():l.mozCancelFullScreen?l.mozCancelFullScreen():l.webkitExitFullscreen&&l.webkitExitFullscreen()}fullScreen(){var n=this;e(l).on("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg",()=>n.core.$outer.toggleClass("lg-fullscreen-on")),this.core.$outer.find(".lg-fullscreen").on("click.lg",()=>{l.fullscreenElement||l.mozFullScreenElement||l.webkitFullscreenElement||l.msFullscreenElement?n.exitFullscreen():n.requestFullscreen()})}destroy(){this.exitFullscreen(),e(l).off("fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg")}}})(jQuery,document);
|