From 223d685a7c6ee95213ec2afcecb6d90dcd6b0259 Mon Sep 17 00:00:00 2001 From: "Cheng-Han, Wu" Date: Thu, 2 Jun 2016 01:06:35 +0800 Subject: [PATCH] Improve history clearDuplicatedHistory performance --- public/js/history.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/public/js/history.js b/public/js/history.js index b3bae980..9bdca709 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -93,14 +93,8 @@ function clearDuplicatedHistory(notehistory) { for (var i = 0; i < notehistory.length; i++) { var found = false; for (var j = 0; j < newnotehistory.length; j++) { - var id = notehistory[i].id; - var newId = newnotehistory[j].id; - try { - id = LZString.decompressFromBase64(id); - newId = LZString.decompressFromBase64(newId); - } catch (err) { - // na - } + var id = notehistory[i].id.replace(/\=+$/, ''); + var newId = newnotehistory[j].id.replace(/\=+$/, ''); 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 newTime = moment(newnotehistory[j].time, 'MMMM Do YYYY, h:mm:ss a');