Санамж: Хадгалсны дараа шинэ тохиргоогоо харахын тулд браузерынхаа cache-г орхих хэрэгтэй болж магадгүй. Мозилла / Файрфокс / Сафари: Shift-г дарж байхдаа Reload дээр дар, эсвэл Ctrl-Shift-R гэж дар (Макинтош дээр Cmd-Shift-R); Интернэт Эксплорер: Ctrl -г дарж байхдаа Refresh дээр дар, эсвэл Ctrl-F5 гэж дар; Конкерор: Reload товч дээр л дар, эсвэл F5-г дар; Опера-гийн хэрэглэгчид cache-г Tools→Preferences дээр бүрэн арилгах шаардлагатай болж магадгүй.

/** Helper function *********************************************************
  *
  *  Description: 
  *  
  */

var hasClass = (function () {
     var reCache = {};
     return function (element, className) {
         return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
     };
 })();

 /** Collapsible tables ******************************************************
  *
  *  Synopsis:  Allows tables to be collapsed, showing only the header.
  * 
  *  Maintainers: [[User:Latebird]]
  *
  *  To get a [hide] link attached, the table must have:
  *  - the class "collapsible"
  *  - at least one <th> in the first <tr>.
  *    If one of the <th>s found also has the class "collapsible", then that
  *    one will be used, otherwise just the first one.
  *    The link will be inserted <th> as a div with the style "float:right;".
  *
  *  If the table has the class "collapsed", then it will be collapsed
  *  unconditionally on page load.
  *
  *  If the table has the class "autocollapse", then it will be collapsed
  *  conditionally on page load, if the page contains <ct_minAutoCollapse>
  *  or more collapsible tables. A resonable value to set below is 3.
  *
  */


/*  Start CONFIGURABLE *****************************************************/

var ct_minAutoCollapse = 3;  // this or more navboxes will autocollapse

var ct_collapseCaption = "hide";   // label for hiding box
var ct_expandCaption   = "show";   // label for showing box

/*  End CONFIGURABLE *******************************************************/


var ct_collapseString = '[' + ct_collapseCaption + ']';
var ct_expandString = '[' + ct_expandCaption + ']';
 
function ct_collapse(tableIndex)
{
    var Button = document.getElementById("collapseButton" + tableIndex);
    var Table = document.getElementById("collapsibleTable" + tableIndex);

    if (!Table || !Button) {
        return false;
    }

    var Rows = Table.getElementsByTagName("tr"); 

    if (Button.firstChild.data == ct_collapseString) {
        for (var i = 1; i < Rows.length; i++) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = ct_expandString;
    } else {
        for (var i = 1; i < Rows.length; i++) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = ct_collapseString;
    }
}


function ct_MakeButton()
{
    var tableIndex = 0;
    var NavigationBoxes = new Object();
    var Tables = document.getElementsByTagName("table");

    for (var i = 0; i < Tables.length; i++) {
        if (hasClass(Tables[i], "collapsible")) {
            NavigationBoxes[ tableIndex ] = Tables[i];
            Tables[i].setAttribute("id", "collapsibleTable" + tableIndex);

            var Button     = document.createElement("div");
            var ButtonLink = document.createElement("a");
            var ButtonText = document.createTextNode(ct_collapseString);

            Button.style.styleFloat = "right";
            Button.style.cssFloat = "right";
            Button.style.fontWeight = "normal";
            Button.style.textAlign = "right";
            Button.style.width = "6em";

            ButtonLink.setAttribute("class", "NavBoxToggle");
            ButtonLink.setAttribute("id", "collapseButton" + tableIndex);
            ButtonLink.setAttribute("href",
                    "javascript: ct_collapse(" + tableIndex + ");");
            ButtonLink.appendChild(ButtonText);

            Button.appendChild(ButtonLink);

            var FirstRow = Tables[i].getElementsByTagName("tr")[0];
            var Headers = FirstRow.getElementsByTagName("th");
            /* only add button if there is a header row to work with */
            if (Headers.length) {
                var marked_header = 0
                for (var j = 0; j < Headers.length; j++) {
                    if (hasClass(Headers[j], "collapsible")) {
                        // found a <th> marked collapsible, add button here
                        Headers[j].insertBefore(Button,
                                Headers[j].childNodes[0]);
                        marked_header = 1;
                    }
                }
                if (marked_header == 0) {
                    // none marked, take first one
                    Headers[0].insertBefore(Button, Headers[0].childNodes[0]);
                }
                tableIndex++;
            }
        }
    }

    for (var i = 0;  i < tableIndex; i++) {
        if (hasClass(NavigationBoxes[i], "collapsed")
                || (tableIndex >= ct_minAutoCollapse
                    && !hasClass(NavigationBoxes[i], "expanded"))) {
            ct_collapse(i);
        }
    }
    return null;
}
 
$(ct_MakeButton);

/***************************************************************************/