User:Verdy p/common.js

In the following article, we will explore User:Verdy p/common.js in depth, a topic that has generated great interest and debate in recent times. From its historical origins to its relevance in today's society, we will analyze its impact in different areas and its influence on people's daily lives. Through various points of view and expert opinions, we seek to shed light on User:Verdy p/common.js and provide the reader with a complete and balanced view of this topic that is so relevant today.
/* Deprecation of Javascript functions in Mediawiki:
  importScript
  importScriptURI
  importStylesheet
  importStylesheetURI
  See: https://www.mediawiki.orghttps://wikifreehand.com/en/ResourceLoader/JavaScript_Deprecations
       https://www.mediawiki.orghttps://wikifreehand.com/en/ResourceLoader/Default_modules#mw.loader.load
*/
function importScriptWP(lang, page) {
  mediaWiki.loader.load('//' + lang + '.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=' + encodeURI(page), 'text/javascript');
  // was: mw.loader.load('https//' + lang + '.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=' + encodeURI(page));
}
function importStylesheetWP(lang, page) {
  mediaWiki.loader.load('//' + lang + '.wikipedia.org/w/index.php?action=raw&ctype=text/css&title=' + encodeURI(page), 'text/css');
  // was: importStylesheetURI('https://'+lang+'.wikipedia.org/w/index.php?action=raw&ctype=text/css&title=' + encodeURI(page));
}

/* supporte le maximum d’écritures */
importStylesheetWP('fr','Utilisateur:Verdy_p/polices.css');
 
/* Keymanweb */
if (0) { // disabled (script not secured with HTTPS)
  importStylesheetWP('en','User:Keymanweb/keymanweb.css');
  addOnloadHook(function() {
        mw.loader.load('http://r.keymanweb.com/code/?id=243&domain='+location.hostname+'&page='+encodeURIComponent(location.pathname));
        var b=document.getElementById('bodyContent');b.innerHTML= '<div id="KeymanWebControl" />'+b.innerHTML;
     });
}

/* tri correct des tableaux */
importScriptWP('en', 'User:Verdy_p/tablesort.js');

/* correcting current bug in Common.js */
function createCollapseButtons() {
    var tableIndex = 0;
    var NavigationBoxes = new Object();
    var Tables = document.getElementsByTagName("table");
    for (var i = 0; i < Tables.length; i++) {
        if (hasClass(Tables, "collapsible")) {
            /* only add button and increment count if there is a header row to work with */
            var HeaderRow = Tables.getElementsByTagName("tr");
            if (!HeaderRow) continue;
            var Header = HeaderRow.getElementsByTagName("th");
            if (!Header) continue;
            NavigationBoxes = Tables;
            Tables.setAttribute("id", "collapsibleTable" + tableIndex);
            var Button     = document.createElement("span");
            var ButtonLink = document.createElement("a");
            var ButtonText = document.createTextNode(collapseCaption);
            Button.className = "collapseButton"; //Styles are declared in Common.css
            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute("id", "collapseButton" + tableIndex);
            ButtonLink.setAttribute("href", "#");
            ButtonLink.setAttribute("onclick", function(evt) {
                    collapseTable(tableIndex);
                    return killEvt(evt);
                });
            ButtonLink.appendChild(ButtonText);
            Button.appendChild(document.createTextNode("["));
            Button.appendChild(ButtonLink);
            Button.appendChild(document.createTextNode("]"));
            Header.insertBefore(Button, Header.childNodes);
            tableIndex++;
        }
    }
}