User:TheDJ/sharebox.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:TheDJ/sharebox. |
/* <source lang="javascript">
Please keep the following lines intact
Userscript: [[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/ )
You can install it by adding "importScript( 'User:TheDJ/sharebox.js );" to
your [[Special:MyPage/monobook.js]].
Written by: [[User:TheDJ]]
<nowiki> */
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(/media/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);
/* </nowiki></source> */