Difference between revisions of "User:Nx/monobook.js"
< User:Nx
Jump to navigation
Jump to search
m (rm test) |
m (note to self: count from zero) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 108: | Line 108: | ||
//addOnloadHook(windowtest); | //addOnloadHook(windowtest); | ||
+ | |||
+ | addOnloadHook(function() { | ||
+ | if (mwEditButtons) | ||
+ | { | ||
+ | if (mwEditButtons.length >= 10) | ||
+ | { | ||
+ | if (mwEditButtons[9].tagOpen == ('--~' + '~' + '~'+ '~')) { mwEditButtons[9].tagOpen = ('~' + '~' + '~' + '~'); } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ); |
Revision as of 11:31, 21 February 2009
/*
sidebar customization, http://www.mediawiki.org/wiki/Manual:Interface/Sidebar#Add_or_remove_sections_.28JavaScript.29
*/
function ModifySidebar(action, section, name, link) {
try {
switch (section) {
case "languages":
var target = "p-lang";
break;
case "toolbox":
var target = "p-tb";
break;
case "navigation":
var target = "p-navigation";
break;
default:
var target = "p-" + section;
break;
}
if (action == "add") {
var node = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement('a');
var liNode = document.createElement('li');
aNode.appendChild(document.createTextNode(name));
aNode.setAttribute('href', link);
liNode.appendChild(aNode);
liNode.className='plainlinks';
node.appendChild(liNode);
}
if (action == "remove") {
var list = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var listelements = list.getElementsByTagName('li');
for (var i = 0; i < listelements.length; i++) {
if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
listelements[i].getElementsByTagName('a')[0].href == link) {
list.removeChild(listelements[i]);
}
}
}
} catch(e) {
// lets just ignore what's happened
return;
}
}
function CustomizeModificationsOfSidebar() {
//ModifySidebar("add", "navigation", "Logs", "http://rationalwiki.com/wiki/Special:Log");
}
addOnloadHook(CustomizeModificationsOfSidebar);
importScript('User:Nx/Scripts/Smileybox.js');
importScript('User:Nx/Scripts/Addcomment.js');
importScript('User:Nx/Scripts/Curse.js');
importScript('User:Nx/Scripts/AutoWIGO.js');
/*
Sandbox
*/
importScript('User:Nx/Scripts/Shared.js');
function windowtest()
{
if (wgPageName != "User:Nx/sandbox") return;
var testwindow = new JWindow();
testwindow.display();
var testwindow2 = new JWindow();
testwindow2.display();
var testwindow3 = new JWindow();
testwindow3.display();
var testwindow4 = new JWindow();
testwindow4.display();
var testwindow5 = new JWindow();
testwindow5.display();
var testwindow6 = new JWindow();
testwindow6.display();
var testwindow7 = new JWindow();
testwindow7.display();
var testwindow8 = new JWindow();
testwindow8.display();
var testwindow9 = new JWindow();
testwindow9.display();
var testwindow10 = new JWindow();
testwindow10.display();
var testwindow11 = new JWindow();
testwindow11.display();
var testwindow12 = new JWindow();
testwindow12.display();
var testwindow13 = new JWindow();
testwindow13.display();
var testwindow14 = new JWindow();
testwindow14.display();
}
//addOnloadHook(windowtest);
addOnloadHook(function() {
if (mwEditButtons)
{
if (mwEditButtons.length >= 10)
{
if (mwEditButtons[9].tagOpen == ('--~' + '~' + '~'+ '~')) { mwEditButtons[9].tagOpen = ('~' + '~' + '~' + '~'); }
}
}
}
);