more share options

This commit is contained in:
Mathias Panzenböck
2012-10-24 01:25:16 +02:00
parent 08ad291fd7
commit 74db398e52
8 changed files with 144 additions and 12 deletions

View File

@@ -26,6 +26,8 @@ if (!window.atob) window.atob = base64.decodeo;
<script type="text/javascript" src="jquery.socialshareprivacy.reddit.js"></script>
<script type="text/javascript" src="jquery.socialshareprivacy.pinterest.js"></script>
<script type="text/javascript" src="jquery.socialshareprivacy.mail.js"></script>
<script type="text/javascript" src="jquery.socialshareprivacy.stumbleupon.js"></script>
<script type="text/javascript" src="jquery.socialshareprivacy.linkedin.js"></script>
<script type="text/javascript" src="ponycfg.js" id="browser-ponies-config"></script>
<script type="text/javascript" src="browserponies.js" id="browser-ponies-script"></script>
<script type="text/javascript" src="gui-common.js"></script>
@@ -33,7 +35,7 @@ if (!window.atob) window.atob = base64.decodeo;
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery('#share').socialSharePrivacy({
order: ['twitter','tumblr','reddit','mail','gplus','pinterest','facebook'],
order: ['twitter','tumblr','reddit','stumbleupon','linkedin','mail','gplus','pinterest','facebook'],
layout: 'box',
services: {
tumblr: {type: 'video'},

View File

@@ -25,7 +25,7 @@
* 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) {
@@ -104,7 +104,7 @@
if (title && creator) {
return title + ' - ' + creator;
} else {
return $('title').text();
return title || $('meta[property="og:title"]').attr('content') || $('title').text();
}
}
@@ -126,7 +126,8 @@
META : 'content',
IMG : 'src',
A : 'href',
IFRAME : 'src'
IFRAME : 'src',
LINK : 'href'
};
// find the largest image of the website
@@ -139,7 +140,7 @@
}
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]);
}
@@ -215,7 +216,7 @@
// 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);

View File

@@ -0,0 +1,54 @@
/*
* 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);

View File

@@ -32,8 +32,8 @@
'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' : '',

View File

@@ -0,0 +1,54 @@
/*
* 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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,8 +1,8 @@
.social_share_privacy_area {
clear: both;
margin: 20px 0 !important;
clear: both;
margin: 5px 0;
list-style-type: none;
padding: 0 !important;
padding: 0;
width: auto;
display: block;
}
@@ -51,6 +51,7 @@
}
.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;
@@ -80,6 +81,24 @@
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;
@@ -151,7 +170,9 @@
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 {