diff options
author | Renard | 2019-04-03 16:00:39 -0300 |
---|---|---|
committer | Renard | 2019-04-03 16:00:39 -0300 |
commit | ed0d81dc63f6856dfe402614760197010ee6be0f (patch) | |
tree | b914864d19ff952757a89cdc258854ce0aebff0e | |
parent | d92a47f45c308209dc80322352db26c3063d9408 (diff) | |
download | weabot-ed0d81dc63f6856dfe402614760197010ee6be0f.tar.gz weabot-ed0d81dc63f6856dfe402614760197010ee6be0f.tar.xz weabot-ed0d81dc63f6856dfe402614760197010ee6be0f.zip |
Shobon: MarkAsRead re-do
-rw-r--r-- | static/js/shobon.js | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/static/js/shobon.js b/static/js/shobon.js index 534821e..86faa53 100644 --- a/static/js/shobon.js +++ b/static/js/shobon.js @@ -88,7 +88,16 @@ function shobon() { } if (newRepliesInThread > 0 && !inThread) { - 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>"; + var btnNew = document.createElement("span"); + btnNew.dataset.id = boardName + "_" + threadId; + btnNew.dataset.last = lastReplyN; + btnNew.textContent = "Marcar como leĆdo"; + btnNew.setAttribute("style", "font-weight: bold; background: #81a2be; padding: 5px; border-radius: 5px; float: right; margin-bottom: 10px;"); + btnNew.onclick = function(){ + localStorage.setItem(this.dataset.id, this.dataset.last); + this.hidden = true; + }; + thread.getElementsByClassName("threadlinks")[0].appendChild(btnNew); } } @@ -103,16 +112,6 @@ 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) { |