Wikipedia:Personliga stilmallar och skript/Dela på Facebook
Utseende
Det här är ett personligt Javascript som kan användas för att anpassa Wikipedia utöver alternativen under "Inställningar". För användning, kopiera nedanstående kod och klistra in den på sidan Special:Min sida/common.js (eller motsvarande sida för andra skinn). Observera att du måste vara inloggad för att det ska fungera. |
Beskrivning: Skriptet gör det möjligt att enkelt dela en artikel på Facebook.
/* <source lang="javascript"> Please keep the following lines intact Userscript: [[en:User:TheDJ/Sharebox]]. Sharebox is a script that changes your toolbox. It adds a new order, some icons and a share button to publish something to facebook for instance. This share button is powered by addthis ( http://www.addthis.com/ ) Written by: [[en:User:TheDJ]] */ var addthis_config = { data_use_flash: false, data_use_cookies: false, ui_language: wgUserLanguage, } importScriptURI('http://s7.addthis.com/js/250/addthis_widget.js?pub=xa-4a83143d4db59aef'); function localaddthis() { var parent = document.getElementById( 't-specialpages' ).parentNode; var permael = document.getElementById( 't-permalink'); var printel = document.getElementById( 't-print' ); var pdfel = document.getElementById( 'coll-download-as-rl' ); var citeel = document.getElementById( 't-cite' ); if( citeel || permael ) { var newel = document.createElement("LI"); var newhtml = '<div class="addthis_toolbox addthis_default_style">'; if( citeel ) newhtml += '<a class="at300m" href="' + citeel.getElementsByTagName("A")[0].href + '" title="' + citeel.getElementsByTagName("A")[0].title + '"><span class="at300bs" style="background: url(); font-size: larger; color:black;">“ ”</span> Cite</a>'; if( citeel && permael ) newhtml += '<span class="addthis_separator"></span>'; if( permael ) { newhtml += '<a class="at300m" href="' + permael.getElementsByTagName("A")[0].href + '" title="' + permael.getElementsByTagName("A")[0].title; if( citeel ) newhtml += '" style="position:absolute; left:7em;' newhtml += '">' /*<span class="at300bs" style="background: url();"></span> */ + 'Permalink</a>'; } newhtml +='</div>'; newel.innerHTML = newhtml; if( citeel ) parent.removeChild( citeel ); if( permael ) parent.removeChild( permael ); parent.insertBefore( newel, parent.firstChild ); } var shareel = document.createElement("LI"); shareel.innerHTML= '<div class="addthis_toolbox addthis_default_style"><a class="addthis_button_email"> E-mail</a><span class="addthis_separator"></span><a class="addthis_button_compact" style="position:absolute; left:7em;">Share</a></div>'; parent.insertBefore( shareel, parent.firstChild ); if( printel && pdfel ) { var parent = document.getElementById('collectionPortletList'); var newel = document.createElement("LI"); newel.innerHTML= '<div class="addthis_toolbox addthis_default_style"><a class="addthis_button_print"> Print</a><span class="addthis_separator"></span><a class="at300m" href="' + pdfel.getElementsByTagName("A")[0].href + '" title="' + pdfel.getElementsByTagName("A")[0].title + '" style="position:absolute; left:7em;"><span class="at300bs" style="background: url(http://upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif);"></span> PDF</a></div>'; parent.removeChild( printel ); parent.removeChild( pdfel ); parent.insertBefore( newel, parent.firstChild ); } } addOnloadHook(localaddthis);