< User:Jsimlo (Difference between pages)
Content deleted Content addedInline
Revision as of 08:55, 19 November 2012 view source TheDJ (talk | contribs )Extended confirmed users , Template editors 46,220 edits some updates per talk page request of helder.
Latest revision as of 23:19, 21 November 2012 view source PrimeHunter (talk | contribs )Administrators 79,296 edits copied from User:Jsimlo/shortcuts.js with one change to keep a former url parameter which allows query strings
Line 41:
Line 41:
* Creates and returns an li element with the desired link.
* Creates and returns an li element with the desired link.
*/
*/
function shortcutsMakeLink (name, pageName)
function shortcutsMakeLink (name, url )
{
{
var ntxt = document.createTextNode (name);
var ntxt = document.createTextNode (name);
Line 47:
Line 47:
var nli = document.createElement ('li');
var nli = document.createElement ('li');
na.setAttribute ('href', mw.util.wikiGetlink( pageName ) );
na.setAttribute ('href', '/' + url );
nli.setAttribute ('class', 'n-shortcut');
nli.setAttribute ('class', 'n-shortcut');
Latest revision as of 23:19, 21 November 2012
/**********************************************************************
* *
* Changes to this file affect other users. *
* Please discuss on the talk page before editing. *
* *
**********************************************************************/
var shortcutsVersion = '1.1.2';
var shortcutsReleaseDate = '2012-11-04';
var shortcutsLinks = ;
/***********************************************************
* INTERFACE
***********************************************************/
/**
* Starts a new section of links. Function for external use.
*/
window.shortcutsStartSection = function (name)
{
shortcutsLinks = { 'name': name, 'links': };
}
/**
* Adds new link into the current section of links. Function for external use.
*/
window.shortcutsAddLink = function (name, article)
{
var links = shortcutsLinks;
links = { 'name': name, 'article': article };
}
/***********************************************************
* IMPLEMENTATION
***********************************************************/
/**
* Link maker.
* Creates and returns an li element with the desired link.
*/
function shortcutsMakeLink (name, url)
{
var ntxt = document.createTextNode (name);
var na = document.createElement ('a');
var nli = document.createElement ('li');
na.setAttribute ('href', '/' + url);
nli.setAttribute ('class', 'n-shortcut');
na.appendChild (ntxt);
nli.appendChild (na);
return nli;
}
/**
* Portlet maker.
* Creates and returns a portlet populated by list of links.
*/
function shortcutsMakePortlet (name, links)
{
var nportlet = document.createElement ('div');
var nh5 = document.createElement ('h5');
var ntit = document.createTextNode (name);
var nbody = document.createElement ('div');
var nul = document.createElement ('ul');
if (mw.config.get('skin') == 'vector') {
nportlet.setAttribute ('id', 'p-'+name);
nportlet.setAttribute ('class', 'portal');
nh5.setAttribute ('xml:lang', 'en');
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++)
nul.appendChild (
shortcutsMakeLink (links, links)
);
nh5.appendChild (ntit);
nportlet.appendChild (nh5);
nbody.appendChild (nul);
nportlet.appendChild (nbody);
return nportlet;
}
/**
* Main function.
* Enumerates all non-empty sections, and adds new portlets beneath the old ones.
*/
function shortcutsMain ()
{
if (mw.config.get('skin') == 'vector') {
var sidecol = document.getElementById ('panel');
} else {
var sidecol = document.getElementById ('column-one');
}
for (var i = 0; i < shortcutsLinks.length; i++)
if (shortcutsLinks.length > 0)
sidecol.appendChild (
shortcutsMakePortlet (shortcutsLinks, shortcutsLinks)
);
}
/**
* Initializes the onload events.
*/
function shortcutsInitialize ()
{
if( $.isFunction( window.shortcutsInit ) ) { shortcutsInit(); }
shortcutsMain ();
}
/***********************************************************
* INITIALIZATION
***********************************************************/
shortcutsStartSection (mw.config.get('wgUserName') ? mw.config.get('wgUserName') : 'shortcuts');
$(shortcutsInitialize);
User:Jsimlo/shortcuts.js and User:PrimeHunter/shortcuts.js: Difference between pages
Add topic
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.
**DISCLAIMER** We are not affiliated with Wikipedia, and Cloudflare.
The information presented on this site is for general informational purposes only and does not constitute medical advice.
You should always have a personal consultation with a healthcare professional before making changes to your diet, medication, or exercise routine.
AI helps with the correspondence in our chat.
We participate in an affiliate program. If you buy something through a link, we may earn a commission 💕
↑