Add: POST markers

This commit is contained in:
Cutls 2019-09-07 01:46:50 +09:00
parent 5e6c713f9d
commit 81b99515cd
2 changed files with 57 additions and 28 deletions

View File

@ -331,7 +331,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
}
var if_notf = 'data-notfIndv="' + acct_id + "_" + toot.id + '"';
var if_notf = 'data-notfIndv="' + acct_id + "_" + toot.id + '" data-notf="' + toot.id + '"';
var toot = toot.status;
var dis_name = escapeHTML(toot.account.display_name);
if (toot.account.emojis) {

View File

@ -1012,7 +1012,36 @@ function ueload(tlid){
ueloadlock = false
});
}
function testAsRead(acct_id) {
function asRead() {
//Markers
var markers = localStorage.getItem("markers");
if (markers == "no") {
markers = false;
} else {
markers = true
}
if (markers) {
var multi = localStorage.getItem("column")
var obj = JSON.parse(multi)
for (var i = 0; i < obj.length; i++) {
var acct_id = obj[i].domain
var type = obj[i].type
if(type == "home" || type == "notf"){
if(type == "home"){
var id = $("#timeline_" + i + " .cvo:eq(0)").attr("unique-id")
var poster = {
home: {
last_read_id: id
}
}
}else{
var id = $("#timeline_" + i + " .cvo:eq(0)").attr("data-notf")
var poster = {
notifications: {
last_read_id: id
}
}
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at");
var httpreq = new XMLHttpRequest();
@ -1021,11 +1050,7 @@ function testAsRead(acct_id) {
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
httpreq.responseType = "json";
httpreq.send(JSON.stringify({
home: {
last_read_id: 1
}
}));
httpreq.send(JSON.stringify(poster));
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response;
@ -1033,3 +1058,7 @@ function testAsRead(acct_id) {
}
}
}
}
}
}
cbTimer1 = setInterval(asRead, 60000);