Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix scrolling issue with FB button.

Thanks to icaaq for the fix.
  • Loading branch information...
commit c522d8be4bccc5891c047fb8825d6db7a0b362b8 1 parent 4aa8530
@pmclanahan pmclanahan authored
Showing with 3 additions and 3 deletions.
  1. +1 −1  media/socialshare.min.js
  2. +2 −2 src/socialshare.js
View
2  media/socialshare.min.js
@@ -1 +1 @@
-(function(a){"use strict";var b='[data-toggle="socialshare"]',c=".socialshare",d='.socialshare.open[data-type="small-bubbles"] #share-options div.fb-like iframe',e,f='<div class="dropdown-toggle" data-toggle="socialshare"> <a class="share-button" role="button" href="#share-options" aria-controls="share-options" aria-expanded="false"><span>Share This</span></a> <div id="share-options"> <ul> <li><div class="fb-like"></div></li> <li><div class="g-plusone"></div></li> <li><a href="https://twitter.com/share" class="twitter-share-button"></a></li> </ul> </div></div><div id="fb-root" aria-hidden="true"></div>',g,h={facebook:{id:"facebook-jssdk",src:"//connect.facebook.net/en_US/all.js#xfbml=1&appId=255566051148260",selector:".fb-like","small-bubbles":{"data-send":"false","data-layout":"button_count","data-width":"105","data-show-face":"false"},bubbles:{"data-send":"false","data-layout":"box_count","data-width":"12","data-show-faces":"false"},small:{"data-send":"false","data-width":"85","data-show-face":"false"}},googleplus:{id:"gplus-api",src:"https://apis.google.com/js/plusone.js",selector:".g-plusone","small-bubbles":{},bubbles:{"data-size":"tall"},small:{"data-size":"small","data-annotation":"none"}},twitter:{id:"twitter-wjs",src:"//platform.twitter.com/widgets.js",selector:".twitter-share-button","small-bubbles":{"data-via":"firefox","data-related":"firefox"},bubbles:{"data-via":"firefox","data-count":"vertical","data-related":"firefox"},small:{"data-via":"firefox","data-count":"none","data-related":"firefox"}}},i=function(){a(b).parent().removeClass("open"),a(b).find(".share-button").attr("aria-expanded","false")},j=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};j.prototype={constructor:j,scripts_loaded:!1,toggle:function(b){var c=a(this).parent(),f=c.hasClass("open");return i(),f||(a(this).find(".share-button").attr("aria-expanded","true"),c.toggleClass("open")),e=a(d).css("width",h.facebook["small-bubbles"]["data-width"]),j.prototype.load_sharing(),!1},load_sharing:function(){if(!this.scripts_loaded){for(var a in h)this.load_script(h[a].src,h[a].id);this.scripts_loaded=!0}},load_script:function(a,b){var c=document.getElementsByTagName("script")[0],d=document.getElementById(b);d||(d=document.createElement("script"),d.id=b,c.parentNode.insertBefore(d,c)),d.src=a}},a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("dropdown");d||c.data("dropdown",d=new j(this)),typeof b=="string"&&d[b].call(c)})},a.fn.dropdown.Constructor=j;var k=function(a,b){h.twitter["small-bubbles"][a]=b,h.twitter.bubbles[a]=b};a(function(){a("html").on("click.dropdown.data-api",i),a("body").on("click.dropdown.data-api",b,j.prototype.toggle),e=a(c);var d=e.attr("data-tweet-at");d&&k("data-via",d);var g=a('meta[property="og:title"]');g&&k("data-text",g.attr("content"));var l=a('meta[property="og:url"]');l&&k("data-url",l.attr("content")),e.append(f);for(var m in h)e.find(h[m].selector).attr(h[m][e.attr("data-type")]);e.find(".share-button").keypress(function(b){b.which===32&&(a(this).trigger("click"),b.preventDefault())}),a(document).keydown(function(b){b.which===27&&a(".socialshare").hasClass("open")&&a(".share-button").trigger("click")})})})(window.jQuery);
+(function(a){"use strict";var b='[data-toggle="socialshare"]',c=".socialshare",d='.socialshare.open[data-type="small-bubbles"] #share-options div.fb-like iframe',e,f='<div class="dropdown-toggle" data-toggle="socialshare"> <a class="share-button" role="button" href="#share-options" aria-controls="share-options" aria-expanded="false"><span>Share This</span></a> <div id="share-options"> <ul> <li><div class="fb-like"></div></li> <li><div class="g-plusone"></div></li> <li><a href="https://twitter.com/share" class="twitter-share-button"></a></li> </ul> </div></div>',g,h={facebook:{id:"facebook-jssdk",src:"//connect.facebook.net/en_US/all.js#xfbml=1&appId=255566051148260",selector:".fb-like","small-bubbles":{"data-send":"false","data-layout":"button_count","data-width":"105","data-show-face":"false"},bubbles:{"data-send":"false","data-layout":"box_count","data-width":"12","data-show-faces":"false"},small:{"data-send":"false","data-width":"85","data-show-face":"false"}},googleplus:{id:"gplus-api",src:"https://apis.google.com/js/plusone.js",selector:".g-plusone","small-bubbles":{},bubbles:{"data-size":"tall"},small:{"data-size":"small","data-annotation":"none"}},twitter:{id:"twitter-wjs",src:"//platform.twitter.com/widgets.js",selector:".twitter-share-button","small-bubbles":{"data-via":"firefox","data-related":"firefox"},bubbles:{"data-via":"firefox","data-count":"vertical","data-related":"firefox"},small:{"data-via":"firefox","data-count":"none","data-related":"firefox"}}},i=function(){a(b).parent().removeClass("open"),a(b).find(".share-button").attr("aria-expanded","false")},j=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};j.prototype={constructor:j,scripts_loaded:!1,toggle:function(b){var c=a(this).parent(),f=c.hasClass("open");return i(),f||(a(this).find(".share-button").attr("aria-expanded","true"),c.toggleClass("open")),e=a(d).css("width",h.facebook["small-bubbles"]["data-width"]),j.prototype.load_sharing(),!1},load_sharing:function(){if(!this.scripts_loaded){a("body").append('<div id="fb-root" aria-hidden="true"></div>');for(var b in h)this.load_script(h[b].src,h[b].id);this.scripts_loaded=!0}},load_script:function(a,b){var c=document.getElementsByTagName("script")[0],d=document.getElementById(b);d||(d=document.createElement("script"),d.id=b,c.parentNode.insertBefore(d,c)),d.src=a}},a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("dropdown");d||c.data("dropdown",d=new j(this)),typeof b=="string"&&d[b].call(c)})},a.fn.dropdown.Constructor=j;var k=function(a,b){h.twitter["small-bubbles"][a]=b,h.twitter.bubbles[a]=b};a(function(){a("html").on("click.dropdown.data-api",i),a("body").on("click.dropdown.data-api",b,j.prototype.toggle),e=a(c);var d=e.attr("data-tweet-at");d&&k("data-via",d);var g=a('meta[property="og:title"]');g&&k("data-text",g.attr("content"));var l=a('meta[property="og:url"]');l&&k("data-url",l.attr("content")),e.append(f);for(var m in h)e.find(h[m].selector).attr(h[m][e.attr("data-type")]);e.find(".share-button").keypress(function(b){b.which===32&&(a(this).trigger("click"),b.preventDefault())}),a(document).keydown(function(b){b.which===27&&a(".socialshare").hasClass("open")&&a(".share-button").trigger("click")})})})(window.jQuery);
View
4 src/socialshare.js
@@ -18,8 +18,7 @@
' <li><a href="https://twitter.com/share" class="twitter-share-button"></a></li>' +
' </ul>' +
' </div>' +
- '</div>'+
- '<div id="fb-root" aria-hidden="true"></div>';
+ '</div>';
var type;
var providers = {
facebook: {
@@ -113,6 +112,7 @@
},
load_sharing: function() {
if (!this.scripts_loaded) {
+ $('body').append('<div id="fb-root" aria-hidden="true"></div>');
for (var key in providers) {
this.load_script(providers[key].src, providers[key].id);
}
Please sign in to comment.
Something went wrong with that request. Please try again.