User:Tyrok1/monobook.js: Difference between revisions

Testing new version of language example link script
(Obvious typo)
(Testing new version of language example link script)
Line 5:
Fe 4.0.280.
========================================*/
 
function SectionLinkLoadFromStorage()
{
if((typeof localStorage != "undefined") && (typeof localStorage.languageLinks =!= "undefined"))
{
window.languageLinks = JSON.parse(localStorage.languageLinks);
}
}
 
function SectionLinkSaveToStorage()
{
if((typeof localStorage != "undefined") && (typeof window.languageLinks != "undefined"))
{
localStorage.languageLinks = JSON.stringify(window.languageLinks);
}
}
 
function SectionLinkCreateLoadClosure(request)
Line 13 ⟶ 29:
//done loading
//initialize the "languages with link information" array
if(typeof localStoragewindow.languageLinks == "undefined")
{
window.localStorage = new Array();
}
if(typeof localStorage.languageLinks == "undefined")
{
localStoragewindow.languageLinks = new Array();
}
Line 70 ⟶ 82:
//add the language to our array for later use
localStoragewindow.languageLinks[curTitle] = { aName: curAName, href: curHREF, title: curTitle };
}
{
//save the link data to localStorage, if available
SectionLinkSaveToStorage();
//and if we've got a function to call when we're done, call it
Line 116 ⟶ 131:
return;
}
//load stored data to reduce requests
SectionLinkLoadFromStorage();
//check this page's "firstHeading" ID content for a category name
Line 127 ⟶ 145:
//check to see if we already have link information about the current language
if((typeof localStorage != "undefined") && (typeof localStoragewindow.languageLinks != "undefined") && (typeof localStoragewindow.languageLinks[langName] != "undefined"))
{
//we do
Line 135 ⟶ 153:
if(aEls[i].href.indexOf("#") < 0)
{
aEls[i].href += "#" + encodeURIComponent(localStoragewindow.languageLinks[langName].aName);
}
}
Anonymous user