diff options
author | Renard | 2019-04-03 15:50:25 -0300 |
---|---|---|
committer | Renard | 2019-04-03 15:50:25 -0300 |
commit | a1404ef6288bf97eb50bad247d70cad0ccee2af9 (patch) | |
tree | 35e422d76ee0de58daa5fff58841243e9fac9327 | |
parent | 51de2645567c3cc3362ace2489ca1570b9d200de (diff) | |
download | weabot-a1404ef6288bf97eb50bad247d70cad0ccee2af9.tar.gz weabot-a1404ef6288bf97eb50bad247d70cad0ccee2af9.tar.xz weabot-a1404ef6288bf97eb50bad247d70cad0ccee2af9.zip |
Shobon: Fix botón marcar mensajes como leidos
-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) { |