1/*global window, localStorage, fontSizeTitle, bigger, reset, smaller, biggerTitle, resetTitle, smallerTitle, Cookie */ 2var prefsLoaded = false; 3var defaultFontSize = 100; 4var currentFontSize = defaultFontSize; 5 6 7 8Object.append(Browser.Features, { 9 localstorage: (function() { 10 return ('localStorage' in window) && window.localStorage !== null; 11 })() 12}); 13 14function setFontSize(fontSize) { 15 document.body.style.fontSize = fontSize + '%'; 16} 17 18function changeFontSize(sizeDifference) { 19 currentFontSize = parseInt(currentFontSize, 10) + parseInt(sizeDifference * 5, 10); 20 if (currentFontSize > 180) { 21 currentFontSize = 180; 22 } else if (currentFontSize < 60) { 23 currentFontSize = 60; 24 } 25 setFontSize(currentFontSize); 26} 27 28function revertStyles() { 29 currentFontSize = defaultFontSize; 30 changeFontSize(0); 31} 32 33function writeFontSize(value) { 34 if (Browser.Features.localstorage) { 35 localStorage.fontSize = value; 36 } else { 37 Cookie.write("fontSize", value, {duration: 180}); 38 } 39} 40 41function readFontSize() { 42 if (Browser.Features.localstorage) { 43 return localStorage.fontSize; 44 } else { 45 return Cookie.read("fontSize"); 46 } 47} 48 49function setUserOptions() { 50 if (!prefsLoaded) { 51 var size = readFontSize(); 52 currentFontSize = size ? size : defaultFontSize; 53 setFontSize(currentFontSize); 54 prefsLoaded = true; 55 } 56} 57 58function addControls() { 59 var container = document.id('fontsize'); 60 var content = '<h3>'+ fontSizeTitle +'</h3><p><a title="'+ biggerTitle +'" href="#" onclick="changeFontSize(2); return false">'+ bigger +'</a><span class="unseen">.</span><a href="#" title="'+resetTitle+'" onclick="revertStyles(); return false">'+ reset +'</a><span class="unseen">.</span><a href="#" title="'+ smallerTitle +'" onclick="changeFontSize(-2); return false">'+ smaller +'</a></p>'; 61 container.set('html', content); 62} 63 64function saveSettings() { 65 writeFontSize(currentFontSize); 66} 67 68 69window.addEvent('domready', function () { 70 71 smaller = Joomla.JText._('TPL_BEEZ3_SMALLER'); 72 fontSizeTitle = Joomla.JText._('TPL_BEEZ3_FONTSIZE'); 73 bigger = Joomla.JText._('TPL_BEEZ3_BIGGER'); 74 reset = Joomla.JText._('TPL_BEEZ3_RESET'); 75 biggerTitle = Joomla.JText._('TPL_BEEZ3_INCREASE_SIZE'); 76 smallerTitle = Joomla.JText._('TPL_BEEZ3_DECREASE_SIZE'); 77 resetTitle = Joomla.JText._('TPL_BEEZ3_REVERT_STYLES_TO_DEFAULT'); 78 79}); 80window.addEvent('domready', setUserOptions); 81window.addEvent('domready', addControls); 82window.addEvent('unload', saveSettings);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.