From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

  /**********************************************************************

  *                                                                    *

  *             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)

 {

   shortcutsLinksshortcutsLinks.length = { 'name': name, 'links': [] };

 }



 /**

  * Adds new link into the current section of links. Function for external use.

  */

 window.shortcutsAddLink = function (name, article)

 {

   var links = shortcutsLinksshortcutsLinks.length - 1]['links'];



   linkslinks.length = { 'name': name, 'article': article };

 }



 /***********************************************************

  * IMPLEMENTATION

  ***********************************************************/



 /**

  * Link maker.

  * Creates and returns an li element with the desired link.

  */

 function shortcutsMakeLink (name, pageName)

 {

   var ntxt = document.createTextNode (name);

   var na   = document.createElement ('a');

   var nli  = document.createElement ('li');



   na.setAttribute ('href', mw.util.getUrl( pageName ) );

   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 (linksi]['name'], linksi]['article'])

     );



   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');

   }

   if(!sidecol) return;



   for (var i = 0; i < shortcutsLinks.length; i++)

     if (shortcutsLinksi]['links'].length > 0)

       sidecol.appendChild (

         shortcutsMakePortlet (shortcutsLinksi]['name'], shortcutsLinksi]['links'])

       );

 }



 /**

  * Initializes the onload events.

  */

 function shortcutsInitialize ()

 {

   if( $.isFunction( window.shortcutsInit ) ) { shortcutsInit(); }

   shortcutsMain ();

 }



 /***********************************************************

  * INITIALIZATION

  ***********************************************************/

 shortcutsStartSection (mw.config.get('wgUserName') ? mw.config.get('wgUserName') : 'shortcuts');



 $(shortcutsInitialize);
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

  /**********************************************************************

  *                                                                    *

  *             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)

 {

   shortcutsLinksshortcutsLinks.length = { 'name': name, 'links': [] };

 }



 /**

  * Adds new link into the current section of links. Function for external use.

  */

 window.shortcutsAddLink = function (name, article)

 {

   var links = shortcutsLinksshortcutsLinks.length - 1]['links'];



   linkslinks.length = { 'name': name, 'article': article };

 }



 /***********************************************************

  * IMPLEMENTATION

  ***********************************************************/



 /**

  * Link maker.

  * Creates and returns an li element with the desired link.

  */

 function shortcutsMakeLink (name, pageName)

 {

   var ntxt = document.createTextNode (name);

   var na   = document.createElement ('a');

   var nli  = document.createElement ('li');



   na.setAttribute ('href', mw.util.getUrl( pageName ) );

   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 (linksi]['name'], linksi]['article'])

     );



   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');

   }

   if(!sidecol) return;



   for (var i = 0; i < shortcutsLinks.length; i++)

     if (shortcutsLinksi]['links'].length > 0)

       sidecol.appendChild (

         shortcutsMakePortlet (shortcutsLinksi]['name'], shortcutsLinksi]['links'])

       );

 }



 /**

  * Initializes the onload events.

  */

 function shortcutsInitialize ()

 {

   if( $.isFunction( window.shortcutsInit ) ) { shortcutsInit(); }

   shortcutsMain ();

 }



 /***********************************************************

  * INITIALIZATION

  ***********************************************************/

 shortcutsStartSection (mw.config.get('wgUserName') ? mw.config.get('wgUserName') : 'shortcuts');



 $(shortcutsInitialize);

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook