Content deleted Content added
No edit summary |
maintenance: more info TypeError: Cannot read property 'appendChild' of null |
||
(11 intermediate revisions by 4 users not shown) | |||
Line 1:
/**********************************************************************
* *
* Changes to this file affect other users. *
* Please discuss on the talk page before editing. *
* *
**********************************************************************/
var shortcutsVersion =
var shortcutsReleaseDate =
/***********************************************************
Line 11 ⟶ 18:
* Starts a new section of links. Function for external use.
*/
{
shortcutsLinks[shortcutsLinks.length] = { 'name': name, 'links':
}
Line 19 ⟶ 26:
* Adds new link into the current section of links. Function for external use.
*/
{
var links = shortcutsLinks[shortcutsLinks.length - 1]['links'];
links[links.length] = { 'name': name, 'article': article };
Line 34 ⟶ 41:
* Creates and returns an li element with the desired link.
*/
function shortcutsMakeLink (name,
{
var ntxt = document.createTextNode (name);
Line 40 ⟶ 47:
var nli = document.createElement ('li');
na.setAttribute ('href',
nli.setAttribute ('class', 'n-shortcut');
Line 53 ⟶ 60:
* Creates and returns a portlet populated by list of links.
*/
function
{
var nportlet = document.createElement ('div');
var nh5 = document.createElement ('h5');
var ntit = document.createTextNode (
var nbody = document.createElement ('div');
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
nul.appendChild (
shortcutsMakeLink (links[i]['name'], links[i]['article'])
);
Line 85 ⟶ 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
if (shortcutsLinks[i]['links'].length > 0)
sidecol.appendChild (
);
}▼
/**
* Initializes the onload events.
*/
function shortcutsInitialize ()
{▼
if( $.isFunction( window.shortcutsInit ) ) { shortcutsInit(); }
shortcutsMain ();
}
Line 97 ⟶ 126:
* INITIALIZATION
***********************************************************/
shortcutsStartSection (mw.config.get('wgUserName') ? mw.config.get('wgUserName') : 'shortcuts');
$(shortcutsInitialize);
▲ var shortcutsLinks = new Array ();
▲ {
▲ }
|