diff options
-rw-r--r-- | static/js/shobon.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/static/js/shobon.js b/static/js/shobon.js index 31fab9a..3d549d0 100644 --- a/static/js/shobon.js +++ b/static/js/shobon.js @@ -60,7 +60,7 @@ function shobon() { if (isNewReply) { newRepliesCounter++; newRepliesInThread++; - reply.children[0].innerHTML += " <span class='shobonNew' style='color: #CC6666; font-weight: bold;'>NUEVO!</span>"; + reply.children[0].innerHTML += " <span class='shobonNew' style='color: #CC6666; font-weight: bold;'>Nuevo!</span>"; } } @@ -88,7 +88,7 @@ function shobon() { } if (newRepliesInThread > 0 && !inThread) { - thread.getElementsByClassName("threadlinks")[0].innerHTML += "<span onClick='localStorage.setItem(\"" + boardName + "_" + threadId + "\" , " + lastReplyN + "); this.hidden = true;' style='font-weight: bold; background: #81a2be; padding: 5px; border-radius: 5px; float: right; margin-bottom: 10px;'>Marcar como leido</span>"; + thread.getElementsByClassName("threadlinks")[0].innerHTML += "<span class=\"btnMarkAsRead\" data-id=\"" + boardName + "_" + threadId + "\ data-last=\"" + lastReplyN + "\" style=\"font-weight: bold; background: #81a2be; padding: 5px; border-radius: 5px; float: right; margin-bottom: 10px;\">Marcar como leido</span>"; } } @@ -103,6 +103,16 @@ function shobon() { if(localStorage.getItem("shobon_newposts") == "true" && inThread) { localStorage.setItem(boardName + "_" + threadId, lastReplyN); } + + var btns = document.getElementsByClassName("btnMarkAsRead"); + for (var i = 0; i < btns.length; i++){ + btns[i].addEventListener("click", markAsRead, false); + } +} + +function markAsRead(){ + this.style.display = none; + localStorage.setItem(this.dataset.id, this.dataset.last); } function on_checked(e) { |