Add: demo: unread reader
This commit is contained in:
parent
38cff550e1
commit
376425cc98
|
@ -436,7 +436,7 @@ p:not(:last-child) {
|
||||||
z-index: 500;
|
z-index: 500;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 40px 48px 1fr 24px;
|
grid-template-columns: 40px 1fr 1fr 24px;
|
||||||
grid-template-rows: 30px 30px;
|
grid-template-rows: 30px 30px;
|
||||||
grid-template-areas: "notice notice_name notice_name a2" "notice a1 sta a3" "notf-box notf-box notf-box notf-box";
|
grid-template-areas: "notice notice_name notice_name a2" "notice a1 sta a3" "notf-box notf-box notf-box notf-box";
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,6 @@ p:not(:last-child) {
|
||||||
}
|
}
|
||||||
|
|
||||||
.area-a1 {
|
.area-a1 {
|
||||||
text-align: center;
|
|
||||||
grid-area: a1;
|
grid-area: a1;
|
||||||
}
|
}
|
||||||
.area-sta {
|
.area-sta {
|
||||||
|
@ -697,3 +696,9 @@ audio {
|
||||||
animation-duration: 0.1s;
|
animation-duration: 0.1s;
|
||||||
animation-name: fadeInDown;
|
animation-name: fadeInDown;
|
||||||
}
|
}
|
||||||
|
.urbadge{
|
||||||
|
line-height: normal;
|
||||||
|
height: 2rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
background-color: #009688;
|
||||||
|
}
|
||||||
|
|
|
@ -121,6 +121,7 @@ var lang={
|
||||||
"lang_layout_nodata": "[No data]<br>F5/⌘+R to reload",
|
"lang_layout_nodata": "[No data]<br>F5/⌘+R to reload",
|
||||||
"lang_layout_dm": "Direct Message",
|
"lang_layout_dm": "Direct Message",
|
||||||
"lang_layout_webviewmode": "Prefer WebView",
|
"lang_layout_webviewmode": "Prefer WebView",
|
||||||
|
"lang_layout_unread": "Unread",
|
||||||
"lang_excluded": "Excluded type of notification",
|
"lang_excluded": "Excluded type of notification",
|
||||||
"lang_layout_excludingbt": "Показване в BT режим (ИЗКЛ./Изключване BT/ Само в BT)",
|
"lang_layout_excludingbt": "Показване в BT режим (ИЗКЛ./Изключване BT/ Само в BT)",
|
||||||
"lang_layout_leftFold": "Стъпка наляво",
|
"lang_layout_leftFold": "Стъпка наляво",
|
||||||
|
|
|
@ -127,6 +127,7 @@ var lang={
|
||||||
"lang_layout_leftUnfold": "Dock on the right",
|
"lang_layout_leftUnfold": "Dock on the right",
|
||||||
"lang_layout_deleteColumn": "Delete this column",
|
"lang_layout_deleteColumn": "Delete this column",
|
||||||
"lang_layout_deleteColumnDesc": "Delete this column",
|
"lang_layout_deleteColumnDesc": "Delete this column",
|
||||||
|
"lang_layout_unread": "Unread",
|
||||||
"lang_sort_gothis": "Go to this column",
|
"lang_sort_gothis": "Go to this column",
|
||||||
"lang_sort_remthis": "Delete this column",
|
"lang_sort_remthis": "Delete this column",
|
||||||
"lang_spotify_img": "Attach an album artwork",
|
"lang_spotify_img": "Attach an album artwork",
|
||||||
|
|
|
@ -127,6 +127,7 @@ var lang={
|
||||||
"lang_layout_leftUnfold": "Rechts Anheften",
|
"lang_layout_leftUnfold": "Rechts Anheften",
|
||||||
"lang_layout_deleteColumn": "Diese Spalte löschen",
|
"lang_layout_deleteColumn": "Diese Spalte löschen",
|
||||||
"lang_layout_deleteColumnDesc": "Diese Spalte löschen",
|
"lang_layout_deleteColumnDesc": "Diese Spalte löschen",
|
||||||
|
"lang_layout_unread": "Unread",
|
||||||
"lang_sort_gothis": "Gehe zu dieser Spalte",
|
"lang_sort_gothis": "Gehe zu dieser Spalte",
|
||||||
"lang_sort_remthis": "Diese Spalte löschen",
|
"lang_sort_remthis": "Diese Spalte löschen",
|
||||||
"lang_spotify_img": "Albumcover anhängen",
|
"lang_spotify_img": "Albumcover anhängen",
|
||||||
|
|
|
@ -153,6 +153,7 @@ var lang = {
|
||||||
"lang_layout_leftUnfold": "Dock on the right",
|
"lang_layout_leftUnfold": "Dock on the right",
|
||||||
"lang_layout_deleteColumn": "Delete this column",
|
"lang_layout_deleteColumn": "Delete this column",
|
||||||
"lang_layout_deleteColumnDesc": "Delete this column",
|
"lang_layout_deleteColumnDesc": "Delete this column",
|
||||||
|
"lang_layout_unread": "Unread",
|
||||||
//ui/sort.js
|
//ui/sort.js
|
||||||
"lang_sort_gothis": "Go to this column",
|
"lang_sort_gothis": "Go to this column",
|
||||||
"lang_sort_remthis": "Delete this column",
|
"lang_sort_remthis": "Delete this column",
|
||||||
|
|
|
@ -153,6 +153,7 @@ var lang = {
|
||||||
"lang_layout_leftUnfold": "右へ出す",
|
"lang_layout_leftUnfold": "右へ出す",
|
||||||
"lang_layout_deleteColumn": "カラム削除",
|
"lang_layout_deleteColumn": "カラム削除",
|
||||||
"lang_layout_deleteColumnDesc": "カラムを削除しますか?",
|
"lang_layout_deleteColumnDesc": "カラムを削除しますか?",
|
||||||
|
"lang_layout_unread": "未読",
|
||||||
//ui/sort.js
|
//ui/sort.js
|
||||||
"lang_sort_gothis": "このカラムへ",
|
"lang_sort_gothis": "このカラムへ",
|
||||||
"lang_sort_remthis": "このカラムを削除",
|
"lang_sort_remthis": "このカラムを削除",
|
||||||
|
|
|
@ -66,7 +66,7 @@ function notfColumn(acct_id, tlid, sys) {
|
||||||
if (os == "darwin") {
|
if (os == "darwin") {
|
||||||
var n = new Notification('TheDesk:' + domain, options);
|
var n = new Notification('TheDesk:' + domain, options);
|
||||||
} else {
|
} else {
|
||||||
var nativeNotfOpt=['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
|
var nativeNotfOpt = ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
|
||||||
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ function notfCommon(acct_id, tlid, sys) {
|
||||||
if (os == "darwin") {
|
if (os == "darwin") {
|
||||||
var n = new Notification('TheDesk:' + domain, options);
|
var n = new Notification('TheDesk:' + domain, options);
|
||||||
} else {
|
} else {
|
||||||
var nativeNotfOpt=['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
|
var nativeNotfOpt = ['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
|
||||||
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,16 +234,19 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
|
||||||
if (type == "notification") {
|
if (type == "notification") {
|
||||||
var templete = "";
|
var templete = "";
|
||||||
localStorage.setItem("lastnotf_" + acct_id, obj.id);
|
localStorage.setItem("lastnotf_" + acct_id, obj.id);
|
||||||
if (obj.type != "follow") {
|
if (!$("#unread_" + tlid + " .material-icons").hasClass("teal-text")) {
|
||||||
templete = parse([obj], 'notf', acct_id, 'notf', popup);
|
//markers show中はダメ
|
||||||
} else {
|
if (obj.type != "follow") {
|
||||||
templete = userparse([obj], 'notf', acct_id, 'notf', popup);
|
templete = parse([obj], 'notf', acct_id, 'notf', popup);
|
||||||
|
} else {
|
||||||
|
templete = userparse([obj], 'notf', acct_id, 'notf', popup);
|
||||||
|
}
|
||||||
|
if (!$("div[data-notfIndv=" + acct_id + "_" + obj.id + "]").length) {
|
||||||
|
$("div[data-notf=" + acct_id + "]").prepend(templete);
|
||||||
|
$("div[data-const=notf_" + acct_id + "]").prepend(templete);
|
||||||
|
}
|
||||||
|
jQuery("time.timeago").timeago();
|
||||||
}
|
}
|
||||||
if (!$("div[data-notfIndv=" + acct_id + "_" + obj.id + "]").length) {
|
|
||||||
$("div[data-notf=" + acct_id + "]").prepend(templete);
|
|
||||||
$("div[data-const=notf_" + acct_id + "]").prepend(templete);
|
|
||||||
}
|
|
||||||
jQuery("time.timeago").timeago();
|
|
||||||
} else if (type == "delete") {
|
} else if (type == "delete") {
|
||||||
$("[toot-id=" + obj + "]").hide();
|
$("[toot-id=" + obj + "]").hide();
|
||||||
$("[toot-id=" + obj + "]").remove();
|
$("[toot-id=" + obj + "]").remove();
|
||||||
|
|
230
app/js/tl/tl.js
230
app/js/tl/tl.js
|
@ -2,6 +2,7 @@
|
||||||
moreloading = false;
|
moreloading = false;
|
||||||
function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
||||||
scrollevent();
|
scrollevent();
|
||||||
|
$("#unread_" + tlid + " .material-icons").removeClass("teal-text")
|
||||||
localStorage.removeItem("morelock");
|
localStorage.removeItem("morelock");
|
||||||
localStorage.removeItem("pool");
|
localStorage.removeItem("pool");
|
||||||
var domain = localStorage.getItem("domain_" + acct_id);
|
var domain = localStorage.getItem("domain_" + acct_id);
|
||||||
|
@ -149,6 +150,18 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) {
|
||||||
jQuery("time.timeago").timeago();
|
jQuery("time.timeago").timeago();
|
||||||
todc();
|
todc();
|
||||||
reload(type, '', acct_id, tlid, data, mute, delc, voice);
|
reload(type, '', acct_id, tlid, data, mute, delc, voice);
|
||||||
|
if (type == "home" || type == "notf") {
|
||||||
|
//Markers
|
||||||
|
var markers = localStorage.getItem("markers");
|
||||||
|
if (markers == "no") {
|
||||||
|
markers = false;
|
||||||
|
} else {
|
||||||
|
markers = true
|
||||||
|
}
|
||||||
|
if (markers) {
|
||||||
|
getMarker(tlid, type, acct_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
$(window).scrollTop(0);
|
$(window).scrollTop(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -217,7 +230,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
||||||
websocket[wsid] = new WebSocket(start);
|
websocket[wsid] = new WebSocket(start);
|
||||||
websocket[wsid].onopen = function (mess) {
|
websocket[wsid].onopen = function (mess) {
|
||||||
console.table({ "tlid": tlid, "type": "Connect Streaming API" + type, "domain": domain, "message": [mess] })
|
console.table({ "tlid": tlid, "type": "Connect Streaming API" + type, "domain": domain, "message": [mess] })
|
||||||
$("#notice_icon_" + tlid).removeClass("red-text");
|
$("#notice_icon_" + tlid).removeClass("red-text")
|
||||||
}
|
}
|
||||||
websocket[wsid].onmessage = function (mess) {
|
websocket[wsid].onmessage = function (mess) {
|
||||||
console.log([tlid + ":Receive Streaming API:", JSON.parse(mess.data)]);
|
console.log([tlid + ":Receive Streaming API:", JSON.parse(mess.data)]);
|
||||||
|
@ -256,37 +269,40 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
||||||
$("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
|
$("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
|
||||||
$("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
|
$("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
|
||||||
} else {
|
} else {
|
||||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
|
$("[toot-id=" + JSON.parse(mess.data).payload + "]").hide()
|
||||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
|
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (typeA == "update" || typeA == "conversation") {
|
} else if (typeA == "update" || typeA == "conversation") {
|
||||||
localStorage.removeItem("delete");
|
localStorage.removeItem("delete")
|
||||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
if (!$("#unread_" + tlid + " .material-icons").hasClass("teal-text")) {
|
||||||
if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) {
|
//markers show中はダメ
|
||||||
if (voice) {
|
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||||
say(obj.content)
|
if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) {
|
||||||
}
|
if (voice) {
|
||||||
var templete = parse([obj], type, acct_id, tlid, "", mute, type);
|
say(obj.content)
|
||||||
if ($("timeline_box_" + tlid + "_box .tl-box").scrollTop() === 0) {
|
|
||||||
$("#timeline_" + tlid).prepend(templete);
|
|
||||||
} else {
|
|
||||||
var pool = localStorage.getItem("pool_" + tlid);
|
|
||||||
if (pool) {
|
|
||||||
pool = templete + pool;
|
|
||||||
} else {
|
|
||||||
pool = templete
|
|
||||||
}
|
}
|
||||||
localStorage.setItem("pool_" + tlid, pool);
|
var templete = parse([obj], type, acct_id, tlid, "", mute, type);
|
||||||
|
if ($("timeline_box_" + tlid + "_box .tl-box").scrollTop() === 0) {
|
||||||
|
$("#timeline_" + tlid).prepend(templete);
|
||||||
|
} else {
|
||||||
|
var pool = localStorage.getItem("pool_" + tlid);
|
||||||
|
if (pool) {
|
||||||
|
pool = templete + pool;
|
||||||
|
} else {
|
||||||
|
pool = templete
|
||||||
|
}
|
||||||
|
localStorage.setItem("pool_" + tlid, pool);
|
||||||
|
}
|
||||||
|
scrollck();
|
||||||
|
additional(acct_id, tlid);
|
||||||
|
jQuery("time.timeago").timeago();
|
||||||
|
} else {
|
||||||
|
todo("二重取得発生中");
|
||||||
}
|
}
|
||||||
scrollck();
|
|
||||||
additional(acct_id, tlid);
|
|
||||||
jQuery("time.timeago").timeago();
|
|
||||||
} else {
|
|
||||||
todo("二重取得発生中");
|
|
||||||
}
|
|
||||||
|
|
||||||
todc();
|
todc();
|
||||||
|
}
|
||||||
} else if (typeA == "filters_changed") {
|
} else if (typeA == "filters_changed") {
|
||||||
filterUpdate(acct_id);
|
filterUpdate(acct_id);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +314,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
||||||
console.error("Error closing");
|
console.error("Error closing");
|
||||||
console.error(error);
|
console.error(error);
|
||||||
if (mode == "error") {
|
if (mode == "error") {
|
||||||
$("#notice_icon_" + tlid).addClass("red-text");
|
$("#notice_icon_" + tlid).addClass("red-text")
|
||||||
todo('WebSocket Error ' + error);
|
todo('WebSocket Error ' + error);
|
||||||
} else {
|
} else {
|
||||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||||
|
@ -312,7 +328,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
|
||||||
websocket[wsid].onclose = function () {
|
websocket[wsid].onclose = function () {
|
||||||
console.warn("Closing " + tlid);
|
console.warn("Closing " + tlid);
|
||||||
if (mode == "error") {
|
if (mode == "error") {
|
||||||
$("#notice_icon_" + tlid).addClass("red-text");
|
$("#notice_icon_" + tlid).addClass("red-text")
|
||||||
todo('WebSocket Closed');
|
todo('WebSocket Closed');
|
||||||
} else {
|
} else {
|
||||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||||
|
@ -824,8 +840,9 @@ function reconnector(tlid, type, acct_id, data, mode) {
|
||||||
M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 })
|
M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 })
|
||||||
|
|
||||||
}
|
}
|
||||||
function columnReload(tlid, type){
|
function columnReload(tlid, type) {
|
||||||
$("#notice_icon_" + tlid).addClass("red-text");
|
$("#notice_icon_" + tlid).addClass("red-text");
|
||||||
|
$("#unread_" + tlid + " .material-icons").removeClass("teal-text")
|
||||||
if (type == "mix" || type == "integrated" || type == "plus") {
|
if (type == "mix" || type == "integrated" || type == "plus") {
|
||||||
if (localStorage.getItem("voice_" + tlid)) {
|
if (localStorage.getItem("voice_" + tlid)) {
|
||||||
var voice = true;
|
var voice = true;
|
||||||
|
@ -861,3 +878,158 @@ function columnReload(tlid, type){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strAliveInt()
|
strAliveInt()
|
||||||
|
//Markers
|
||||||
|
function getMarker(tlid, type, acct_id) {
|
||||||
|
var domain = localStorage.getItem("domain_" + acct_id);
|
||||||
|
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||||
|
if (type == "home") {
|
||||||
|
var add = "home"
|
||||||
|
} else if (type == "notf") {
|
||||||
|
var add = "notifications"
|
||||||
|
}
|
||||||
|
var start = "https://" + domain + "/api/v1/markers?timeline=" + add
|
||||||
|
fetch(start, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + at
|
||||||
|
},
|
||||||
|
}).then(function (response) {
|
||||||
|
return response.json();
|
||||||
|
}).catch(function (error) {
|
||||||
|
$("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + lang.lang_nothing)
|
||||||
|
$("#unread_" + tlid).attr("data-id", "")
|
||||||
|
return false;
|
||||||
|
}).then(function (json) {
|
||||||
|
if (json) {
|
||||||
|
if (json[add]) {
|
||||||
|
json = json[add]
|
||||||
|
$("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + json.updated_at + ' v' + json.version)
|
||||||
|
$("#unread_" + tlid).attr("data-id", json.last_read_id)
|
||||||
|
} else {
|
||||||
|
$("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + lang.lang_nothing)
|
||||||
|
$("#unread_" + tlid).attr("data-id", "")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + lang.lang_nothing)
|
||||||
|
$("#unread_" + tlid).attr("data-id", "")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function showUnread(tlid, type, acct_id) {
|
||||||
|
if($("#unread_" + tlid + " .material-icons").hasClass("teal-text")){
|
||||||
|
$("#unread_" + tlid + " .material-icons").removeClass("teal-text")
|
||||||
|
goTop(tlid)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$("#unread_" + tlid + " .material-icons").addClass("teal-text")
|
||||||
|
var domain = localStorage.getItem("domain_" + acct_id);
|
||||||
|
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||||
|
var id = $("#unread_" + tlid).attr("data-id")
|
||||||
|
if (type == "home") {
|
||||||
|
var add = "timelines/home?min_id=" + id
|
||||||
|
} else if (type == "notf") {
|
||||||
|
var add = "notifications?min_id=" + id
|
||||||
|
}
|
||||||
|
var start = "https://" + domain + "/api/v1/" + add
|
||||||
|
fetch(start, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + at
|
||||||
|
},
|
||||||
|
}).then(function (response) {
|
||||||
|
return response.json();
|
||||||
|
}).catch(function (error) {
|
||||||
|
todo(error);
|
||||||
|
console.error(error);
|
||||||
|
}).then(function (json) {
|
||||||
|
if(!json){
|
||||||
|
columnReload(tlid)
|
||||||
|
}
|
||||||
|
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||||
|
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
|
||||||
|
} else {
|
||||||
|
var mute = [];
|
||||||
|
}
|
||||||
|
var templete = parse(json, '', acct_id, tlid, "", mute, type);
|
||||||
|
var len = json.length - 1
|
||||||
|
$("#timeline_" + tlid).html(templete);
|
||||||
|
var to = $("#timeline_" + tlid + " .cvo:eq(" + len + ")").offset().top
|
||||||
|
$("#timeline_box_" + tlid + "_box .tl-box").scrollTop(to)
|
||||||
|
additional(acct_id, tlid);
|
||||||
|
jQuery("time.timeago").timeago();
|
||||||
|
todc();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var ueloadlock = false
|
||||||
|
function ueload(tlid){
|
||||||
|
if(ueloadlock){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
ueloadlock = true
|
||||||
|
var multi = localStorage.getItem("column")
|
||||||
|
var obj = JSON.parse(multi)
|
||||||
|
var acct_id = obj[tlid*1].domain
|
||||||
|
var type = obj[tlid*1].type
|
||||||
|
var domain = localStorage.getItem("domain_" + acct_id)
|
||||||
|
var at = localStorage.getItem("acct_" + acct_id + "_at")
|
||||||
|
var id = $("#timeline_" + tlid + " .cvo:eq(0)").attr("unique-id")
|
||||||
|
if (type == "home") {
|
||||||
|
var add = "timelines/home?min_id=" + id
|
||||||
|
} else if (type == "notf") {
|
||||||
|
var add = "notifications?min_id=" + id
|
||||||
|
}
|
||||||
|
var start = "https://" + domain + "/api/v1/" + add
|
||||||
|
fetch(start, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
'Authorization': 'Bearer ' + at
|
||||||
|
},
|
||||||
|
}).then(function (response) {
|
||||||
|
return response.json();
|
||||||
|
}).catch(function (error) {
|
||||||
|
todo(error);
|
||||||
|
console.error(error);
|
||||||
|
}).then(function (json) {
|
||||||
|
if(!json){
|
||||||
|
columnReload(tlid)
|
||||||
|
}
|
||||||
|
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||||
|
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
|
||||||
|
} else {
|
||||||
|
var mute = [];
|
||||||
|
}
|
||||||
|
var templete = parse(json, '', acct_id, tlid, "", mute, type);
|
||||||
|
var len = json.length - 1
|
||||||
|
$("#timeline_" + tlid).prepend(templete);
|
||||||
|
var to = $("#timeline_" + tlid + " .cvo:eq(" + len + ")").offset().top
|
||||||
|
$("#timeline_box_" + tlid + "_box .tl-box").scrollTop(to)
|
||||||
|
additional(acct_id, tlid);
|
||||||
|
jQuery("time.timeago").timeago();
|
||||||
|
todc();
|
||||||
|
ueloadlock = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function testAsRead(acct_id) {
|
||||||
|
var domain = localStorage.getItem("domain_" + acct_id);
|
||||||
|
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||||
|
var httpreq = new XMLHttpRequest();
|
||||||
|
var start = "https://" + domain + "/api/v1/markers"
|
||||||
|
httpreq.open('POST', start, true);
|
||||||
|
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||||
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||||
|
httpreq.responseType = "json";
|
||||||
|
httpreq.send(JSON.stringify({
|
||||||
|
home: {
|
||||||
|
last_read_id: 1
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
httpreq.onreadystatechange = function () {
|
||||||
|
if (httpreq.readyState === 4) {
|
||||||
|
var json = httpreq.response;
|
||||||
|
console.log(json)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -190,6 +190,7 @@ function parseColumn(target, dontclose) {
|
||||||
} else {
|
} else {
|
||||||
var animecss = "";
|
var animecss = "";
|
||||||
}
|
}
|
||||||
|
var unread = '<a id="unread_' + tlid + '" onclick="showUnread(' + key + ',\'' + acct.type + '\',\'' + acct.domain + '\')" class="setting nex" title="' + lang.lang_layout_unread + '"><i class="material-icons waves-effect nex">more</i></a>'
|
||||||
if (acct.type == "notf") {
|
if (acct.type == "notf") {
|
||||||
var exclude = lang.lang_excluded + ':<br><label><input type="checkbox" class="filled-in" id="exc-reply-' + key + '" ' + excludeCk(key, "mention") + ' /><span><i class="fas fa-share exc-icons"></i></span></label> ' +
|
var exclude = lang.lang_excluded + ':<br><label><input type="checkbox" class="filled-in" id="exc-reply-' + key + '" ' + excludeCk(key, "mention") + ' /><span><i class="fas fa-share exc-icons"></i></span></label> ' +
|
||||||
'<label><input type="checkbox" class="filled-in" id="exc-fav-' + key + '" ' + excludeCk(key, "favourite") + ' /><span><i class="fas fa-star exc-icons"></i></span></label> ' +
|
'<label><input type="checkbox" class="filled-in" id="exc-fav-' + key + '" ' + excludeCk(key, "favourite") + ' /><span><i class="fas fa-star exc-icons"></i></span></label> ' +
|
||||||
|
@ -201,12 +202,15 @@ function parseColumn(target, dontclose) {
|
||||||
exclude = exclude + '<button class="btn red waves-effect" style="width:60px; padding:0;" onclick="resetNotfFilter(' + key + ')">Clear all</button>'
|
exclude = exclude + '<button class="btn red waves-effect" style="width:60px; padding:0;" onclick="resetNotfFilter(' + key + ')">Clear all</button>'
|
||||||
}
|
}
|
||||||
exclude = exclude + "<br>";
|
exclude = exclude + "<br>";
|
||||||
|
|
||||||
} else if (acct.type == "home") {
|
} else if (acct.type == "home") {
|
||||||
var exclude = '<a onclick="ebtToggle(' + key +
|
var exclude = '<a onclick="ebtToggle(' + key +
|
||||||
')" class="setting nex"><i class="fas fa-retweet waves-effect nex" title="' + lang.lang_layout_excludingbt + '" style="font-size:24px"></i><span id="sta-bt-' +
|
')" class="setting nex"><i class="fas fa-retweet waves-effect nex" title="' + lang.lang_layout_excludingbt + '" style="font-size:24px"></i><span id="sta-bt-' +
|
||||||
key + '">Off</span></a>' + lang.lang_layout_excludingbt + '<br>';
|
key + '">Off</span></a>' + lang.lang_layout_excludingbt + '<br>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var exclude = "";
|
var exclude = "";
|
||||||
|
unread = ""
|
||||||
}
|
}
|
||||||
if (!acct.left_fold) {
|
if (!acct.left_fold) {
|
||||||
basekey = key;
|
basekey = key;
|
||||||
|
@ -235,7 +239,7 @@ function parseColumn(target, dontclose) {
|
||||||
'<div class="area-notice_name"><span id="notice_' + key + '" class="tl-title"></span></div>' +
|
'<div class="area-notice_name"><span id="notice_' + key + '" class="tl-title"></span></div>' +
|
||||||
'<div class="area-a1"><a onclick="notfToggle(' + acct.domain + ',' + key +
|
'<div class="area-a1"><a onclick="notfToggle(' + acct.domain + ',' + key +
|
||||||
')" class="setting nex ' + if_notf + '" title="' + unique_notf + '"' + icnsert + '><i class="material-icons waves-effect nex notf-icon_' +
|
')" class="setting nex ' + if_notf + '" title="' + unique_notf + '"' + icnsert + '><i class="material-icons waves-effect nex notf-icon_' +
|
||||||
acct.domain + '">notifications</i></div><div class="area-sta"><span class="new badge teal notf-reply_' + acct.domain + ' hide" data-badge-caption="Reply">0</span><span class="new badge yellow black-text notf-fav_' + acct.domain + ' hide" data-badge-caption="Fav">0</span><span class="new badge blue notf-bt_' + acct.domain + ' hide" data-badge-caption="BT">0</span><span class="new badge orange notf-follow_' + acct.domain + ' hide" data-badge-caption="Follow">0</span></a></div>' +
|
acct.domain + '">notifications</i></a>' + unread + '</div><div class="area-sta"><span class="new badge teal notf-reply_' + acct.domain + ' hide" data-badge-caption="Reply">0</span><span class="new badge yellow black-text notf-fav_' + acct.domain + ' hide" data-badge-caption="Fav">0</span><span class="new badge blue notf-bt_' + acct.domain + ' hide" data-badge-caption="BT">0</span><span class="new badge orange notf-follow_' + acct.domain + ' hide" data-badge-caption="Follow">0</span></div>' +
|
||||||
'<div class="area-a2"><a onclick="removeColumn(' + key +
|
'<div class="area-a2"><a onclick="removeColumn(' + key +
|
||||||
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_delthis + '"' + icnsert + '>cancel</i></a></div>' +
|
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_delthis + '"' + icnsert + '>cancel</i></a></div>' +
|
||||||
'<div class="area-a3"><a onclick="setToggle(' + key +
|
'<div class="area-a3"><a onclick="setToggle(' + key +
|
||||||
|
|
|
@ -9,13 +9,17 @@ scrollevent();
|
||||||
function scrollck() {
|
function scrollck() {
|
||||||
$(".tl-box").each(function (i, elem) {
|
$(".tl-box").each(function (i, elem) {
|
||||||
var tlid = $(this).attr('tlid');
|
var tlid = $(this).attr('tlid');
|
||||||
//一番上ならためていた新しいトゥートを表示
|
//一番上ならためていた新しいトゥートを表示ないしtealなら未読管理モード
|
||||||
if ($(this).scrollTop() === 0) {
|
if ($(this).scrollTop() === 0) {
|
||||||
var pool = localStorage.getItem("pool_" + tlid);
|
if (!$("#unread_" + tlid + " .material-icons").hasClass("teal-text")) {
|
||||||
if (pool) {
|
var pool = localStorage.getItem("pool_" + tlid);
|
||||||
$("#timeline_" + tlid).prepend(pool);
|
if (pool) {
|
||||||
jQuery("time.timeago").timeago();
|
$("#timeline_" + tlid).prepend(pool);
|
||||||
localStorage.removeItem("pool_" + tlid);
|
jQuery("time.timeago").timeago();
|
||||||
|
localStorage.removeItem("pool_" + tlid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ueload(tlid)
|
||||||
}
|
}
|
||||||
//自動リフレッシュ
|
//自動リフレッシュ
|
||||||
if ($("#timeline_" + tlid + " .cvo").length > 30) {
|
if ($("#timeline_" + tlid + " .cvo").length > 30) {
|
||||||
|
@ -35,6 +39,10 @@ function scrollck() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function goTop(id) {
|
function goTop(id) {
|
||||||
|
if ($("#unread_" + id + " .material-icons").hasClass("teal-text")) {
|
||||||
|
$("#unread_" + id + " .material-icons").removeClass("teal-text")
|
||||||
|
columnReload(id)
|
||||||
|
}
|
||||||
if ($("#timeline_box_" + id + "_box .tl-box").scrollTop() > 500) {
|
if ($("#timeline_box_" + id + "_box .tl-box").scrollTop() > 500) {
|
||||||
$("#timeline_box_" + id + "_box .tl-box").scrollTop(500)
|
$("#timeline_box_" + id + "_box .tl-box").scrollTop(500)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user