lg-share
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "lg-share", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Social media share module for lightgallery.", | ||
@@ -5,0 +5,0 @@ "main": [ |
@@ -1,4 +0,4 @@ | ||
/*! lg-share - v1.1.0 - 2017-10-03 | ||
/*! lg-share - v1.1.0 - 2020-05-03 | ||
* http://sachinchoolur.github.io/lightGallery | ||
* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ | ||
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */ | ||
@@ -11,3 +11,3 @@ (function (root, factory) { | ||
}); | ||
} else if (typeof exports === 'object') { | ||
} else if (typeof module === 'object' && module.exports) { | ||
// Node. Does not work with strict CommonJS, but | ||
@@ -18,3 +18,3 @@ // only CommonJS-like environments that support module.exports, | ||
} else { | ||
factory(jQuery); | ||
factory(root["jQuery"]); | ||
} | ||
@@ -53,3 +53,4 @@ }(this, function ($) { | ||
var _this = this; | ||
var shareHtml = '<span id="lg-share" class="lg-icon">' + | ||
var shareHtml = '<button aria-label="Share" id="lg-share" class="lg-icon" aria-haspopup="true" aria-expanded="false">' + | ||
'<ul class="lg-dropdown" style="position: absolute;">'; | ||
@@ -60,3 +61,3 @@ shareHtml += _this.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>' : ''; | ||
shareHtml += _this.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>' : ''; | ||
shareHtml += '</ul></span>'; | ||
shareHtml += '</ul></button>'; | ||
@@ -67,2 +68,4 @@ this.core.$outer.find('.lg-toolbar').append(shareHtml); | ||
_this.core.$outer.toggleClass('lg-dropdown-active'); | ||
var ariaExpanded = $('#lg-share').attr('aria-expanded'); | ||
$('#lg-share').attr('aria-expanded', ariaExpanded === 'true' ? false: true); | ||
}); | ||
@@ -72,2 +75,3 @@ | ||
_this.core.$outer.removeClass('lg-dropdown-active'); | ||
$('#lg-share').attr('aria-expanded', false); | ||
}); | ||
@@ -74,0 +78,0 @@ |
@@ -1,4 +0,4 @@ | ||
/*! lg-share - v1.1.0 - 2017-10-03 | ||
/*! lg-share - v1.1.0 - 2020-05-03 | ||
* http://sachinchoolur.github.io/lightGallery | ||
* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ | ||
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){!function(){"use strict";var b={share:!0,facebook:!0,facebookDropdownText:"Facebook",twitter:!0,twitterDropdownText:"Twitter",googlePlus:!0,googlePlusDropdownText:"GooglePlus",pinterest:!0,pinterestDropdownText:"Pinterest"},c=function(c){return this.core=a(c).data("lightGallery"),this.core.s=a.extend({},b,this.core.s),this.core.s.share&&this.init(),this};c.prototype.init=function(){var b=this,c='<span id="lg-share" class="lg-icon"><ul class="lg-dropdown" style="position: absolute;">';c+=b.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>":"",c+=b.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>":"",c+=b.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>":"",c+=b.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>":"",c+="</ul></span>",this.core.$outer.find(".lg-toolbar").append(c),this.core.$outer.find(".lg").append('<div id="lg-dropdown-overlay"></div>'),a("#lg-share").on("click.lg",function(){b.core.$outer.toggleClass("lg-dropdown-active")}),a("#lg-dropdown-overlay").on("click.lg",function(){b.core.$outer.removeClass("lg-dropdown-active")}),b.core.$el.on("onAfterSlide.lg.tm",function(c,d,e){setTimeout(function(){a("#lg-share-facebook").attr("href","https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(b.getSahreProps(e,"facebookShareUrl")||window.location.href)),a("#lg-share-twitter").attr("href","https://twitter.com/intent/tweet?text="+b.getSahreProps(e,"tweetText")+"&url="+encodeURIComponent(b.getSahreProps(e,"twitterShareUrl")||window.location.href)),a("#lg-share-googleplus").attr("href","https://plus.google.com/share?url="+encodeURIComponent(b.getSahreProps(e,"googleplusShareUrl")||window.location.href)),a("#lg-share-pinterest").attr("href","http://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(b.getSahreProps(e,"pinterestShareUrl")||window.location.href)+"&media="+encodeURIComponent(b.getSahreProps(e,"src"))+"&description="+b.getSahreProps(e,"pinterestText"))},100)})},c.prototype.getSahreProps=function(a,b){var c="";if(this.core.s.dynamic)c=this.core.s.dynamicEl[a][b];else{var d=this.core.$items.eq(a).attr("href"),e=this.core.$items.eq(a).data(b);c="src"===b?d||e:e}return c},c.prototype.destroy=function(){},a.fn.lightGallery.modules.share=c}()}); | ||
* Copyright (c) 2020 Sachin N; Licensed GPLv3 */ | ||
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(){"use strict";var b={share:!0,facebook:!0,facebookDropdownText:"Facebook",twitter:!0,twitterDropdownText:"Twitter",googlePlus:!0,googlePlusDropdownText:"GooglePlus",pinterest:!0,pinterestDropdownText:"Pinterest"},c=function(c){return this.core=a(c).data("lightGallery"),this.core.s=a.extend({},b,this.core.s),this.core.s.share&&this.init(),this};c.prototype.init=function(){var b=this,c='<button aria-label="Share" id="lg-share" class="lg-icon" aria-haspopup="true" aria-expanded="false"><ul class="lg-dropdown" style="position: absolute;">';c+=b.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>":"",c+=b.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>":"",c+=b.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>":"",c+=b.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>":"",c+="</ul></button>",this.core.$outer.find(".lg-toolbar").append(c),this.core.$outer.find(".lg").append('<div id="lg-dropdown-overlay"></div>'),a("#lg-share").on("click.lg",function(){b.core.$outer.toggleClass("lg-dropdown-active");var c=a("#lg-share").attr("aria-expanded");a("#lg-share").attr("aria-expanded","true"!==c)}),a("#lg-dropdown-overlay").on("click.lg",function(){b.core.$outer.removeClass("lg-dropdown-active"),a("#lg-share").attr("aria-expanded",!1)}),b.core.$el.on("onAfterSlide.lg.tm",function(c,d,e){setTimeout(function(){a("#lg-share-facebook").attr("href","https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(b.getSahreProps(e,"facebookShareUrl")||window.location.href)),a("#lg-share-twitter").attr("href","https://twitter.com/intent/tweet?text="+b.getSahreProps(e,"tweetText")+"&url="+encodeURIComponent(b.getSahreProps(e,"twitterShareUrl")||window.location.href)),a("#lg-share-googleplus").attr("href","https://plus.google.com/share?url="+encodeURIComponent(b.getSahreProps(e,"googleplusShareUrl")||window.location.href)),a("#lg-share-pinterest").attr("href","http://www.pinterest.com/pin/create/button/?url="+encodeURIComponent(b.getSahreProps(e,"pinterestShareUrl")||window.location.href)+"&media="+encodeURIComponent(b.getSahreProps(e,"src"))+"&description="+b.getSahreProps(e,"pinterestText"))},100)})},c.prototype.getSahreProps=function(a,b){var c="";if(this.core.s.dynamic)c=this.core.s.dynamicEl[a][b];else{var d=this.core.$items.eq(a).attr("href"),e=this.core.$items.eq(a).data(b);c="src"===b?d||e:e}return c},c.prototype.destroy=function(){},a.fn.lightGallery.modules.share=c}()}); |
@@ -90,3 +90,4 @@ 'use strict'; | ||
options: { | ||
reporter: require('jshint-stylish') | ||
reporter: require('jshint-stylish'), | ||
reporterOutput: '' | ||
}, | ||
@@ -93,0 +94,0 @@ gruntfile: { |
{ | ||
"name": "lg-share", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Social media share module for lightgallery.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -0,0 +0,0 @@ ![travis](https://travis-ci.org/sachinchoolur/lg-share.svg?branch=master) |
@@ -31,3 +31,4 @@ (function() { | ||
var _this = this; | ||
var shareHtml = '<span id="lg-share" class="lg-icon">' + | ||
var shareHtml = '<button aria-label="Share" id="lg-share" class="lg-icon" aria-haspopup="true" aria-expanded="false">' + | ||
'<ul class="lg-dropdown" style="position: absolute;">'; | ||
@@ -38,3 +39,3 @@ shareHtml += _this.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>' : ''; | ||
shareHtml += _this.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>' : ''; | ||
shareHtml += '</ul></span>'; | ||
shareHtml += '</ul></button>'; | ||
@@ -45,2 +46,4 @@ this.core.$outer.find('.lg-toolbar').append(shareHtml); | ||
_this.core.$outer.toggleClass('lg-dropdown-active'); | ||
var ariaExpanded = $('#lg-share').attr('aria-expanded'); | ||
$('#lg-share').attr('aria-expanded', ariaExpanded === 'true' ? false: true); | ||
}); | ||
@@ -50,2 +53,3 @@ | ||
_this.core.$outer.removeClass('lg-dropdown-active'); | ||
$('#lg-share').attr('aria-expanded', false); | ||
}); | ||
@@ -52,0 +56,0 @@ |
58666
312
14