TheDesk Mio (ver.1 beta)
This commit is contained in:
@@ -172,3 +172,37 @@ function cardCheck(tlid) {
|
||||
$("#sta-card-" + tlid).css("color",'red');
|
||||
}
|
||||
}
|
||||
|
||||
function mov(id,tlid){
|
||||
if(tlid=="notf"){
|
||||
var tlide="[data-notf="+acct_id+"]";
|
||||
}else{
|
||||
var tlide="[tlid="+tlid+"]";
|
||||
}
|
||||
var mouseover=localStorage.getItem("mouseover");
|
||||
if(!mouseover){
|
||||
mouseover="";
|
||||
}else if(mouseover=="yes"){
|
||||
mouseover="hide";
|
||||
}else if(mouseover=="no"){
|
||||
mouseover="";
|
||||
}
|
||||
if(mouseover=="hide"){
|
||||
$(tlide+" [toot-id="+id+"] .area-actions").removeClass("hide")
|
||||
}
|
||||
}
|
||||
|
||||
function resetmv(){
|
||||
var mouseover=localStorage.getItem("mouseover");
|
||||
if(!mouseover){
|
||||
mouseover="";
|
||||
}else if(mouseover=="yes"){
|
||||
mouseover="hide";
|
||||
}else if(mouseover=="no"){
|
||||
mouseover="";
|
||||
}
|
||||
if(mouseover=="hide"){
|
||||
$(".area-actions").addClass("hide");
|
||||
}
|
||||
|
||||
}
|
@@ -37,10 +37,12 @@ function details(id, acct_id, tlid) {
|
||||
replyTL(json.in_reply_to_id, acct_id);
|
||||
}
|
||||
context(id, acct_id);
|
||||
beforeToot(id, acct_id);
|
||||
userToot(id, acct_id, json.account.id);
|
||||
faved(id, acct_id);
|
||||
rted(id, acct_id);
|
||||
if(!$("#activator").hasClass("active")){
|
||||
$('#det-col').collapsible('open', 2);
|
||||
$('#det-col').collapsible('open', 1);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -63,7 +65,7 @@ function replyTL(id, acct_id) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
var templete = parse([json]);
|
||||
var templete = parse([json], '', acct_id);
|
||||
$("#toot-reply").prepend(templete);
|
||||
jQuery("time.timeago").timeago();
|
||||
if (json.in_reply_to_id) {
|
||||
@@ -89,9 +91,9 @@ function context(id, acct_id) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
var templete = parse(json.descendants);
|
||||
var templete = parse(json.descendants, '', acct_id);
|
||||
$("#toot-after").html(templete);
|
||||
beforeToot(id, acct_id);
|
||||
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
}
|
||||
@@ -114,11 +116,33 @@ function beforeToot(id, acct_id) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
var templete = parse(json);
|
||||
var templete = parse(json, '', acct_id);
|
||||
$("#toot-before").html(templete);
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
}
|
||||
//前のユーザーのトゥート
|
||||
function userToot(id, acct_id, user) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses?max_id=" + id;
|
||||
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) {
|
||||
var templete = parse(json, '', acct_id);
|
||||
$("#user-before").html(templete);
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
}
|
||||
|
||||
//ふぁぼ一覧
|
||||
function faved(id, acct_id) {
|
||||
|
@@ -28,8 +28,8 @@ function notf(acct_id, tlid, sys) {
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var obj = json[key];
|
||||
if(lastnotf==obj.id && key>0 && native=="yes"){
|
||||
var ct=key+1;
|
||||
if(key==14){
|
||||
var ct=key;
|
||||
if(key>14){
|
||||
ct="15+";
|
||||
}
|
||||
var electron = require("electron");
|
||||
@@ -37,9 +37,9 @@ function notf(acct_id, tlid, sys) {
|
||||
ipc.send('native-notf', ['TheDesk:'+domain,ct+"件の新しい通知",localStorage.getItem("prof_"+acct_id)]);
|
||||
}
|
||||
if(obj.type!="follow"){
|
||||
templete = templete+parse([obj], 'notf', acct_id, tlid, -1);
|
||||
templete = templete+parse([obj], 'notf', acct_id, 'notf', -1);
|
||||
}else{
|
||||
templete = templete+userparse([obj.account], 'notf', acct_id, tlid, -1);
|
||||
templete = templete+userparse([obj.account], 'notf', acct_id, 'notf', -1);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -80,9 +80,9 @@ function notf(acct_id, tlid, sys) {
|
||||
var templete="";
|
||||
localStorage.setItem("lastnotf_" + acct_id,obj.id);
|
||||
if(obj.type!="follow"){
|
||||
templete = parse([obj], 'notf', acct_id, tlid, popup);
|
||||
templete = parse([obj], 'notf', acct_id, 'notf', popup);
|
||||
}else{
|
||||
templete = userparse([obj], 'notf', acct_id, tlid, popup);
|
||||
templete = userparse([obj], 'notf', acct_id, 'notf', popup);
|
||||
}
|
||||
if(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){
|
||||
$("div[data-notf=" + acct_id +"]").prepend(templete);
|
||||
|
@@ -1,6 +1,20 @@
|
||||
//オブジェクトパーサー(トゥート)
|
||||
function parse(obj, mix, acct_id, tlid, popup) {
|
||||
var templete = '';
|
||||
var actb = localStorage.getItem("action_btns");
|
||||
var actb='re,rt,fav,qt,del,pin';
|
||||
if(actb){
|
||||
var actb = actb.split(',');
|
||||
var disp={};
|
||||
for(var k=0;k<actb.length;k++){
|
||||
if(k<4){
|
||||
var tp="type-a";
|
||||
}else{
|
||||
var tp="type-b";
|
||||
}
|
||||
disp[actb[k]]=tp;
|
||||
}
|
||||
}
|
||||
var datetype = localStorage.getItem("datetype");
|
||||
var nsfwtype = localStorage.getItem("nsfw");
|
||||
var sent = localStorage.getItem("sentence");
|
||||
@@ -83,12 +97,26 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
if(!wordmute){
|
||||
var wordmute=[];
|
||||
}
|
||||
//via通知
|
||||
var viashow=localStorage.getItem("viashow");
|
||||
if(!viashow){
|
||||
viashow="hide";
|
||||
}
|
||||
//認証なしTL
|
||||
if(mix=="noauth"){
|
||||
var noauth="hide";
|
||||
}else{
|
||||
var noauth="";
|
||||
}
|
||||
//マウスオーバーのみ
|
||||
var mouseover=localStorage.getItem("mouseover");
|
||||
if(!mouseover){
|
||||
mouseover="";
|
||||
}else if(mouseover=="yes"){
|
||||
mouseover="hide";
|
||||
}else if(mouseover=="no"){
|
||||
mouseover="";
|
||||
}
|
||||
var local = [];
|
||||
var times=[];
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
@@ -327,25 +355,27 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
var visen = toot.visibility;
|
||||
if (visen == "public") {
|
||||
var vis =
|
||||
'<i class="text-darken-3 material-icons gray sml vis-data pointer" title="公開(クリックして本文コピー)" data-vis="public" onclick="staCopy(\''+id+'\')">public</i>';
|
||||
'<i class="text-darken-3 material-icons gray sml vis-data pointer" title="公開(クリックして本文コピー)" data-vis="public" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">public</i>';
|
||||
var can_rt = "";
|
||||
} else if (visen == "unlisted") {
|
||||
var vis =
|
||||
'<i class="text-darken-3 material-icons blue-text vis-data pointer" title="未収載(クリックして本文コピー)" data-vis="unlisted" onclick="staCopy(\''+id+'\')">lock_open</i>';
|
||||
'<i class="text-darken-3 material-icons blue-text vis-data pointer" title="未収載(クリックして本文コピー)" data-vis="unlisted" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">lock_open</i>';
|
||||
var can_rt = "";
|
||||
} else if (visen == "private") {
|
||||
var vis =
|
||||
'<i class="text-darken-3 material-icons orange-text vis-data pointer" title="非公開(クリックして本文コピー)" data-vis="private" onclick="staCopy(\''+id+'\')">lock</i>';
|
||||
'<i class="text-darken-3 material-icons orange-text vis-data pointer" title="非公開(クリックして本文コピー)" data-vis="private" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">lock</i>';
|
||||
var can_rt = "hide";
|
||||
} else if (visen == "direct") {
|
||||
var vis =
|
||||
'<i class="text-darken-3 material-icons red-text vis-data pointer" title="ダイレクト(クリックして本文コピー)" data-vis="direct" onclick="staCopy(\''+id+'\')">mail</i>';
|
||||
'<i class="text-darken-3 material-icons red-text vis-data pointer" title="ダイレクト(クリックして本文コピー)" data-vis="direct" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">mail</i>';
|
||||
var can_rt = "hide";
|
||||
}
|
||||
if (toot.account.acct == localStorage.getItem("user_" + acct_id)) {
|
||||
var if_mine = "";
|
||||
var mine_via="type-b";
|
||||
} else {
|
||||
var if_mine = "hide";
|
||||
var mine_via="";
|
||||
}
|
||||
if (toot.favourited) {
|
||||
var if_fav = " yellow-text";
|
||||
@@ -407,7 +437,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
|
||||
boostback + ' ' + fav_app + ' ' + rt_app + ' ' + pin_app +
|
||||
' ' + hasmedia + '" toot-id="' + id + '" unixtime="' + date(obj[
|
||||
key].created_at, 'unix') + '" '+if_notf+'>' +
|
||||
key].created_at, 'unix') + '" '+if_notf+' onmouseover="mov(\'' + toot.id + '\',\''+tlid+'\')" onmouseout="resetmv()">' +
|
||||
'<div class="area-notice"><span class="gray sharesta">' + notice + home +
|
||||
'</span></div>' +
|
||||
'<div class="area-icon"><a onclick="udg(\'' + toot.account.id +
|
||||
@@ -422,7 +452,8 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
'<div class="area-acct"><div><span class="cbadge pointer waves-effect" onclick="tootUriCopy(\'' +
|
||||
toot.url + '\');" title="' + date(toot.created_at, 'absolute') +
|
||||
'(クリックでトゥートURLをコピー)"><i class="fa fa-clock-o"></i>' +
|
||||
date(toot.created_at, datetype) + '</span></div></div>' +
|
||||
date(toot.created_at, datetype) + '</span><span style="padding:0;">' +
|
||||
vis + '</span></div></div>' +
|
||||
'<div class="area-toot"><span class="toot ' + spoiler + '">' + content +
|
||||
'</span><span class="' +
|
||||
api_spoil + ' cw_text_' + toot.id + '">' + spoil + spoiler_show +
|
||||
@@ -431,38 +462,38 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
'</div><div class="area-additional"><span class="additional">' + analyze +
|
||||
'</span>' +
|
||||
'' + mentions + tags + '</div>' +
|
||||
'<div class="area-actions '+noauth+'" style="padding:0; margin:0; top:-20px; display:flex; justify-content:space-around; max-width:100%; ">' +
|
||||
'<div class="action"><span style="padding:0">' +
|
||||
vis + '</span></div><div class="action"><a onclick="re(\'' + toot.id +
|
||||
'<div class="area-vis"></div>'+
|
||||
'<div class="area-actions '+noauth+' '+mouseover+'" style="padding:0; margin:0; top:-20px; display:flex; justify-content:space-around; max-width:100%; ">' +
|
||||
'<div class="action '+disp["re"]+'"><a onclick="re(\'' + toot.id +
|
||||
'\',\'' + toot.account.acct + '\',' +
|
||||
acct_id + ',\''+visen+
|
||||
'\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="このトゥートに返信"><i class="fa fa-share"></i></a></div>' +
|
||||
'<div class="action '+can_rt+'"><a onclick="rt(\'' + toot.id + '\',' + acct_id +
|
||||
'<div class="action '+can_rt+' '+disp["rt"]+'"><a onclick="rt(\'' + toot.id + '\',' + acct_id +
|
||||
',\'' + tlid +
|
||||
'\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="このトゥートをブースト"><i class="text-darken-3 fa fa-retweet ' +
|
||||
if_rt + ' rt_' + toot.id + '"></i><span class="rt_ct">' + toot.reblogs_count +
|
||||
'</span></a></div>' +
|
||||
'<div class="action '+can_rt+'"><a onclick="qt(\'' + toot.id + '\',' + acct_id +
|
||||
'<div class="action '+can_rt+' '+disp["qt"]+'"><a onclick="qt(\'' + toot.id + '\',' + acct_id +
|
||||
',\'' + toot.account.acct +'\',\''+toot.url+
|
||||
'\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="このトゥートを引用"><i class="text-darken-3 fa fa-quote-right"></i></a></div>' +
|
||||
'<div class="action"><a onclick="fav(\'' + toot.id + '\',' + acct_id +
|
||||
'<div class="action '+disp["fav"]+'"><a onclick="fav(\'' + toot.id + '\',' + acct_id +
|
||||
',\'' + tlid +
|
||||
'\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="このトゥートをお気に入り登録"><i class="fa text-darken-3 fa-star' +
|
||||
if_fav + ' fav_' + toot.id + '"></i><span class="fav_ct">' + toot.favourites_count +
|
||||
'</a></span></div>' +
|
||||
'<div class="' + if_mine + ' action"><a onclick="del(\'' + toot.id + '\',' +
|
||||
'<div class="' + if_mine + ' action '+disp["del"]+'"><a onclick="del(\'' + toot.id + '\',' +
|
||||
acct_id +
|
||||
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="このトゥートを削除"><i class="fa fa-trash-o"></i></a></div>' +
|
||||
'<div class="' + if_mine + ' action pin"><a onclick="pin(\'' + toot.id + '\',' +
|
||||
'<div class="' + if_mine + ' action pin '+disp["pin"]+'"><a onclick="pin(\'' + toot.id + '\',' +
|
||||
acct_id +
|
||||
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="このトゥートをピン留め"><i class="fa fa-map-pin pin_' + toot.id + ' '+if_pin+'"></i></a></div>' +trans+
|
||||
'<div class="action ' + if_mine + '"><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"><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 class="area-date_via">' +
|
||||
'<div><span class="cbadge waves-effect" onclick="client(\''+$.strip_tags(via)+'\')" title="via ' + $.strip_tags(via) + '">via ' +
|
||||
',\''+tlid+'\')" class="waves-effect waves-dark btn-flat details" style="padding:0"><i class="text-darken-3 material-icons">more_vert</i></a></div>' +
|
||||
'<span class="cbadge waves-effect '+viashow+' '+mine_via+'" onclick="client(\''+$.strip_tags(via)+'\')" title="via ' + $.strip_tags(via) + '">via ' +
|
||||
via +
|
||||
'</span></div></div></div>' +
|
||||
'</div>' + divider;
|
||||
'</span></div></div>' +
|
||||
'</div></div>' + divider;
|
||||
});
|
||||
if (mix == "mix") {
|
||||
return [templete, local, times]
|
||||
|
@@ -131,6 +131,9 @@ function reload(type, cc, acct_id, tlid, data) {
|
||||
} else if (type=="list"){
|
||||
var start = "wss://" + domain +
|
||||
"/api/v1/streaming/?stream=list&list=" + data +"&access_token=" + at;
|
||||
} else if (type=="dm"){
|
||||
var start = "wss://" + domain +
|
||||
"/api/v1/streaming/?stream=direct&access_token=" + at;
|
||||
}
|
||||
console.log(start);
|
||||
var wsid = websocket.length;
|
||||
@@ -321,6 +324,8 @@ function cap(type, data, acct_id) {
|
||||
}
|
||||
} else if (type == "noauth") {
|
||||
var response= "Glance TL"
|
||||
} else if (type == "dm") {
|
||||
var response= "DM"
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@@ -335,9 +340,10 @@ function com(type, data) {
|
||||
return "public?"
|
||||
} else if (type == "tag") {
|
||||
return "tag/" + data + "?"
|
||||
}
|
||||
if (type == "list") {
|
||||
}else if (type == "list") {
|
||||
return "list/" + data + "?"
|
||||
}else if (type="dm") {
|
||||
return "direct?"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,8 +359,9 @@ function icon(type) {
|
||||
return "search"
|
||||
} else if (type == "list") {
|
||||
return "view_headline"
|
||||
}
|
||||
if (type == "list") {
|
||||
}else if (type == "list") {
|
||||
return "subject"
|
||||
}else if (type == "dm") {
|
||||
return "mail"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user