aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static/js/shobon.js21
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) {