Add: POST markers
This commit is contained in:
parent
5e6c713f9d
commit
81b99515cd
|
@ -331,7 +331,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
|
||||||
localStorage.setItem("notice-mem", noticetext);
|
localStorage.setItem("notice-mem", noticetext);
|
||||||
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 toot = toot.status;
|
||||||
var dis_name = escapeHTML(toot.account.display_name);
|
var dis_name = escapeHTML(toot.account.display_name);
|
||||||
if (toot.account.emojis) {
|
if (toot.account.emojis) {
|
||||||
|
|
|
@ -917,7 +917,7 @@ function getMarker(tlid, type, acct_id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function showUnread(tlid, type, acct_id) {
|
function showUnread(tlid, type, acct_id) {
|
||||||
if($("#unread_" + tlid + " .material-icons").hasClass("teal-text")){
|
if ($("#unread_" + tlid + " .material-icons").hasClass("teal-text")) {
|
||||||
$("#unread_" + tlid + " .material-icons").removeClass("teal-text")
|
$("#unread_" + tlid + " .material-icons").removeClass("teal-text")
|
||||||
goTop(tlid)
|
goTop(tlid)
|
||||||
return
|
return
|
||||||
|
@ -944,7 +944,7 @@ function showUnread(tlid, type, acct_id) {
|
||||||
todo(error);
|
todo(error);
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}).then(function (json) {
|
}).then(function (json) {
|
||||||
if(!json){
|
if (!json) {
|
||||||
columnReload(tlid)
|
columnReload(tlid)
|
||||||
}
|
}
|
||||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||||
|
@ -963,15 +963,15 @@ function showUnread(tlid, type, acct_id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var ueloadlock = false
|
var ueloadlock = false
|
||||||
function ueload(tlid){
|
function ueload(tlid) {
|
||||||
if(ueloadlock){
|
if (ueloadlock) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
ueloadlock = true
|
ueloadlock = true
|
||||||
var multi = localStorage.getItem("column")
|
var multi = localStorage.getItem("column")
|
||||||
var obj = JSON.parse(multi)
|
var obj = JSON.parse(multi)
|
||||||
var acct_id = obj[tlid*1].domain
|
var acct_id = obj[tlid * 1].domain
|
||||||
var type = obj[tlid*1].type
|
var type = obj[tlid * 1].type
|
||||||
var domain = localStorage.getItem("domain_" + acct_id)
|
var domain = localStorage.getItem("domain_" + acct_id)
|
||||||
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
||||||
var id = $("#timeline_" + tlid + " .cvo:eq(0)").attr("unique-id")
|
var id = $("#timeline_" + tlid + " .cvo:eq(0)").attr("unique-id")
|
||||||
|
@ -993,7 +993,7 @@ function ueload(tlid){
|
||||||
todo(error);
|
todo(error);
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}).then(function (json) {
|
}).then(function (json) {
|
||||||
if(!json){
|
if (!json) {
|
||||||
columnReload(tlid)
|
columnReload(tlid)
|
||||||
}
|
}
|
||||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||||
|
@ -1012,7 +1012,36 @@ function ueload(tlid){
|
||||||
ueloadlock = false
|
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 domain = localStorage.getItem("domain_" + acct_id);
|
||||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||||
var httpreq = new XMLHttpRequest();
|
var httpreq = new XMLHttpRequest();
|
||||||
|
@ -1021,15 +1050,15 @@ function testAsRead(acct_id) {
|
||||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||||
httpreq.responseType = "json";
|
httpreq.responseType = "json";
|
||||||
httpreq.send(JSON.stringify({
|
httpreq.send(JSON.stringify(poster));
|
||||||
home: {
|
|
||||||
last_read_id: 1
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
httpreq.onreadystatechange = function () {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response;
|
var json = httpreq.response;
|
||||||
console.log(json)
|
console.log(json)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
cbTimer1 = setInterval(asRead, 60000);
|
Loading…
Reference in New Issue
Block a user