User:Verdy p/common.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
The accompanying .css page for this skin can be added at User:Verdy p/common.css. |
- Report page listing warnings and errors.
//<nowiki>
/* Deprecation of Javascript functions in Mediawiki:
importScript
importScriptURI
importStylesheet
importStylesheetURI
See: https://www.mediawiki.org/wiki/ResourceLoader/JavaScript_Deprecations
https://www.mediawiki.org/wiki/ResourceLoader/Default_modules#mw.loader.load
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));
}
// no longer in c:User:Verdy/common.js, replaced by c:User:Verdy/common.css on this wiki for all skins, and global // supporte le maximum d’écritures
m:User:Verdy/global.css for all wikis
importStylesheetWP('fr','Utilisateur:Verdy_p/polices.css');
*/
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));
}
//catALot///////////////////////////////////////
////////// Cat-A-Lot user preferences //////////
window.catALotPrefs = {
'watchlist': 'preferences',
'minor': false,
'editpages': true,
'docleanup': false,
'subcatcount': 500
};
////////////////////////////////////catALotEnd//
/* tri correct des tableaux */
importScriptWP('en', 'User:Verdy_p/tablesort.js');
/* correcting current bug in Common.js */
function createCollapseButtons() {
var collapsibleTableIndex = 0;
var NavigationBoxes = new Object(); // NOT "... = {};" !!
var Tables = document.getElementsByTagName('table');
for (var i = 0; i < Tables.length; i++) {
if (hasClass(Tables[i], 'collapsible')) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName('tr')[0];
if (!HeaderRow) continue;
var Header = HeaderRow.getElementsByTagName('th')[0];
if (!Header) continue;
NavigationBoxes[collapsibleTableIndex] = Tables[i];
Tables[i].setAttribute('id', 'collapsibleTable' + collapsibleTableIndex);
var ButtonLink = document.createElement('a');
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute('id', 'collapseButton' + collapsibleTableIndex);
ButtonLink.setAttribute('href', '#');
ButtonLink.setAttribute('onclick', function collapseClick(evt) {
// This function MUST be reinstanciated for different values of `collapsibleTableIndex`, using a local
// closure in the current loop, for each enumerated collapsible table not disqualified above.
collapseTable(collapsibleTableIndex);
return killEvt(evt);
});
ButtonLink.appendChild(document.createTextNode(collapseCaption));
var Button = document.createElement('span');
Button.className = 'collapseButton'; //Styles are declared in Common.css
Button.appendChild(document.createTextNode('['));
Button.appendChild(ButtonLink);
Button.appendChild(document.createTextNode(']'));
Header.insertBefore(Button, Header.childNodes[0]);
collapsibleTableIndex++;
}
}
}
/* Keymanweb */
// importScriptWP('en', 'User:Keymanweb/keymanweb.js'); // does not work (cross site, not the same base domain)
if (0) { // disabled (script not secured with HTTPS)
var content = document.getElementById('bodyContent');
if (content) {
addOnloadHook(function() {
importStylesheetWP('en', 'User:Keymanweb/keymanweb.css');
mw.loader.load('https://s.keyman.com/kmw/engine/14.0.280/keymanweb.js');
mw.loader.load('https://s.keyman.com/kmw/engine/14.0.280/kmwuitoggle.js');
(function(kmw) {
kmw.init({ attachType: 'auto' });
kmw.addKeyboards('@en'); // Loads default English keyboard from Keyman Cloud (CDN)
kmw.addKeyboards('@fr'); // Loads default French keyboard from Keyman Cloud (CDN)
})(window.keyman);
var kmwc = document.createElement('div');
kmwc.setAttribute('id', 'KeymanWebControl');
content.prepend(kmwc);
});
}
}
//</nowiki>