prokat/api/jquery/plugins/lightGallery/2.7.2/lg-vimeo-thumbnail.es5.min.js
2025-06-16 18:28:08 +05:00

1 line
3.4 KiB
JavaScript
Executable File

var __assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function __awaiter(e,l,a,s){return new(a=a||Promise)(function(n,t){function i(e){try{o(s.next(e))}catch(e){t(e)}}function r(e){try{o(s.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(i,r)}o((s=s.apply(e,l||[])).next())})}function __generator(i,r){var o,l,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,l&&(a=2&t[0]?l.return:t[0]?l.throw||((a=l.return)&&a.call(l),0):l.next)&&!(a=a.call(l,t[1])).done)return a;switch(l=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,l=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(i,s)}catch(e){t=[6,e],l=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}var lGEvents={afterAppendSlide:"lgAfterAppendSlide",init:"lgInit",hasVideo:"lgHasVideo",containerResize:"lgContainerResize",updateSlides:"lgUpdateSlides",afterAppendSubHtml:"lgAfterAppendSubHtml",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",beforeSlide:"lgBeforeSlide",afterSlide:"lgAfterSlide",posterClick:"lgPosterClick",dragStart:"lgDragStart",dragMove:"lgDragMove",dragEnd:"lgDragEnd",beforeNextSlide:"lgBeforeNextSlide",beforePrevSlide:"lgBeforePrevSlide",beforeClose:"lgBeforeClose",afterClose:"lgAfterClose",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical",autoplay:"lgAutoplay",autoplayStart:"lgAutoplayStart",autoplayStop:"lgAutoplayStop"},vimeoSettings={showVimeoThumbnails:!0,showThumbnailWithPlayButton:!1},VimeoThumbnail=function(){function e(e){return this.core=e,this.settings=__assign(__assign({},vimeoSettings),this.core.settings),this}return e.prototype.init=function(){var t=this;this.settings.showVimeoThumbnails&&this.core.LGel.on(lGEvents.init+".vimeothumbnails",function(e){e=e.detail.instance;e.$container.find(".lg-thumb-outer").get()&&t.setVimeoThumbnails(e)})},e.prototype.setVimeoThumbnails=function(i){return __awaiter(this,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:t=0,e.label=1;case 1:return t<i.galleryItems.length?(n=i.galleryItems[t],(n.__slideVideoInfo||{}).vimeo?[4,fetch("https://vimeo.com/api/oembed.json?url="+encodeURIComponent(n.src))]:[3,4]):[3,5];case 2:return[4,e.sent().json()];case 3:n=e.sent(),i.$container.find(".lg-thumb-item").eq(t).find("img").attr("src",this.settings.showThumbnailWithPlayButton?n.thumbnail_url_with_play_button:n.thumbnail_url),e.label=4;case 4:return t++,[3,1];case 5:return[2]}})})},e.prototype.destroy=function(){this.core.LGel.off(".lg.vimeothumbnails"),this.core.LGel.off(".vimeothumbnails")},e}();export default VimeoThumbnail;