Commit ff2be2de authored by lechuck's avatar lechuck Committed by lechuck
Browse files

added minified privacy share js

parent ed70bfa3
(function(a){a.widget("psb.baseButton",{options:{name:"",display_name:"",txt_info:"Click here to enable the button",dummy_img:"",javascript:"",js_loaded:false},_create:function(){var b=this;a('<span class="info">'+this.options.txt_info+"</span>").hide().addClass("dropdown").appendTo(this.element);a('<div class="dummy_btn off"></div>').append(this._dummy_image()).appendTo(this.element);this.element.click(function(c){b.switch_button()});this.element.hover(function(){var c=a(".info",b.element);if(!c.hasClass("info_off")){c.show()}},function(){a(".info",b.element).hide()})},_dummy_image:function(){return a("<img/>",{src:this.options.dummy_img,alt:this.options.display_name+" Dummy Image","class":"dummy_img"})},_javascript_is_loaded:function(){var d=Object.getPrototypeOf(this);var b=d.widgetBaseClass;var c=d.widgetName;this._trigger("javacript",b);if(a(":"+b).filter(function(e){return a(this)[c]("option","js_loaded")}).length>0){return true}return false},_append_javascript:function(){if(!this.options.javascript||this._javascript_is_loaded()){return}this.options.js_loaded=true;a.getScript(this.options.javascript)},_get_uri:function(){var b=this.element.parents(".post").find(".entry-title").find("a").attr("href");if(b){return b}else{return document.URL}},switch_button:function(){var b=this.element;var d=a(".info",b);var c=a(".dummy_btn",b);if(c.hasClass("off")){this._trigger("switch-on",b);d.addClass("info_off").hide();c.addClass("on").removeClass("off").html(this._real_btn());this._append_javascript()}}});a.widget("psb.twitterButton",a.psb.baseButton,{options:{name:"twitter",display_name:"Twitter",javascript:"//platform.twitter.com/widgets.js",reply_to:"",language:"",},_real_btn:function(){return a('<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>').attr("data-url",this._get_uri()).attr("counturl",this._get_uri()).attr("data-via",this.options.reply_to).attr("data-lang",this.options.language).attr("data-related",this.options.reply_to).attr("data-dnt",true)},});a.widget("psb.identicaButton",a.psb.baseButton,{options:{name:"identica",display_name:"Identi.ca",img:"",javascript:"",reply_to:"",language:"",result_limit:100,count:0,},countPost:function(){var b=this;a.get("https://identi.ca/api/search.json?q="+b._get_uri()+"&rpp=100",function(d){var c;if(d.results.length>=b.options.result_limit){c=b.options.result_limit+"+"}else{c=d.results.length}b.option("count",c)})},_button:function(c){var d=this.options.count;var b=c?"ui-icon-identica-dummy":"ui-icon-identica";return a('<button">identi.ca</button>').button({icons:{primary:b,},text:true,label:"identi.ca",disabled:false,})},_dummy_image:function(){var b=this;return this._button(true)},_real_btn:function(){var c=this;this.countPost();var b=a("<div></div>");b.append(this._button(false).click(function(d){c.share()}));a('<div class="count-o"><div>').append("<i></i><u></u>").append('<a id="count">...</a>').appendTo(b);return b.width(110)},share:function(){var i=document,h=window.getSelection,f=i.getSelection,m=i.selection,n=(h?h():(f)?f():(m?m.createRange().text:0)),c=i.location,h=encodeURIComponent,j=((h(n))?h(n):h(i.title));var b="";if(this.options.reply_to){b=" via @"+this.options.reply_to}var g="http://identi.ca/index.php?action=newnotice&status_textarea="+j+" "+this._get_uri()+b;window.open(g,"t","toolbar=0, resizable=0, scrollbars=0, status=0, width=785, height=480")},_setOption:function(b,c){switch(b){case"count":this.element.find("#count").attr("href","https://identi.ca/search/notice?q="+this._get_uri()).html(c);break}a.Widget.prototype._setOption.apply(this,arguments)},});a.widget("psb.facebookButton",a.psb.baseButton,{options:{name:"facebook",display_name:"Facebook",javascript:"//connect.facebook.net/en_US/all.js#xfbml=1",action:"recommend",js_id:"facebook-jssdk"},_real_btn:function(){return a('<div class="fb-like" data-send="false" data-layout="button_count" data-width="250" data-show-faces="false" data-action="recommend"></div>')},_append_javascript:function(){if(!this._javascript_is_loaded()){a("body").append('<div id="fb-root"></div>');this.options.js_loaded=true;a.getScript(this.options.javascript,function(){FB.init();FB.XFBML.parse()})}else{FB.XFBML.parse()}},});a.widget("psb.gplusButton",a.psb.baseButton,{options:{name:"gplus",display_name:"Google+",javascript:"//apis.google.com/js/plusone.js",},_real_btn:function(){return a('<div class="g-plusone" data-size="medium"></div>')}});a.widget("psb.socialShareButtons",{options:{info_link:"https://github.com/controesempio/Privacy-Share-Buttons",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. More informationf <em> <a href="https://github.com/controesempio/Privacy-Share-Buttons"> here </a></em>.',perma:"on",settings_perma:"Permanently enable data transfer for:",css_path:"",cookie_options:{path:"/",expires:365},services:{},},_create:function(){if(!this.options.services){return}this._append_css();this._attach()},_attach:function(){var e=a('<ul class="social_share_privacy_area" style="font-size: 0.6em"></ul>').appendTo(this.element);for(var d in this.options.services){if(!a.psb[d+"Button"]){continue}var b=a('<li class="'+d+'"><li');b[d+"Button"](a.extend(this.options,this.options.services[d])).appendTo(e)}var c=a("<li></li>");c.prependTo(e);this._info_area(c);this._options_area(c);c.buttonset()},_options_submenu:function(b){var c=this;var e=a("<div id='option-dropdown'></div>").addClass("dropdown").html(this.options.settings_perma+"<br/>");var h=function(k){var j=k.target.id;var i=j.substr(j.lastIndexOf("_")+1,j.length);var m="privacyShareButtons_"+i;var l=e.find("#"+k.target.id);if(l.is(":checked")){a.cookie(m,"perma_on",c.options.cookie_options);e.find("label[for="+j+"]").addClass("checked")}else{a.cookie(m,null,c.options.cookie_options);e.find("label[for="+j+"]").removeClass("checked")}};for(var d in this.options.services){var g=this.options.services[d];var f=a("<input type='checkbox' />").attr("id","perma_status_"+d).click(h);if(a.cookie("privacyShareButtons_"+d)=="perma_on"){f.attr("checked",true);this.element.find("."+d).click()}f.appendTo(e);a("<label></label><br/>").attr("for","perma_status_"+d).html(g.display_name).appendTo(e)}e.hide().appendTo(b.parent())},_options_area:function(b){if(this.options.perma){a("<button>option</button>").button({icons:{primary:"ui-icon-wrench",secondary:"ui-icon-triangle-1-s"},text:false}).click(function(){b.parent().find("#option-dropdown").toggle(100)}).appendTo(b);this._options_submenu(b)}},_info_area:function(b){var c=a("<div></div>").addClass("psb_info").addClass("dropdown").html("<p>"+this.options.txt_help+"</p>").hide().mouseleave(function(){a(this).hide()}).appendTo(b.parent());a("<button>info</button>").button({icons:{primary:"ui-icon-info"},text:false}).click(function(){c.toggle()}).appendTo(b)},_append_css:function(){if(this.options.css_path){if(document.createStyleSheet){document.createStyleSheet(options.css_path)}else{a("head").append('<link rel="stylesheet" type="text/css" href="'+options.css_path+'" />')}}},});a(document).ready(a(".social_share_privacy").each(function(){a(this).socialShareButtons(socialshareprivacy_settings)}))})(jQuery);
\ No newline at end of file
(function(a){a.widget("psb.baseButton",{options:{name:"",display_name:"",txt_info:"Click here to enable the button",dummy_img:"",javascript:"",js_loaded:false},_create:function(){var b=this;a('<span class="info">'+this.options.txt_info+"</span>").hide().addClass("dropdown").appendTo(this.element);a('<div class="dummy_btn off"></div>').append(this._dummy_image()).appendTo(this.element);this.element.click(function(c){b.switch_button()});this.element.hover(function(){var c=a(".info",b.element);if(!c.hasClass("info_off")){c.show()}},function(){a(".info",b.element).hide()})},_dummy_image:function(){return a("<img/>",{src:this.options.dummy_img,alt:this.options.display_name+" Dummy Image","class":"dummy_img"})},_javascript_is_loaded:function(){var d=Object.getPrototypeOf(this);var b=d.widgetBaseClass;var c=d.widgetName;this._trigger("javacript",b);if(a(":"+b).filter(function(e){return a(this)[c]("option","js_loaded")}).length>0){return true}return false},_append_javascript:function(){if(!this.options.javascript||this._javascript_is_loaded()){return}this.options.js_loaded=true;a.getScript(this.options.javascript)},_get_uri:function(){var b=this.element.parents(".post").find(".entry-title").find("a").attr("href");if(b){return b}var b=this.element.parents(".post").find(".title").find("a").attr("href");if(b){return b}else{return document.URL}},switch_button:function(){var b=this.element;var d=a(".info",b);var c=a(".dummy_btn",b);if(c.hasClass("off")){this._trigger("switch-on",b);d.addClass("info_off").hide();c.addClass("on").removeClass("off").html(this._real_btn());this._append_javascript()}}});a.widget("psb.twitterButton",a.psb.baseButton,{options:{name:"twitter",display_name:"Twitter",javascript:"//platform.twitter.com/widgets.js",reply_to:"",language:"",},_real_btn:function(){return a('<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>').attr("data-url",this._get_uri()).attr("counturl",this._get_uri()).attr("data-via",this.options.reply_to).attr("data-lang",this.options.language).attr("data-related",this.options.reply_to).attr("data-dnt",true)},});a.widget("psb.identicaButton",a.psb.baseButton,{options:{name:"identica",display_name:"Identi.ca",img:"",javascript:"",reply_to:"",language:"",result_limit:100,count:0,},countPost:function(){var b=this;a.get("https://identi.ca/api/search.json?q="+b._get_uri()+"&rpp=100",function(d){var c;if(d.results.length>=b.options.result_limit){c=b.options.result_limit+"+"}else{c=d.results.length}b.option("count",c)})},_button:function(c){var d=this.options.count;var b=c?"ui-icon-identica-dummy":"ui-icon-identica";return a('<button">identi.ca</button>').button({icons:{primary:b,},text:true,label:"identi.ca",disabled:false,})},_dummy_image:function(){var b=this;return this._button(true)},_real_btn:function(){var c=this;this.countPost();var b=a("<div></div>");b.append(this._button(false).click(function(d){c.share()}));a('<div class="count-o"><div>').append("<i></i><u></u>").append('<a id="count">...</a>').appendTo(b);return b.width(110)},share:function(){var i=document,h=window.getSelection,f=i.getSelection,m=i.selection,n=(h?h():(f)?f():(m?m.createRange().text:0)),c=i.location,h=encodeURIComponent,j=((h(n))?h(n):h(i.title));var b="";if(this.options.reply_to){b=" via @"+this.options.reply_to}var g="http://identi.ca/index.php?action=newnotice&status_textarea="+j+" "+this._get_uri()+b;window.open(g,"t","toolbar=0, resizable=0, scrollbars=0, status=0, width=785, height=480")},_setOption:function(b,c){switch(b){case"count":this.element.find("#count").attr("href","https://identi.ca/search/notice?q="+this._get_uri()).html(c);break}a.Widget.prototype._setOption.apply(this,arguments)},});a.widget("psb.facebookButton",a.psb.baseButton,{options:{name:"facebook",display_name:"Facebook",javascript:"//connect.facebook.net/en_US/all.js#xfbml=1",action:"recommend",js_id:"facebook-jssdk"},_real_btn:function(){return a('<div class="fb-like" data-send="false" data-layout="button_count" data-width="250" data-show-faces="false" data-action="recommend"></div>')},_append_javascript:function(){if(!this._javascript_is_loaded()){a("body").append('<div id="fb-root"></div>');this.options.js_loaded=true;a.getScript(this.options.javascript,function(){FB.init();FB.XFBML.parse()})}else{FB.XFBML.parse()}},});a.widget("psb.gplusButton",a.psb.baseButton,{options:{name:"gplus",display_name:"Google+",javascript:"//apis.google.com/js/plusone.js",},_real_btn:function(){return a('<div class="g-plusone" data-size="medium"></div>')}});a.widget("psb.socialShareButtons",{options:{info_link:"https://github.com/controesempio/Privacy-Share-Buttons",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. More informationf <em> <a href="https://github.com/controesempio/Privacy-Share-Buttons"> here </a></em>.',perma:"on",settings_perma:"Permanently enable data transfer for:",css_path:"",cookie_options:{path:"/",expires:365},services:{},},_create:function(){if(!this.options.services){return}this._append_css();this._attach()},_attach:function(){var e=a('<ul class="social_share_privacy_area" style="font-size: 0.6em"></ul>').appendTo(this.element);for(var d in this.options.services){if(!a.psb[d+"Button"]){continue}var b=a('<li class="'+d+'"><li');b[d+"Button"](a.extend(this.options,this.options.services[d])).appendTo(e)}var c=a("<li></li>");c.prependTo(e);this._info_area(c);this._options_area(c);c.buttonset()},_options_submenu:function(b){var c=this;var e=a("<div id='option-dropdown'></div>").addClass("dropdown").html(this.options.settings_perma+"<br/>");var h=function(k){var j=k.target.id;var i=j.substr(j.lastIndexOf("_")+1,j.length);var m="privacyShareButtons_"+i;var l=e.find("#"+k.target.id);if(l.is(":checked")){a.cookie(m,"perma_on",c.options.cookie_options);e.find("label[for="+j+"]").addClass("checked")}else{a.cookie(m,null,c.options.cookie_options);e.find("label[for="+j+"]").removeClass("checked")}};for(var d in this.options.services){var g=this.options.services[d];var f=a("<input type='checkbox' />").attr("id","perma_status_"+d).click(h);if(a.cookie("privacyShareButtons_"+d)=="perma_on"){f.attr("checked",true);this.element.find("."+d).click()}f.appendTo(e);a("<label></label><br/>").attr("for","perma_status_"+d).html(g.display_name).appendTo(e)}e.hide().appendTo(b.parent())},_options_area:function(b){if(this.options.perma){a("<button>option</button>").button({icons:{primary:"ui-icon-wrench",secondary:"ui-icon-triangle-1-s"},text:false}).click(function(){b.parent().find("#option-dropdown").toggle(100)}).appendTo(b);this._options_submenu(b)}},_info_area:function(b){var c=a("<div></div>").addClass("psb_info").addClass("dropdown").html("<p>"+this.options.txt_help+"</p>").hide().mouseleave(function(){a(this).hide()}).appendTo(b.parent());a("<button>info</button>").button({icons:{primary:"ui-icon-info"},text:false}).click(function(){c.toggle()}).appendTo(b)},_append_css:function(){if(this.options.css_path){if(document.createStyleSheet){document.createStyleSheet(options.css_path)}else{a("head").append('<link rel="stylesheet" type="text/css" href="'+options.css_path+'" />')}}},});a(document).ready(a(".social_share_privacy").each(function(){a(this).socialShareButtons(socialshareprivacy_settings)}))})(jQuery);
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment