User:Mike Dillon/Scripts/toolbox.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

// Requires: [[User:Mike Dillon/Scripts/addlilink.js]]

/* <pre><nowiki> */

// Add a new list item to the "toolbox" div
function addToolboxLink(url, name, id, title, key){
    var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    return addlilink(tb, url, name, id, title, key);
}

// Show/Hide Persondata
function doTogglePersondata() {
    var element = document.getElementById('persondata');

    if (element.style.display == 'none') {
        element.style.display = 'table';
    } else {
        element.style.display = 'none';
    }
}

addOnloadHook(function () {
    if (document.getElementById('persondata') != null) {
        return addToolboxLink("javascript:doTogglePersondata()",
            "Show/hide persondata", "t-togglepersondata", "Toggle persondata on/off");
    }
});

/* </nowiki></pre> */