-
-
Save kivanio/85fde805b0c5448dc742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// turbolinks addthis | |
var initAdthis; | |
initAdthis = function(){ | |
// Remove all global properties set by addthis, otherwise it won't reinitialize | |
for (var i in window) { | |
if (/^addthis/.test(i) || /^_at/.test(i)) { | |
delete window[i]; | |
} | |
} | |
window.addthis_share = null; | |
// Finally, load addthis | |
$.getScript("http://s7.addthis.com/js/300/addthis_widget.js#pubid=YOUR-PUBLISHER-ID"); | |
} | |
// Trigger the function on both jquery's ready event and turbolinks page:change event | |
$(document).on('ready page:change', function() { | |
initAdthis(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment