User:Jd/monobook.js
< User:Jd
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
document.write('<script type="text/javascript" src="'
+ 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:GôTô/objects.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="'
+ 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:GôTô/ufunctions.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
document.write('<script type="text/javascript" src="'
+ 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:Dake/monobook.js/deluxehistory.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// --------------
// Event loader
// --------------
function addLoadEvent(func) {
if (window.addEventListener) {
window.addEventListener("load", func, false);
} else if (window.attachEvent) {
window.attachEvent("onload", func);
}
}
// ------------------------------------------------
// quicklinks : liens sous les onglets supérieurs
// p-nbx : boîte latérale personnelle
// ------------------------------------------------
function perso() {
var l = document.getElementById("column-one");
if (l) {
l.innerHTML = l.innerHTML
+ '<div class="portlet" id="p-nbx">'
+ ' <h5>Boîte perso</h5>'
+ ' <div class="pBody">'
+ ' <ul>'
+ ' <li><a href="http://wikimediafoundation.org/wiki/Wikimedia:Babel">Babel</a></li>'
+ ' <li><a href="http://wikimediafoundation.org/wiki/Wikimedia:Editors">WP Editors</a></li>'
+ ' </ul>'
+ ' <hr />'
+ ' </div>'
+ '</div> ';
}
}
// ------------------------
// Outils de modification
// ------------------------
function DeluxeBar() {
if (document.createTextNode) {
var toolbar = document.getElementById("toolbar");
if (!toolbar) return;
var messages = new Array()
messages[0] = "[[Category:" + "Français" + "]]";
messages[0] = "[[Category:" + "English" + "]]";
var images = new Array()
images[0] = "http://upload.wikimedia.org/wikipedia/fr/1/12/Button_accueilA.png";
images[0] = "http://upload.wikimedia.org/wikipedia/fr/1/12/Button_accueilB.png";
var commentaires = new Array()
commentaires[0] = "cat: Français"
commentaires[0] = "cat: English"
for (var i=0;i<messages.length;i++) {
var img = document.createElement("img");
img.setAttribute("src", images[i]);
var ref = document.createElement("a");
ref.setAttribute("href", "javascript:insertTags('', \"" + messages[i] + "\", '');" +
"javascript:changeSummary(\"" + commentaires[i] + "\");" );
ref.appendChild(img);
toolbar.appendChild(ref);
}
}
}
function changeSummary(sampleText) {
document.editform.wpSummary.value = document.editform.wpSummary.value + ' ' + sampleText
}
addLoadEvent(perso);
addLoadEvent(DeluxeBar);
// ---------------------------------
// Catégories dans le menu latéral
// ---------------------------------
function CategoriesAGauche() {
var catlinks = document.getElementById("catlinks");
if (!catlinks) { return; }
var categories = catlinks.getElementsByTagName("a") ;
var h5_cats = document.createElement( "h5" );
var text = document.createTextNode( "Catégories" ) ;
h5_cats.appendChild( text ) ;
var div_cats = document.createElement( "div" );
div_cats.setAttribute( "class", "pBody" );
var ul = document.createElement( "ul" );
var a_debut = 1 ;
for (var i = a_debut ; i < categories.length ; i++ ) {
var a = categories[i] ;
var li = document.createElement( "li" ) ;
li.appendChild( a.cloneNode(1) ) ;
ul.appendChild( li );
}
div_cats.appendChild( ul ) ;
var portlet = document.createElement( "div" ) ;
portlet.setAttribute( "class", "portlet" );
portlet.setAttribute( "id", "p-cat" ) ;
portlet.appendChild( h5_cats ) ;
portlet.appendChild( div_cats ) ;
//document.getElementById("column-one").insertBefore( document.getElementById("p-search"), portlet ) ;
//document.getElementById("column-one").appendChild( portlet ) ;
div_ptb = document.getElementById( "p-tb" );
document.getElementById("column-one").insertBefore( portlet, div_ptb)
}
addLoadEvent(CategoriesAGauche);
// This will add an [edit top] link at the top of all pages except preview pages
// by User:Pile0nades
// Add an [edit top] link to pages
addOnloadHook(function () {
// if this is preview page or generated page, stop
if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;
// get the page title
var pageTitle = document.title.split(" - ")[0].replace(" ", "_");
// create div and set innerHTML to link
var divContainer = document.createElement("div");
divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-right:15px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit§ion=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';
// insert divContainer into the DOM before the h1
if(window.location.href.indexOf("&action=edit") == -1)
document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
if(window.location.href.indexOf("&action=edit§ion=0") != -1)
document.getElementById("wpSummary").value = "/* Intro */ ";
});