mirror of
https://github.com/alangrainger/immich-public-proxy.git
synced 2025-01-01 05:31:59 +00:00
9 lines
8.2 KiB
JavaScript
9 lines
8.2 KiB
JavaScript
|
/**
|
||
|
* lightgallery | 2.8.0-beta.3 | May 3rd 2024
|
||
|
* http://www.lightgalleryjs.com/
|
||
|
* Copyright (c) 2020 Sachin Neravath;
|
||
|
* @license GPLv3
|
||
|
*/
|
||
|
|
||
|
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).lgVideo=o()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var o,i=1,t=arguments.length;i<t;i++)for(var s in o=arguments[i])Object.prototype.hasOwnProperty.call(o,s)&&(e[s]=o[s]);return e}).apply(this,arguments)},o={autoplayFirstVideo:!0,youTubePlayerParams:!1,vimeoPlayerParams:!1,wistiaPlayerParams:!1,gotoNextSlideOnVideoEnd:!0,autoplayVideoOnSlide:!1,videojs:!1,videojsTheme:"",videojsOptions:{}},i="lgHasVideo",t="lgSlideItemLoad",s="lgBeforeSlide",n="lgAfterSlide",l="lgPosterClick",r=function(e){return Object.keys(e).map((function(o){return encodeURIComponent(o)+"="+encodeURIComponent(e[o])})).join("&")},d=function(o,i){if(!o.youtube)return"";var t=o.youtube[2]?o.youtube[2].slice(1).split("&").map((function(e){return e.split("=")})).reduce((function(e,o){var i=o.map(decodeURIComponent),t=i[0],s=i[1];return e[t]=s,e}),{}):"",s=i||{},n=e(e(e({},{wmode:"opaque",autoplay:0,mute:1,enablejsapi:1}),s),t);return"?"+r(n)};return function(){function a(i){return this.core=i,this.settings=e(e({},o),this.core.settings),this}return a.prototype.init=function(){var e=this;this.core.LGel.on(i+".video",this.onHasVideo.bind(this)),this.core.LGel.on(l+".video",(function(){var o=e.core.getSlideItem(e.core.index);e.loadVideoOnPosterClick(o)})),this.core.LGel.on(t+".video",this.onSlideItemLoad.bind(this)),this.core.LGel.on(s+".video",this.onBeforeSlide.bind(this)),this.core.LGel.on(n+".video",this.onAfterSlide.bind(this))},a.prototype.onSlideItemLoad=function(e){var o=this,i=e.detail,t=i.isFirstSlide,s=i.index;this.settings.autoplayFirstVideo&&t&&s===this.core.index&&setTimeout((function(){o.loadAndPlayVideo(s)}),200),!t&&this.settings.autoplayVideoOnSlide&&s===this.core.index&&this.loadAndPlayVideo(s)},a.prototype.onHasVideo=function(e){var o=e.detail,i=o.index,t=o.src,s=o.html5Video;o.hasPoster||(this.appendVideos(this.core.getSlideItem(i),{src:t,addClass:"lg-object",index:i,html5Video:s}),this.gotoNextSlideOnVideoEnd(t,i))},a.prototype.onBeforeSlide=function(e){if(this.core.lGalleryOn){var o=e.detail.prevIndex;this.pauseVideo(o)}},a.prototype.onAfterSlide=function(e){var o=this,i=e.detail,t=i.index,s=i.prevIndex,n=this.core.getSlideItem(t);this.settings.autoplayVideoOnSlide&&t!==s&&n.hasClass("lg-complete")&&setTimeout((function(){o.loadAndPlayVideo(t)}),100)},a.prototype.loadAndPlayVideo=function(e){var o=this.core.getSlideItem(e);this.core.galleryItems[e].poster?this.loadVideoOnPosterClick(o,!0):this.playVideo(e)},a.prototype.playVideo=function(e){this.controlVideo(e,"play")},a.prototype.pauseVideo=function(e){this.controlVideo(e,"pause")},a.prototype.getVideoHtml=function(e,o,i,t){var s="",n=this.core.galleryItems[i].__slideVideoInfo||{},l=this.core.galleryItems[i],a=l.title||l.alt;a=a?'title="'+a+'"':"";var c='allowtransparency="true"\n frameborder="0"\n scrolling="no"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n oallowfullscreen\n msallowfullscreen';if(n.youtube){var u="lg-youtube"+i,f=d(n,this.settings.youTubePlayerParams);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-youtube '+o+'" '+a+' src="'+(e.includes("youtube-nocookie.com")?"//www.youtube-nocookie.com/":"//www.youtube.com/")+"embed/"+(n.youtube[1]+f)+'" '+c+"></iframe>"}else if(n.vimeo){u="lg-vimeo"+i;var h=function(e,o){if(!o||!o.vimeo)return"";var i=o.vimeo[2]||"",t=Object.assign({},{autoplay:0,muted:1},e),s=t&&0!==Object.keys(t).length?r(t):"",n=((o.vimeo[0].split("/").pop()||"").split("?")[0]||"").split("#")[0],l=o.vimeo[1]!==n;l&&(i=i.replace("/"+n,""));var d=l?"h="+n:"";return"?"+d+(s=d?"&"+s:s)+("?"==i[0]?"&"+i.slice(1):i||"")}(this.settings.vimeoPlayerParams,n);s='<iframe allow="autoplay" id='+u+' class="lg-video-object lg-vimeo '+o+'" '+a+' src="//player.vimeo.com/video/'+(n.vimeo[1]+h)+'" '+c+"></iframe>"}else if(n.wistia){var
|