Select Git revision
jquery.privacysharebuttons.min.js
jquery.privacysharebuttons.min.js 7.02 KiB
(function(b){var a=function(d,c){this.elements=d;this.options=b.extend(true,{},this.defaults,c);if(!this.is_on()){return}this.append_css();this.attach()};a.prototype={defaults:{info_link:"http://cavallette.noblogs.org/?p=7641",txt_help:"When you activate these buttons by clicking on them, some of your personal data will be transferred to third parties and can be stored by them. For more information click on the <em> i </em>",settings_perma:"Permanently enable data transfer for:",css_path:"",uri:"",cookie_options:{path:"/",expires:365},services:{facebook:{display_name:"Facebook",status:"off",perma:"on",txt_info:"2 click for more privacy: only if you click here, the button will activate and you will be able to send your recommendation to Facebook. When enabled, data will be transferred to third parties - see <em> i </em>.",txt_off:"not connected with Facebook",txt_on:"connected with Facebook",dummy_img:"",action:"recommend",iframe_src:function(c){return'<div id="fb-root"></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/it_IT/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));<\/script><div class="fb-like" data-send="false" data-layout="button_count" data-width="400" data-show-faces="false" data-action="recommend"></div>'}},twitter:{display_name:"Twitter",status:"off",perma:"on",txt_info:"2 click for more privacy: only if you click here, the button will activate and you will be able to send your recommendation to Twitter. When enabled, data will be transferred to third parties - see <em> i </em>.",txt_off:"not connected with Twitter",txt_on:"connected with Twitter",dummy_img:"",reply_to:"",text:encodeURIComponent(document.title),iframe_src:function(d){var c=(d.services.twitter.reply_to!="")?"&via="+d.services.twitter.reply_to:"";return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+d.uri+"&counturl="+d.uri+"&text="+d.services.twitter.text+c+"&count=horizontal&lang="+d.services.twitter.language+'" style="width:100px; height:25px;"></iframe>'}},identica:{display_name:"Identi.ca",status:"off",perma:"on",txt_info:"2 click for more privacy: only if you click here, the button will activate and you will be able to send your recommendation to Identi.ca. When enabled, data will be transferred to third parties - see <em> i </em>.",txt_off:"not connected with Identi.ca",txt_on:"connected with Identi.ca",dummy_img:"",text:encodeURIComponent(document.title),identica_lib:"",iframe_src:function(c){return'<iframe scrolling="no" frameborder="0" src="'+c.services.identica.identica_lib+"?noscript&style2&title="+c.services.identica.text+'" allowtransparency="true" style="width:130px; height:25px; position: absolute;"></iframe>'}},gplus:{display_name:"Google+",status:"off",perma:"on",txt_info:"2 click for more privacy: only if you click here, the button will activate and you will be able to send your recommendation to Google+. When enabled, data will be transferred to third parties - see <em> i </em>.",txt_off:"not connected with Google+",txt_on:"connected with Google+",dummy_img:"",language:"en",iframe_src:function(d){var c=b('<div class="g-plusone" data-size="medium"></div>');var e='<script type="text/javascript">window.___gcfg = {lang: "'+d.services.gplus.language+'"}; (function() { var po = document.createElement("script"); po.type = "text/javascript";po.async = true; po.src = "https://apis.google.com/js/plusone.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s); })(); <\/script>';return c.append(e)}}}},is_on:function(){var d=false;for(var c in this.options.services){var e=this.options.services[c];if(e.status=="on"){d=true;break}}return d},perma_is_on:function(){var d=false;for(var c in this.options.services){var e=this.options.services[c];if(e.status=="on"&&e.perma=="on"){d=true;break}}return d&&(!b.browser.msie||(b.browser.msie&&(b.browser.version>7)))},append_css:function(){if(this.options.css_path.length>0){if(document.createStyleSheet){document.createStyleSheet(options.css_path)}else{b("head").append('<link rel="stylesheet" type="text/css" href="'+options.css_path+'" />')}}},dummy_image:function(c){return b("<img/>",{src:c.dummy_img,alt:c.display_name+" Dummy Image","class":"dummy_img"})},switch_button:function(c,f){var e=b(".switch",b(f));var d=b("div.dummy_btn",b(f));if(e.hasClass("off")){b(f).addClass("info_off");e.addClass("on").removeClass("off").html(c.txt_on);d.html(c.iframe_src(this.options))}else{b(f).removeClass("info_off");e.addClass("off").removeClass("on").html(c.txt_off);d.html(this.dummy_image(c))}},attach:function(){var c=this;this.elements.each(function(){var g=b('<ul class="social_share_privacy_area"></ul>').appendTo(this);for(var f in c.options.services){var k=c.options.services[f];if(k.status!="on"){continue}var h=k.iframe_src(c.options);var e=b('<li class="help_info '+f+'"><span class="info">'+k.txt_info+"</span></li>").appendTo(g);b('<span class="switch off">'+k.txt_off+"</span>").appendTo(e);var d=b('<div class="dummy_btn"></div>').appendTo(e);d.append(c.dummy_image(k));e.click({serv:k,element:e},function(l){c.switch_button(l.data.serv,l.data.element)})}var e=b('<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a href="'+c.options.info_link+'"><span class="help_info icon"><span class="info">'+c.options.txt_help+"</span></span></a></div></li>").appendTo(g);b(".help_info").each(function(){b(this).mouseenter(function(){if(!b(this).hasClass("info_off")){b(".info",this).show()}});b(this).mouseleave(function(){b(".info",this).hide()})});if(c.perma_is_on()){var j=e.find(".settings_info_menu").removeClass("perma_option_off");b('<span class="settings">Settings</span><form><fieldset><legend>'+c.options.settings_perma+"</legend></fieldset></form>").appendTo(j);for(var f in c.options.services){var k=c.options.services[f];if(!(k.status=="on"&&k.perma=="on")){continue}var i=(b.cookie("privacyShareButtons_"+f)=="perma_on")?'checked="checked"':"";j.find("form fieldset").append('<input type="checkbox" name="perma_status_'+f+'" id="perma_status_'+f+'" '+i+' /><label for="perma_status_'+f+'">'+k.display_name+"</label>");if(i!=""){b("li."+f+" span.switch",g).click()}}j.find("span.settings").css("cursor","pointer");j.find("span.settings").mouseenter(function(){j.removeClass("off").addClass("on")});e.mouseleave(function(){j.removeClass("on").addClass("off")});b(j.find("fieldset input")).click(function(n){var m=n.target.id;var l=m.substr(m.lastIndexOf("_")+1,m.length);var o="privacyShareButtons_"+l;if(b("#"+n.target.id+":checked").length){b.cookie(o,"perma_on",c.options.cookie_options);b("form fieldset label[for="+m+"]",g).addClass("checked")}else{b.cookie(o,null,c.options.cookie_options);b("form fieldset label[for="+m+"]",g).removeClass("checked")}})}})}};b.fn.socialShareButtons=function(c){new a(this,c);return this};b(document).ready(b(".social_share_privacy").socialShareButtons(socialshareprivacy_settings))})(jQuery);