Utilisateur:Perditax/monobook.js
Un article de Wikipédia, l'encyclopédie libre.
Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.
document.write('<script type="text/javascript" src="' + 'http://fr.wikipedia.org/w/index.php?title=Utilisateur:Perditax/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:Dake/monobook.js/deluxehistory.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); <!-- ONGLETS --> function addLoadEvent(func) { if (window.addEventListener) window.addEventListener("load", func, false); else if (window.attachEvent) window.attachEvent("onload", func); } function nouvelOnglet() { var a = document.getElementById("p-cactions"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { b[0].innerHTML = b[0].innerHTML + '<li><a href="http://fr.wikipedia.org/wiki/user:Perditax/Test Zone">Bac à sable</a></li>' } } } addLoadEvent(nouvelOnglet); <!-- CHOIX D'AFFICHAGE DANS LA LISTE DE CONTRIBUTIONS --> var pagesArray; function SortContributions() { if (unescape(window.location.href).indexOf("Special:Contributions") > 0) { pagesArray = new pages(); try { var lis = document.getElementById("bodyContent").getElementsByTagName("ul")[0].getElementsByTagName("li"); } catch (e) { return; } for (var cpt = 0 ; cpt < lis.length ; cpt++) { var as = lis[cpt].getElementsByTagName("a"); pagesArray.newPage(as[2].innerHTML, (as.length > 3 ? (as[3].href.indexOf("#") > 0 ? as[3].href.split("#")[as[3].href.split("#").length -1] : "") : "")); } // for var select = document.createElement("select"); var opt1 = document.createElement("option"); select.options.add(opt1); opt1.value = 0; opt1.innerHTML = "Toutes les pages"; opt1.selected = true; var arrTmp = new Array(); for (var cpt1 = 0 ; cpt1 < pagesArray.length ; cpt1++) { var found = false; for (var cpt2 = 0 ; cpt2 < arrTmp.length && !found; cpt2++) if (pagesArray.nom[cpt1] == arrTmp[cpt2]) found = true; if (!found) arrTmp.push(pagesArray.nom[cpt1]); } //for arrTmp = arrTmp.sort(); for (var cpt1 = 0 ; cpt1 < arrTmp.length ; cpt1++) { var opt = document.createElement("option"); select.options.add(opt); opt.value = 1; opt.innerHTML = arrTmp[cpt1]; } //for select.id = "selectPage"; if (select.attachEvent) select.attachEvent("onpropertychange", toggleLiView) else select.setAttribute("onchange", "javascript: toggleLiView()") var chkboxSel = document.createElement("input"); chkboxSel.id = "revSelect"; chkboxSel.type = "checkbox"; if (chkboxSel.attachEvent) chkboxSel.attachEvent("onpropertychange", reverseSelect) else chkboxSel.setAttribute("onchange", "javascript: reverseSelect()") var lblSel = document.createElement("label"); lblSel.innerHTML = "Inverser la boîte de sélection"; lblSel.htmlFor = "revSelect"; var chkboxPage= document.createElement("input"); chkboxPage.id = "showPageOnce"; chkboxPage.type = "checkbox"; if (chkboxPage.attachEvent) chkboxPage.attachEvent("onpropertychange", toggleLiView) else chkboxPage.setAttribute("onchange", "javascript: toggleLiView()") var lblPage = document.createElement("label"); lblPage.innerHTML = "N'afficher chaque page qu'une fois"; lblPage.htmlFor = "showPageOnce"; var chkboxSection= document.createElement("input"); chkboxSection.id = "showSectionOnce"; chkboxSection.type = "checkbox"; if (chkboxSection.attachEvent) chkboxSection.attachEvent("onpropertychange", toggleLiView) else chkboxSection.setAttribute("onchange", "javascript: toggleLiView()") var lblSection= document.createElement("label"); lblSection.innerHTML = "N'afficher chaque section qu'une fois"; lblSection.htmlFor = "showSectionOnce"; var form = document.getElementsByTagName("form")[0]; form.appendChild(select); form.appendChild(chkboxSel); form.appendChild(lblSel); form.appendChild(document.createElement("br")); form.appendChild(chkboxPage); form.appendChild(lblPage); form.appendChild(chkboxSection); form.appendChild(lblSection); } //if } //function addLoadEvent(SortContributions) function pages() { this.nom = new Array(); this.section = new Array(); this.length = 0; } pages.prototype.newPage = function (nom, sec) { this.nom[this.length] = nom; this.section[this.length] = sec; this.length++; } function pages() { this.nom = new Array(); this.section = new Array(); this.length = 0; } pages.prototype.newPage = function (nom, sec) { this.nom[this.length] = nom; this.section[this.length] = sec; this.length++; } function toggleLiView() { var checkedPage = document.getElementById("showPageOnce").checked; var checkedSection = document.getElementById("showSectionOnce").checked; var pageName = document.getElementById("selectPage").options[document.getElementById("selectPage").selectedIndex].innerHTML; try { var lis = document.getElementById("bodyContent").getElementsByTagName("ul")[0].getElementsByTagName("li"); } catch (e) { return; } for (var cpt1 = 0 ; cpt1 < pagesArray.length ; cpt1++) { var selected; if (pageName != "Toutes les pages" && pageName != pagesArray.nom[cpt1]) { selected = false; lis[cpt1].style.display = "none"; } else { selected = true; lis[cpt1].style.display = "list-item"; } if (selected && checkedPage) { for (var cpt2 = 0 ; cpt2 < cpt1 ; cpt2++) { if (pagesArray.nom[cpt2] == pagesArray.nom[cpt1]) { lis[cpt1].style.display = "none"; break; } } } else if (selected && checkedSection) { for (var cpt2 = 0 ; cpt2 < cpt1 ; cpt2++) { if (pagesArray.nom[cpt2] == pagesArray.nom[cpt1] && pagesArray.section[cpt2] == pagesArray.section[cpt1]) { lis[cpt1].style.display = "none"; break; } } } } //for } //function function reverseSelect() { var sel = document.getElementById("selectPage"); var selected = sel.options[sel.selectedIndex].innerHTML; for (var cpt = 1 ; cpt < Math.floor((sel.options.length - 1) / 2) ; cpt++) { var strTmp = sel.options[cpt].innerHTML; sel.options[cpt].innerHTML = sel.options[sel.options.length - cpt].innerHTML; sel.options[sel.options.length - cpt].innerHTML = strTmp; } for (var cpt = 0 ; cpt < sel.options.length ; cpt++) { if (sel.options[cpt].innerHTML == selected) { sel.options[cpt].selected = true; return; } } } <!-- BOÎTE À OUTILS AMÉLIORÉE --> function PaletteOutils() { var a = document.getElementById("p-tb"); if (a) { b = a.getElementsByTagName("ul"); if(b.length > 0) { b[0].innerHTML = b[0].innerHTML + '<li><span id="n-bistro" title="http://commons.wikimedia.org/wiki/Special:Upload">' + '<a href="http://commons.wikimedia.org/wiki/Special:Upload">' + 'Importer une image ou un son sur Commons</a></span> </li>' + '<li><a href="http://fr.wikipedia.org/wiki/Utilisateur:Perditax/monobook.js">Monobook.js</a></li>' + '<li><a href="http://fr.wikipedia.org/wiki/Utilisateur:Perditax/monobook.css">Monobook.css</a></li>' + '<li><a href="http://fr.wikipedia.org/wiki/Le_Bistro">Le Bistro</a></li>' + '<li><a href="http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Articles_sans_cat%C3%A9gories">Articles sans catégorie</a></li>' + '<li><a href="http://fr.wikipedia.org/wiki/Projet:Maintenance/Analyse_des_cr%C3%A9ations_sous_IP">Créations sous IP</a></li>' } } } addLoadEvent(PaletteOutils);