View file wu-static/js/lightgallery/js/lg-share.min.js

File size: 2.85Kb
/*! lg-share - v1.0.0 - 2016-09-20
* http://sachinchoolur.github.io/lightGallery
* Copyright (c) 2016 Sachin N; Licensed GPLv3 */
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){!function(a,b,c,d){"use strict";var e={share:!0,facebook:!0,facebookDropdownText:"Facebook",twitter:!0,twitterDropdownText:"Twitter",googlePlus:!0,googlePlusDropdownText:"GooglePlus",pinterest:!0,pinterestDropdownText:"Pinterest"},f=function(b){return this.core=a(b).data("lightGallery"),this.core.s=a.extend({},e,this.core.s),this.init(),this};f.prototype.init=function(){var c=this,d='<span id="lg-share" class="lg-icon"><ul class="lg-dropdown" style="position: absolute;">';d+=c.core.s.facebook?'<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.facebookDropdownText+"</span></a></li>":"",d+=c.core.s.twitter?'<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.twitterDropdownText+"</span></a></li>":"",d+=c.core.s.googlePlus?'<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.googlePlusDropdownText+"</span></a></li>":"",d+=c.core.s.pinterest?'<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">'+this.core.s.pinterestDropdownText+"</span></a></li>":"",d+="</ul></span>",this.core.$outer.find(".lg-toolbar").append(d),this.core.$outer.find(".lg").append('<div id="lg-dropdown-overlay"></div>'),a("#lg-share").on("click.lg",function(){c.core.$outer.toggleClass("lg-dropdown-active")}),a("#lg-dropdown-overlay").on("click.lg",function(){c.core.$outer.removeClass("lg-dropdown-active")}),c.core.$el.on("onAfterSlide.lg.tm",function(d,e,f){setTimeout(function(){a("#lg-share-facebook").attr("href","https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(c.core.$items.eq(f).attr("data-facebook-share-url")||b.location.href)),a("#lg-share-twitter").attr("href","https://twitter.com/intent/tweet?text="+c.core.$items.eq(f).attr("data-tweet-text")+"&url="+encodeURIComponent(c.core.$items.eq(f).attr("data-twitter-share-url")||b.location.href)),a("#lg-share-googleplus").attr("href","https://plus.google.com/share?url="+encodeURIComponent(c.core.$items.eq(f).attr("data-googleplus-share-url")||b.location.href)),a("#lg-share-pinterest").attr("href","http://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(c.core.$items.eq(f).attr("data-pinterest-share-url")||b.location.href)+"&media="+encodeURIComponent(c.core.$items.eq(f).attr("href")||c.core.$items.eq(f).attr("data-src"))+"&description="+c.core.$items.eq(f).attr("data-pinterest-text"))},100)})},f.prototype.destroy=function(){},a.fn.lightGallery.modules.share=f}(jQuery,window,document)});