Too rash. Fixes gjslint errors

This commit is contained in:
Saebekassebil 2011-12-23 23:56:01 +01:00
parent ac8f0e2c87
commit c7375745ae

View File

@ -26,7 +26,7 @@ var Cache = function cacheCache(size) {
}; };
// Settings Manager - This is a utility for saving settings // Settings Manager - This is a utility for saving settings
// First we see if localStorage is available, which isn't pt. in FF due to bug #495747 // First we see if localStorage is available, FF bug #495747
// If not, we use FUEL in FF and fallback to Cookies for other browsers. // If not, we use FUEL in FF and fallback to Cookies for other browsers.
var Settings = (function settingsClosure() { var Settings = (function settingsClosure() {
var isCookiesEnabled = (function() { var isCookiesEnabled = (function() {
@ -53,15 +53,17 @@ var Settings = (function settingsClosure() {
localStorage.setItem(name, val); localStorage.setItem(name, val);
} else if (isCookiesEnabled) { } else if (isCookiesEnabled) {
var cookieString = name + '=' + escape(val); var cookieString = name + '=' + escape(val);
var expire = (new Date((new Date().getTime())+1000*60*60*24*365)).toGMTString(); var expire = new Date();
cookieString += '; expires='+expire; expire.setTime(expire.getTime() + 1000 * 60 * 60 * 24 * 365);
cookieString += '; expires=' + expire.toGMTString();
document.cookie = cookieString; document.cookie = cookieString;
} }
}, },
get: function settingsGet(name, defaultValue) { get: function settingsGet(name, defaultValue) {
if (location.protocol == 'chrome:' && !isLocalStorageEnabled) { if (location.protocol == 'chrome:' && !isLocalStorageEnabled) {
return Application.prefs.getValue(extPrefix + '.' + name, defaultValue); var preferenceName = extPrefix + '.' + name;
return Application.prefs.getValue(preferenceName, defaultValue);
} else if (isLocalStorageEnabled) { } else if (isLocalStorageEnabled) {
return localStorage.getItem(name) || defaultValue; return localStorage.getItem(name) || defaultValue;
} else if (isCookiesEnabled) { } else if (isCookiesEnabled) {
@ -885,10 +887,8 @@ function updateViewarea() {
window.addEventListener('scroll', function webViewerScroll(evt) { window.addEventListener('scroll', function webViewerScroll(evt) {
updateViewarea(); updateViewarea();
var id; var fingerprint = PDFView.pages[0].content.pdf.fingerprint;
if((id = PDFView.pages[0].content.pdf.fingerprint)) { Settings.set(fingerprint + '.scroll', window.pageYOffset);
Settings.set(id+'.scroll', window.pageYOffset);
}
}, true); }, true);