Jump to content

User:Mike Dillon/Scripts/duplicateTabs.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* <pre><nowiki> */

// Duplicate tabs from the top to the bottom of the content area
$(function () {
    // Clone the original tabs and change the id to "mytabs"
    var tabs = document.getElementById('p-cactions').cloneNode(true);
    tabs.id = 'mytabs';

    // Find individual tabs with ids and prefix the ids with "mytabs-"
    var listitems = tabs.getElementsByTagName('LI');
    for (var i=0; i < listitems.length; i++) {
        if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
    }

    // Add the cloned tabs at the end of the "column-content" div
    document.getElementById('column-content').appendChild(tabs);
});

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