diff options
Diffstat (limited to 'public/js/history.js')
-rw-r--r-- | public/js/history.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/public/js/history.js b/public/js/history.js index 82c145da..b3656d89 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -111,12 +111,13 @@ function clearDuplicatedHistory(notehistory) { return newnotehistory; } -function addHistory(id, text, time, tags, notehistory) { +function addHistory(id, text, time, tags, pinned, notehistory) { notehistory.push({ id: id, text: text, time: time, - tags: tags + tags: tags, + pinned: pinned }); return notehistory; } @@ -232,8 +233,16 @@ function renderHistory(view) { function generateHistory(view, notehistory) { var info = renderHistory(view); + //keep any pinned data + var pinned = false; + for (var i = 0; i < notehistory.length; i++) { + if (notehistory[i].id == info.id && notehistory[i].pinned) { + pinned = true; + break; + } + } notehistory = removeHistory(info.id, notehistory); - notehistory = addHistory(info.id, info.text, info.time, info.tags, notehistory); + notehistory = addHistory(info.id, info.text, info.time, info.tags, pinned, notehistory); notehistory = clearDuplicatedHistory(notehistory); return notehistory; } |