Improve history clearDuplicatedHistory performance

This commit is contained in:
Cheng-Han, Wu 2016-06-02 01:06:35 +08:00
parent 7a371ec7ca
commit 223d685a7c
1 changed files with 2 additions and 8 deletions

View File

@ -93,14 +93,8 @@ function clearDuplicatedHistory(notehistory) {
for (var i = 0; i < notehistory.length; i++) { for (var i = 0; i < notehistory.length; i++) {
var found = false; var found = false;
for (var j = 0; j < newnotehistory.length; j++) { for (var j = 0; j < newnotehistory.length; j++) {
var id = notehistory[i].id; var id = notehistory[i].id.replace(/\=+$/, '');
var newId = newnotehistory[j].id; var newId = newnotehistory[j].id.replace(/\=+$/, '');
try {
id = LZString.decompressFromBase64(id);
newId = LZString.decompressFromBase64(newId);
} catch (err) {
// na
}
if (id == newId || notehistory[i].id == newnotehistory[j].id || !notehistory[i].id || !newnotehistory[j].id) { if (id == newId || notehistory[i].id == newnotehistory[j].id || !notehistory[i].id || !newnotehistory[j].id) {
var time = moment(notehistory[i].time, 'MMMM Do YYYY, h:mm:ss a'); var time = moment(notehistory[i].time, 'MMMM Do YYYY, h:mm:ss a');
var newTime = moment(newnotehistory[j].time, 'MMMM Do YYYY, h:mm:ss a'); var newTime = moment(newnotehistory[j].time, 'MMMM Do YYYY, h:mm:ss a');