Anonymous user
User:Tyrok1/monobook.js: Difference between revisions
Let's try a cookie instead of an HTML5 data store
m (Another experiment) |
(Let's try a cookie instead of an HTML5 data store) |
||
Line 6:
========================================*/
function
{
//load cached language link info from the cookie
if((typeof
{
window.languageLinks = new Object();
if(cookieStart >= 0)
{
var cookieEnd = document.cookie.indexOf(";", cookieStart);
cookieStart += ("languageLinks=").length;
cookieEnd = (cookieEnd >= 0 ? cookieEnd : document.cookie.length);
var cookieVal = document.cookie.substring(cookieStart, cookieEnd);
window.languageLinks = JSON.parse(decodeURIComponent(cookieVal));
}
}
}
function
{
//save language link info to the cookie for later use
if((typeof
{
document.cookie = "languageLinks=" + data;
}
}
Line 31 ⟶ 43:
if(typeof window.languageLinks == "undefined" || !window.languageLinks || !window.languageLinks.length)
{
window.languageLinks = new
}
Line 85 ⟶ 97:
}
//save the link data
//to reduce the number of requests
SectionLinkSave();
//and if we've got a function to call when we're done, call it
Line 133 ⟶ 146:
//load stored data to reduce requests
SectionLinkLoad();
//check this page's "firstHeading" ID content for a category name
|