fix read post

This commit is contained in:
Ryan Stafford 2024-04-28 12:12:04 -04:00
parent 88aff9cbe9
commit 410e1513ac

View file

@ -5,7 +5,7 @@ function request(url, params, callback, errorcallback = function(){}) {
if (xmlHttp.status == 200) { if (xmlHttp.status == 200) {
return callback(xmlHttp.responseText); return callback(xmlHttp.responseText);
} }
if (errorcallback) errorcallback(xmlHttp.responseText); errorcallback(xmlHttp.responseText);
} }
var method = "GET" var method = "GET"
if (params) method = "POST" if (params) method = "POST"
@ -33,7 +33,12 @@ function postClick(e) {
var url = targ.getElementsByClassName("url")[0].href var url = targ.getElementsByClassName("url")[0].href
if (bdy.querySelector("img.image") && localStorage.getItem("markRead") == "true") { if (bdy.querySelector("img.image") && localStorage.getItem("markRead") == "true") {
bdy.parentNode.querySelector(".title").className = "title visited" bdy.parentNode.querySelector(".title").className = "title visited"
request(bdy.parentNode.querySelector('.buttons a').href, { op: "read_post", submit: "mark read"}) var data = new FormData();
data.append("op", "read_post")
data.append("submit", "mark read")
data.append("xhr", "1")
data.append("postid", bdy.parentNode.parentNode.id.slice(1))
request("", data)
} }
if (id = parseYoutube(url)) { if (id = parseYoutube(url)) {
targ.getElementsByClassName("embed")[0].innerHTML = youtubeIframe(id) targ.getElementsByClassName("embed")[0].innerHTML = youtubeIframe(id)