User:Mike Dillon/Scripts/navbox.js

Hello, you have come here looking for the meaning of the word User:Mike Dillon/Scripts/navbox.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word User:Mike Dillon/Scripts/navbox.js, but we will also tell you about its etymology, its characteristics and you will know how to say User:Mike Dillon/Scripts/navbox.js in singular and plural. Everything you need to know about the word User:Mike Dillon/Scripts/navbox.js you have here. The definition of the word User:Mike Dillon/Scripts/navbox.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofUser:Mike Dillon/Scripts/navbox.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
// Requires: ]

function addNavbox(id, title, refId, refMode) {
    // Find the toolbox
    var oldBox = document.getElementById('p-tb');
    if (!oldBox) return;

    // Clone the toolbox and change its DOM id
    var newBox = oldBox.cloneNode(true);
    newBox.id = id;

    // Find the header and list components
    var oldHeader = newBox.getElementsByTagName('h5');
    var oldList = newBox.getElementsByTagName('ul');
    if (!(oldHeader && oldList)) return;

    // Create the new header and list
    var newHeader = easyDom.h5(title);
    var newList = easyDom.ul();

    // Replace the header and list
    oldHeader.parentNode.replaceChild(newHeader, oldHeader);
    oldList.parentNode.replaceChild(newList, oldList);

    var parent = oldBox.parentNode;
    if (refId) {
        var refElement = toolbox.parentNode.getElementById(refId);
        if (refElement) {
            if (refMode && refMode == 'replace') {
                parent.replaceChild(newBox, refElement);
            } else {
                parent.insertBefore(newBox, refElement);
            }
        } else {
            parent.appendChild(newBox);
        }
    } else {
        parent.appendChild(newBox);
    }

    return newList;
}

function addToggleNavbox(id, title, closed, refId, refMode) {
    with (easyDom) {
        var toggle = a({ "href": "#" }, "+/-");
        var toggleTitle = span(title, ' ', toggle);
    }
    var list = addNavbox(id, toggleTitle, refId, refMode);

    if (!list.parentNode.style.maxHeight) {
        list.parentNode.style.maxHeight = "15em";
    }

    var overflowProperty = list.parentNode.style.overflowX
        ? "overflowX" : "overflow";
    var origDisplay = list.style.display;
    var origOverflow = list.parentNode.style;
    var toggleListDisplay = function (closed) {
        if (typeof closed != typeof false) {
            closed = list.style.display == origDisplay;
        }
        var newDisplay;
        var newOverflow; 
        if (!closed) {
            newDisplay = origDisplay;
            newOverflow = 'scroll';
        } else {
            newDisplay = 'none';
            newOverflow = origOverflow;
        }
   
        list.style.display = newDisplay;
        list.parentNode.style = newOverflow;

        return false;
    };
    toggle.onclick = toggleListDisplay;
    toggleListDisplay(closed);

    return list;
}