Commits

Mathias Panzenböck committed b762f3f

SocialSharePrivacy++

  • Participants
  • Parent commits 3e96445

Comments (0)

Files changed (11)

 <script type="text/javascript" src="javascripts/jquery.socialshareprivacy.reddit.js"></script>
 <script type="text/javascript" src="javascripts/jquery.socialshareprivacy.tumblr.js"></script>
 <script type="text/javascript" src="javascripts/jquery.socialshareprivacy.twitter.js"></script>
+<script type="text/javascript" src="javascripts/jquery.socialshareprivacy.stumbleupon.js"></script>
+<script type="text/javascript" src="javascripts/jquery.socialshareprivacy.linkedin.js"></script>
 <script type="text/javascript">
 
   var _gaq = _gaq || [];

File javascripts/jquery.socialshareprivacy.js

 	 * The provided base url has to be a valid absolute url. It will not be validated!
 	 * If no base url is given the document location is used.
 	 * Schemes that behave other than http might not work.
-	 * It tries to support file:-urls, but might fail in some cases.
+	 * This function tries to support file:-urls, but might fail in some cases.
 	 * email:-urls aren't supported at all (don't make sense anyway).
 	 */
 	function absurl (url, base) {
 		if (title && creator) {
 			return title + ' - ' + creator;
 		} else {
-			return $('title').text();
+			return title || $('meta[property="og:title"]').attr('content') || $('title').text();
 		}
 	}
 
 		META   : 'content',
 		IMG    : 'src',
 		A      : 'href',
-		IFRAME : 'src'
+		IFRAME : 'src',
+		LINK   : 'href'
 	};
 	
 	// find the largest image of the website
 		}
 
 		if (!img) {
-			imgs = $('itemscope *[itemprop="image"]').first();
+			imgs = $('meta[property="image"], meta[property="og:image"], meta[property="og:image:url"], meta[name="twitter:image"], link[rel="image_src"], itemscope *[itemprop="image"]').first();
 			if (imgs.length > 0) {
 				img = imgs.attr(IMAGE_ATTR_MAP[imgs[0].nodeName]);
 			}
 	// build URI from rel="canonical" or document.location
 	function getURI () {
 		var uri = document.location.href;
-		var canonical = $("link[rel=canonical]").attr("href");
+		var canonical = $("link[rel=canonical]").attr("href") || $('head meta[property="og:url"]').attr("content");
 
 		if (canonical) {
 			uri = absurl(canonical);
 					var $help_info;
 
 					if (service.privacy === 'safe') {
-						$help_info = $('<li class="help_info"><span class="info">' +
-							service.txt_info + '</span><div class="dummy_btn"></div></li>').addClass(class_name);
+						$help_info = $('<li class="help_info"><div class="info">' +
+							service.txt_info + '</div><div class="dummy_btn"></div></li>').addClass(class_name);
 						$help_info.find('.dummy_btn').
 							addClass(button_class).
 							append(service.button.call(this,service,uri,options));
 					}
 					else {
-						$help_info = $('<li class="help_info"><span class="info">' +
-							service.txt_info + '</span><span class="switch off">' + service.txt_off +
+						$help_info = $('<li class="help_info"><div class="info">' +
+							service.txt_info + '</div><span class="switch off">' + service.txt_off +
 							'</span><div class="dummy_btn"></div></li>').addClass(class_name);
 						$help_info.find('.dummy_btn').
 							addClass(button_class).

File javascripts/jquery.socialshareprivacy.linkedin.js

+/*
+ * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
+ *
+ * http://www.heise.de/extras/socialshareprivacy/
+ * http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html
+ *
+ * Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt,
+ * Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de
+ *
+ * Copiright (c) 2012 Mathias Panzenböck
+ *
+ * is released under the MIT License http://www.opensource.org/licenses/mit-license.php
+ *
+ * Spread the word, link to us if you can.
+ */
+(function ($, undefined) {
+	"use strict";
+
+	$.fn.socialSharePrivacy.settings.services.linkedin = {
+		'status'            : 'on',
+		'dummy_line_img'    : 'socialshareprivacy/images/dummy_linkedin.png',
+		'dummy_box_img'     : 'socialshareprivacy/images/dummy_box_linkedin.png',
+		'dummy_alt'         : '"Linked in"-Dummy',
+		'txt_info'          : '2 clicks for more privacy: The Linked in button will be enabled once you click here. Activating the button already sends data to Linked in &ndash; see <em>i</em>.',
+		'txt_off'           : 'not connected to Linked in',
+		'txt_on'            : 'connected to Linked in',
+		'perma_option'      : 'on',
+		'display_name'      : 'Linked in',
+		'referrer_track'    : '',
+		'onsuccess'         : null,
+		'onerror'           : null,
+		'showzero'          : false,
+		'button'            : function (options, uri, settings) {
+			var protocol = location.protocol === 'https:' ? 'https' : 'http';
+			var attrs = {
+				'data-counter' : settings.layout === 'line' ? 'right' : 'top',
+				'data-url'     : uri + options.referrer_track,
+				'data-showzero': String(options.showzero)
+			};
+			if (options.onsuccess) attrs['data-onsuccess'] = options.onsuccess;
+			if (options.onerror)   attrs['data-onerror']   = options.onerror;
+			var $code = $('<script type="IN/Share"></script>').attr(attrs);
+
+			if (window.IN && window.IN.parse) {
+				$code = $code.add('<script type="text/javascript">IN.parse(document.body);</script>');
+			}
+			else if ($('script[src^="'+protocol+'://platform.linkedin.com/"]').length === 0) {
+				$code = $code.add('<script type="text/javascript" src="'+protocol+'://platform.linkedin.com/in.js"></script>');
+			}
+
+			return $code;
+		}
+	};
+})(jQuery);

File javascripts/jquery.socialshareprivacy.pinterest.js

 		'dummy_box_img'     : 'socialshareprivacy/images/dummy_box_pinit.png',
 		'dummy_alt'         : '"Pin it"-Dummy',
 		'txt_info'          : '2 clicks for more privacy: The Pin it button will be enabled once you click here. Activating the button already sends data to Pinterest &ndash; see <em>i</em>.',
-		'txt_off'           : 'not connceted to Pinterest',
-		'txt_on'            : 'connceted to Pinterest',
+		'txt_off'           : 'not connected to Pinterest',
+		'txt_on'            : 'connected to Pinterest',
 		'perma_option'      : 'on',
 		'display_name'      : 'Pinterest',
 		'referrer_track'    : '',

File javascripts/jquery.socialshareprivacy.stumbleupon.js

+/*
+ * jquery.socialshareprivacy.js | 2 Klicks fuer mehr Datenschutz
+ *
+ * http://www.heise.de/extras/socialshareprivacy/
+ * http://www.heise.de/ct/artikel/2-Klicks-fuer-mehr-Datenschutz-1333879.html
+ *
+ * Copyright (c) 2011 Hilko Holweg, Sebastian Hilbig, Nicolas Heiringhoff, Juergen Schmidt,
+ * Heise Zeitschriften Verlag GmbH & Co. KG, http://www.heise.de
+ *
+ * Copiright (c) 2012 Mathias Panzenböck
+ *
+ * is released under the MIT License http://www.opensource.org/licenses/mit-license.php
+ *
+ * Spread the word, link to us if you can.
+ */
+
+(function ($, undefined) {
+	"use strict";
+
+	$.fn.socialSharePrivacy.settings.services.stumbleupon = {
+		'status'            : 'on', 
+		'button_class'      : 'stumbleupon',
+		'dummy_line_img'    : 'socialshareprivacy/images/dummy_stumbleupon.png',
+		'dummy_box_img'     : 'socialshareprivacy/images/dummy_box_stumbleupon.png',
+		'dummy_alt'         : '"Stumble!"-Dummy',
+		'txt_info'          : '2 clicks for more privacy: The Stumble! button will be enabled once you click here. Activating the button already sends data to Stumble Upon &ndash; see <em>i</em>.',
+		'txt_off'           : 'not connceted to stumble upon',
+		'txt_on'            : 'connceted to stumble upon',
+		'perma_option'      : 'on',
+		'display_name'      : 'Stumble Upon',
+		'referrer_track'    : '',
+		'button'            : function (options, uri, settings) {
+			var base_url = 'https:' === document.location.protocol ? 'https://' : 'http://';
+			var w, h;
+
+			if (settings.layout === 'line') {
+				w = '74';
+				h = '18';
+				base_url += 'badge.stumbleupon.com/badge/embed/1/?';
+			}
+			else {
+				w = '50';
+				h = '60';
+				base_url += 'badge.stumbleupon.com/badge/embed/5/?';
+			}
+
+			return $('<iframe allowtransparency="true" frameborder="0" scrolling="no"></iframe>').attr({
+				src:    base_url+$.param({url: uri + options.referrer_track}),
+				width:  w,
+				height: h
+			});
+		}
+	};
+})(jQuery);

File socialshareprivacy/images/dummy_box_linkedin.png

Added
New image

File socialshareprivacy/images/dummy_box_stumbleupon.png

Added
New image

File socialshareprivacy/images/dummy_linkedin.png

Added
New image

File socialshareprivacy/images/dummy_stumbleupon.png

Added
New image

File socialshareprivacy/socialshareprivacy.css

 .social_share_privacy_area {
-    clear: both;
-    margin: 5px 0 !important;
+	clear: both;
+	margin: 5px 0;
 	list-style-type: none;
 	padding: 0;
 	width: auto;
 	display: block;
 }
+.social_share_privacy_area.line {
+	height: 25px;
+}
 .social_share_privacy_area.box {
 	width: 95px;
 }
 	text-align: center;
 }
 .social_share_privacy_area.line li {
-	height: 25px;
+	height: 21px;
 	float: left;
 }
 .social_share_privacy_area li .dummy_btn {
 }
 .social_share_privacy_area .pinterest iframe,
 .social_share_privacy_area .reddit iframe,
+.social_share_privacy_area .stumbleupon iframe,
 .social_share_privacy_area .twitter iframe,
 .social_share_privacy_area .facebook iframe {
 	overflow: hidden;
 }
 .social_share_privacy_area.line .facebook iframe {
 	width: 120px;
-	height: 21px;
+	height: 20px;
 }
 .social_share_privacy_area.box .facebook iframe {
 	width: 62px;
 	width: 58px;
 	height: 66px;
 }
+.social_share_privacy_area.line .stumbleupon iframe,
+.social_share_privacy_area.line .stumbleupon img {
+	width: 74px;
+	height: 18px;
+}
+.social_share_privacy_area.box .stumbleupon iframe,
+.social_share_privacy_area.box .stumbleupon img {
+	width: 50px;
+	height: 60px;
+}
+.social_share_privacy_area.line .linkedin img.linkedin_privacy_dummy {
+	width: 63px;
+	height: 20px;
+}
+.social_share_privacy_area.box .linkedin img.linkedin_privacy_dummy {
+	width: 61px;
+	height: 62px;
+}
 .social_share_privacy_area.line .twitter iframe {
 	width: 120px;
 	height: 20px;
 	background: url(images/mail_box.png) top left no-repeat transparent;
 }
 .social_share_privacy_area.line .reddit img,
-.social_share_privacy_area.line .reddit iframe {
+.social_share_privacy_area.line .reddit iframe,
+.social_share_privacy_area.line .stumbleupon img,
+.social_share_privacy_area.line .stumbleupon iframe {
 	margin-right: 20px;
 }
 .social_share_privacy_area.line li div.tweet {
 /* Switch end */
 /* Tooltips begin */
 .social_share_privacy_area li.help_info {
-    position: relative;
-	white-space: nowrap;
-}
-.social_share_privacy_area li.help_info .info {
-	white-space: normal;
+    position: relative; 
 }
 .social_share_privacy_area li.settings_info,
 .social_share_privacy_area li.help_info .info {
     font-size: 12px;
     line-height: 16px;
     font-weight: bold;
+    border: 1px solid #ccc;
     -moz-border-radius: 4px;
     -webkit-border-radius: 4px;
     border-radius: 4px;
-    -moz-box-shadow: 0 0px 8px rgba(0,0,0,0.5);
-    -webkit-box-shadow: 0 0px 8px rgba(0,0,0,0.5);
-    box-shadow: 0 0px 8px rgba(0,0,0,0.5);
+    -moz-box-shadow: 0px 0px 15px rgba(0,0,0,0.4);
+    -webkit-box-shadow: 0px 0px 15px rgba(0,0,0,0.4);
+    box-shadow: 0px 0px 15px rgba(0,0,0,0.4);
     background-color: #fdfbec;
     color: #000;
     z-index: 500;
 }
 .social_share_privacy_area.box li.help_info .info {
 	left: 100%;
+	top: 0px;
+	bottom: auto;
 }
 .social_share_privacy_area li .help_info.icon .info {
     width: 350px;
     margin: 0;
     padding: 0;
 }
-.social_share_privacy_area li.settings_info .settings_info_menu.on .help_info.icon {
-	border-top-width: 0;
-	border-left-width: 0;
-}
 .social_share_privacy_area li.settings_info .settings_info_menu.perma_option_off .help_info.icon {
 	border-right-width: 2px;
 	-moz-border-radius: 5px;
 /* Settings/Info begin */
 .social_share_privacy_area li.settings_info {
 	position: relative;
-	top: -2px;
 }
 .social_share_privacy_area li.settings_info a {
 	text-decoration: none;
 }
 .social_share_privacy_area li.settings_info .settings_info_menu {
     background-color: #f3f4f5;
-	color: #000;
-    border: 2px solid #e7e3e3;
+    color: #000;
+	border-style: none;
 	-moz-border-radius: 5px;
 	-webkit-border-radius: 5px;
     border-radius: 5px;
-	-moz-box-shadow: 0px 0px 8px rgba(0,0,0,0.5);
-	-webkit-box-shadow: 0px 0px 8px rgba(0,0,0,0.5);
-    box-shadow: 0px 0px 8px rgba(0,0,0,0.5);
+	-moz-box-shadow: 0px 0px 15px rgba(0,0,0,0.4);
+	-webkit-box-shadow: 0px 0px 15px rgba(0,0,0,0.4);
+    box-shadow: 0px 0px 15px rgba(0,0,0,0.4);
     left: 0;
     position: absolute;
     top: 0;
 	margin: 0;
 	padding: 0;
 }
-.social_share_privacy_area li.settings_info .settings_info_menu.on .settings {
-	border-top-width: 0;
-}
 .social_share_privacy_area li.settings_info .settings_info_menu form fieldset {
     border-width: 0;
     margin: 0;
 
 .share {
 	position: relative;
-	height: 32px;
+	height: 30px;
 	overflow: hidden;
 }