Too rash. Fixes gjslint errors
This commit is contained in:
parent
ac8f0e2c87
commit
c7375745ae
@ -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() {
|
||||||
@ -37,7 +37,7 @@ var Settings = (function settingsClosure() {
|
|||||||
var isLocalStorageEnabled = (function localStorageEnabledTest() {
|
var isLocalStorageEnabled = (function localStorageEnabledTest() {
|
||||||
try {
|
try {
|
||||||
localStorage;
|
localStorage;
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -47,25 +47,27 @@ var Settings = (function settingsClosure() {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
set: function settingsSet(name, val) {
|
set: function settingsSet(name, val) {
|
||||||
if(location.protocol == 'chrome:' && !isLocalStorageEnabled) {
|
if (location.protocol == 'chrome:' && !isLocalStorageEnabled) {
|
||||||
Application.prefs.setValue(extPrefix + '.' + name, val);
|
Application.prefs.setValue(extPrefix + '.' + name, val);
|
||||||
} else if(isLocalStorageEnabled) {
|
} else if (isLocalStorageEnabled) {
|
||||||
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;
|
||||||
} else if(isLocalStorageEnabled) {
|
return Application.prefs.getValue(preferenceName, defaultValue);
|
||||||
|
} else if (isLocalStorageEnabled) {
|
||||||
return localStorage.getItem(name) || defaultValue;
|
return localStorage.getItem(name) || defaultValue;
|
||||||
} else if(isCookiesEnabled) {
|
} else if (isCookiesEnabled) {
|
||||||
var res = document.cookie.match ( '(^|;) ?' + name + '=([^;]*)(;|$)' );
|
var res = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
||||||
return res ? unescape(res[2]) : defaultValue;
|
return res ? unescape(res[2]) : defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user