aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorLibravatar Renard 2019-04-03 16:00:39 -0300
committerLibravatar Renard 2019-04-03 16:00:39 -0300
commited0d81dc63f6856dfe402614760197010ee6be0f (patch)
treeb914864d19ff952757a89cdc258854ce0aebff0e /static/js
parentd92a47f45c308209dc80322352db26c3063d9408 (diff)
downloadweabot-ed0d81dc63f6856dfe402614760197010ee6be0f.tar.gz
weabot-ed0d81dc63f6856dfe402614760197010ee6be0f.tar.xz
weabot-ed0d81dc63f6856dfe402614760197010ee6be0f.zip
Shobon: MarkAsRead re-do
Diffstat (limited to 'static/js')
-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) {