Content deleted Content added
version 1.1.0: added initialization through addOnloadHook () |
maintenance: more info TypeError: Cannot read property 'appendChild' of null |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1:
▲ /**********************************************************************
* *
* Changes to this file affect other users. *
Line 9 ⟶ 7:
var shortcutsVersion =
var shortcutsReleaseDate =
/***********************************************************
Line 20 ⟶ 18:
* Starts a new section of links. Function for external use.
*/
{
shortcutsLinks[shortcutsLinks.length] = { 'name': name, 'links':
}
Line 28 ⟶ 26:
* Adds new link into the current section of links. Function for external use.
*/
{
var links = shortcutsLinks[shortcutsLinks.length - 1]['links'];
Line 43 ⟶ 41:
* Creates and returns an li element with the desired link.
*/
function shortcutsMakeLink (name,
{
var ntxt = document.createTextNode (name);
Line 49 ⟶ 47:
var nli = document.createElement ('li');
na.setAttribute ('href',
nli.setAttribute ('class', 'n-shortcut');
Line 70 ⟶ 68:
var nul = document.createElement ('ul');
if (mw.config.get('skin') == 'vector') {
nportlet.setAttribute ('id', 'p-'+name);▼
nportlet.setAttribute ('
nh5.setAttribute ('lang', 'en');
nbody.setAttribute ('class', 'body');
} else {
▲ nportlet.setAttribute ('id', 'p-'+name);
nportlet.setAttribute ('class', 'portlet');
nbody.setAttribute ('class', 'pBody');
nul.setAttribute ('id', 'p-'+name);
}
for (var i = 0; i < links.length; i++)
Line 94 ⟶ 100:
function shortcutsMain ()
{
if (mw.config.get('skin') == 'vector') {
var sidecol = document.getElementById ('column-one');▼
var sidecol = document.getElementById ('panel');
} else {
▲ var sidecol = document.getElementById ('column-one');
}
if(!sidecol) return;
for (var i = 0; i < shortcutsLinks.length; i++)
Line 108 ⟶ 119:
function shortcutsInitialize ()
{
if( $.isFunction( window.shortcutsInit ) ) { shortcutsInit(); }
shortcutsMain ();
}
Line 115 ⟶ 126:
* INITIALIZATION
***********************************************************/
shortcutsStartSection (mw.config.get('wgUserName') ? mw.config.get('wgUserName') : 'shortcuts');▼
▲ var shortcutsLinks = new Array ();
▲ shortcutsStartSection (wgUserName ? wgUserName : 'shortcuts');
▲ addOnloadHook (shortcutsInitialize);
|