summaryrefslogtreecommitdiff
path: root/public/js/history.js
diff options
context:
space:
mode:
authorWu Cheng-Han2015-06-01 18:04:25 +0800
committerWu Cheng-Han2015-06-01 18:04:25 +0800
commitf7f8c901f4bc39c3ed0a2bdfe1cbaa1ee6957999 (patch)
tree1bb09442906fa8e258c670c87491c64b6de27e68 /public/js/history.js
parent4e64583a0b6175d2c9a6729ffde1472dd55d389c (diff)
Marked as 0.2.9
Diffstat (limited to 'public/js/history.js')
-rw-r--r--public/js/history.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/public/js/history.js b/public/js/history.js
index 717a7ca4..c5db94c5 100644
--- a/public/js/history.js
+++ b/public/js/history.js
@@ -47,7 +47,7 @@ function saveHistoryToStorage(notehistory) {
if (store.enabled)
store.set('notehistory', JSON.stringify(notehistory));
else
- saveHistoryToCookie(notehistory);
+ saveHistoryToStorage(notehistory);
}
function saveHistoryToCookie(notehistory) {
@@ -146,11 +146,14 @@ function writeHistoryToServer(view) {
} catch (err) {
var notehistory = [];
}
+ if(!notehistory)
+ notehistory = [];
+
var newnotehistory = generateHistory(view, notehistory);
saveHistoryToServer(newnotehistory);
})
.fail(function () {
- writeHistoryToCookie(view);
+ writeHistoryToStorage(view);
});
}
@@ -160,7 +163,9 @@ function writeHistoryToCookie(view) {
} catch (err) {
var notehistory = [];
}
-
+ if(!notehistory)
+ notehistory = [];
+
var newnotehistory = generateHistory(view, notehistory);
saveHistoryToCookie(newnotehistory);
}
@@ -174,6 +179,9 @@ function writeHistoryToStorage(view) {
var notehistory = data;
} else
var notehistory = [];
+ if(!notehistory)
+ notehistory = [];
+
var newnotehistory = generateHistory(view, notehistory);
saveHistoryToStorage(newnotehistory);
} else {
@@ -241,7 +249,7 @@ function getServerHistory(callback) {
}
})
.fail(function () {
- getCookieHistory(callback);
+ getStorageHistory(callback);
});
}
@@ -282,7 +290,7 @@ function parseServerToHistory(list, callback) {
}
})
.fail(function () {
- parseCookieToHistory(list, callback);
+ parseStorageToHistory(list, callback);
});
}