This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
forked from patrickheck/socialshareprivacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.socialshareprivacy.min.js
4 lines (3 loc) · 10.4 KB
/
jquery.socialshareprivacy.min.js
1
2
3
4
/*! jquery.socialshareprivacy 2014-05-23 */
!function(a){"use strict";function b(a,b){var c=decodeURIComponent(a);if(c.length<=b)return a;var d=c.substring(0,b-1).lastIndexOf(" ");return c=encodeURIComponent(c.substring(0,d))+"…"}function c(b){var c=a('meta[name="'+b+'"]').attr("content");return c||""}function d(){var b=c("DC.title"),d=c("DC.creator");return b.length>0&&d.length>0?b+=" - "+d:b=a("title").text(),encodeURIComponent(b)}function e(){var b=document.location.href,c=a("link[rel=canonical]").attr("href");return c&&c.length>0&&(c.indexOf("http")<0&&(c=document.location.protocol+"//"+document.location.host+c),b=c),b}function f(a,b,c,d,e){var f=new Date;f.setTime(f.getTime()+24*c*60*60*1e3),document.cookie=a+"="+b+"; expires="+f.toUTCString()+"; path="+d+"; domain="+e}function g(a,b,c,d){var e=new Date;e.setTime(e.getTime()-100),document.cookie=a+"="+b+"; expires="+e.toUTCString()+"; path="+c+"; domain="+d}function h(b){var c={},d=b.split(/[;,] */);return d.forEach(function(b){var d=b.indexOf("=");if(!(0>d)){var e=a.trim(b.substr(0,d)),f=a.trim(b.substr(++d,b.length));if('"'==f[0]&&(f=f.slice(1,-1)),void 0===c[e])try{c[e]=decodeURIComponent(f)}catch(g){c[e]=f}}}),c}a.fn.socialSharePrivacy=function(c){var i={services:{facebook:{status:"on",dummy_img:"",txt_info:"2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.",txt_fb_off:"nicht mit Facebook verbunden",txt_fb_on:"mit Facebook verbunden",perma_option:"on",display_name:"Facebook",referrer_track:"",language:"de_DE",action:"recommend",dummy_caption:"Empfehlen"},twitter:{status:"on",dummy_img:"",txt_info:"2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Twitter senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.",txt_twitter_off:"nicht mit Twitter verbunden",txt_twitter_on:"mit Twitter verbunden",perma_option:"on",display_name:"Twitter",referrer_track:"",tweet_text:d,language:"en",dummy_caption:"Tweet"},gplus:{status:"on",dummy_img:"",txt_info:"2 Klicks für mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie können Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte übertragen – siehe <em>i</em>.",txt_gplus_off:"nicht mit Google+ verbunden",txt_gplus_on:"mit Google+ verbunden",perma_option:"on",display_name:"Google+",referrer_track:"",language:"de"}},info_link:"",txt_help:"Wenn Sie diese Felder durch einen Klick aktivieren, werden Informationen an Facebook, Twitter oder Google in die USA übertragen und unter Umständen auch dort gespeichert.",settings_perma:"Dauerhaft aktivieren und Datenüber­tragung zustimmen:",cookie_path:"/",cookie_domain:document.location.host,cookie_expires:"365",css_path:"socialshareprivacy/socialshareprivacy.css",uri:e},j=a.extend(!0,i,c),k="on"===j.services.facebook.status,l="on"===j.services.twitter.status,m="on"===j.services.gplus.status;return k||l||m?(j.css_path.length>0&&(document.createStyleSheet?document.createStyleSheet(j.css_path):a("head").append('<link rel="stylesheet" type="text/css" href="'+j.css_path+'" />')),this.each(function(){a(this).prepend('<ul class="social_share_privacy_area"></ul>');var c=a(".social_share_privacy_area",this),d=j.uri;if("function"==typeof d&&(d=d(c)),k){var e,i=encodeURIComponent(d+j.services.facebook.referrer_track),n='<iframe src="//www.facebook.com/plugins/like.php?locale='+j.services.facebook.language+"&href="+i+"&send=false&layout=button_count&width=120&show_faces=false&action="+j.services.facebook.action+'&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:145px; height:21px;" allowTransparency="true"></iframe>';e=j.services.facebook.dummy_img?'<img class="fb_like_privacy_dummy" src="'+j.services.facebook.dummy_img+'" alt="'+j.services.facebook.dummy_caption+'" />':'<div class="fb_like_privacy_dummy"><span>'+j.services.facebook.dummy_caption+"</span></div>",c.append('<li class="facebook help_info"><span class="info">'+j.services.facebook.txt_info+'</span><span class="switch off">'+j.services.facebook.txt_fb_off+'</span><div class="fb_like dummy_btn">'+e+"</div></li>");var o=a("li.facebook",c);c.on("click","li.facebook div.fb_like .fb_like_privacy_dummy,li.facebook span.switch",function(){o.find("span.switch").hasClass("off")?(o.addClass("info_off"),o.find("span.switch").addClass("on").removeClass("off").html(j.services.facebook.txt_fb_on),o.find(".fb_like_privacy_dummy").replaceWith(n)):(o.removeClass("info_off"),o.find("span.switch").addClass("off").removeClass("on").html(j.services.facebook.txt_fb_off),o.find(".fb_like").html(e))})}if(l){var p=j.services.twitter.tweet_text;"function"==typeof p&&(p=p()),p=b(p,"120");var q,r=encodeURIComponent(d+j.services.twitter.referrer_track),s=encodeURIComponent(d),t='<iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/tweet_button.html?url='+r+"&counturl="+s+"&text="+p+"&count=horizontal&lang="+j.services.twitter.language+'" style="width:130px; height:25px;"></iframe>';q=j.services.twitter.dummy_img?'<img class="tweet_this_dummy" src="'+j.services.twitter.dummy_img+'" alt="'+j.services.twitter.dummy_caption+'" />':'<div class="tweet_this_dummy"><span>'+j.services.twitter.dummy_caption+"</span></div>",c.append('<li class="twitter help_info"><span class="info">'+j.services.twitter.txt_info+'</span><span class="switch off">'+j.services.twitter.txt_twitter_off+'</span><div class="tweet dummy_btn">'+q+"</div></li>");var u=a("li.twitter",c);c.on("click","li.twitter .tweet_this_dummy,li.twitter span.switch",function(){u.find("span.switch").hasClass("off")?(u.addClass("info_off"),u.find("span.switch").addClass("on").removeClass("off").html(j.services.twitter.txt_twitter_on),u.find(".tweet_this_dummy").replaceWith(t)):(u.removeClass("info_off"),u.find("span.switch").addClass("off").removeClass("on").html(j.services.twitter.txt_twitter_off),u.find(".tweet").html(q))})}if(m){var v,w=d+j.services.gplus.referrer_track,x='<div class="g-plusone" data-size="medium" data-href="'+w+'"></div><script type="text/javascript">window.___gcfg = {lang: "'+j.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>';v=j.services.gplus.dummy_img?'<img src="'+j.services.gplus.dummy_img+'" alt="+1" class="gplus_one_dummy" />':'<div class="gplus_one_dummy">+1</div>',c.append('<li class="gplus help_info"><span class="info">'+j.services.gplus.txt_info+'</span><span class="switch off">'+j.services.gplus.txt_gplus_off+'</span><div class="gplusone dummy_btn">'+v+"</div></li>");var y=a("li.gplus",c);c.on("click","li.gplus div.gplusone .gplus_one_dummy,li.gplus span.switch",function(){y.find("span.switch").hasClass("off")?(y.addClass("info_off"),y.find("span.switch").addClass("on").removeClass("off").html(j.services.gplus.txt_gplus_on),y.find(".gplus_one_dummy").replaceWith(x)):(y.removeClass("info_off"),y.find("span.switch").addClass("off").removeClass("on").html(j.services.gplus.txt_gplus_off),y.find(".gplusone").html(v))})}c.append(""!==j.info_link?'<li class="settings_info"><div class="settings_info_menu off perma_option_off"><a href="'+j.info_link+'"><span class="help_info icon"><span class="info">'+j.txt_help+"</span></span></a></div></li>":'<li class="settings_info"><div class="settings_info_menu off perma_option_off"><span class="help_info icon"><span class="info">'+j.txt_help+"</span></span></div></li>"),c.on("mouseenter",".help_info:not(.info_off)",function(){var b=a(this),c=window.setTimeout(function(){a(b).addClass("display")},500);a(this).data("timeout_id",c)}),c.on("mouseleave",".help_info",function(){var b=a(this).data("timeout_id");window.clearTimeout(b),a(this).hasClass("display")&&a(this).removeClass("display")});var z="on"===j.services.facebook.perma_option,A="on"===j.services.twitter.perma_option,B="on"===j.services.gplus.perma_option;if((k&&z||l&&A||m&&B)&&JSON&&JSON.parse){var C=h(document.cookie),D=a("li.settings_info",c);D.find(".settings_info_menu").removeClass("perma_option_off"),D.find(".settings_info_menu").append('<span class="settings">Einstellungen</span><form><fieldset><legend>'+j.settings_perma+"</legend></fieldset></form>");var E=' checked="checked"';if(k&&z){var F="perma_on"===C.socialSharePrivacy_facebook?E:"";D.find("form fieldset").append('<input type="checkbox" name="perma_status_facebook" id="perma_status_facebook"'+F+' /><label for="perma_status_facebook">'+j.services.facebook.display_name+"</label>")}if(l&&A){var G="perma_on"===C.socialSharePrivacy_twitter?E:"";D.find("form fieldset").append('<input type="checkbox" name="perma_status_twitter" id="perma_status_twitter"'+G+' /><label for="perma_status_twitter">'+j.services.twitter.display_name+"</label>")}if(m&&B){var H="perma_on"===C.socialSharePrivacy_gplus?E:"";D.find("form fieldset").append('<input type="checkbox" name="perma_status_gplus" id="perma_status_gplus"'+H+' /><label for="perma_status_gplus">'+j.services.gplus.display_name+"</label>")}D.find("span.settings").css("cursor","pointer"),D.on("mouseenter","span.settings",function(){var b=window.setTimeout(function(){D.find(".settings_info_menu").removeClass("off").addClass("on")},500);a(this).data("timeout_id",b)}),D.on("mouseleave",function(){var b=a(this).data("timeout_id");window.clearTimeout(b),D.find(".settings_info_menu").removeClass("on").addClass("off")}),D.on("click","fieldset input",function(b){var d=b.target.id,e=d.substr(d.lastIndexOf("_")+1,d.length),h="socialSharePrivacy_"+e;a("#"+b.target.id+":checked").length?(f(h,"perma_on",j.cookie_expires,j.cookie_path,j.cookie_domain),a("form fieldset label[for="+d+"]",c).addClass("checked")):(g(h,"perma_on",j.cookie_path,j.cookie_domain),a("form fieldset label[for="+d+"]",c).removeClass("checked"))}),k&&z&&"perma_on"===C.socialSharePrivacy_facebook&&a("li.facebook span.switch",c).click(),l&&A&&"perma_on"===C.socialSharePrivacy_twitter&&a("li.twitter span.switch",c).click(),m&&B&&"perma_on"===C.socialSharePrivacy_gplus&&a("li.gplus span.switch",c).click()}})):void 0}}(jQuery);
//# sourceMappingURL=jquery.socialshareprivacy.min.map