TheDesk Akane (16.0.8)

This commit is contained in:
cutls
2018-08-17 02:21:40 +09:00
parent 621a1f3797
commit c5151f6db0
22 changed files with 633 additions and 207 deletions

View File

@@ -1,9 +1,6 @@
//カード処理やメンション、ハッシュタグの別途表示
//全てのTL処理で呼び出し
function additional(acct_id, tlid) {
if(localStorage.getItem("domain_" + acct_id)=="misskey.xyz"){
return false;
}
//メンション系
//$(".mention").attr("href", "");
@@ -31,9 +28,14 @@ function additional(acct_id, tlid) {
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var card = localStorage.getItem("card_" + tlid);
var text = $(this).attr('href');
var urls = text.match(
/https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
);
if(text){
var urls = text.match(
/https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
);
}else{
var urls =[]
}
//トゥートのURLぽかったら
toot = text.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/);
if(toot){
@@ -44,46 +46,70 @@ function additional(acct_id, tlid) {
if (urls) {
$(this).remove();
} else if (!card) {
var id = $(this).parents('.cvo').attr("toot-id");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/card";
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
//body: JSON.stringify({})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
//このリンク鳥やんけ、ってとき
if (json.provider_name=="Twitter"){
if(json.image){
var twiImg='<br><img src="'+json.image+'">';
}else{
var twiImg='';
if(localStorage.getItem("domain_" + acct_id)=="misskey.xyz"){
var start = "https://" + domain + "/url?url="+text;
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json'
},
//body: JSON.stringify({})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
if (json.title) {
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URL"+lang_cards_check[lang]+":<br>Title:" + json.title + "<br>" +
json.description + "</span>");
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
$("[toot-id=" + id + "]").addClass("parsed");
}
$("[toot-id=" + id + "] .additional").html(
'<blockquote class="twitter-tweet"><b>'+json.author_name+'</b><br>'+json.description+twiImg+'</blockquote>');
}
if (json.title) {
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URL"+lang_cards_check[lang]+":<br>Title:" + json.title + "<br>" +
json.description + "</span>");
}
if (json.html) {
$("[toot-id=" + id + "] .additional").html(json.html+'<i class="material-icons" onclick="pip('+id+')" title="'+lang_cards_pip[lang]+'">picture_in_picture_alt</i>');
}
if (json.title) {
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
$("[toot-id=" + id + "]").addClass("parsed");
}
});
});
}else{
var start = "https://" + domain + "/api/v1/statuses/" + id + "/card";
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
//body: JSON.stringify({})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
//このリンク鳥やんけ、ってとき
if (json.provider_name=="Twitter"){
if(json.image){
var twiImg='<br><img src="'+json.image+'">';
}else{
var twiImg='';
}
$("[toot-id=" + id + "] .additional").html(
'<blockquote class="twitter-tweet"><b>'+json.author_name+'</b><br>'+json.description+twiImg+'</blockquote>');
}
if (json.title) {
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URL"+lang_cards_check[lang]+":<br>Title:" + json.title + "<br>" +
json.description + "</span>");
}
if (json.html) {
$("[toot-id=" + id + "] .additional").html(json.html+'<i class="material-icons" onclick="pip('+id+')" title="'+lang_cards_pip[lang]+'">picture_in_picture_alt</i>');
}
if (json.title) {
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
$("[toot-id=" + id + "]").addClass("parsed");
}
});
}
}else{
$(this).attr("title",text);
}
@@ -145,49 +171,81 @@ function additionalIndv(tlid, acct_id, id) {
if (urls) {
$("[toot-id="+id+"] .toot a").remove();
} else {
var id = $("[toot-id="+id+"] .toot a").parents('.cvo').attr("toot-id");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/card";
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
//body: JSON.stringify({})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
//このリンク鳥やんけ、ってとき
console.log(json.provider_name);
if (json.provider_name=="Twitter"){
if(json.image){
var twiImg='<br><img src="'+json.image+'" style="max-width:100%">';
}else{
var twiImg='';
}
$("[toot-id=" + id + "] .additional").html(
'<div class="twitter-tweet"><b>'+json.author_name+'</b><br>'+json.description+twiImg+'</div>');
}else{
if(localStorage.getItem("domain_" + acct_id)=="misskey.xyz"){
var start = "https://" + domain + "/url?url="+text;
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json'
},
//body: JSON.stringify({})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
if (json.title) {
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URL"+lang_cards_check[lang]+":<br>Title:" + json.title + "<br>" +
json.description + "</span>");
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
$("[toot-id=" + id + "]").addClass("parsed");
}
if (json.html) {
$("[toot-id=" + id + "] .additional").html(json.html+'<i class="material-icons sml pointer" onclick="pip(\''+id+'\')" title="'+lang_cards_pip[lang]+'">picture_in_picture_alt</i>');
});
}else{
var id = $("[toot-id="+id+"] .toot a").parents('.cvo').attr("toot-id");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/card";
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
//body: JSON.stringify({})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
//このリンク鳥やんけ、ってとき
console.log(json.provider_name);
if (json.provider_name=="Twitter"){
if(json.image){
var twiImg='<br><img src="'+json.image+'" style="max-width:100%" onclick="imgv(\'twi_'+id+'\', 0, \'twitter\');" id="twi_'+id+'-image-0" data-url="'+json.image+'" data-type="image">';
}else{
var twiImg='';
}
$("[toot-id=" + id + "] .additional").html(
'<div class="twitter-tweet"><b>'+json.author_name+'</b><br>'+json.description+twiImg+'</div>');
}else if (json.provider_name=="pixiv"){
if(json.image){
var pxvImg='<br><img src="'+json.image+'" style="max-width:100%" onclick="imgv(\'pixiv_'+id+'\', 0, \'pixiv\');" id="pixiv_'+id+'-image-0" data-url="'+json.embed_url+'" data-type="image">';
}else{
var pxvImg='';
}
$("[toot-id=" + id + "] .additional").html(
'<div class="pixiv-post"><b><a href="'+json.author_url+'" target="_blank">'+json.author_name+'</a></b><br>'+json.title+pxvImg+'</div>');
}else{
if (json.title) {
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URL"+lang_cards_check[lang]+":<br>Title:" + json.title + "<br>" +
json.description + "</span>");
}
if (json.html) {
$("[toot-id=" + id + "] .additional").html(json.html+'<i class="material-icons sml pointer" onclick="pip(\''+id+'\')" title="'+lang_cards_pip[lang]+'">picture_in_picture_alt</i>');
}
}
}
if (json.title) {
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
$("[toot-id=" + id + "]").addClass("parsed");
}
});
if (json.title) {
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
$("[toot-id=" + id + "]").addClass("parsed");
}
});
}
}
}
@@ -216,7 +274,7 @@ function cardCheck(tlid) {
}
}
function mov(id,tlid){
function mov(id,tlid,type){
if(tlid=="notf"){
var tlide="[data-notf="+acct_id+"]";
}else{
@@ -225,17 +283,24 @@ function mov(id,tlid){
var mouseover=localStorage.getItem("mouseover");
if(!mouseover){
mouseover="";
}else if(mouseover=="yes"){
}
if(mouseover=="yes"){
mouseover="hide";
}else if(mouseover=="click"){
if(type=="mv"){
mouseover="";
}else{
mouseover="hide";
}
}else if(mouseover=="no"){
mouseover="";
}
if(mouseover=="hide"){
$(tlide+" [toot-id="+id+"] .area-actions").removeClass("hide")
$(tlide+" [toot-id="+id+"] .area-actions").toggleClass("hide")
}
}
function resetmv(){
function resetmv(type){
var mouseover=localStorage.getItem("mouseover");
if(!mouseover){
mouseover="";
@@ -243,6 +308,8 @@ function resetmv(){
mouseover="hide";
}else if(mouseover=="no"){
mouseover="";
}else if(mouseover=="click" && type!="mv"){
mouseover="hide";
}
if(mouseover=="hide"){
$(".area-actions").addClass("hide");

View File

@@ -1,6 +1,7 @@
//オブジェクトパーサー(トゥート)
function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var templete = '';
localStorage.setItem("lastunix_"+ tlid,date(obj[0].createdAt, 'unix'));
var actb = localStorage.getItem("action_btns");
var actb='re,rt,fav,qt,del,pin,red';
if(actb){
@@ -115,7 +116,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var mouseover=localStorage.getItem("mouseover");
if(!mouseover){
mouseover="";
}else if(mouseover=="yes"){
}else if(mouseover=="yes" || mouseover=="click"){
mouseover="hide";
}else if(mouseover=="no"){
mouseover="";
@@ -167,6 +168,8 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(toot.note.reactionCounts[reactions[i]])
}
}
}else{
var icon = '<i class="big-text material-icons indigo-text" style="font-size:17px">info</i>';
}
var noticetext = '<span class="cbadge cbadge-hover"title="' + date(toot.createdAt,
'absolute') + '('+lang_parse_notftime[lang]+')"><i class="fa fa-clock-o"></i>' + date(toot.createdAt,
@@ -178,6 +181,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var notice = noticetext;
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
if(localStorage.getItem("hasNotfC_" + acct_id)!="true"){
if (toot.type == "reply") {
var replyct=localStorage.getItem("notf-reply_" + acct_id)
$(".notf-reply_" + acct_id).text(replyct*1-(-1));
@@ -194,6 +198,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
localStorage.setItem("notf-fav_" + acct_id,favct*1-(-1))
$(".notf-fav_" + acct_id).removeClass("hide")
}
}
var domain = localStorage.getItem("domain_" + acct_id);
if(popup>0){
Materialize.toast("["+domain+"]"+escapeHTML(toot.user.name)+what, popup * 1000);
@@ -212,7 +217,9 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
ipc.send('native-notf', ['TheDesk:'+domain,toot.user.name+"(" + toot.user.acct +")"+what+"\n\n"+$.strip_tags(toot.note.text),toot.user.avatarUrl]);
}
}
$(".notf-icon_" + acct_id).addClass("red-text");
if(localStorage.getItem("hasNotfC_" + acct_id)!="true"){
$(".notf-icon_" + acct_id).addClass("red-text");
}
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
}
@@ -323,6 +330,15 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
}
}
var analyze = '';
var urls = $.strip_tags(content).replace(/\n/g, " ").match(
/https?:\/\/([-a-zA-Z0-9@.]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/
);
if (urls) {
var analyze = '<a onclick="additionalIndv(\'' + tlid + '\',' + acct_id +
',\'' + id + '\')" class="add-show pointer">'+lang_parse_url[lang]+'</a><br>';
} else {
var analyze = '';
}
var viewer = "";
var hasmedia = "";
var youtube = "";
@@ -363,7 +379,12 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
if(notice){
notice=twemoji.parse(notice);
}
var mediack = toot.media[0];
if(toot.media){
var mediack = toot.media[0];
}else{
var mediack=false;
}
//メディアがあれば
var media_ids="";
if (mediack) {
@@ -412,9 +433,9 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
if (tagck) {
Object.keys(toot.tags).forEach(function(key4) {
var tag = toot.tags[key4];
var tags = '<a onclick="tagShow(\'' + tag + '\')" class="pointer">#' + tag + '</a><span class="hide" data-tag="' + tag + '">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id +
',\'add\')" class="pointer" title="' +lang_parse_tagTL[lang].replace("{{tag}}" ,'#'+tag)+ '">TL</a> <a onclick="brInsert(\'#' + tag + '\')" class="pointer" title="' + lang_parse_tagtoot[lang].replace("{{tag}}" ,'#'+tag) + '">Toot</a> '+
'<a onclick="tagPin(\'' + tag + '\')" class="pointer" title="' +lang_parse_tagpin[lang].replace("{{tag}}" ,'#'+tag)+ '">Pin</a></span> ';
var tags = '<a onclick="tagShow(\'' + tag + '\')" class="pointer parsed">#' + tag + '</a><span class="hide" data-tag="' + tag + '">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id +
',\'add\')" class="pointer parsed" title="' +lang_parse_tagTL[lang].replace("{{tag}}" ,'#'+tag)+ '">TL</a> <a onclick="brInsert(\'#' + tag + '\')" class="pointer parsed" title="' + lang_parse_tagtoot[lang].replace("{{tag}}" ,'#'+tag) + '">Toot</a> '+
'<a onclick="tagPin(\'' + tag + '\')" class="pointer parsed" title="' +lang_parse_tagpin[lang].replace("{{tag}}" ,'#'+tag)+ '">Pin</a></span> ';
content=content.replace("#"+tag,tags);
});
//tags = '<div style="float:right">' + tags + '</div>';
@@ -596,7 +617,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var trans="";
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
boostback + ' ' + fav_app + ' ' + rt_app + ' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="'+media_ids+' " unixtime="' + date(obj[
key].created_at, 'unix') + '" '+if_notf+' onmouseover="mov(\'' + toot.id + '\',\''+tlid+'\')" onmouseout="resetmv()" reacted="'+reacted+'">' +
key].created_at, 'unix') + '" '+if_notf+' onmouseover="mov(\'' + toot.id + '\',\''+tlid+'\',\'mv\')" onclick="mov(\'' + toot.id + '\',\''+tlid+'\',\'cl\')" onmouseout="resetmv(\'mv\')" reacted="'+reacted+'">' +
'<div class="area-notice"><span class="gray sharesta">' + notice + home +
'</span></div>' +
'<div class="area-icon"><a onclick="udg(\'' + toot.user.id +
@@ -618,8 +639,8 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
api_spoil + ' cw_text_' + toot.id + '">' + spoil + spoiler_show +
'</span>' +
'' + viewer + '' +
'</div><div class="area-additional"><span class="additional">'+
'<div class="reactions '+fullhide+'" style="height: 20px;"><span class="'+likehide+' reaction re-like"><a onclick="reaction(\'like\',\'' + toot.id + '\',' + acct_id +
'</div><div class="area-additional"><span class="additional">'+analyze+
'<div class="reactions '+fullhide+'" style="height: 25px;"><span class="'+likehide+' reaction re-like"><a onclick="reaction(\'like\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat" style="padding:0">'+twemoji.parse("👍")+'</a><span class="re-likect">'+like+
'</span></span><span class="'+lovehide+' reaction re-love"><a onclick="reaction(\'love\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("💓")+'</a><span class="re-lovect">'+love+
@@ -668,7 +689,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
'<span class="cbadge viabadge waves-effect '+viashow+' '+mine_via+'" onclick="client(\''+$.strip_tags(via)+'\')" title="via ' + $.strip_tags(via) + '">via ' +
via +
'</span>'+
'</div><div class="area-side"><div class="action ' + if_mine + ' '+noauth+'"><a onclick="toggleAction(\'' + toot.id + '\',\''+tlid+'\',\''+acct_id+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 material-icons act-icon">expand_more</i></a></div>' +
'</div><div class="area-side '+mouseover+'"><div class="action ' + if_mine + ' '+noauth+'"><a onclick="toggleAction(\'' + toot.id + '\',\''+tlid+'\',\''+acct_id+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 material-icons act-icon">expand_more</i></a></div>' +
'<div class="action '+noauth+'"><a onclick="details(\'' + toot.id + '\',' + acct_id +
',\''+tlid+'\')" class="waves-effect waves-dark btn-flat details" style="padding:0"><i class="text-darken-3 material-icons">more_vert</i></a></div>' +
'</div></div>' +

View File

@@ -65,7 +65,7 @@ function mixtl(acct_id, tlid, type,delc,voice) {
}
});
$("#landing_" + tlid).hide();
$("#timeline_" + tlid).html(templete);
mixre(acct_id, tlid, type, mute,delc,voice);
additional(acct_id, tlid);
@@ -90,10 +90,12 @@ function mixre(acct_id, tlid, TLtype, mute,delc,voice) {
websocketHome[wshid] = new WebSocket(startHome);
websocketLocal[wslid] = new WebSocket(startLocal);
websocketHome[wshid].onopen = function(mess) {
localStorage.setItem("wssH_" + tlid, wshid);
console.log("Connect Streaming API(Integrated:Home)");
$("#notice_icon_" + tlid).removeClass("red-text");
}
websocketLocal[wslid].onopen = function(mess) {
localStorage.setItem("wssL_" + tlid, wslid);
console.log("Connect Streaming API(Integrated:Local)");
$("#notice_icon_" + tlid).removeClass("red-text");
}

View File

@@ -86,7 +86,7 @@ function notf(acct_id, tlid, sys) {
} else {
$("div[data-notf=" + acct_id +"]").html(templete);
}
$("#landing_" + tlid).hide();
jQuery("time.timeago").timeago();
}
$("#notf-box").addClass("fetched");
@@ -102,33 +102,44 @@ function notf(acct_id, tlid, sys) {
console.log(start);
var wsid = websocketNotf.length;
websocketNotf[wsid] = new WebSocket(start);
websocketNotf[acct_id] = new WebSocket(start);
console.log(websocketNotf);
websocketNotf[wsid].onopen = function(mess) {
websocketNotf[acct_id].onopen = function(mess) {
console.log("Connect Streaming API(Notf):");
console.log(mess);
$("i[data-notf=" + acct_id +"]").removeClass("red-text");
}
websocketNotf[wsid].onmessage = function(mess) {
websocketNotf[acct_id].onmessage = function(mess) {
console.log("Receive Streaming API(Notf):"+acct_id);
var popup = localStorage.getItem("popup");
if (!popup) {
popup = 0;
}
console.log(domain)
if(domain=="misskey.xyz"){
console.log("misskey")
console.log(JSON.parse(mess.data));
if (JSON.parse(mess.data).type == "notification") {
var obj = JSON.parse(mess.data).body;
console.log(obj);
if(obj.type!="follow"){
templete = misskeyParse([obj], 'notf', acct_id, 'notf', popup);
}else{
templete = misskeyUserparse([obj], 'notf', acct_id, 'notf', popup);
}
if(obj.type=="reaction"){
console.log("refresh")
reactRefresh(acct_id,obj.note.id)
}
if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){
$("div[data-notf=" + acct_id +"]").prepend(templete);
}
jQuery("time.timeago").timeago();
}else if(JSON.parse(mess.data).type == "note-updated"){
var obj = JSON.parse(mess.data).body.note;
reactRefreshCore(obj)
}
}else{
var obj = JSON.parse(JSON.parse(mess.data).payload);
@@ -152,7 +163,7 @@ function notf(acct_id, tlid, sys) {
}
}
}
websocketNotf[wsid].onerror = function(error) {
websocketNotf[acct_id].onerror = function(error) {
console.error('WebSocket Error ' + error);
};
}
@@ -174,7 +185,7 @@ function notfmore(tlid) {
todo("Notfication TL MoreLoading");
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/i/notifications";
var i={
@@ -198,13 +209,8 @@ function notfmore(tlid) {
},
}
}
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}).then(function(response) {
fetch(start, i,
).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
@@ -215,7 +221,7 @@ function notfmore(tlid) {
var obj = json[key];
if(obj.type!="follow"){
if(domain=="misskey.xyz"){
templete = templete+misskeyParse([obj], '', acct_id, tlid, -1);
templete = templete+misskeyParse([obj.note], '', acct_id, tlid, -1);
}else{
templete = templete+parse([obj], '', acct_id, tlid, -1);
}

View File

@@ -1,6 +1,13 @@
//オブジェクトパーサー(トゥート)
function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
var templete = '';
if(obj[0]){
if(tlid==1){
console.log("testalive:"+"lastunix_"+ tlid+":"+date(obj[0].created_at, 'unix'))
}
localStorage.setItem("lastunix_"+ tlid,date(obj[0].created_at, 'unix'));
}
var actb = localStorage.getItem("action_btns");
var actb='re,rt,fav,qt,del,pin,red';
if(actb){
@@ -123,7 +130,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
var mouseover=localStorage.getItem("mouseover");
if(!mouseover){
mouseover="";
}else if(mouseover=="yes"){
}else if(mouseover=="yes" || mouseover=="click"){
mouseover="hide";
}else if(mouseover=="no"){
mouseover="";
@@ -177,22 +184,25 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
var notice = noticetext;
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
if (toot.type == "mention") {
var replyct=localStorage.getItem("notf-reply_" + acct_id)
$(".notf-reply_" + acct_id).text(replyct*1-(-1));
localStorage.setItem("notf-reply_" + acct_id,replyct*1-(-1))
$(".notf-reply_" + acct_id).removeClass("hide")
}else if (toot.type == "reblog") {
var btct=localStorage.getItem("notf-bt_" + acct_id)
$(".notf-bt_" + acct_id).text(btct*1-(-1));
localStorage.setItem("notf-bt_" + acct_id,btct*1-(-1))
$(".notf-bt_" + acct_id).removeClass("hide")
}else if (toot.type == "favourite") {
var favct=localStorage.getItem("notf-fav_" + acct_id)
$(".notf-fav_" + acct_id).text(favct*1-(-1));
localStorage.setItem("notf-fav_" + acct_id,favct*1-(-1))
$(".notf-fav_" + acct_id).removeClass("hide")
if(localStorage.getItem("hasNotfC_" + acct_id)!="true"){
if (toot.type == "mention") {
var replyct=localStorage.getItem("notf-reply_" + acct_id)
$(".notf-reply_" + acct_id).text(replyct*1-(-1));
localStorage.setItem("notf-reply_" + acct_id,replyct*1-(-1))
$(".notf-reply_" + acct_id).removeClass("hide")
}else if (toot.type == "reblog") {
var btct=localStorage.getItem("notf-bt_" + acct_id)
$(".notf-bt_" + acct_id).text(btct*1-(-1));
localStorage.setItem("notf-bt_" + acct_id,btct*1-(-1))
$(".notf-bt_" + acct_id).removeClass("hide")
}else if (toot.type == "favourite") {
var favct=localStorage.getItem("notf-fav_" + acct_id)
$(".notf-fav_" + acct_id).text(favct*1-(-1));
localStorage.setItem("notf-fav_" + acct_id,favct*1-(-1))
$(".notf-fav_" + acct_id).removeClass("hide")
}
}
var domain = localStorage.getItem("domain_" + acct_id);
if(popup>0){
Materialize.toast("["+domain+"]"+escapeHTML(toot.account.display_name)+what, popup * 1000);
@@ -211,7 +221,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
ipc.send('native-notf', ['TheDesk:'+domain,toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),toot.account.avatar]);
}
}
$(".notf-icon_" + acct_id).addClass("red-text");
if(localStorage.getItem("hasNotfC_" + acct_id)!="true"){
$(".notf-icon_" + acct_id).addClass("red-text");
}
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
}
@@ -406,8 +418,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
} else {
var sense = ""
}
viewer = viewer + '<a onclick="imgv(\'' + id + '\',\'' + key2 + '\',' +
acct_id + ')" id="' + id + '-image-' + key2 + '" data-url="' + url +
viewer = viewer + '<a onclick="imgv(\'' + id + '\',\'' + key2 + '\',\'' +
acct_id + '\')" id="' + id + '-image-' + key2 + '" data-url="' + url +
'" data-type="' + media.type + '" class="img-parsed"><img src="' +
purl + '" class="' + sense +
' toot-img pointer" style="width:' + cwdt + '%; height:'+imh+'px;"></a></span>';
@@ -532,7 +544,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
boostback + ' ' + fav_app + ' ' + rt_app + ' ' + pin_app +
' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="'+media_ids+' " unixtime="' + date(obj[
key].created_at, 'unix') + '" '+if_notf+' onmouseover="mov(\'' + toot.id + '\',\''+tlid+'\')" onmouseout="resetmv()">' +
key].created_at, 'unix') + '" '+if_notf+' onmouseover="mov(\'' + toot.id + '\',\''+tlid+'\',\'mv\')" onclick="mov(\'' + toot.id + '\',\''+tlid+'\',\'cl\')" onmouseout="resetmv(\'mv\')">' +
'<div class="area-notice"><span class="gray sharesta">' + notice + home +
'</span></div>' +
'<div class="area-icon"><a onclick="udg(\'' + toot.account.id +
@@ -590,7 +602,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
'<span class="cbadge viabadge waves-effect '+viashow+' '+mine_via+'" onclick="client(\''+$.strip_tags(via)+'\')" title="via ' + $.strip_tags(via) + '">via ' +
via +
'</span>'+
'</div><div class="area-side"><div class="action ' + if_mine + ' '+noauth+'"><a onclick="toggleAction(\'' + toot.id + '\',\''+tlid+'\',\''+acct_id+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 material-icons act-icon">expand_more</i></a></div>' +
'</div><div class="area-side '+mouseover+'"><div class="action ' + if_mine + ' '+noauth+'"><a onclick="toggleAction(\'' + toot.id + '\',\''+tlid+'\',\''+acct_id+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 material-icons act-icon">expand_more</i></a></div>' +
'<div class="action '+noauth+'"><a onclick="details(\'' + toot.id + '\',' + acct_id +
',\''+tlid+'\')" class="waves-effect waves-dark btn-flat details" style="padding:0"><i class="text-darken-3 material-icons">more_vert</i></a></div>' +
'</div></div>' +

View File

@@ -100,7 +100,6 @@ function trendTag(){
function trendintervalset(){
setTimeout(trendTag, 6000000);
}
function tagTL(a,b,c,d){
var acct_id = $("#post-acct-sel").val();

View File

@@ -117,7 +117,8 @@ function tl(type, data, acct_id, tlid, delc, voice) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
console.log(json)
$("#landing_" + tlid).hide();
if(localStorage.getItem("filter_"+ acct_id)!="undefined"){
var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),type);
}else{
@@ -127,6 +128,7 @@ function tl(type, data, acct_id, tlid, delc, voice) {
var templete = misskeyParse(json, type, acct_id, tlid, "", mute);
}else{
var templete = parse(json, type, acct_id, tlid, "", mute);
localStorage.setItem("lastobj_"+ tlid,json[0].id)
}
$("#timeline_" + tlid).html(templete);
additional(acct_id, tlid);
@@ -211,6 +213,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) {
console.log(start);
var wsid = websocket.length;
localStorage.setItem("wss_" + tlid, wsid);
websocket[wsid] = new WebSocket(start);
websocket[wsid].onopen = function(mess) {
console.log(tlid + ":Connect Streaming API:" + type);
@@ -226,6 +229,10 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) {
if(voice){
say(obj.text)
}
websocketNotf[acct_id].send(JSON.stringify({
type: 'capture',
id: obj.id
}))
var templete = misskeyParse([obj], type, acct_id, tlid,"",mute);
var pool = localStorage.getItem("pool_" + tlid);
if (pool) {
@@ -306,7 +313,7 @@ function moreload(type, tlid) {
var data=obj[tlid].data;
}
var sid = $("#timeline_" + tlid + " .cvo").last().attr("unique-id");
if (localStorage.getItem("morelock") != sid) {
if (sid && localStorage.getItem("morelock") != sid) {
localStorage.setItem("morelock", sid);
if (type == "mix" && localStorage.getItem("domain_" + acct_id)!="misskey.xyz") {
mixmore(tlid,"integrated");
@@ -429,7 +436,7 @@ function tlCloser() {
}
});
websocketLocal = [];
websocketNotf = [];
}
//TLのタイトル
@@ -555,4 +562,110 @@ function icon(type) {
}else if (type == "mix") {
return "share"
}
}
}
function strAlive(){
var date = new Date() ;
var a = date.getTime() ;
var unix = Math.floor( a / 1000 ) ;
var col = localStorage.getItem("column");
if(col){
var obj = JSON.parse(col);
Object.keys(obj).forEach(function(key) {
var type=obj[key].type;
var lastunix=localStorage.getItem("lastunix_"+ key);
if(obj[key].type=="pub" || obj[key].type=="pub-media"){
//連合[連合数100超 or not]
if(localStorage.getItem("connects_" + obj[key].domain)>100){
var should=30;
}else{
var should=120;
}
}else if(obj[key].type=="local" || obj[key].type=="local-media"){
//連合[週間トゥ数10000超 or not]
if(localStorage.getItem("statuses_" + obj[key].domain)>10000){
var should=10;
}else if(localStorage.getItem("statuses_" + obj[key].domain)>1000){
var should=120;
}else{
var should=600;
}
}else{
if(type=="local" || type=="local-media" || type=="mix" || type=="plus"){
//ローカル[週間トゥ数10000超 or not]
if(localStorage.getItem("statuses_" + obj[key].domain)>10000){
var should=10;
}else if(localStorage.getItem("statuses_" + obj[key].domain)>1000){
var should=120;
}else{
var should=600;
}
}
if(type=="home" || type=="mix"){
//ホーム[フォロー数]
var flw=localStorage.getItem("follow_" + obj[key].domain)
if(flw>1000){
var should=10;
}else if(flw>500){
var should=20;
}else if(flw>100){
var should=30;
}else if(flw>50){
var should=45;
}else{
var should=60;
}
}
}
if (obj[key].data) {
var data = obj[key].data;
} else {
var data = "";
}
if(unix*1>lastunix*1+should*1 && should){
reconnector(tlid,type,obj[key].domain,data);
}
});
}
}
function strAliveInt(){
setTimeout(strAlive, 10000);
}
function reconnector(tlid,type,acct_id,data){
console.log("Reconnector")
if(type=="mix" || type=="plus"){
if(localStorage.getItem("voice_" + tlid)){
var voice=true;
}else{
var voice=false;
}
if(localStorage.getItem("filter_"+ acct_id)!="undefined"){
var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),type);
}else{
var mute=[];
}
var wssh=localStorage.getItem("wssH_" + tlid);
websocketHome[wssh].close();
var wssh=localStorage.getItem("wssL_" + tlid);
websocketLocal[wssl].close();
mixre(acct_id, tlid, type, mute,"",voice);
}else if(type=="notf"){
}else{
var wss=localStorage.getItem("wss_" + tlid);
websocket[wss].close();
if(localStorage.getItem("voice_" + tlid)){
var voice=true;
}else{
var voice=false;
}
if(localStorage.getItem("filter_"+ acct_id)!="undefined"){
var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),type);
}else{
var mute=[];
}
reload(type, '', acct_id, tlid, data, mute, "",voice);
}
Materialize.toast(lang_tl_reconnect[lang], 2000);
}
strAliveInt()