/* Copyright (c) 2010 Christian Pfeiffer (christian.pfeiffer.k@gmail.com || http://www.fancydesign.de)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Last Change: 2010-11-18
* Version: 1.01
*
*/
(function($){
$.fn.share = function(options) {
var defaults = {
url: window.location, // url of social bookmark, default is current url, use 'http://www.example.com' for individual url
title: $('title').html(), // title of social bookmark, default is window title, use 'example' for individual title
description: $('meta[name=description]').attr("content"), // description of social bookmark, default is -description, use 'example' for individual description
share_twitter: $('meta[name=dtwitter]').attr("content"), // twitter description
share_email: $('meta[name=share_email]').attr("content"),
tags: $('meta[name=keywords]').attr("content"), // tags of social bookmark, default is -keywords, use 'example' for individual tags
services: ['all'], // 'all' for [all] services, or ['facebook', 'delicious', ..] for specific services
//img_size: 16, // width and height of -tag (px)
img_alt: '$service', // alt-text of -tag, $service will be replaced by the name of the service
a_target: '_blank', // target-attribute of -tag
a_title: 'share on $service' // title-attribute of -tag, $service will be replaced by the name of the service
};
var options = $.extend(defaults, options);
return this.each(function() {
var optionsurl=options.url;
var linebreak = '%0D%0A%0D%0A';
var optionstitle=options.title;
var emailsubject='Prudential - Bring Your Challenges';
var target = $(this);
var services = {
facebook: ['http://www.facebook.com/sharer.php?u=' + escape(options.url) + '&t=' + options.title, '../media/img/icon_facebook.gif'],
twitter: ['http://twitter.com/?status=' + options.share_twitter + options.url, '../media/img/icon_twitter.gif'],
linkedin: ['http://www.linkedin.com/shareArticle?mini=true&url=' + options.url + '&title=' + options.title + '&source=&summary=' + options.description, '../media/img/icon_linkedin.gif'],
email: ['mailto:Add a Recipient?subject='+emailsubject+'&body=See how Prudential is tackling our biggest financial challenges:'+linebreak+optionsurl+ linebreak, '../media/img/icon_email.gif']
/*delicious: ['http://del.icio.us/post?url=' + options.url + '&title=' + options.title + '&tags=' + options.tags + '¬es=' + options.description, 'http://www.delicious.com/favicon.ico'],
digg: ['http://digg.com/submit?phase=2&url=' + options.url + '&title=' + options.title, 'http://cdn1.diggstatic.com/img/favicon.a015f25c.ico'],
google: ['http://www.google.com/bookmarks/mark?op=add&bkmk=' + options.url + '&title=' + options.title + '&labels=' + options.tags + '&annotation=' + options.description, 'http://www.google.com/favicon.ico'],
yahoo: ['http://bookmarks.yahoo.com/toolbar/savebm?u=' + options.url + '&t=' + options.title + "&d=" + options.description, 'http://l.yimg.com/i/i/eu/aut/favic1.ico'],
misterwong: ['http://www.mister-wong.com/index.php?action=addurl&bm_url=' + options.url + '&bm_description=' + options.title + '&bm_tags=' + options.tags + '&bm_notice=' + options.description, 'http://www.mister-wong.de/favicon.ico'],
netvibes: ['http://www.netvibes.com/share?url=' + options.url + '&title=' + options.title, 'http://cdn.netvibes.com/favicon.ico'],
stumbleupon:['http://www.stumbleupon.com/submit?url=' + options.url + '&title=' + options.title, 'http://cdn.stumble-upon.com/favicon.ico']
stumbleupon:['http://www.stumbleupon.com/submit?url=' + options.url + '&title=' + options.title, 'http://cdn.stumble-upon.com/favicon.ico']*/
}
if(options.services == "all") {
options.services = new Array();
for(n in services) options.services.push(n);
}
$.each(options.services, function(index, service) {
if(services[service] != undefined) {
var content = '';
target.append(content);
}
});
});
};
})(jQuery);