- md5
- 68186d8406277583eb3fe77759bd71e1
- sha1
- 66936a331d06d2bc34dc22590f0f875ee861becf
- sha256
- fc44cd53d3534f8f194a39f78282e4500acd9572b60d5b0bf201ff1d9bca7504
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
/*global window, localStorage, fontSizeTitle, bigger, reset, smaller, biggerTitle, resetTitle, smallerTitle, Cookie */
var prefsLoaded = false;
var defaultFontSize = 100;
var currentFontSize = defaultFontSize;
function supportsLocalStorage() {
return ('localStorage' in window) && window.localStorage !== null;
}
function setFontSize(fontSize) {
document.body.style.fontSize = fontSize + '%';
}
function changeFontSize(sizeDifference) {
currentFontSize = parseInt(currentFontSize, 10) + parseInt(sizeDifference * 5, 10);
if (currentFontSize > 180) {
currentFontSize = 180;
} else if (currentFontSize < 60) {
currentFontSize = 60;
}
setFontSize(currentFontSize);
}
function revertStyles() {
currentFontSize = defaultFontSize;
changeFontSize(0);
}
function writeFontSize(value) {
if (supportsLocalStorage()) {
localStorage.fontSize = value;
} else {
Cookie.write("fontSize", value, {duration: 180});
}
}
function readFontSize() {
if (supportsLocalStorage()) {
return localStorage.fontSize;
} else {
return Cookie.read("fontSize");
}
}
function setUserOptions() {
if (!prefsLoaded) {
var size = readFontSize();
currentFontSize = size ? size : defaultFontSize;
setFontSize(currentFontSize);
prefsLoaded = true;
}
}
function addControls() {
var xhtml = "http://www.w3.org/1999/xhtml";
var container = document.id('fontsize');
var link = [];
var linkClass = ["larger", "reset", "smaller"];
var linkTitle = [biggerTitle, resetTitle, smallerTitle];
var linkAction = ["changeFontSize(2); return false;", "revertStyles(); return false;", "changeFontSize(-2); return false;"];
var linkContent = [document.createTextNode(bigger), document.createTextNode(reset), document.createTextNode(smaller)];
var headingText = document.createTextNode(fontSizeTitle);
var heading;
var p;
var span;
if (document.createElementNS) {
heading = document.createElementNS(xhtml, "h3");
p = document.createElementNS(xhtml, "p");
link[3] = document.createElementNS(xhtml, "a");
span = document.createElementNS(xhtml, "span");
} else {
heading = document.createElement("h3");
p = document.createElement("p");
link[3] = document.createElement("a");
span = document.createElement("span");
}
p.setAttribute("class", "fontsize");
span.setAttribute("class", "unseen");
link[3].setAttribute("href", "index.php");
for (var x = 0; x < 3; x++) {
link[x] = link[3].cloneNode(true);
link[x].setAttribute("class", linkClass[x]);
link[x].setAttribute("title", linkTitle[x]);
link[x].setAttribute("onclick", linkAction[x]);
link[x].appendChild(linkContent[x]);
}
span.appendChild(document.createTextNode('\u00a0')); //This is a nbsp
heading.appendChild(headingText);
p.appendChild(link[0]);
p.appendChild(span.cloneNode(true));
p.appendChild(link[1]);
p.appendChild(link[2]);
p.appendChild(span);
container.appendChild(heading);
container.appendChild(p);
}
function saveSettings() {
writeFontSize(currentFontSize);
}
window.addEvent('domready', setUserOptions);
window.addEvent('domready', addControls);
window.addEvent('unload', saveSettings);
No other release has this exact content. See every version of this file.