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

1 line
3.7 KiB
JavaScript
Executable File

var __assign=function(){return(__assign=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},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"},commentSettings={commentBox:!1,fbComments:!1,disqusComments:!1,disqusConfig:{title:void 0,language:"en"},commentsMarkup:'<div id="lg-comment-box" class="lg-comment-box lg-fb-comment-box"><div class="lg-comment-header"><h3 class="lg-comment-title">Leave a comment.</h3><span class="lg-comment-close lg-icon"></span></div><div class="lg-comment-body"></div></div>',commentPluginStrings:{toggleComments:"Toggle Comments"}},CommentBox=function(){function e(e,t){return this.core=e,this.$LG=t,this.settings=__assign(__assign({},commentSettings),this.core.settings),this}return e.prototype.init=function(){this.settings.commentBox&&(this.setMarkup(),this.toggleCommentBox(),this.settings.fbComments?this.addFbComments():this.settings.disqusComments&&this.addDisqusComments())},e.prototype.setMarkup=function(){this.core.outer.append(this.settings.commentsMarkup+'<div class="lg-comment-overlay"></div>');var e='<button type="button" aria-label="'+this.settings.commentPluginStrings.toggleComments+'" class="lg-comment-toggle lg-icon"></button>';this.core.$toolbar.append(e)},e.prototype.toggleCommentBox=function(){var e=this;this.core.outer.find(".lg-comment-toggle").first().on("click.lg.comment",function(){e.core.outer.toggleClass("lg-comment-active")}),this.core.outer.find(".lg-comment-overlay").first().on("click.lg.comment",function(){e.core.outer.removeClass("lg-comment-active")}),this.core.outer.find(".lg-comment-close").first().on("click.lg.comment",function(){e.core.outer.removeClass("lg-comment-active")})},e.prototype.addFbComments=function(){var t=this,o=this;this.core.LGel.on(lGEvents.beforeSlide+".comment",function(e){e=t.core.galleryItems[e.detail.index].fbHtml;t.core.outer.find(".lg-comment-body").html(e)}),this.core.LGel.on(lGEvents.afterSlide+".comment",function(){try{FB.XFBML.parse()}catch(e){o.$LG(window).on("fbAsyncInit",function(){FB.XFBML.parse()})}})},e.prototype.addDisqusComments=function(){var i=this,e=this.$LG("#disqus_thread");e.remove(),this.core.outer.find(".lg-comment-body").append('<div id="disqus_thread"></div>'),this.core.LGel.on(lGEvents.beforeSlide+".comment",function(){e.html("")}),this.core.LGel.on(lGEvents.afterSlide+".comment",function(e){var t=e.detail.index,o=i;setTimeout(function(){try{DISQUS.reset({reload:!0,config:function(){this.page.identifier=o.core.galleryItems[t].disqusIdentifier,this.page.url=o.core.galleryItems[t].disqusURL,this.page.title=o.settings.disqusConfig.title,this.language=o.settings.disqusConfig.language}})}catch(e){console.error("Make sure you have included disqus JavaScript code in your document. Ex - https://lg-disqus.disqus.com/admin/install/platforms/universalcode/")}},o.core.lGalleryOn?0:1e3)})},e.prototype.destroy=function(){this.core.LGel.off(".lg.comment"),this.core.LGel.off(".comment")},e}();export default CommentBox;