use localStorage without new global
This commit is contained in:
parent
a3c1081964
commit
dddd39aaa6
2 changed files with 7 additions and 8 deletions
|
@ -300,7 +300,7 @@ function loadVideo(videoFile) {
|
|||
Ox.oshash(videoFile, function(hash) {
|
||||
videoHash = hash;
|
||||
var storageKey = 'txt_' + videoHash;
|
||||
if (storageKey in storage) {
|
||||
if (storageKey in localStorage) {
|
||||
loadTxt();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
var url = "https://speedtrans.pad.ma";
|
||||
|
||||
var storage = window.localStorage;
|
||||
|
||||
//elem = string (elementId to make TextArea)
|
||||
var TextArea = function(elem) {
|
||||
|
@ -381,16 +380,16 @@ User.prototype.init = function() {
|
|||
|
||||
User.prototype.set_pref = function(key, val) {
|
||||
var that = this;
|
||||
storage[key] = val;
|
||||
localStorage[key] = val;
|
||||
this.callbacks[key](val);
|
||||
}
|
||||
|
||||
User.prototype.get_pref = function(key) {
|
||||
var that = this;
|
||||
if (typeof storage[key] === 'undefined') {
|
||||
storage[key] = that.defaults[key];
|
||||
if (typeof localStorage[key] === 'undefined') {
|
||||
localStorage[key] = that.defaults[key];
|
||||
}
|
||||
return storage[key];
|
||||
return localStorage[key];
|
||||
}
|
||||
|
||||
User.prototype.set_prefs = function(keyvals) {
|
||||
|
@ -412,12 +411,12 @@ User.prototype.get_prefs = function(keys) {
|
|||
|
||||
User.prototype.set_txt = function(filename, txt) {
|
||||
var that = this;
|
||||
storage['txt_' + filename] = txt;
|
||||
localStorage['txt_' + filename] = txt;
|
||||
}
|
||||
|
||||
User.prototype.get_txt = function(filename) {
|
||||
var that = this;
|
||||
return storage['txt_' + filename];
|
||||
return localStorage['txt_' + filename];
|
||||
}
|
||||
|
||||
function loadCuts(url, id) {
|
||||
|
|
Loading…
Reference in a new issue