User:Jsimlo/shortcuts.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
//<pre>
 
var shortcutsVersion = "0.0.12";
var shortcutsReleaseDate = "2006-09-01 17:2358";
 
/***********************************************************
* INTERFACE
***********************************************************/
 
/**
* Starts a new section of links. Function for external use.
*/
function shortcutsStartSection (name)
{
shortcutsLinks[shortcutsLinks.length] = new Array ('name': name, 'links': new Array ());
}
 
/**
* Adds new link into the current section of links. Function for external use.
*/
function shortcutsAddLink (name, article)
{
var links = shortcutsLinks[shortcutsLinks.length - 1];
 
links[links.length] = new Array ('name': name, 'article': article);
}
 
/***********************************************************
* IMPLEMENTATION
***********************************************************/
 
/**
* Link maker.
* Creates and returns an li element with the desired link.
*/
function shortcutsMakeLink (name, url)
{
Line 19 ⟶ 49:
}
 
/**
* Portlet maker.
* Creates and returns a portlet populated by list of links.
*/
function makePortlet (name, links)
{
Line 34 ⟶ 68:
for (i = 0; i < links.length; i++)
nul.appendChild (
shortcutsMakeLink (links[i]['name'], links[i].['article'])
);
 
Line 45 ⟶ 79:
}
 
/**
function shortcutsMyLinks ()
* Main function.
* Enumerates all non-empty sections, and adds new portlets beneath the old ones.
*/
function shortcutsMyLinksshortcutsMain ()
{
var sidecol = document.getElementById ('column-one');
Line 56 ⟶ 94:
}
 
/***********************************************************
function shortcutsStartSection (name)
* INITIALIZATION
{
***********************************************************/
shortcutsLinks[shortcutsLinks.length] = new Array ('name': name, 'links': new Array ());
}
 
function shortcutsAddLink (name, article)
{
var links = shortcutsLinks[shortcutsLinks.length - 1];
 
links[links.length] = new Array ('name': name, 'article': article);
}
 
/**
* Initialization stuff..
*/
var shortcutsLinks = new Array ();
shortcutsStartSection ('shortcuts');
 
if (window.addEventListener)
window.addEventListener("load", shortcutsMyLinksshortcutsMain, false);
else if (window.attachEvent)
window.attachEvent("onload", shortcutsMyLinksshortcutsMain);
 
//</pre>