MediaWiki:Share.js

function shareLinks { var a = document.getElementById( 'ca-edit' ); if( !a ) a = document.getElementById( 'ca-viewsource' ); if( !a ) return; // create tab var root = document.getElementById('p-cactions'); var node=root.getElementsByTagName('ul')[0]; root.className=root.className.replace(/(^| )emptyPortlet( |$)/,"$2"); var imga=document.createElement('img'); var link=document.createElement('a'); link.href=''; if (skin == 'monobook') { imga.setAttribute('src', 'http://images4.wikia.nocookie.net/__cb20110621070624/uncyclopedia/images/5/56/Share-icon-12x12.png'); imga.setAttribute('height', '12px'); imga.setAttribute('width', '12px'); imga.style.padding = '0 6px 0 0'; var an=document.createTextNode('Share'); //link.appendChild(imga); link.appendChild(an); }	else { imga.setAttribute('src', 'http://images3.wikia.nocookie.net/uncyclopedia/images/b/b5/Share-icon_vector.png'); imga.setAttribute('height', '16px'); imga.setAttribute('width', '16px'); imga.style.margin = '-4px 0 -2px 0'; link.appendChild(imga); }	var item=document.createElement('li'); item.appendChild(link); item.id = 'ca-share'; link.setAttribute('title', 'Share this page'); node.appendChild(item); var shares = new Array(8); var pathn = wgServer + wgArticlePath.replace('$1', wgPageName); var titlen = escape(wgCanonicalNamespace + ':' + wgTitle); var titlenu = escape(wgCanonicalNamespace + ':' + wgTitle + '- on Uncyclopedia'); shares[0] = ['http://www.facebook.com/share.php?u=' + pathn + '?facebook&t=' + titlenu, 'Facebook', 'd-facebook']; shares[1] = ['http://twitter.com/intent/tweet?original_referer=' + pathn + '&related=uncyclopedia&text=' + titlen + '&url=' + pathn, 'Twitter', 'd-twitter']; shares[2] = ['http://www.stumbleupon.com/submit?url=' + pathn + '&title=' + titlen, 'Stumbleupon', 'd-stumbleupon']; shares[3] = ['http://www.google.com/reader/link?url=' + pathn + '&srcTitle=Uncyclopedia&title=' + titlen, 'Buzz', 'd-buzz']; shares[4] = ['http://reddit.com/submit?url=' + pathn + '&title=' + titlenu, 'Reddit', 'd-reddit']; shares[5] = ['http://digg.com/submit?phase=2&url=' + pathn, 'Digg', 'd-digg']; shares[6] = ['http://spaces.live.com/BlogIt.aspx?Title=' + titlenu + '&SourceURL=' + pathn, 'BlogIt', 'd-blogit']; shares[7] = ['http://www.tumblr.com/share?v=3&u=' + pathn + '&t=' + titlenu, 'Tumblr', 'd-tumblr']; //shares[n] = ['http://www.myspace.com/Modules/PostTo/Pages/?l=3&u=' + pathn + '&t=' + titlenu, 'MySpace', 'd-myspace']; //shares[n] = ['http://www.delicious.com/save?v=5&noui&jump=close&url=' + pathn + '&title=' + titlen, 'Delicious', 'd-delicious']; //shares[n] = ['http://www.buzzfeed.com/...', 'BuzzFeed', 'd-buzzfeed']; addCactionsDropdown('ca-share', shares); } YAHOO.util.Event.onContentReady('p-cactions', shareLinks);