diff --git a/public/css/cover.css b/public/css/cover.css index b5d82e0..26cc8d5 100644 --- a/public/css/cover.css +++ b/public/css/cover.css @@ -207,7 +207,7 @@ input { padding: 0 10px; } .list li * { - word-break: break-all; + word-break: break-word; word-wrap: break-word; } .list li a { diff --git a/public/index.ejs b/public/index.ejs index 5fbc36c..2a80d88 100644 --- a/public/index.ejs +++ b/public/index.ejs @@ -232,6 +232,7 @@ + diff --git a/public/js/cover.js b/public/js/cover.js index f1ca613..412d329 100644 --- a/public/js/cover.js +++ b/public/js/cover.js @@ -8,7 +8,7 @@ var options = {
\

\

\ - visit \ + visited \
\ \ \ @@ -148,18 +148,19 @@ function deleteHistory() { saveHistory([]); historyList.clear(); checkHistoryList(); + deleteId = null; } else { if (!deleteId) return; getHistory(function (notehistory) { var newnotehistory = removeHistory(deleteId, notehistory); saveHistory(newnotehistory); + historyList.remove('id', deleteId); + checkHistoryList(); + deleteId = null; }); - historyList.remove('id', deleteId); - checkHistoryList(); } $('.delete-modal').modal('hide'); clearHistory = false; - deleteId = null; } $(".ui-delete-modal-confirm").click(function () { diff --git a/public/js/history.js b/public/js/history.js index 15e46cc..10ab932 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -93,7 +93,14 @@ function clearDuplicatedHistory(notehistory) { for (var i = 0; i < notehistory.length; i++) { var found = false; for (var j = 0; j < newnotehistory.length; j++) { - if (notehistory[i].id == newnotehistory[j].id) { + var id = LZString.decompressFromBase64(notehistory[i].id); + var newId = LZString.decompressFromBase64(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 newTime = moment(newnotehistory[j].time, 'MMMM Do YYYY, h:mm:ss a'); + if(time >= newTime) { + newnotehistory[j] = notehistory[i]; + } found = true; break; } @@ -146,9 +153,9 @@ function writeHistoryToServer(view) { } catch (err) { var notehistory = []; } - if(!notehistory) + if (!notehistory) notehistory = []; - + var newnotehistory = generateHistory(view, notehistory); saveHistoryToServer(newnotehistory); }) @@ -163,9 +170,9 @@ function writeHistoryToCookie(view) { } catch (err) { var notehistory = []; } - if(!notehistory) + if (!notehistory) notehistory = []; - + var newnotehistory = generateHistory(view, notehistory); saveHistoryToCookie(newnotehistory); } @@ -179,9 +186,9 @@ function writeHistoryToStorage(view) { var notehistory = data; } else var notehistory = []; - if(!notehistory) + if (!notehistory) notehistory = []; - + var newnotehistory = generateHistory(view, notehistory); saveHistoryToStorage(newnotehistory); } else { @@ -223,9 +230,9 @@ function renderHistory(view) { function generateHistory(view, notehistory) { var info = renderHistory(view); - notehistory = clearDuplicatedHistory(notehistory); notehistory = removeHistory(info.id, notehistory); notehistory = addHistory(info.id, info.text, info.time, info.tags, notehistory); + notehistory = clearDuplicatedHistory(notehistory); return notehistory; }