TheDesk Akane (16.0.0)

This commit is contained in:
cutls 2018-07-30 20:03:49 +09:00
parent 96995066ac
commit dd81771ccf
29 changed files with 2070 additions and 857 deletions

View File

@ -1,80 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>Account Manager - TheDesk</title>
<meta content="width=device-width,initial-scale=1.0" name="viewport">
<link href="./css/materialize.css" type="text/css" rel="stylesheet">
<link href="./css/themes.css" type="text/css" rel="stylesheet">
<link href="./css/master.css" type="text/css" rel="stylesheet">
<link href='./css/font-awesome.css' rel='stylesheet' type='text/css'>
<link href='./css/tl.css' rel='stylesheet' type='text/css'>
<link href='./css/userdata.css' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Open+Sans:300" rel="stylesheet">
<style>.acct{display:flex; justify-content:space-around;}
.card{width:400px; background-color: #9e9e9e; margin:10px; }
body,html{overflow-y: scroll;}
#acct-list{display:flex; flex-wrap:wrap; color:white; align-items: flex-start}
.lts{font-size:150%}
.colorsel{ display:flex; }
.card .colorsel div:not(.exc){width:20px;height:20px;}
.card .colorsel div.exc{width:40px;height:20px;}
</style>
<meta charset="utf-8">
</head>
<body id="mainView">
<script type="text/javascript" src="./js/common/jquery.js"></script>
<script type="text/javascript" src="./js/platform/first.js"></script>
<script type="text/javascript" src="./js/common/materialize.js"></script>
<script type="text/javascript" src="./js/lang/lang.js"></script>
<script>
var lang="en";
</script>
<script type="text/javascript" src="./js/ui/tips.js"></script>
<script type="text/javascript" src="./js/common/time.js"></script>
<script type="text/javascript" src="./js/common/modal.js"></script>
<a href="index.html" class="btn waves-effect orange nex" style="width:100%; max-width:200px;">Back</a><br>
<h5>List of accounts</h5>
<div id="acct-list"></div>
<div class="divider"></div>
<h5>Add an account</h5><br>
<div id="add">
<div class="row">
<div class="col s6">
<input type="text" id="url" style="width:70%" placeholder="ex)mstdn.jp">
<div id="ins-suggest"></div>
Check if TheDesk is not working on Windows, you want to login Pleroma instance.<br>
<input type="checkbox" class="filled-in" id="linux" />
<label for="linux">Code setup</label><br>
<button class="btn waves-effect" onclick="instance()">Login</button><br>
</div>
<div class="col s6">
<span style="font-family:Open Sans;">Supports</span>
<div id="support" class="collection transparent"></div>
</div>
</div>
<h5>Main an account</h5>
<div class="input-field" style="width:300px"><span data-trans="your_acct">Select an account</span>
<br>
<select id="main-acct-sel" class="acct-sel" style="color:black" onchange="mainacct()"></select>
<label></label>
</div>
</div>
<div id="auth" style="display:none">
Paste the code and close browser.<br>
<input type="text" id="code" placeholder="Code">
<button class="btn waves-effect" onclick="code()">Auth</button><br>
</div>
Instance data by <a href="https://instances.social" target="_blank">instances.social API</a><br>
<img src="./img/loading.svg" id="ins-prof" width="200"><br>
@<span id="ins-upd"></span><br>
Domain:<span id="ins-name"></span><br>
Federated instances:<span id="ins-connect"></span><br>
Toots:<span id="ins-toot"></span><br>
Users:<span id="ins-user"></span>Users<br>
Connection:<span id="ins-per"></span>%<br>
Mastodon version:<span id="ins-ver"></span><br>
<script type="text/javascript" src="./js/ui/theme.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script>
<script type="text/javascript" src="./js/login/instance.js"></script>
<script type="text/javascript" src="./js/login/manager.js"></script>
<script type="text/javascript" src="./js/tl/date.js"></script>

View File

@ -75,6 +75,7 @@ Instance data by <a href="https://instances.social" target="_blank">instances.so
{{ver}}:<span id="ins-ver"></span><br>
<script type="text/javascript" src="./js/ui/theme.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script>
<script type="text/javascript" src="./js/common/sha256.js"></script>
<script type="text/javascript" src="./js/login/instance.js"></script>
<script type="text/javascript" src="./js/login/manager.js"></script>
<script type="text/javascript" src="./js/tl/date.js"></script>

View File

@ -26,7 +26,7 @@
<script type="text/javascript" src="./js/common/modal.js"></script>
<script type="text/javascript" src="./js/ui/jquery-ui.min.js"></script>
<script>
var ver="Akane (16.0.0) beta";
var ver="Akane (16.0.0)";
//betaを入れるとバージョンチェックしない
//GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html)
//var ver="beta";
@ -629,7 +629,7 @@ var lang="{{lang}}";
<br><br>
<div id="lists"></div>
<div id="lists-user"></div>
<input type="text" style="width:150px" id="list-add" placeholder="タイトル">
<input type="text" style="width:150px" id="list-add" placeholder="{{name}}">
<button class="btn waves-effect" style="width:120px;" onclick="makeNewList()">{{makeNew}}</button>
</div>
<!--フィルター-->
@ -759,6 +759,7 @@ var lang="{{lang}}";
<script src="https://twemoji.maxcdn.com/2/twemoji.min.js?2.7"></script>
<script type="text/javascript" src="./js/common/about.js"></script>
<script type="text/javascript" src="./js/tl/parse.js"></script>
<script type="text/javascript" src="./js/tl/misskeyparse.js"></script>
<script type="text/javascript" src="./js/ui/scroll.js"></script>
<script type="text/javascript" src="./js/tl/tl.js"></script>
<script type="text/javascript" src="./js/tl/card.js"></script>
@ -785,6 +786,7 @@ var lang="{{lang}}";
<script type="text/javascript" src="./js/post/secure.js"></script>
<script type="text/javascript" src="./js/post/img.js"></script>
<script type="text/javascript" src="./js/post/status.js"></script>
<script type="text/javascript" src="./js/post/misskeystatus.js"></script>
<script type="text/javascript" src="./js/post/emoji.js"></script>
<script type="text/javascript" src="./js/post/suggest.js"></script>
<script type="text/javascript" src="./js/post/bb-md.js"></script>

33
app/js/common/sha256.js Normal file
View File

@ -0,0 +1,33 @@
/*
A JavaScript implementation of the SHA family of hashes, as
defined in FIPS PUB 180-4 and FIPS PUB 202, as well as the corresponding
HMAC implementation as defined in FIPS PUB 198a
Copyright 2008-2018 Brian Turek, 1998-2009 Paul Johnston & Contributors
Distributed under the BSD License
See http://caligatio.github.com/jsSHA/ for more information
*/
'use strict';(function(I){function w(c,a,d){var l=0,b=[],g=0,f,n,k,e,h,q,y,p,m=!1,t=[],r=[],u,z=!1;d=d||{};f=d.encoding||"UTF8";u=d.numRounds||1;if(u!==parseInt(u,10)||1>u)throw Error("numRounds must a integer >= 1");if(0===c.lastIndexOf("SHA-",0))if(q=function(b,a){return A(b,a,c)},y=function(b,a,l,f){var g,e;if("SHA-224"===c||"SHA-256"===c)g=(a+65>>>9<<4)+15,e=16;else throw Error("Unexpected error in SHA-2 implementation");for(;b.length<=g;)b.push(0);b[a>>>5]|=128<<24-a%32;a=a+l;b[g]=a&4294967295;
b[g-1]=a/4294967296|0;l=b.length;for(a=0;a<l;a+=e)f=A(b.slice(a,a+e),f,c);if("SHA-224"===c)b=[f[0],f[1],f[2],f[3],f[4],f[5],f[6]];else if("SHA-256"===c)b=f;else throw Error("Unexpected error in SHA-2 implementation");return b},p=function(b){return b.slice()},"SHA-224"===c)h=512,e=224;else if("SHA-256"===c)h=512,e=256;else throw Error("Chosen SHA variant is not supported");else throw Error("Chosen SHA variant is not supported");k=B(a,f);n=x(c);this.setHMACKey=function(b,a,g){var e;if(!0===m)throw Error("HMAC key already set");
if(!0===z)throw Error("Cannot set HMAC key after calling update");f=(g||{}).encoding||"UTF8";a=B(a,f)(b);b=a.binLen;a=a.value;e=h>>>3;g=e/4-1;if(e<b/8){for(a=y(a,b,0,x(c));a.length<=g;)a.push(0);a[g]&=4294967040}else if(e>b/8){for(;a.length<=g;)a.push(0);a[g]&=4294967040}for(b=0;b<=g;b+=1)t[b]=a[b]^909522486,r[b]=a[b]^1549556828;n=q(t,n);l=h;m=!0};this.update=function(a){var c,f,e,d=0,p=h>>>5;c=k(a,b,g);a=c.binLen;f=c.value;c=a>>>5;for(e=0;e<c;e+=p)d+h<=a&&(n=q(f.slice(e,e+p),n),d+=h);l+=d;b=f.slice(d>>>
5);g=a%h;z=!0};this.getHash=function(a,f){var d,h,k,q;if(!0===m)throw Error("Cannot call getHash after setting HMAC key");k=C(f);switch(a){case "HEX":d=function(a){return D(a,e,k)};break;case "B64":d=function(a){return E(a,e,k)};break;case "BYTES":d=function(a){return F(a,e)};break;case "ARRAYBUFFER":try{h=new ArrayBuffer(0)}catch(v){throw Error("ARRAYBUFFER not supported by this environment");}d=function(a){return G(a,e)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER");
}q=y(b.slice(),g,l,p(n));for(h=1;h<u;h+=1)q=y(q,e,0,x(c));return d(q)};this.getHMAC=function(a,f){var d,k,t,u;if(!1===m)throw Error("Cannot call getHMAC without first setting HMAC key");t=C(f);switch(a){case "HEX":d=function(a){return D(a,e,t)};break;case "B64":d=function(a){return E(a,e,t)};break;case "BYTES":d=function(a){return F(a,e)};break;case "ARRAYBUFFER":try{d=new ArrayBuffer(0)}catch(v){throw Error("ARRAYBUFFER not supported by this environment");}d=function(a){return G(a,e)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER");
}k=y(b.slice(),g,l,p(n));u=q(r,x(c));u=y(k,e,h,u);return d(u)}}function m(){}function D(c,a,d){var l="";a/=8;var b,g;for(b=0;b<a;b+=1)g=c[b>>>2]>>>8*(3+b%4*-1),l+="0123456789abcdef".charAt(g>>>4&15)+"0123456789abcdef".charAt(g&15);return d.outputUpper?l.toUpperCase():l}function E(c,a,d){var l="",b=a/8,g,f,n;for(g=0;g<b;g+=3)for(f=g+1<b?c[g+1>>>2]:0,n=g+2<b?c[g+2>>>2]:0,n=(c[g>>>2]>>>8*(3+g%4*-1)&255)<<16|(f>>>8*(3+(g+1)%4*-1)&255)<<8|n>>>8*(3+(g+2)%4*-1)&255,f=0;4>f;f+=1)8*g+6*f<=a?l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(n>>>
6*(3-f)&63):l+=d.b64Pad;return l}function F(c,a){var d="",l=a/8,b,g;for(b=0;b<l;b+=1)g=c[b>>>2]>>>8*(3+b%4*-1)&255,d+=String.fromCharCode(g);return d}function G(c,a){var d=a/8,l,b=new ArrayBuffer(d),g;g=new Uint8Array(b);for(l=0;l<d;l+=1)g[l]=c[l>>>2]>>>8*(3+l%4*-1)&255;return b}function C(c){var a={outputUpper:!1,b64Pad:"=",shakeLen:-1};c=c||{};a.outputUpper=c.outputUpper||!1;!0===c.hasOwnProperty("b64Pad")&&(a.b64Pad=c.b64Pad);if("boolean"!==typeof a.outputUpper)throw Error("Invalid outputUpper formatting option");
if("string"!==typeof a.b64Pad)throw Error("Invalid b64Pad formatting option");return a}function B(c,a){var d;switch(a){case "UTF8":case "UTF16BE":case "UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE");}switch(c){case "HEX":d=function(a,b,c){var f=a.length,d,k,e,h,q;if(0!==f%2)throw Error("String of HEX type must be in byte increments");b=b||[0];c=c||0;q=c>>>3;for(d=0;d<f;d+=2){k=parseInt(a.substr(d,2),16);if(isNaN(k))throw Error("String of HEX type contains invalid characters");
h=(d>>>1)+q;for(e=h>>>2;b.length<=e;)b.push(0);b[e]|=k<<8*(3+h%4*-1)}return{value:b,binLen:4*f+c}};break;case "TEXT":d=function(c,b,d){var f,n,k=0,e,h,q,m,p,r;b=b||[0];d=d||0;q=d>>>3;if("UTF8"===a)for(r=3,e=0;e<c.length;e+=1)for(f=c.charCodeAt(e),n=[],128>f?n.push(f):2048>f?(n.push(192|f>>>6),n.push(128|f&63)):55296>f||57344<=f?n.push(224|f>>>12,128|f>>>6&63,128|f&63):(e+=1,f=65536+((f&1023)<<10|c.charCodeAt(e)&1023),n.push(240|f>>>18,128|f>>>12&63,128|f>>>6&63,128|f&63)),h=0;h<n.length;h+=1){p=k+
q;for(m=p>>>2;b.length<=m;)b.push(0);b[m]|=n[h]<<8*(r+p%4*-1);k+=1}else if("UTF16BE"===a||"UTF16LE"===a)for(r=2,n="UTF16LE"===a&&!0||"UTF16LE"!==a&&!1,e=0;e<c.length;e+=1){f=c.charCodeAt(e);!0===n&&(h=f&255,f=h<<8|f>>>8);p=k+q;for(m=p>>>2;b.length<=m;)b.push(0);b[m]|=f<<8*(r+p%4*-1);k+=2}return{value:b,binLen:8*k+d}};break;case "B64":d=function(a,b,c){var f=0,d,k,e,h,q,m,p;if(-1===a.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");k=a.indexOf("=");a=a.replace(/\=/g,
"");if(-1!==k&&k<a.length)throw Error("Invalid '=' found in base-64 string");b=b||[0];c=c||0;m=c>>>3;for(k=0;k<a.length;k+=4){q=a.substr(k,4);for(e=h=0;e<q.length;e+=1)d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(q[e]),h|=d<<18-6*e;for(e=0;e<q.length-1;e+=1){p=f+m;for(d=p>>>2;b.length<=d;)b.push(0);b[d]|=(h>>>16-8*e&255)<<8*(3+p%4*-1);f+=1}}return{value:b,binLen:8*f+c}};break;case "BYTES":d=function(a,b,c){var d,n,k,e,h;b=b||[0];c=c||0;k=c>>>3;for(n=0;n<a.length;n+=
1)d=a.charCodeAt(n),h=n+k,e=h>>>2,b.length<=e&&b.push(0),b[e]|=d<<8*(3+h%4*-1);return{value:b,binLen:8*a.length+c}};break;case "ARRAYBUFFER":try{d=new ArrayBuffer(0)}catch(l){throw Error("ARRAYBUFFER not supported by this environment");}d=function(a,b,c){var d,n,k,e,h;b=b||[0];c=c||0;n=c>>>3;h=new Uint8Array(a);for(d=0;d<a.byteLength;d+=1)e=d+n,k=e>>>2,b.length<=k&&b.push(0),b[k]|=h[d]<<8*(3+e%4*-1);return{value:b,binLen:8*a.byteLength+c}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER");
}return d}function r(c,a){return c>>>a|c<<32-a}function J(c,a,d){return c&a^~c&d}function K(c,a,d){return c&a^c&d^a&d}function L(c){return r(c,2)^r(c,13)^r(c,22)}function M(c){return r(c,6)^r(c,11)^r(c,25)}function N(c){return r(c,7)^r(c,18)^c>>>3}function O(c){return r(c,17)^r(c,19)^c>>>10}function P(c,a){var d=(c&65535)+(a&65535);return((c>>>16)+(a>>>16)+(d>>>16)&65535)<<16|d&65535}function Q(c,a,d,l){var b=(c&65535)+(a&65535)+(d&65535)+(l&65535);return((c>>>16)+(a>>>16)+(d>>>16)+(l>>>16)+(b>>>
16)&65535)<<16|b&65535}function R(c,a,d,l,b){var g=(c&65535)+(a&65535)+(d&65535)+(l&65535)+(b&65535);return((c>>>16)+(a>>>16)+(d>>>16)+(l>>>16)+(b>>>16)+(g>>>16)&65535)<<16|g&65535}function x(c){var a=[],d;if(0===c.lastIndexOf("SHA-",0))switch(a=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],d=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],c){case "SHA-224":break;case "SHA-256":a=d;break;case "SHA-384":a=[new m,new m,
new m,new m,new m,new m,new m,new m];break;case "SHA-512":a=[new m,new m,new m,new m,new m,new m,new m,new m];break;default:throw Error("Unknown SHA variant");}else throw Error("No SHA variants supported");return a}function A(c,a,d){var l,b,g,f,n,k,e,h,m,r,p,w,t,x,u,z,A,B,C,D,E,F,v=[],G;if("SHA-224"===d||"SHA-256"===d)r=64,w=1,F=Number,t=P,x=Q,u=R,z=N,A=O,B=L,C=M,E=K,D=J,G=H;else throw Error("Unexpected error in SHA-2 implementation");d=a[0];l=a[1];b=a[2];g=a[3];f=a[4];n=a[5];k=a[6];e=a[7];for(p=
0;p<r;p+=1)16>p?(m=p*w,h=c.length<=m?0:c[m],m=c.length<=m+1?0:c[m+1],v[p]=new F(h,m)):v[p]=x(A(v[p-2]),v[p-7],z(v[p-15]),v[p-16]),h=u(e,C(f),D(f,n,k),G[p],v[p]),m=t(B(d),E(d,l,b)),e=k,k=n,n=f,f=t(g,h),g=b,b=l,l=d,d=t(h,m);a[0]=t(d,a[0]);a[1]=t(l,a[1]);a[2]=t(b,a[2]);a[3]=t(g,a[3]);a[4]=t(f,a[4]);a[5]=t(n,a[5]);a[6]=t(k,a[6]);a[7]=t(e,a[7]);return a}var H;H=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,
2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,
2756734187,3204031479,3329325298];"function"===typeof define&&define.amd?define(function(){return w}):"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(module.exports=w),exports=w):I.jsSHA=w})(this);
function sha256(token){
var shaObj = new jsSHA("SHA-256", "TEXT");
shaObj.update(token);
var hash = shaObj.getHash("HEX");
return hash;
}

View File

@ -112,6 +112,11 @@ var lang_manager_none={
"ja":"なし",
"en":"None"
}
//post/bb-md.js
var lang_bbmd_misskey={
"ja":"TheDeskにおけるMisskeyでは、@を返信として扱いますが、全ての@は消去され別パラメータに入力されます。また、「未収載」を「ホーム」として扱います。",
"en":"TheDesk regards \"@\" as reply, but put other parameter. Unlisted on Mastodon means Home on Misskey."
}
//post/emoji.js
var lang_emoji_get={
"ja":"絵文字リストを取得",
@ -365,6 +370,10 @@ var lang_hisdata_taketime={
"ja":"30秒から数分かかります",
"en":"It will take 30s ~ several minutes"
}
var lang_hisdata_notonmisskey={
"ja":"このシステムはMisskeyにはありません。",
"en":"Misskey is unable to request."
}
//userdata/showOnTL.js
var lang_showontl_movetxt={
"ja":"このアカウントは移行しています",

View File

@ -137,4 +137,45 @@ var lang_parse_clientmute={
var lang_parse_mute={
"ja":"ミュートします。設定から解除できます。",
"en":" will be muted. You can remove on preferences."
}
//misskey
var lang_misskeyparse_renote={
"ja":"再投稿",
"en":"Repost"
}
var lang_misskeyparse_renoteqt={
"ja":"引用",
"en":"Renote"
}
var lang_misskeyparse_reaction={
"ja":"リアクション",
"en":"Reaction"
}
var lang_misskeyparse_tagnostr={
"ja":"タグTLはストリーミング非対応です。",
"en":"No streaming API on Tag TLs"
}
var lang_misskeyparse_listnostr={
"ja":"リストTLはストリーミング非対応です。",
"en":"No streaming API on List TLs"
}
var lang_misskeyparse_home={
"ja":"ホーム",
"en":"Home"
}
var lang_misskeyparse_qt={
"ja":"MisskeyのRenote(引用モード)中:Ctrl+Shift+Cでクリア",
"en":"Misskey renote(quote) mode:Ctrl+Shift+Enter to clear"
}
var lang_misskeyparse_renoted={
"ja":"がRepost",
"en":" renoted your following post."
}
var lang_misskeyparse_quoted={
"ja":"が引用",
"en":" quoted your following post."
}
var lang_misskeyparse_reaction={
"ja":"がリアクション",
"en":" reacted your following post."
}

View File

@ -72,7 +72,12 @@ var idata={
"dtp-mstdn.jp_name":"DTP鯖",
"dtp-mstdn.jp_letters":"500",
"dtp-mstdn.jp_bbcode":"disabled",
"dtp-mstdn.jp_markdown":"disabled"
"dtp-mstdn.jp_markdown":"disabled",
"misskey.xyz":"instance",
"misskey.xyz_name":"Misskey",
"misskey.xyz_letters":"1000",
"misskey.xyz_bbcode":"disabled",
"misskey.xyz_markdown":"enabled"
};
localStorage.setItem("instance", JSON.stringify(idata));

View File

@ -314,30 +314,13 @@ function misskeyLogin() {
const {
shell
} = require('electron');
var token=json.token;
$("#auth").show();
$("#code").val(token);
$("#add").hide();
localStorage.setItem("domain_tmp","misskey.xyz");
shell.openExternal(json.url);
var electron = require("electron");
/*
var auth = "https://" + url + "/oauth/authorize?client_id=" + json[
"client_id"] + "&client_secret=" + json["client_secret"] +
"&response_type=code&scope=read+write+follow&redirect_uri=" + red;
localStorage.setItem("domain_tmp", url);
localStorage.setItem("client_id", json["client_id"]);
localStorage.setItem("client_secret", json["client_secret"]);
$("#auth").show();
$("#add").hide();
const {
shell
} = require('electron');
shell.openExternal(auth);
var electron = require("electron");
var ipc = electron.ipcRenderer;
if ($('#linux:checked').val() == "on") {} else {
ipc.send('quit', 'go');
}
*/
}
}
@ -358,6 +341,51 @@ function code(code) {
}
var url = localStorage.getItem("domain_tmp");
localStorage.removeItem("domain_tmp");
console.log(url);
if(url=="misskey.xyz"){
var start = "https://misskey.xyz/api/auth/session/userkey";
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
httpreq.send(JSON.stringify({
token:code,
appSecret:localStorage.getItem("mkc")
}));
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
var json = httpreq.response;
var i = sha256(json.accessToken + localStorage.getItem("mkc"));
console.log(json);
var avatar=json["user"]["avatarUrl"];
var priv="public";
var add = {
at: i,
name: json["user"]["name"],
domain: "misskey.xyz",
user: json["user"]["username"],
prof: avatar,
id: json["user"]["id"],
vis: priv
};
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
var target = obj.lengtth;
obj.push(add);
localStorage.setItem("name_" + target, json["user"]["name"]);
localStorage.setItem("user_" + target, json["user"]["username"]);
localStorage.setItem("user-id_" + target, json["user"]["id"]);
localStorage.setItem("prof_" + target, avatar);
console.log(obj);
var json = JSON.stringify(obj);
localStorage.setItem("multi", json);
load();
return;
}
}
return;
}
var start = "https://" + url + "/oauth/token";
var id = localStorage.getItem("client_id");
var secret = localStorage.getItem("client_secret");
@ -445,6 +473,10 @@ function getdata(domain, at) {
function refresh(target) {
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
if(obj[target].domain=="misskey.xyz"){
misskeyRefresh(obj,target);
return
}
var start = "https://" + obj[target].domain +
"/api/v1/accounts/verify_credentials";
console.log(start);
@ -494,6 +526,48 @@ function refresh(target) {
load();
});
}
function misskeyRefresh(obj,target){
var start = "https://misskey.xyz/api/users/show";
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
httpreq.send(JSON.stringify({
username:obj[target].user,
i:localStorage.getItem("at")
}));
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
var json = httpreq.response;
console.log(json);
return;
var avatar=json["user"]["avatarURL"];
var priv="public";
var add = {
at: json.accessToken,
name: json["user"]["name"],
domain: "misskey.xyz",
user: json["user"]["username"],
prof: avatar,
id: json["user"]["id"],
vis: priv
};
var multi = localStorage.getItem("multi");
var obj = JSON.parse(multi);
var target = obj.lengtth;
obj.push(add);
localStorage.setItem("name_" + target, json["user"]["name"]);
localStorage.setItem("user_" + target, json["user"]["username"]);
localStorage.setItem("user-id_" + target, json["user"]["id"]);
localStorage.setItem("prof_" + target, avatar);
console.log(obj);
var json = JSON.stringify(obj);
localStorage.setItem("multi", json);
load();
return;
}
}
}
//アカウントを選択…を実装
function multisel() {
var multi = localStorage.getItem("multi");

View File

@ -118,6 +118,9 @@
return ret;
};
$.strip_tags = function(str, allowed) {
if(!str){
return "";
}
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || [])
.join('');
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,

View File

@ -32,6 +32,9 @@ function mdCheck(){
}else{
$("#trendtag").html("");
}
if(domain=="misskey.xyz"){
Materialize.toast(lang_bbmd_misskey[lang], 5000);
}
if(idata[domain+"_letters"]){
$("#textarea").attr("data-length", idata[domain+"_letters"])
}else{
@ -104,8 +107,11 @@ if(localStorage.getItem("md")=="hide"){
}
//PHPのnl2brと同様
function nl2br(str) {
if(!str){
return "";
}
str = str.replace(/\r\n/g, "<br />");
str = str.replace(/(\n|\r)/g, "<br />");
str = str.replace(/(\n|\r)/g, "<br />");
return str;
}
//テキストボックスで選択したやつをタグで囲む(BB版)

View File

@ -101,20 +101,37 @@ function media(b64, type, no) {
var acct_id = $("#post-acct-sel").val();
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/media";
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.upload.addEventListener("progress", progshow, false);
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
httpreq.responseType = 'json';
httpreq.send(fd);
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/drive/files/create";
httpreq.open('POST', start, true);
httpreq.upload.addEventListener("progress", progshow, false);
httpreq.responseType = 'json';
if ($("#nsfw").hasClass("nsfw-avail")) {
var nsfw = true;
} else {
var nsfw = false;
}
var previewer="url"
fd.append('i', at);
//fd.append('isSensitive', nsfw);
httpreq.send(fd);
}else{
var previewer="preview_url"
var start = "https://" + domain + "/api/v1/media";
httpreq.open('POST', start, true);
httpreq.upload.addEventListener("progress", progshow, false);
httpreq.responseType = 'json';
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
httpreq.send(fd);
}
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
var json = httpreq.response;
console.log(json);
var img = localStorage.getItem("img");
if (json.type=="image") {
var html = '<img src="' + json.preview_url + '" style="width:50px; max-height:100px;">';
if (json.type.indexOf("image")!=-1) {
var html = '<img src="' + json[previewer] + '" style="width:50px; max-height:100px;">';
$('#preview').append(html);
} else {
$('#preview').append(lang_postimg_previewdis[lang]);

View File

@ -0,0 +1,120 @@
//Renpost
function renote(id, acct_id, remote) {
if ($("#pub_" + id).hasClass("rted")) {
return
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/notes/create";
if(domain!="misskey.xyz"){
return false;
}
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
httpreq.send(JSON.stringify({i:at,renoteId:id}));
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
var json = httpreq.response;
console.log(json);
$("[toot-id=" + id + "]").addClass("rted");
$(".rt_"+id).toggleClass("teal-text");
}
}
}
//Renote
function renoteqt(id, acct_id) {
localStorage.setItem("nohide",true);
show();
$("#reply").val("renote_"+id);
$("#rec").text("Renote");
$("#post-acct-sel").val(acct_id);
$("#post-acct-sel").prop("disabled", true);
$('select').material_select();
$("#textarea").attr("placeholder",lang_misskeyparse_qt[lang]);
$("#textarea").focus();
}
//Reply
function misskeyreply(id, acct_id) {
localStorage.setItem("nohide",true);
show();
$("#reply").val(id);
$("#rec").text("Renote");
$("#post-acct-sel").val(acct_id);
$("#post-acct-sel").prop("disabled", true);
$('select').material_select();
$("#textarea").attr("placeholder",lang_misskeyparse_qt[lang]);
$("#textarea").focus();
}
//Reaction
function reactiontoggle(id,acct_id,tlid){
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/notes/show";
if(domain!="misskey.xyz"){
return false;
}
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
httpreq.send(JSON.stringify({i:at,noteId:id}));
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
var json = httpreq.response;
console.log(json);
if(json.reactionCounts){
var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding"];
for(var i=0;i<reactions.length;i++){
if(json.reactionCounts[reactions[i]]){
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(json.reactionCounts[reactions[i]])
$("#pub_" + id +" .re-"+reactions[i]).removeClass("hide")
}else{
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(0)
if($("#pub_" + id +" .reactions").hasClass("fullreact")){
$("#pub_" + id +" .re-"+reactions[i]).addClass("hide")
}else{
$("#pub_" + id +" .re-"+reactions[i]).removeClass("hide")
}
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(json.reactionCounts[reactions[i]])
}
}
$("#pub_" + id +" .reactions").removeClass("hide");
$("#pub_" + id +" .reactions").toggleClass("fullreact")
}else{
if($("#pub_" + id +" .reactions").hasClass("fullreact")){
$("#pub_" + id +" .reactions").addClass("hide")
$("#pub_" + id +" .reactions").removeClass("fullreact")
}else{
$("#pub_" + id +" .reactions").removeClass("hide");
$("#pub_" + id +" .reaction").removeClass("hide");
$("#pub_" + id +" .reactions").addClass("fullreact");
}
}
}
}
}
function reaction(mode,id,acct_id,tlid){
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if($(".fav_"+id).hasClass("yellow-text")){
var flag="delete";
}else{
var flag="create";
}
var start = "https://" + domain + "/api/notes/reactions/"+flag;
if(domain!="misskey.xyz"){
return false;
}
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
httpreq.send(JSON.stringify({i:at,noteId:id,reaction:mode}));
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
$(".fav_"+id).toggleClass("yellow-text");
}
}
}

View File

@ -26,6 +26,10 @@ function post() {
}
}
}
if(domain=="misskey.xyz"){
misskeyPost();
return;
}
$("#toot-post-btn").prop("disabled", true);
todo("Posting");
var at = localStorage.getItem("acct_"+ acct_id + "_at");
@ -84,6 +88,80 @@ function post() {
}
}
}
function misskeyPost(){
var str = $("#textarea").val();
var acct_id = $("#post-acct-sel").val();
localStorage.setItem("last-use", acct_id);
var domain = "misskey.xyz"
$("#toot-post-btn").prop("disabled", true);
todo("Posting");
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/notes/create";
var reply = $("#reply").val();
var toot={
text: str
}
if(reply){
if(reply.indexOf("renote")!== -1){
toot.renoteId=reply.replace("renote_","")
}else{
toot.replyId=reply
}
}
var media = $("#media").val();
if(media){
toot.mediaIds=media.split(",");
}
if ($("#nsfw").hasClass("nsfw-avail")) {
var nsfw = "true";
toot.sensitive=nsfw;
} else {
var nsfw = "false";
}
var vis = $("#vis").text();
if(vis=="unlisted"){
vis=="home"
}else if(vis=="direct"){
vis=="specified";
toot.visibleUserIds=str.match(/@([a-zA-Z0-9_@.-]+)(\s|$)/g).join('').split("@");
}
if(vis!="inherit"){
toot.visibility=vis;
}
if ($("#cw").hasClass("cw-avail")) {
var spo = $("#cw-text").val();
cw();
toot.cw=spo;
} else {
var spo = "";
}
toot.i=at;
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
httpreq.send(JSON.stringify(toot));
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
if(str.indexOf(localStorage.getItem("stable"))==-1){
localStorage.removeItem("stable")
}
var json = httpreq.response;
console.log(json);
var box = localStorage.getItem("box");
if (box == "yes") {
hide();
}else if (box == "hide"){
$("body").addClass("mini-post");
$(".mini-btn").text("expand_less");
}
$("#toot-post-btn").prop("disabled", false);
todc();
clear();
}
}
}
//クリア(Shift+C)
function clear() {
@ -113,9 +191,9 @@ function clear() {
$("#preview").html("");
$("#toot-post-btn").prop("disabled", false);
$("#post-acct-sel").prop("disabled", false);
$('select').material_select();
localStorage.removeItem("image");
if(localStorage.getItem("mainuse")=="main"){
multi();
$("#post-acct-sel").val(localStorage.getItem("main"));
}
$('select').material_select();
}

View File

@ -105,8 +105,10 @@ function follow(acct_id,remote) {
}
if (!remote && $("#his-data").hasClass("following")) {
var flag = "unfollow";
var flagm = "delete";
} else {
var flag = "follow";
var flagm = "create";
}
var id = $("#his-data").attr("user-id");
if(!remote){
@ -114,7 +116,11 @@ function follow(acct_id,remote) {
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if(remote=="true" && flag=="follow"){
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/following/"+flagm;
var user=$("#his-acct").text();
var ent={"i":at,"userId":id}
}else if(remote=="true" && flag=="follow"){
var start = "https://" + domain + "/api/v1/follows";
var user=$("#his-acct").text();
var ent={"uri":user}
@ -185,18 +191,27 @@ function mute(acct_id) {
var id = $("#his-data").attr("user-id");
if ($("#his-data").hasClass("muting")) {
var flag = "unmute";
var flagm = "delete";
} else {
var flag = "mute";
var flagm = "create";
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/mute/"+flagm;
var ent={"i":at,"userId":id}
var rq=JSON.stringify(ent);
}else{
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
var rq="";
}
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
httpreq.responseType = 'json';
httpreq.send();
httpreq.send(rq);
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
if ($("#his-data").hasClass("muting")) {
@ -214,13 +229,22 @@ function mute(acct_id) {
function del(id, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id;
var httpreq = new XMLHttpRequest();
httpreq.open('DELETE', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
httpreq.responseType = 'json';
httpreq.send();
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/notes/delete";
var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.responseType = 'json';
httpreq.send(JSON.stringify({i:at,noteId:id}));
}else{
var start = "https://" + domain + "/api/v1/statuses/" + id;
var httpreq = new XMLHttpRequest();
httpreq.open('DELETE', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json');
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
httpreq.responseType = 'json';
httpreq.send();
}
httpreq.onreadystatechange = function() {
if (httpreq.readyState == 4) {
}

View File

@ -5,7 +5,7 @@ function re(id,at,acct_id,mode){
$("#reply").val(id);
var te=$("#textarea").val();
$("#textarea").val("@"+at+" "+te);
$("#rec").text("はい");
$("#rec").text(lang_yesno[lang]);
$("#post-acct-sel").val(acct_id);
$("#post-acct-sel").prop("disabled", true);
$('select').material_select();

View File

@ -1,6 +1,9 @@
//カード処理やメンション、ハッシュタグの別途表示
//全てのTL処理で呼び出し
function additional(acct_id, tlid) {
if(localStorage.getItem("domain_" + acct_id)=="misskey.xyz"){
return false;
}
//メンション系
//$(".mention").attr("href", "");

View File

@ -6,44 +6,85 @@ function details(id, acct_id, tlid) {
$('#tootmodal').modal('open');
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id;
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}).then(function(response) {
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/notes/show";
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify({
i:at,
noteId:id
})
}
}else{
var start = "https://" + domain + "/api/v1/statuses/" + id;
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}
}
fetch(start, i).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
if(!$("#timeline_"+tlid+" #pub_" + id).length){
var html = parse([json], '', acct_id);
$("#toot-this").html(html);
jQuery("time.timeago").timeago();
}
if(domain=="misskey.xyz"){
var url="https://misskey.xyz/notes/"+json.id;
var scn=json.user.username;
if(!json.user.host){
var local=true;
}else{
var local=false;
scn=scn+"@"+host;
}
var rep="";
var uid=json.user.id;
if(json._replyIds){
replyTL(json._replyIds[0], acct_id);
}
}else{
var url=json.url
if(json.account.acct==json.account.username){
var local=true;
}else{
var local=false;
}
var scn=json.account.acct;
var uid=json.account.id;
if (json["in_reply_to_id"]) {
replyTL(json["in_reply_to_id"], acct_id);
}
}
$("#toot-this .fav_ct").text(json.favourites_count);
$("#toot-this .rt_ct").text(json.reblogs_count);
$("#tootmodal").attr("data-url",json.url);
$("#tootmodal").attr("data-url",url);
$("#tootmodal").attr("data-id",json.id);
if(json.account.acct==json.account.username){
$("#tootmodal").attr("data-user",json.account.acct+"@"+domain);
if(local){
$("#tootmodal").attr("data-user",scn+"@"+domain);
}else{
$("#tootmodal").attr("data-user",json.account.acct);
}
if (json.in_reply_to_id) {
replyTL(json.in_reply_to_id, acct_id);
$("#tootmodal").attr("data-user",scn);
}
context(id, acct_id);
if(json.account.acct!=json.account.username){
var dom=json.account.acct.replace(/.+@/g,'');
if(!local){
var dom=scn.replace(/.+@/g,'');
}else{
var dom=domain;
}
beforeToot(id, acct_id, dom);
userToot(id, acct_id, json.account.id);
userToot(id, acct_id, uid);
faved(id, acct_id);
rted(id, acct_id);
if(!$("#activator").hasClass("active")){
@ -57,14 +98,29 @@ function details(id, acct_id, tlid) {
function replyTL(id, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id;
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}).then(function(response) {
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/notes/show";
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify({
i:at,
noteId:id
})
}
}else{
var start = "https://" + domain + "/api/v1/statuses/" + id;
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}
}
fetch(start, i).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
@ -75,16 +131,29 @@ function replyTL(id, acct_id) {
}else{
var mute=[];
}
console.log(mute);
var templete = parse([json], '', acct_id,"","",mute);
$("#toot-reply").prepend(templete);
$("#toot-reply .hide").html(lang_details_filtered[lang]);
$("#toot-reply .by_filter").css("display","block");
$("#toot-reply .by_filter").removeClass("hide");
if(domain=="misskey.xyz"){
var templete = misskeyParse([json], '', acct_id,"","",mute);
$("#toot-after").prepend(templete);
$("#toot-after .hide").html(lang_details_filtered[lang]);
$("#toot-after .by_filter").css("display","block");
$("#toot-after .by_filter").removeClass("hide");
var rep="_replyIds";
if (json[rep]) {
replyTL(json[rep][0], acct_id);
}
}else{
var templete = parse([json], '', acct_id,"","",mute);
$("#toot-reply").prepend(templete);
$("#toot-reply .hide").html(lang_details_filtered[lang]);
$("#toot-reply .by_filter").css("display","block");
$("#toot-reply .by_filter").removeClass("hide");
jQuery("time.timeago").timeago();
if (json.in_reply_to_id) {
replyTL(json.in_reply_to_id, acct_id);
var rep="in_reply_to_id";
if (json[rep]) {
replyTL(json[rep], acct_id);
}
}
});
}
@ -92,30 +161,56 @@ function replyTL(id, acct_id) {
function context(id, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/context";
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}).then(function(response) {
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/notes/conversation";
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify({
i:at,
noteId:id
})
}
}else{
var start = "https://" + domain + "/api/v1/statuses/" + id + "/context";
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}
}
fetch(start, i).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
if(localStorage.getItem("filter_"+ acct_id)!="undefined"){
var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),"thread");
if(domain=="misskey.xyz"){
console.log(json);
var templete = misskeyParse(json, '', acct_id,"","",[]);
$("#toot-reply").html(templete);
$("#toot-reply .hide").html(lang_details_filtered[lang]);
$("#toot-reply .by_filter").css("display","block");
$("#toot-reply .by_filter").removeClass("hide");
jQuery("time.timeago").timeago();
}else{
var mute=[];
if(localStorage.getItem("filter_"+ acct_id)!="undefined"){
var mute=getFilterType(JSON.parse(localStorage.getItem("filter_"+ acct_id)),"thread");
}else{
var mute=[];
}
var templete = parse(json.descendants, '', acct_id,"","",mute);
$("#toot-after").html(templete);
$("#toot-after .hide").html(lang_details_filtered[lang]);
$("#toot-after .by_filter").css("display","block");
$("#toot-after .by_filter").removeClass("hide");
jQuery("time.timeago").timeago();
}
var templete = parse(json.descendants, '', acct_id,"","",mute);
$("#toot-after").html(templete);
$("#toot-after .hide").html(lang_details_filtered[lang]);
$("#toot-after .by_filter").css("display","block");
$("#toot-after .by_filter").removeClass("hide");
jQuery("time.timeago").timeago();
});
}
@ -123,50 +218,101 @@ function context(id, acct_id) {
function beforeToot(id, acct_id, domain) {
//var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain +
if(domain=="misskey.xyz"){
var start = "https://" + domain +
"/api/notes/local-timeline"
fetch(start, {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify({
i:at,
untilID:id
})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
var templete = misskeyParse(json, 'noauth', acct_id);
$("#toot-before").html(templete);
jQuery("time.timeago").timeago();
});
}else{
var start = "https://" + domain +
"/api/v1/timelines/public?local=true&max_id=" + id;
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
},
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
var templete = parse(json, 'noauth', acct_id);
$("#toot-before").html(templete);
jQuery("time.timeago").timeago();
});
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
},
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
var templete = parse(json, 'noauth', 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("acct_"+ acct_id + "_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();
});
if(domain=="misskey.xyz"){
var start = "https://" + domain +
"/api/users/notes"
fetch(start, {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify({
i:at,
untilID:id,
userId:user
})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
var templete = misskeyParse(json, 'noauth', acct_id);
$("#user-before").html(templete);
jQuery("time.timeago").timeago();
});
}else{
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) {
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="misskey.xyz"){ return false; }
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/favourited_by";
fetch(start, {
@ -189,6 +335,7 @@ function faved(id, acct_id) {
//ブースト一覧
function rted(id, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="misskey.xyz"){ return false; }
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id + "/reblogged_by";
fetch(start, {

685
app/js/tl/misskeyparse.js Normal file
View File

@ -0,0 +1,685 @@
//オブジェクトパーサー(トゥート)
function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var templete = '';
var actb = localStorage.getItem("action_btns");
var actb='re,rt,fav,qt,del,pin,red';
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");
var ltr = localStorage.getItem("letters");
var gif = localStorage.getItem("gif");
var imh = localStorage.getItem("img-height");
//ネイティブ通知
var native=localStorage.getItem("nativenotf");
if(!native){
native="yes";
}
//クライアント強調
var emp = localStorage.getItem("client_emp");
if(emp){
var emp = JSON.parse(emp);
}
//クライアントミュート
var mute = localStorage.getItem("client_mute");
if(mute){
var mute = JSON.parse(mute);
}
//ユーザー強調
var useremp = localStorage.getItem("user_emp");
if(useremp){
var useremp = JSON.parse(useremp);
}
//ワード強調
var wordemp = localStorage.getItem("word_emp");
if(wordemp){
var wordemp = JSON.parse(wordemp);
}
//ワードミュート
var wordmute = localStorage.getItem("word_mute");
if(wordmute){
var wordmute = JSON.parse(wordmute);
wordmute = wordmute.concat(mutefilter);
}else{
wordmute = mutefilter;
}
if (!sent) {
var sent = 500;
}
if (!ltr) {
var ltr = 500;
}
if (!nsfwtype || nsfwtype == "yes") {
var nsfw = "ok";
} else {
var nsfw;
}
var cwtype = localStorage.getItem("cw");
if (!cwtype || cwtype == "yes") {
var cw = "ok";
} else {
var cw;
}
if (!datetype) {
datetype = "absolute";
}
if (!gif) {
var gif = "yes";
}
if (!imh) {
var imh = "200";
}
if(!emp){
var emp=[];
}
if(!mute){
var mute=[];
}
if(!useremp){
var useremp=[];
}
if(!wordemp){
var wordemp=[];
}
if(!wordmute){
var wordmute=[];
}
//via通知
var viashow=localStorage.getItem("viashow");
if(!viashow){
viashow="via-hide";
}
if(viashow=="hide"){
viashow="via-hide";
}
//認証なしTL
if(mix=="noauth"){
var noauth="hide";
var antinoauth="";
}else{
var noauth="";
var antinoauth="hide";
}
//マウスオーバーのみ
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) {
var toot = obj[key];
var dis_name=toot.user.name;
if(dis_name){
dis_name=escapeHTML(dis_name);
}
if (mix == "notf") {
if (toot.type == "reply") {
var what = lang_parse_mentioned[lang];
var icon = '<i class="big-text fa fa-share teal"></i>';
} else if (toot.type == "renote") {
var what = lang_misskeyparse_renoted[lang];
var icon = '<i class="big-text fa fa-retweet light-blue-text"></i>';
} else if (toot.type == "quote") {
var what = lang_misskeyparse_quoted[lang];
var icon = '<i class="big-text fa fa-quote-right orange-text"></i>';
} else if (toot.type == "reaction") {
var what = lang_misskeyparse_reaction[lang];
var reactions={
"like":"👍",
"love":"💓",
"laugh":"😁",
"hmm":"🤔",
"surprise":"😮",
"congrats":"🎉",
"amgry":"💢",
"confused":"😥",
"pudding":"🍮"
}
var icon=reactions[toot.reaction];
}
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,
datetype) +
'</span>'+icon+'<a onclick="udg(\'' + toot.user.username +
'\',\'' + acct_id + '\')" class="pointer grey-text">' + dis_name +
"(@" + toot.user.username +
")</a>";
var notice = noticetext;
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
if (toot.type == "reply") {
$(".notf-reply_" + acct_id).text($(".notf-reply_" + acct_id+":eq(0)").text()*1+1);
$(".notf-reply_" + acct_id).removeClass("hide")
}else if (toot.type == "renote" || toot.type=="quote") {
$(".notf-bt_" + acct_id).text($(".notf-bt_" + acct_id+":eq(0)").text()*1+1);
$(".notf-bt_" + acct_id).removeClass("hide")
}else if (toot.type == "reaction") {
$(".notf-fav_" + acct_id).text($(".notf-fav_" + acct_id+":eq(0)").text()*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);
}
if(native=="yes"){
var electron = require("electron");
var ipc = electron.ipcRenderer;
var os = electron.remote.process.platform;
var options = {
body: toot.user.name+"(" + toot.user.username +")"+what+"\n\n"+$.strip_tags(toot.note.text),
icon: toot.user.avatarUrl
};
if(os=="darwin"){
var n = new Notification('TheDesk:'+domain, options);
}else{
ipc.send('native-notf', ['TheDesk:'+domain,toot.user.name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.note.text),toot.user.avatarUrl]);
}
}
$(".notf-icon_" + acct_id).addClass("red-text");
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
}
var if_notf='data-notfIndv="'+acct_id+"_"+toot.id+'"';
var toot = toot.note;
var dis_name=escapeHTML(toot.user.name);
}else{
var if_notf="";
if (toot.renote) {
var rebtxt = lang_parse_btedsimple[lang];
var rticon = "fa-retweet light-blue-text";
var notice = '<i class="big-text fa '+rticon+'"></i>'+ dis_name + "(@" + toot.user.username +
")<br>";
var boostback = "shared";
var uniqueid=toot.id;
var toot = toot.renote;
var dis_name=escapeHTML(toot.user.name);
var uniqueid=toot.id;
var actemojick=false
} else {
var uniqueid=toot.id;
var notice = "";
var boostback = "";
//ユーザー強調
if(toot.user.host){
var fullname=toot.user.username+"@"+toot.user.host;
}else{
var domain = localStorage.getItem("domain_" + acct_id);
var fullname=toot.user.username+"@"+domain;
}
if(useremp){
Object.keys(useremp).forEach(function(key10) {
var user = useremp[key10];
if(user==fullname){
boostback = "emphasized";
}
});
}
}
}
var id = toot.id;
if (mix == "home") {
var home = ""
var divider = '<div class="divider"></div>';
} else {
var home = "";
var divider = '<div class="divider"></div>';
}
/*
if (toot.account.locked) {
var locked = ' <i class="fa fa-lock red-text"></i>';
} else {
var locked = "";
}
*/
if (!toot.app) {
if(toot.viaMobile){
var via = '<span style="font-style: italic;">Mobile</span>';
}else{
var via = '<span style="font-style: italic;">Unknown</span>';
}
} else {
var via = toot.app.name;
//強調チェック
Object.keys(emp).forEach(function(key6) {
var cli = emp[key6];
if(cli == via){
boostback = "emphasized";
}
});
//ミュートチェック
Object.keys(mute).forEach(function(key7) {
var cli = mute[key7];
if(cli == via){
boostback = "hide";
}
});
}
if ((toot.cw || toot.cw=="") && cw) {
var content = toot.text;
var spoil = escapeHTML(toot.cw);
var spoiler = "cw cw_hide_" + toot.id;
var api_spoil = "gray";
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
'\')" class="nex parsed">'+lang_parse_cwshow[lang]+'</a><br>';
} else {
var ct1 = nl2br(toot.text).split('<br />').length -2;
var ct2 = nl2br(toot.text).split('<br>').length -2;
if(ct1>ct2){ var ct= ct1; }else{ var ct= ct2; }
if ((sent < ct && $.mb_strlen($.strip_tags(toot.text)) > 5) || ($.strip_tags(toot.text).length > ltr && $.mb_strlen($.strip_tags(toot.text)) > 5)) {
var content = '<span class="gray">'+lang_parse_fulltext[lang]+'</span><br>' + toot.text
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tags(
toot.text), 0, 100) +
'</span><span class="gray">'+lang_parse_autofold[lang]+'</span>';
var spoiler = "cw cw_hide_" + toot.id;
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
'\')" class="nex parsed">'+lang_parse_more[lang]+'</a><br>';
} else {
var content = toot.text;
if(toot.cw){
var spoil = escapeHTML(toot.cw);
}else{
var spoil="";
}
var spoiler = "";
var spoiler_show = "";
}
}
var analyze = '';
var viewer = "";
var hasmedia = "";
var youtube = "";
if(toot.emojis){
var emojick = toot.emojis[0];
}else{
var emojick=false;
}
//デフォ絵文字
if(content){
content=content.replace(/(http(s)?:\/\/[\x21-\x7e]+)/gi, "<a href='$1' target='_blank'>$1</a>")
content=twemoji.parse(content);
}else{
content="";
}
if(dis_name){
dis_name=twemoji.parse(dis_name);
}
if(spoil){
spoil=twemoji.parse(spoil);
}
if(noticetext){
noticetext=twemoji.parse(noticetext);
}
if(notice){
notice=twemoji.parse(notice);
}
var mediack = toot.media[0];
//メディアがあれば
var media_ids="";
if (mediack) {
hasmedia = "hasmedia";
var cwdt = 100 / toot.media.length;
Object.keys(toot.media).forEach(function(key2) {
var media = toot.media[key2];
var purl = media.url;
media_ids=media_ids+media.id+",";
var url = media.url;
if (media.isSensitive && nsfw) {
var sense = "sensitive"
} else {
var sense = ""
}
viewer = viewer + '<a onclick="imgv(\'' + id + '\',\'' + key2 + '\',' +
acct_id + ')" id="' + id + '-image-' + key2 + '" data-url="' + url +
'" data-type="image" class="img-parsed"><img src="' +
purl + '" class="' + sense +
' toot-img pointer" style="width:' + cwdt + '%; height:'+imh+'px;"></a></span>';
});
media_ids = media_ids.slice(0, -1) ;
} else {
viewer = "";
hasmedia = "nomedia";
}
var menck = toot.reply;
var mentions = "";
//メンションであれば
if (menck) {
mentions = '<div style="float:right"><a onclick="udg(\'' + menck.user.username + '\',' +
acct_id + ')" class="pointer">@' + menck.user.username + '</a></div>';
}
var tagck = toot.tags[0];
var tags = "";
//タグであれば
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> ';
content=content.replace("#"+tag,tags);
});
//tags = '<div style="float:right">' + tags + '</div>';
}
//公開範囲を取得
var vis = "";
var visen = toot.visibility;
if (visen == "public") {
var vis =
'<i class="text-darken-3 material-icons gray sml vis-data pointer" title="'+lang_parse_public[lang]+'('+lang_parse_clickcopy[lang]+')" data-vis="public" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">public</i>';
var can_rt = "";
} else if (visen == "home") {
var vis =
'<i class="text-darken-3 material-icons blue-text vis-data pointer" title="'+lang_misskeyparse_home[lang]+'('+lang_parse_clickcopy[lang]+')" data-vis="unlisted" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">lock_open</i>';
var can_rt = "";
} else if (visen == "followers") {
var vis =
'<i class="text-darken-3 material-icons blue-text vis-data pointer" title="'+lang_misskeyparse_followers[lang]+'('+lang_parse_clickcopy[lang]+')" data-vis="unlisted" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">people</i>';
var can_rt = "";
} else if (visen == "private") {
var vis =
'<i class="text-darken-3 material-icons orange-text vis-data pointer" title="'+lang_parse_private[lang]+'('+lang_parse_clickcopy[lang]+')" data-vis="private" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">lock</i>';
var can_rt = "";
} else if (visen == "specified") {
var vis =
'<i class="text-darken-3 material-icons red-text vis-data pointer" title="'+lang_misskeyparse_specified[lang]+'('+lang_parse_clickcopy[lang]+')" data-vis="direct" onclick="staCopy(\''+id+'\')" style="font-size:1rem;">mail</i>';
var can_rt = "hide";
}
if (toot.user.username == localStorage.getItem("user_" + acct_id)) {
var if_mine = "";
var mine_via="type-b";
} else {
var if_mine = "hide";
var mine_via="";
}
if (toot.myReaction) {
var if_fav = " yellow-text";
var fav_app = "faved";
} else {
var if_fav = "";
var fav_app = "";
}
var if_rt = "";
var rt_app = "";
/*
if (toot.reblogged) {
var if_rt = "teal-text";
var rt_app = "rted";
} else {
var if_rt = "";
var rt_app = "";
}
*/
//アバター
var avatar = toot.user.avatarUrl;
//ワードミュート
if(wordmute){
Object.keys(wordmute).forEach(function(key8) {
var worde = wordmute[key8];
if(worde){
if(worde.tag){
var word=worde.tag;
}else{
var word=worde
}
var regExp = new RegExp( word, "g" ) ;
if($.strip_tags(content).match(regExp)){
boostback = "hide by_filter";
}
}
});
}
//ワード強調
if(wordemp){
Object.keys(wordemp).forEach(function(key9) {
var word = wordemp[key9];
if(word){
var word=word.tag;
var regExp = new RegExp( word, "g" ) ;
content=content.replace(regExp,'<span class="emp">'+word+"</span>");
}
});
}
//Reactions
if(toot.reactionCounts){
if(toot.reactionCounts.like){
var like=toot.reactionCounts.like;
var likehide="";
}else{
var like=0;
var likehide="hide";
}
if(toot.reactionCounts.love){
var love=toot.reactionCounts.love;
var lovehide="";
}else{
var love=0;
var lovehide="hide";
}
if(toot.reactionCounts.laugh){
var laugh=toot.reactionCounts.laugh;
var laughhide="";
}else{
var laugh=0;
var laughhide="hide";
}
if(toot.reactionCounts.hmm){
var hmm=toot.reactionCounts.hmm;
var hmmhide="";
}else{
var hmm=0;
var hmmhide="hide";
}
if(toot.reactionCounts.surprise){
var surprise=toot.reactionCounts.surprise;
var suphide="";
}else{
var suphide="hide";
var surprise=0;
}
if(toot.reactionCounts.congrats){
var congrats=toot.reactionCounts.congrats;
var conghide="";
}else{
var congrats=0;
var conghide="hide";
}
if(toot.reactionCounts.angry){
var angry=toot.reactionCounts.angry;
var anghide="";
}else{
var angry=0;
var anghide="hide";
}
if(toot.reactionCounts.confused){
var confhide="";
var confused=toot.reactionCounts.confused;
}else{
var confused=0;
var confhide="hide";
}
if(toot.reactionCounts.pudding){
var pudding=toot.reactionCounts.pudding;
var pudhide="";
}else{
var pudding=0;
var pudhide="hide";
}
var fullhide="";
}else{
var like=0;var love=0;var laugh=0;var hmm=0;var surprise=0;var congrats=0;var angry=0;var confused=0;var pudding=0;
var likehide="hide";var lovehide="hide";var laughhide="hide";var hmmhide="hide";var suphide="hide";var conghide="hide";var anghide="hide";var confhide="hide";var pudhide="hide";
var fullhide="hide";
}
if(toot.myReaction){
var reacted=toot.myReaction;
}else{
var reacted="";
}
content=nl2br(content);
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+'">' +
'<div class="area-notice"><span class="gray sharesta">' + notice + home +
'</span></div>' +
'<div class="area-icon"><a onclick="udg(\'' + toot.user.id +
'\',' + acct_id + ');" user="' + toot.user.username + '" class="udg">' +
'<img src="' + avatar +
'" width="40" class="prof-img" user="' + toot.user.username +
'"></a></div>' +
'<div class="area-display_name"><div class="flex-name"><span class="user">' +
dis_name +
'</span><span class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis; cursor:text;"> @' +
toot.user.username + '</span></div>' +
'<div class="flex-time"><span class="cbadge cbadge-hover pointer waves-effect" onclick="tootUriCopy(\'' +
toot.url + '\');" title="' + date(toot.createdAt, 'absolute') +
'('+lang_parse_clickcopyurl[lang]+')"><i class="fa fa-clock-o"></i>' +
date(toot.createdAt, datetype) + '</span>' +
'</div></div>' +
'<div class="area-toot"><span class="toot ' + spoiler + '">' + content +
'</span><span class="' +
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 +
',\'' + 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+
'</span></span><span class="'+laughhide+' reaction re-laugh"><a onclick="reaction(\'laugh\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("😁")+'</a><span class="re-laughct">'+laugh+
'</span></span><span class="'+hmmhide+' reaction re-hmm"><a onclick="reaction(\'hmm\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("🤔")+'</a><span class="re-hmmct">'+hmm+
'</span></span><span class="'+suphide+' reaction re-surprise"><a onclick="reaction(\'surprise\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("😮")+'</a><span class="re-surprisect">'+surprise+
'</span></span><span class="'+conghide+' reaction re-congrats"><a onclick="reaction(\'congrats\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("🎉")+'</a><span class="re-congratsct">'+congrats+
'</span></span><span class="'+anghide+' reaction re-angry"><a onclick="reaction(\'angry\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("💢")+'</a><span class="re-angryct">'+angry+
'</span></span><span class="'+confhide+' reaction re-confused"><a onclick="reaction(\'confused\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("😥")+'</a><span class="re-confusedct">'+confused+
'</span></span><span class="'+pudhide+' reaction re-pudding"><a onclick="reaction(\'pudding\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("🍮")+'</a><span class="re-puddingct">'+pudding+
'</span></div>' + mentions + tags + '</div>' +
'<div class="area-vis"></div>'+
'<div class="area-actions '+mouseover+'">' +
'<div class="action">'+vis+'</div>'+
'<div class="action '+antinoauth+'"><a onclick="detEx(\'https://misskey.xyz/notes/'+toot.id+'\',\'main\')" class="waves-effect waves-dark details" style="padding:0">'+lang_parse_det[lang]+'</a></div>' +
'<div class="action '+disp["re"]+' '+noauth+'"><a onclick="misskeyreply(\'' + toot.id +
'\',\'' + acct_id + '\',' +
acct_id + ',\''+visen+
'\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="'+lang_parse_replyto[lang]+'"><i class="fa fa-share"></i></a></div>' +
'<div class="action '+can_rt+' '+disp["rt"]+' '+noauth+'"><a onclick="renote(\'' + toot.id + '\',' + acct_id +
',\'' + tlid +
'\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="'+lang_misskeyparse_renote[lang]+'"><i class="text-darken-3 fa fa-retweet ' +
if_rt + ' rt_' + toot.id + '"></i><span class="rt_ct"></span></a></div>' +
'<div class="action '+can_rt+' '+disp["qt"]+' '+noauth+'"><a onclick="renoteqt(\'' + toot.id + '\',' + acct_id +
',\'misskey.xyz\',\'misskey.xyz\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="'+lang_misskeyparse_renoteqt[lang]+'"><i class="text-darken-3 fa fa-quote-right"></i></a></div>' +
'<div class="action '+disp["fav"]+' '+noauth+'"><a onclick="reactiontoggle(\'' + toot.id + '\',' + acct_id +
',\'' + tlid +
'\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="'+lang_misskeyparse_reaction[lang]+'"><i class="fa text-darken-3 fa-plus' +
if_fav + ' fav_' + toot.id + '"></i></div>' +
'<div class="' + if_mine + ' action '+disp["del"]+' '+noauth+'"><a onclick="del(\'' + toot.id + '\',' +
acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="'+lang_parse_del[lang]+'"><i class="fa fa-trash-o"></i></a></div>' +
'<div class="' + if_mine + ' action pin '+disp["pin"]+' '+noauth+'"><a onclick="pin(\'' + toot.id + '\',' +
acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="'+lang_parse_pin[lang]+'"><i class="fa fa-map-pin pin_' + toot.id + '"></i></a></div>'
+'<div class="' + if_mine + ' action '+disp["red"]+' '+noauth+'"><a onclick="redraft(\'' + toot.id + '\',' +
acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0" title="'+lang_parse_redraft[lang]+'"><i class="material-icons">redo</i></a></div>'+trans+
'<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 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>' +
'</div></div>';
});
return templete;
}
//オブジェクトパーサー(ユーザーデータ)
function misskeyUserparse(obj, auth, acct_id, tlid, popup) {
if(popup > 0 || popup==-1){
}else{
var obj = obj.users;
}
var templete = '';
var datetype = localStorage.getItem("datetype");
Object.keys(obj).forEach(function(key) {
var toot = obj[key];
var locked = "";
if (auth) {
var auth = '<i class="material-icons gray pointer" onclick="misskeyRequest(\'' +
toot.id + '\',\'accept\',' + acct_id + ')">person_add</i>';
} else {
var auth = "";
}
var ftxt=lang_parse_followed[lang];
if(popup > 0 || popup==-1){
var notftext='<span class="cbadge"title="' + date(toot.createdAt,
'absolute') + '('+lang_parse_notftime[lang]+')"><i class="fa fa-clock-o"></i>' + date(toot.createdAt,
datetype) +
'</span>'+ftxt+'<br>';
var toot = toot.user;
}else{
var notftext="";
}
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && notftext != memory) {
Materialize.toast(escapeHTML(toot.name)+":"+ftxt, popup * 1000);
$(".notf-icon_" + tlid).addClass("red-text");
localStorage.setItem("notice-mem", notftext);
notftext = "";
}
if(toot.name){
var dis_name=escapeHTML(toot.name);
dis_name=twemoji.parse(dis_name);
}else{
var dis_name=toot.name;
}
console.log(dis_name)
templete = templete +
'<div class="cvo" style="padding-top:5px;" user-id="' + toot.id + '"><div class="area-notice">' +
notftext +
'</div><div class="area-icon"><a onclick="udg(\'' + toot.id + '\',' +
acct_id + ');" user="' + toot.username + '" class="udg">' +
'<img src="' + toot.avatarUrl + '" width="40" class="prof-img" user="' + toot
.username + '"></a></div>' +
'<div class="area-display_name"><div class="flex-name"><span class="user">' +
dis_name + '</span>' +
'<span class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;user-select:auto; cursor:text;"> @' +
toot.username + auth +'</span>' +
'</div>' +
'</div>' +
'<div style="justify-content:space-around" class="area-toot"> <div class="cbadge" style="width:100px;">Follows:' +
toot.followingCount +
'</div><div class="cbadge" style="width:100px;">Followers:' + toot.followersCount +
'</div>' +
'</div>' +
'</div>' +
'</div>';
});
return templete;
}

View File

@ -3,20 +3,33 @@
function notf(acct_id, tlid, sys) {
todo("Notifications Loading...");
var native=localStorage.getItem("nativenotf");
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if(!native){
native="yes";
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/notifications";
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
//body: JSON.stringify({})
}).then(function(response) {
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/i/notifications";
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify({
i:at
})
}
}else{
var start = "https://" + domain + "/api/v1/notifications";
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}
}
fetch(start, i).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
@ -25,7 +38,6 @@ function notf(acct_id, tlid, sys) {
if(json[0]){
var templete="";
var lastnotf=localStorage.getItem("lastnotf_" + acct_id);
console.log(domain);
localStorage.setItem("lastnotf_" + acct_id,json[0].id);
Object.keys(json).forEach(function(key) {
var obj = json[key];
@ -54,9 +66,18 @@ function notf(acct_id, tlid, sys) {
var mute=[];
}
if(obj.type!="follow"){
templete = templete+parse([obj], 'notf', acct_id, 'notf', -1, mute);
if(domain=="misskey.xyz"){
templete = templete+misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute);
}else{
templete = templete+parse([obj], 'notf', acct_id, 'notf', -1, mute);
}
}else{
templete = templete+userparse([obj.account], 'notf', acct_id, 'notf', -1);
if(domain=="misskey.xyz"){
templete = templete+misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute);
}else{
templete = templete+userparse([obj.account], 'notf', acct_id, 'notf', -1);
}
}
});
@ -71,8 +92,13 @@ function notf(acct_id, tlid, sys) {
$("#notf-box").addClass("fetched");
todc();
});
var start = "wss://" + domain + "/api/v1/streaming/?stream=user&access_token=" +
if(domain!="misskey.xyz"){
var start = "wss://" + domain + "/api/v1/streaming/?stream=user&access_token=" +
at;
}else{
var start = "wss://" + domain + "/?i=" +
at;
}
console.log(start);
var wsid = websocketNotf.length;
@ -85,15 +111,30 @@ function notf(acct_id, tlid, sys) {
}
websocketNotf[wsid].onmessage = function(mess) {
console.log("Receive Streaming API(Notf):"+acct_id);
var popup = localStorage.getItem("popup");
if (!popup) {
popup = 0;
}
if(domain=="misskey.xyz"){
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(!$("div[data-notfIndv=" + acct_id +"_"+obj.id+"]").length){
$("div[data-notf=" + acct_id +"]").prepend(templete);
}
jQuery("time.timeago").timeago();
}
}else{
var obj = JSON.parse(JSON.parse(mess.data).payload);
console.log(obj);
var type = JSON.parse(mess.data).event;
if (type == "notification") {
var popup = localStorage.getItem("popup");
if (!popup) {
popup = 0;
}
var templete="";
localStorage.setItem("lastnotf_" + acct_id,obj.id);
if(obj.type!="follow"){
@ -109,7 +150,7 @@ function notf(acct_id, tlid, sys) {
$("[toot-id=" + obj + "]").hide();
$("[toot-id=" + obj + "]").remove();
}
}
}
websocketNotf[wsid].onerror = function(error) {
console.error('WebSocket Error ' + error);
@ -133,8 +174,30 @@ function notfmore(tlid) {
todo("Notfication TL MoreLoading");
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/notifications"+
"max_id=" + sid;
if(domain=="misskey.xyz"){
var start = "https://" + domain + "/api/i/notifications";
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify({
i:at,
untilId:sid
})
}
}else{
var start = "https://" + domain + "/api/v1/notifications"+
"max_id=" + sid;
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}
}
fetch(start, {
method: 'GET',
headers: {
@ -151,9 +214,17 @@ function notfmore(tlid) {
Object.keys(json).forEach(function(key) {
var obj = json[key];
if(obj.type!="follow"){
templete = templete+parse([obj], '', acct_id, tlid, -1);
if(domain=="misskey.xyz"){
templete = templete+misskeyParse([obj], '', acct_id, tlid, -1);
}else{
templete = templete+parse([obj], '', acct_id, tlid, -1);
}
}else{
templete = templete+userparse([obj.account], '', acct_id, tlid, -1);
if(domain=="misskey.xyz"){
templete = templete+misskeyUserparse([obj], '', acct_id, tlid, -1);
}else{
templete = templete+userparse([obj.account], '', acct_id, tlid, -1);
}
}
});

View File

@ -633,16 +633,16 @@ function userparse(obj, auth, acct_id, tlid, popup) {
var notftext='<span class="cbadge"title="' + date(toot.created_at,
'absolute') + '('+lang_parse_notftime[lang]+')"><i class="fa fa-clock-o"></i>' + date(toot.created_at,
datetype) +
'</span>'+ftxt+'<br>';
'</span>'+ftxt+'<br>';
}else{
var notftext="";
}
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
Materialize.toast(escapeHTML(toot.display_name)+""+ftxt, popup * 1000);
if (popup >= 0 && obj.length < 5 && notftext != memory) {
Materialize.toast(escapeHTML(toot.display_name)+":"+ftxt, popup * 1000);
$(".notf-icon_" + tlid).addClass("red-text");
localStorage.setItem("notice-mem", noticetext);
noticetext = "";
localStorage.setItem("notice-mem", notftext);
notftext = "";
}
var dis_name=escapeHTML(toot.display_name);
if(toot.emojis){

View File

@ -31,7 +31,7 @@ function tl(type, data, acct_id, tlid, delc, voice) {
var type = "local";
}
}
if (type == "mix") {
if (type == "mix" && domain != "misskey.xyz") {
//Integratedなら飛ばす
$("#notice_" + tlid).text("Integrated TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
@ -71,31 +71,63 @@ function tl(type, data, acct_id, tlid, delc, voice) {
$("#notice_" + tlid).text("Glance TL(" + domain + ")");
}
$("#notice_icon_" + tlid).text(icon(type));
var url=com(type, data);
if(type=="tag"){
var tag = localStorage.getItem("tag-range");
if(tag=="local"){
url=url+"local=true";
if(domain=="misskey.xyz"){
var url=misskeycom(type, data);
var start = "https://" + domain + "/api/notes/"+url;
var method="POST";
var req={};
if(type!="noauth"){
req.i=at;
}
if(type=="local-media"||type=="pub-media"){
req.mediaOnly=true;
}
if(type=="tag"){
req.tag=data;
}
if(type=="list"){
req.listId=data;
}
req.limit=20;
var i={
method: method,
headers: hdr,
body: JSON.stringify(req),
}
}else{
var url=com(type, data);
if(type=="tag"){
var tag = localStorage.getItem("tag-range");
if(tag=="local"){
url=url+"local=true";
}
}
var start = "https://" + domain + "/api/v1/timelines/" + url;
var method="GET";
var i={
method: method,
headers: hdr
};
}
var start = "https://" + domain + "/api/v1/timelines/" + url;
console.log(start);
fetch(start, {
method: 'GET',
headers: hdr,
}).then(function(response) {
fetch(start, i).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
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, type, acct_id, tlid, "", mute);
if(domain=="misskey.xyz"){
var templete = misskeyParse(json, type, acct_id, tlid, "", mute);
}else{
var templete = parse(json, type, acct_id, tlid, "", mute);
}
$("#timeline_" + tlid).html(templete);
additional(acct_id, tlid);
jQuery("time.timeago").timeago();
@ -113,40 +145,70 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) {
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
localStorage.setItem("now", type);
if (type == "home") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=user&access_token=" + at;
} else if (type == "pub") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public&access_token=" + at;
} else if (type == "pub-media") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public:media&access_token=" + at;
} else if (type == "local") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public:local&access_token=" + at;
} else if (type == "local-media") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public:local:media&only_media=true&access_token=" + at;
} else if (type == "tag") {
if(type=="tag"){
var tag = localStorage.getItem("tag-range");
if(tag=="local"){
data=data+"&local=true";
}
if(domain=="misskey.xyz"){
if (type == "home") {
var start = "wss://" + domain +
"/?i=" + at;
} else if (type == "pub") {
var start = "wss://" + domain +
"/global-timeline?i=" + at;
} else if (type == "pub-media") {
var start = "wss://" + domain +
"/global-timeline?i=" + at;
} else if (type == "local") {
var start = "wss://" + domain +
"/local-timeline?i=" + at;
} else if (type == "local-media") {
var start = "wss://" + domain +
"/local-timeline?i=" + at;
} else if (type == "mix") {
var start = "wss://" + domain +
"/hybrid-timeline?i=" + at;
} else if (type == "tag") {
Materialize.toast(lang_misskeyparse_tagnostr[lang], 1000);
} else if (type == "noauth") {
var start = "wss://" + acct_id +
"/local-timeline?i=" + at;
} else if (type=="list"){
Materialize.toast(lang_misskeyparse_listnostr[lang], 1000);
}
}else{
if (type == "home") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=user&access_token=" + at;
} else if (type == "pub") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public&access_token=" + at;
} else if (type == "pub-media") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public:media&access_token=" + at;
} else if (type == "local") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public:local&access_token=" + at;
} else if (type == "local-media") {
var start = "wss://" + domain +
"/api/v1/streaming/?stream=public:local:media&only_media=true&access_token=" + at;
} else if (type == "tag") {
if(type=="tag"){
var tag = localStorage.getItem("tag-range");
if(tag=="local"){
data=data+"&local=true";
}
}
var start = "wss://" + domain +
"/api/v1/streaming/?stream=hashtag&tag=" + data +"&access_token=" + at;
} else if (type == "noauth") {
var start = "wss://" + acct_id +
"/api/v1/streaming/?stream=public:local";
} 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;
}
var start = "wss://" + domain +
"/api/v1/streaming/?stream=hashtag&tag=" + data +"&access_token=" + at;
} else if (type == "noauth") {
var start = "wss://" + acct_id +
"/api/v1/streaming/?stream=public:local";
} 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;
websocket[wsid] = new WebSocket(start);
@ -157,29 +219,14 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) {
}
websocket[wsid].onmessage = function(mess) {
console.log(tlid + ":Receive Streaming API:");
console.log(mess);
var typeA = JSON.parse(mess.data).event;
if (typeA == "delete") {
var obj = JSON.parse(mess.data).payload;
if(delc=="true"){
$("#timeline_"+tlid+" [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
$("#timeline_"+tlid+" [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
}else{
$("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
}
} else if (typeA == "update") {
var obj = JSON.parse(JSON.parse(mess.data).payload);
console.log(obj);
if($("#timeline_" + tlid +" [toot-id=" + obj.id + "]").length < 1){
console.log("speech:"+voice);
console.log(JSON.parse(mess.data));
if(domain=="misskey.xyz"){
if (JSON.parse(mess.data).type == "note") {
var obj = JSON.parse(mess.data).body;
if(voice){
say(obj.content)
}
var templete = parse([obj], type, acct_id, tlid,"",mute);
}
var templete = misskeyParse([obj], type, acct_id, tlid,"",mute);
var pool = localStorage.getItem("pool_" + tlid);
if (pool) {
pool = templete + pool;
@ -187,22 +234,52 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice) {
pool = templete
}
localStorage.setItem("pool_" + tlid, pool);
scrollck();
additional(acct_id, tlid);
jQuery("time.timeago").timeago();
}else{
todo("二重取得発生中");
}
todc();
}else if(typeA=="filters_changed"){
filterUpdate(acct_id);
}
websocket[wsid].onclose = function(mess) {
console.log("Close Streaming API:" + type);
}else{
var typeA = JSON.parse(mess.data).event;
if (typeA == "delete") {
var obj = JSON.parse(mess.data).payload;
if(delc=="true"){
$("#timeline_"+tlid+" [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
$("#timeline_"+tlid+" [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
}else{
$("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
}
} else if (typeA == "update") {
var obj = JSON.parse(JSON.parse(mess.data).payload);
console.log(obj);
if($("#timeline_" + tlid +" [toot-id=" + obj.id + "]").length < 1){
if(voice){
say(obj.content)
}
var templete = parse([obj], type, acct_id, tlid,"",mute);
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("二重取得発生中");
}
todc();
}else if(typeA=="filters_changed"){
filterUpdate(acct_id);
}
}
}
websocket[wsid].onerror = function(error) {
console.error('WebSocket Error ' + error);
@ -231,10 +308,10 @@ function moreload(type, tlid) {
var sid = $("#timeline_" + tlid + " .cvo").last().attr("unique-id");
if (localStorage.getItem("morelock") != sid) {
localStorage.setItem("morelock", sid);
if (type == "mix") {
if (type == "mix" && domain!="misskey.xyz") {
mixmore(tlid,"integrated");
return;
}else if (type == "plus") {
}else if (type == "plus" && domain!="misskey.xyz") {
mixmore(tlid,"plus");
return;
}else if (type == "notf") {
@ -243,23 +320,68 @@ function moreload(type, tlid) {
}
localStorage.setItem("now", type);
todo(cap(type) + " TL MoreLoading");
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/timelines/" + com(type,data) +
"max_id=" + sid;
fetch(start, {
method: 'GET',
headers: {
if(type!="noauth"){
var hdr={
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
},
}).then(function(response) {
};
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
}else{
var hdr={
'content-type': 'application/json'
};
domain=acct_id;
}
if(domain=="misskey.xyz"){
hdr={
'content-type': 'application/json'
};
var url=misskeycom(type, data);
var start = "https://" + domain + "/api/notes/"+url;
var method="POST";
var req={};
if(type!="noauth"){
req.i=at;
}
if(type=="local-media"||type=="pub-media"){
req.mediaOnly=true;
}
if(type=="tag"){
req.tag=data;
}
if(type=="list"){
req.listId=data;
}
req.untilId=sid;
req.limit=20;
var i={
method: method,
headers: hdr,
body: JSON.stringify(req),
}
}else{
var start = "https://" + domain + "/api/v1/timelines/" + com(type,data) +
"max_id=" + sid;
var method="GET";
var i={
method: method,
headers: hdr
};
}
fetch(start, i).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
var templete = parse(json, '', acct_id, tlid,"",mute);
if(domain=="misskey.xyz"){
var templete = misskeyParse(json, '', acct_id, tlid,"",mute);
}else{
var templete = parse(json, '', acct_id, tlid,"",mute);
}
$("#timeline_" + tlid).append(templete);
additional(acct_id, tlid);
jQuery("time.timeago").timeago();
@ -390,6 +512,25 @@ function com(type, data) {
return "direct?"
}
}
function misskeycom(type, data) {
if (type == "home") {
return "timeline"
}else if (type == "mix") {
return "hybrid-timeline"
} else if (type == "local" || type == "noauth") {
return "local-timeline"
} else if (type == "local-media") {
return "local-timeline"
} else if (type == "pub") {
return "global-timeline"
} else if (type == "pub-media") {
return "global-timeline"
} else if (type == "tag") {
return "search_by_tag"
}else if (type == "list") {
return "user-list-timeline"
}
}
//TLのアイコン
function icon(type) {
@ -407,5 +548,7 @@ function icon(type) {
return "subject"
}else if (type == "dm") {
return "mail"
}else if (type == "mix") {
return "share"
}
}

View File

@ -9,27 +9,49 @@ function utl(user, more, acct_id) {
if (user == "--now") {
var user = $('#his-data').attr("user-id");
}
if (more) {
var sid = $("#his-tl .cvo").last().attr("toot-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
if(domain!="misskey.xyz"){
if (more) {
var sid = $("#his-tl .cvo").last().attr("toot-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" +
plus;
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
}else{
var req={i:at}
if (more) {
var sid = $("#his-tl .cvo").last().attr("toot-id");
req.maxId=sid;
}
req.userId=user;
var start = "https://" + domain + "/api/users/notes"
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify(req)
}
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses" +
plus
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);
console.error(error);
}).then(function(json) {
var templete = parse(json, '', acct_id);
if(domain=="misskey.xyz"){
var templete = misskeyParse(json, '', acct_id);
}else{
var templete = parse(json, '', acct_id);
}
if(!json[0]){
templete=lang_details_nodata[lang]+"<br>";
}
@ -38,7 +60,11 @@ function utl(user, more, acct_id) {
if (more) {
$("#his-tl-contents").append(templete);
} else {
pinutl(templete,user, acct_id)
if(domain!="misskey.xyz"){
pinutl(templete,user, acct_id)
}else{
$("#his-tl-contents").html(templete);
}
}
jQuery("time.timeago").timeago();
});
@ -89,28 +115,49 @@ function flw(user, more, acct_id) {
if (user == "--now") {
var user = $('#his-data').attr("user-id");
}
if (more) {
var sid = $("#his-follow-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
if(domain=="misskey.xyz"){
var req={i:at}
if (more) {
var sid = $("#his-follow-list .cvo").last().attr("user-id");
req.maxId=sid;
}
req.userId=user;
var start = "https://" + domain + "/api/users/following"
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify(req)
}
}else{
if (more) {
var sid = $("#his-follow-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/following" +
plus
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
}
}
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/following" +
plus
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);
console.error(error);
}).then(function(json) {
var templete = userparse(json,'',acct_id);
if(!json[0]){
if(domain=="misskey.xyz"){
var templete = misskeyUserparse(json,'',acct_id);
}else{
var templete = userparse(json,'',acct_id);
}
if(templete==""){
templete=lang_details_nodata[lang]+"<br>";
}
if (more) {
@ -133,28 +180,49 @@ function fer(user, more, acct_id) {
if (user == "--now") {
var user = $('#his-data').attr("user-id");
}
if (more) {
var sid = $("#his-follower-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
if(domain=="misskey.xyz"){
var req={i:at}
if (more) {
var sid = $("#his-follower-list .cvo").last().attr("user-id");
req.maxId=sid;
}
req.userId=user;
var start = "https://" + domain + "/api/users/followers"
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify(req)
}
}else{
if (more) {
var sid = $("#his-follower-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/followers" +
plus
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
}
}
}
var start = "https://" + domain + "/api/v1/accounts/" + user + "/followers" +
plus;
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);
console.error(error);
}).then(function(json) {
var templete = userparse(json,'',acct_id);
if(!json[0]){
if(domain=="misskey.xyz"){
var templete = misskeyUserparse(json,'',acct_id);
}else{
var templete = userparse(json,'',acct_id);
}
if(templete==""){
templete=lang_details_nodata[lang]+"<br>";
}
if (more) {
@ -174,26 +242,48 @@ function showFav(more, acct_id) {
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if (more) {
var sid = $("#his-fav-list .cvo").last().attr("toot-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
if(domain!="misskey.xyz"){
if (more) {
var sid = $("#his-fav-list .cvo").last().attr("toot-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/favourites" + plus
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
}else{
var req={i:at}
if (more) {
var sid = $("#his-fav-list .cvo").last().attr("toot-id");
req.maxId=sid;
}
var start = "https://" + domain + "/api/i/favorites"
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify(req)
}
}
var start = "https://" + domain + "/api/v1/favourites" + plus
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);
console.error(error);
}).then(function(json) {
var templete = parse(json, '', acct_id);
if(domain!="misskey.xyz"){
var templete = parse(json, '', acct_id);
}else{
var templete = misskeyParse(json, '', acct_id);
}
if(!json[0]){
templete=lang_details_nodata[lang]+"<br>";
}
@ -213,20 +303,37 @@ function showMut(more, acct_id) {
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if (more) {
var sid = $("#his-muting-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
if(domain=="misskey.xyz"){
var req={i:at}
if (more) {
var sid = $("#his-muting-list .cvo").last().attr("user-id");
req.maxId=sid;
}
var start = "https://" + domain + "/api/mute/list"
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify(req)
}
}else{
if (more) {
var sid = $("#his-muting-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/mutes" + plus
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
}
}
}
var start = "https://" + domain + "/api/v1/mutes" + plus
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);
@ -251,6 +358,10 @@ function showBlo(more, acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="misskey.xyz"){
$("#his-blocking-list-contents").html(lang_hisdata_notonmisskey[lang]+"<br>");
return false;
}
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if (more) {
var sid = $("#his-blocking-list .cvo").last().attr("user-id");
@ -286,31 +397,53 @@ function showBlo(more, acct_id) {
//フォロリクリスト
function showReq(more, acct_id) {
if (!acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if (more) {
var sid = $("#his-request-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
if(domain=="misskey.xyz"){
var req={i:at}
if (more) {
var sid = $("#his-request-list .cvo").last().attr("user-id");
req.maxId=sid;
}
var start = "https://" + domain + "/following/requests/list"
var i={
method: 'POST',
headers: {
'content-type': 'application/json',
},
body:JSON.stringify(req)
}
}else{
if (more) {
var sid = $("#his-request-list .cvo").last().attr("user-id");
var plus = "?max_id=" + sid;
} else {
var plus = "";
}
var start = "https://" + domain + "/api/v1/follow_requests" + plus
var i={
method: 'GET',
headers: {
'content-type': 'application/json',
}
}
}
var start = "https://" + domain + "/api/v1/follow_requests" + plus
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);
console.error(error);
}).then(function(json) {
var templete = userparse(json, 'true',acct_id);
if(domain="misskey.xyz"){
var templete = userparse(json, 'true',acct_id);
}else{
var templete = misskeyUserparse(json, 'true',acct_id);
}
if(!json[0]){
templete=lang_details_nodata[lang]+"<br>";
}
@ -329,6 +462,10 @@ function showDom(more, acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="misskey.xyz"){
$("#his-domain-list-contents").html(lang_hisdata_notonmisskey[lang]+"<br>");
return false;
}
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if (more) {
var sid = $("#his-domain-list .cvo").last().attr("user-id");
@ -376,6 +513,10 @@ function showFrl(more, acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="misskey.xyz"){
$("#his-follow-recom-contents").html(lang_hisdata_notonmisskey[lang]+"<br>");
return false;
}
var at = localStorage.getItem("acct_"+ acct_id + "_at");
if (more) {
var sid = $("#his-follow-recom-list .cvo").last().attr("user-id");

View File

@ -21,6 +21,7 @@ function udgEx(user,acct_id){
}
console.log(user);
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="misskey.xyz"){ return false; }
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/search?resolve=true&q="+user
fetch(start, {
@ -48,6 +49,10 @@ function udg(user, acct_id) {
}
todo("User Data Loading...");
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="misskey.xyz"){
misskeyUdg(user, acct_id)
return;
}
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/v1/accounts/" + user;
console.log(start);
@ -177,6 +182,125 @@ function udg(user, acct_id) {
todc();
});
}
function misskeyUdg(user, acct_id) {
reset();
if (!user) {
user = localStorage.getItem("user-id_"+acct_id);
console.log(user);
}
todo("User Data Loading...");
var domain = localStorage.getItem("domain_" + acct_id);
if(domain!="misskey.xyz"){
udg(user, acct_id)
return;
}
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/users/show";
console.log(user);
fetch(start, {
method: 'POST',
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({
i:at,
userId:user
})
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
//一つ前のユーザーデータ
if (!localStorage.getItem("history")){
$("#his-history-btn").prop("disabled",true);
}else{
$("#his-history-btn").prop("disabled",false);
$('#his-data').attr("history", localStorage.getItem("history"));
}
$('#his-data').modal('open');
$('#his-data').attr("user-id", user);
$('#his-data').attr("use-acct", acct_id);
if(json.host){
//Remote
$('#his-data').attr("remote", "false");
var fullname=json.username+"@"+json.host;
}else{
$('#his-data').attr("remote", "false");
var fullname=json.acct+"@"+domain;
}
utl(json.id, '', acct_id);
flw(json.id, '', acct_id);
fer(json.id, '', acct_id);
if(json.name){
var dis_name=escapeHTML(json.name);
dis_name=twemoji.parse(dis_name);
}else{
var dis_name=json.name
}
$("#his-name").html(dis_name);
$("#his-acct").text(json.username);
$("#his-acct").attr("fullname",fullname);
$("#his-prof").attr("src", json.avatarUrl);
$('#his-data').css('background-image', 'url(' + json.bannerUrl + ')');
$("#his-sta").text(json.notesCount);
$("#his-follow").text(json.followingCount);
$("#his-follower").text(json.followersCount);
$("#his-since").text(crat(json.createdAt));
var note=json.description;
$("#his-des").html(twemoji.parse(note));
if(json.isCat){
$("#his-bot").html("Cat"+twemoji.parse("😺"));
}
$('#his-data').css('background-size', 'cover');
localStorage.setItem("history" , user);
//自分の時
if (json.username == localStorage.getItem("user_"+acct_id) && !json.host) {
//showFav('', acct_id);
//showMut('', acct_id);
//showReq('', acct_id);
showFrl('', acct_id);
$("#his-name-val").val(json.name);
var des = json.note;
des = nl2br(des)
des = $.strip_tags(des);
$("#his-des-val").val(des);
$("#his-follow-btn").hide();
$("#his-block-btn").hide();
$("#his-mute-btn").hide();
$("#his-notf-btn").hide();
$("#his-domain-btn").hide();
$("#his-emp-btn").hide();
$(".only-my-data").show();
$(".only-his-data").hide();
} else {
if (json.isFollowing) {
//自分がフォローしている
$("#his-data").addClass("following");
$("#his-follow-btn").text(lang_status_unfollow[lang]);
hisList(user,acct_id);
}else{
$("#his-follow-btn").text(lang_status_follow[lang]);
}
if (json.isFollowed) {
//フォローされてる
$("#his-relation").text(lang_showontl_followed[lang]);
}
$("#his-block-btn").hide();
if (json.isMuted) {
$("#his-data").addClass("muting");
$("#his-mute-btn").text(lang_status_unmute[lang]);
}else{
$("#his-mute-btn").text(lang_status_mute[lang]);
}
$(".only-my-data").hide();
$(".only-his-data").show();
}
todc();
});
}
//一つ前のユーザーデータ表示
function historyShow(){
var acct_id=$('#his-data').attr("use-acct");

View File

@ -59,7 +59,7 @@
"timeline":"Timeline",
"operateOtherAcct":"Cross-account",
"list":"List",
"makeNew":"Make a list",
"makeNew":"Save",
"blocks":"Blocks",
"mutes":"Mutes",
"block":"Block",

View File

@ -118,6 +118,7 @@
"keyrow":"Show next or previous image",
"keyzoom":"Mousewheel:Zoom a image",
"reset":"Reset(Danger)",
"resetconfirm":"Delete all data. You cannot undo. Continue?",
"about":"About TheDesk",
"hp":"Website",
"support":"Support",

View File

@ -118,6 +118,7 @@
"keyrow":"イメージビューワー起動時に画像切り替え",
"keyzoom":"マウスホイール:イメージビューワー時に拡大縮小",
"reset":"初期化",
"resetconfirm":"全てのデータを削除します。この操作は取り消せません。",
"about":"このソフトについて",
"hp":"公式HP",
"support":"支援",

View File

@ -1,345 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>Settings - TheDesk</title>
<meta content="width=device-width,initial-scale=1.0" name="viewport">
<link href="./css/materialize.css" type="text/css" rel="stylesheet">
<link href="./css/themes.css" type="text/css" rel="stylesheet">
<link href="./css/master.css" type="text/css" rel="stylesheet">
<link href='./css/font-awesome.css' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Open+Sans:300" rel="stylesheet">
<meta charset="utf-8">
</head>
<body id="mainView" style="overflow-y:scroll">
<script type="text/javascript" src="./js/common/jquery.js"></script>
<script type="text/javascript" src="./js/platform/first.js"></script>
<script type="text/javascript" src="./js/common/materialize.js"></script>
<script type="text/javascript" src="./js/lang/setting.lang.js"></script>
<script>var lang="en";</script>
<h4>Preferences</h4>
<ul class="collapsible" data-collapsible="accordion">
<li>
<div class="collapsible-header">
<i class="material-icons">desktop_windows</i>System Preferences
</div>
<div class="collapsible-body">
<h5>Languages</h5>
<a href="language.html" class="btn waves-effect indigo nex" style="width:100%; max-width:200px;">Change</a>
<h5>Themes</h5>
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="black" value="black" />
<label for="black">Black</label>
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="white" value="white" />
<label for="white">White</label>
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="indigo" value="indigo" />
<label for="indigo">Indigo<span class="imas hide">(エンドレスナイト)</span></label>
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="brown" value="brown" />
<label for="brown">Brown<span class="imas hide">(ビタースイート・タイム)</span></label>
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="green" value="green" />
<label for="green">Green<span class="imas hide">(ユースフルロマンス)</span></label>
<br>
<h5>Popup notification(on window)</h5>Hide to set "0"
<br>
<input type="text" style="width:50px" id="popup">sec
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Save</button>
<br>
<h5>Native notification</h5>
This does not work on Windows 10.<br><a onclick="notftest()" class="pointer">Notification test</a>
<br>
<input class="with-gap" onchange="settings()" name="notf" type="radio" id="ntf_yes" value="yes" />
<label for="ntf_yes">Yes</label>
<input class="with-gap" onchange="settings()" name="notf" type="radio" id="ntf_no" value="no" />
<label for="ntf_no">No</label>
<br>
<h5>Minimam width of columns</h5>Scroll bar will be shown when your window size is more than ammounts of columns.
<br>
<input type="text" style="width:50px" id="width">pxabove
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Save</button>
<br>
<h5>Font</h5>
Set local font<br>
<input type="text" style="width:150px" id="font">
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Save</button>
<br>
<h5>Font size</h5>
<span style="font-size:15px">15px(absolute value)</span>
<br>
<input type="text" style="width:50px" id="size">px
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Save</button>
</div>
</li>
<li>
<div class="collapsible-header">
<i class="material-icons">reorder</i>Timeline Preferences
</div>
<div class="collapsible-body">
<h5>Time format</h5>Relative format:"1 minutes ago","3 days ago"
<br>Absolute format:"23:25:21","2017/12/30 23:59:00"
<br>Mixed format:toots posted today are relative-format, others are absolute-format.
<br>
<input class="with-gap" onchange="settings()" onchange="settings()" name="time" type="radio" id="relative" value="relative" />
<label for="relative">Relative</label>
<input class="with-gap" onchange="settings()" name="time" type="radio" id="absolute" value="absolute" />
<label for="absolute">Absoltue</label>
<input class="with-gap" onchange="settings()" name="time" type="radio" id="double" value="double" />
<label for="double">Both relative and absolute</label>
<input class="with-gap" onchange="settings()" name="time" type="radio" id="medium" value="medium" />
<label for="medium">Mixed</label>
<h5>Instance unique locale</h5>This value is available on some Japanese instances
<br>
<input class="with-gap" onchange="settings()" name="ul" type="radio" id="ul_yes" value="yes" />
<label for="ul_yes">Yes</label>
<input class="with-gap" onchange="settings()" name="ul" type="radio" id="ul_no" value="no" />
<label for="ul_no">No</label>
<br>
<h5>Hide NSFW pictures</h5>Strong blur effect
<br>
<input class="with-gap" onchange="settings()" name="nsfw" type="radio" id="n_yes" value="yes" />
<label for="n_yes">Yes</label>
<input class="with-gap" onchange="settings()" name="nsfw" type="radio" id="n_no" value="no" />
<label for="n_no">No</label>
<br>
<h5>Hide CW contents</h5>
<input class="with-gap" onchange="settings()" name="cw" type="radio" id="c_yes" value="yes" />
<label for="c_yes">Yes</label>
<input class="with-gap" onchange="settings()" name="cw" type="radio" id="c_no" value="no" />
<label for="c_no">No</label>
<br>
<h5>Animated GIF images animation</h5>
<input class="with-gap" onchange="settings()" name="gif" type="radio" id="g_yes" value="yes" />
<label for="g_yes">Yes</label>
<input class="with-gap" onchange="settings()" name="gif" type="radio" id="g_no" value="no" />
<label for="g_no">No</label>
<br>
<h5>Tag TL Search</h5>
<input class="with-gap" onchange="settings()" name="tag" type="radio" id="t_all" value="all" />
<label for="t_all">Use federated network</label>
<input class="with-gap" onchange="settings()" name="tag" type="radio" id="t_local" value="local" />
<label for="t_local">Use local network</label>
<br>
<h5>Show via</h5>
<input class="with-gap" onchange="settings()" name="via" type="radio" id="via_yes" value="yes" />
<label for="via_yes">Yes</label>
<input class="with-gap" onchange="settings()" name="via" type="radio" id="via_hide" value="hide" />
<label for="via_hide">No</label>
<br>
<h5>Hide aaction buttons without mouseover</h5>
You may feel unconfortable:(<br>
<input class="with-gap" onchange="settings()" name="mov" type="radio" id="mov_yes" value="yes" />
<label for="mov_yes">Yes</label>
<input class="with-gap" onchange="settings()" name="mov" type="radio" id="mov_no" value="no" />
<label for="mov_no">No</label>
<br>
<h5>Auto folding</h5>
TheDesk does not collapse totes of 5 characters or less. Also, when collapsing, newlines are not shown. TheDesk count only newlines as the number of lines.
<br>
<input type="text" style="width:50px" id="sentence">linesaboveor
<input type="text" style="width:50px" id="letters">lettersabove
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Save</button>
<br>
<h5>Height of images
</h5>
<input type="text" style="width:50px" id="img-height">px
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Save</button>
<br>
<br>
</div>
</li>
<li>
<div class="collapsible-header">
<i class="material-icons">send</i>Posting Preferences
</div>
<div class="collapsible-body">
<h5>Default warining text</h5>
<input type="text" style="width:150px" id="cw-text">
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Save</button>
<br>
<h5>Default visibility</h5>
<input class="with-gap" onchange="settings()" name="vis" type="radio" id="public" value="public" />
<label for="public">Public</label>
<input class="with-gap" onchange="settings()" name="vis" type="radio" id="unlisted" value="unlisted" />
<label for="unlisted">Unlisted</label>
<input class="with-gap" onchange="settings()" name="vis" type="radio" id="private" value="private" />
<label for="private">Private</label>
<input class="with-gap" onchange="settings()" name="vis" type="radio" id="direct" value="direct" />
<label for="direct">Direct</label>
<input class="with-gap" onchange="settings()" name="vis" type="radio" id="memory" value="memory" />
<label for="memory">Memory(memorized as each instance)</label>
<input class="with-gap" onchange="settings()" name="vis" type="radio" id="server" value="server" />
<label for="server">Default of your visibility(Set on preferences of Mastodon instance)</label>
<br>
<h5>Posting images preferences</h5>
<input class="with-gap" onchange="settings()" name="img" type="radio" id="i_url" value="url" />
<label for="i_url">Insert media URL</label>
<input class="with-gap" onchange="settings()" name="img" type="radio" id="i_no-act" value="no-act" />
<label for="i_no-act">Insert nothig</label>
<br>
<input class="with-gap" onchange="settings()" name="img" type="radio" id="i_inline" value="inline" disabled />
<label for="i_inline">Disabled
<!--画像を投稿し、インラインで表示(Markdownに対応したインスタンスのみ。マルチアカウント環境では非推奨。)-->
</label>
<br>
<h5>Quote format</h5>
<input class="with-gap" onchange="settings()" name="quote" type="radio" id="q_simple" value="simple" />
<label for="q_simple">Only URL</label>
<input class="with-gap" onchange="settings()" name="quote" type="radio" id="q_mention" value="mention" />
<label for="q_mention">URL and acct(mention to the user)</label>
<input class="with-gap" onchange="settings()" name="quote" type="radio" id="q_full" value="full" />
<label for="q_full">URL, text and acct(mention to the user)
</label>
<br>
<h5>Default accounts of actions</h5>
Main account can be set on Account Manager.<br>
<input class="with-gap" onchange="settings()" name="main" type="radio" id="mn_remain" value="remain" />
<label for="mn_remain">Account you used recently</label>
<input class="with-gap" onchange="settings()" name="main" type="radio" id="mn_main" value="main" />
<label for="mn_main">Main account</label>
</label>
<br>
</div>
</li>
<li>
<div class="collapsible-header">
<i class="material-icons">keyboard</i>Keyboard shortcut Preferences
</div>
<div class="collapsible-body">
<h5>Easy inserter</h5>
You can insert any letters and emojis with only 3 keys<br>
Ctrl+Shift+1:<input type="text" style="width:150px" id="oks-1">
<button onclick="oks(1)" class="btn waves-effect" style="width:100px;">Save</button><br><br>
Ctrl+Shift+2:<input type="text" style="width:150px" id="oks-2">
<button onclick="oks(2)" class="btn waves-effect" style="width:100px;">Save</button><br><br>
Ctrl+Shift+3:<input type="text" style="width:150px" id="oks-3">
<button onclick="oks(3)" class="btn waves-effect" style="width:100px;">Save</button><br><br>
</div>
</li>
<li>
<div class="collapsible-header">
<i class="material-icons">bookmark</i>Mute & Emphasis Preferences
</div>
<div class="collapsible-body">
<h5>Client Mute</h5>
<div id="mute-cli"></div>
<h5>Client Emphasis</h5>
Click client name on toots to toggle mute and emphasis.
<h5>Words Mute</h5>
Enter to set<br>
<div class="chips" id="wordmute" style="background-color:gray;"></div>
<button onclick="wordmuteSave()" class="btn waves-effect" style="width:100px;">Save</button>
<h5>Words Emphasis</h5>
Enter to set<br>
<div class="chips" id="wordemp" style="background-color:gray;"></div>
<button onclick="wordempSave()" class="btn waves-effect" style="width:100px;">Save</button>
<h5>Users Emphasis</h5>
Set on users data modals.
<span class="emphasized"> Use this color to emphasis </span>
</div>
</li>
<li>
<div class="collapsible-header">
<i class="fa fa-spotify"></i>Spotify and NowPlaying Preferences
</div>
<div class="collapsible-body">
Click <i class="material-icons" style="font-size:24px;">music_note</i>icon to NowPlaying<br>
<h5>Account Connection</h5>
TheDesk save your data on thedesk.top server.<br>
<div id="spotify-code-show" class="hide"><input type="text" id="spotify-code"><button onclick="spotifyAuth()" class="btn waves-effect" style="width:100px;">Save</button></div>
<a onclick="spotifyConnect()" class="btn waves-effect nex" style="width:100%; max-width:200px; background-color:#1ed760;" id="spotify-enable"><i class="fa fa-spotify left"></i>Connect</a>
<a onclick="spotifyDisconnect()" class="btn waves-effect nex disabled" style="width:100%; max-width:200px; background-color:#1ed760;" id="spotify-disable"><i class="fa fa-spotify left"></i>Disconnect</a>
<h5>Edit a template</h5>
<br>
<textarea id="np-temp" class="materialize-textarea" data-length="500">#NowPlaying {song} / {album} / {artist}
{url}</textarea><br>
Refer:{song}:Song name/{album}:Album name/{artist}:Artist name/{url}:URL to Spotify<br>
iTunes NowPlaying:{url} is disabled, but composer:{composer}/spampling rate:{hz}/bit rate:{bitRate}/genre:{genre} are available.<br>
<span class="imas hide">CINDERELLA NowPlaying(imastodon.net限定)では作曲家{composer}/作詞家{lyricist}/BPM{bpm}が有効です。<br>
CINDERELLA NowPlayingはimastodon.netにログインしているとき、トゥート欄に「//」を入力し、その後に曲名を入れることで可能です。</span><br>
<button onclick="spotifySave()" class="btn waves-effect" style="width:100px;">Save</button>
<h5>Attach an Artwork of Spotify</h5>
<span class="imas hide">この設定はCINDERELLA NowPlaying(imastodon.net限定)にも適用されます。</span><br>
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_yes" value="yes" />
<label for="awk_yes">Yes</label>
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_no" value="no" />
<label for="awk_no">No</label>
<br>
</div>
</li>
<li>
<div class="collapsible-header">
<i class="material-icons">hearing</i>TTS(text to speech) Preferences
</div>
<div class="collapsible-body">
<h5>Speed</h5>
1-100(default:10)<br>
<p class="range-field"><input type="range" id="voicespeed" min="1" max="100" value="10" style="width:500px; max-width:100%"/></p>
<h5>Pitch</h5>
0-100(default:50)<br>
<p class="range-field"><input type="range" id="voicepitch" min="0" max="100" value="50" style="width:500px; max-width:100%"/></p>
<h5>Volume</h5>
0-100(default:100)<br>
<p class="range-field"><input type="range" id="voicevol" min="0" max="100" value="100" style="width:500px; max-width:100%"/></p>
<h5>Test</h5>
<input type="text" style="width:350px" id="voicetxt" value="TheDesk is an open-source Mastodon client for PC.">
<button class="btn waves-effect blue" style="width:150px;" onclick="voicePlay()" id="testplay">Play/Stop</button><br>
<br>
<button class="btn waves-effect" style="width:100px;" onclick="voiceSettings()">Save</button>
</div>
</li>
</ul>
<br>
<a href="index.html" class="btn waves-effect orange nex" style="width:100%; max-width:200px;"><i class="material-icons left">undo</i>Back</a>
<br>
<br>Keyboard shortcuts
<li>Ctrl+1-9:Jump to n(1-9)th column</li>
<li>N:Open toot box</li>
<li>X:Toggle toot box</li>
<li>Ctrl+Enter:Post</li>
<li>Ctrl+E:Make all notifications read</li>
<li>Esc:Hide toot box</li>
<li>F5:Super Reload</li>
<li>Ctrl+Shift+C:Clear toot box</li>
<li>Ctrl+Shift+S:Preferences</li>
<li>Ctrl+Shift+M:Account Manager</li>
<li>Ctrl+Shift+N:NowPlaying(Spotify)</li>
<li>Ctrl+Shift+P:Show profile of selecting</li>
<li>←/→:Show next or previous image</li>
<li>Mousewheel:Zoom a image</li>
<div class="hide kirishima">
以下Markdownに対応したインスタンスのみ。
<br>
<li>Ctrl+B/I/S/U:太字/斜字/取り消し/下線</li>
<li>Shift+Enter:全角スペースを入れて改行</li>
<li>Shift+Space:ゼロ幅スペース</li>
以下アスタルテにログインしている場合のみ
<br>
<li>Ctrl+R:
<a href="https://astarte.thedesk.top">アスタルテ暇人ランキング</a>を開く
</li><br>
</div>
<button class="btn waves-effect red" style="width:100%; max-width:500px;" onclick="if(confirm('初期化します')){ localStorage.clear(); location.href='index.html'; }"><i class="material-icons left">delete</i>Reset(Danger)</button><br><br>
<button class="btn waves-effect indigo" onclick="about()" style="width:100%; max-width:500px;"><i class="material-icons left">info</i>About TheDesk</button>
<a href="https://thedesk.top" class="btn waves-effect deep-purple lighten-2" style="width:100%; max-width:500px;"><i class="material-icons left">web</i>Website</a>
<a href="https://enty.jp/Cutls" class="btn waves-effect purple lighten-2" style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>Support(Enty)</a>
<a href="https://docs.thedesk.top" class="btn waves-effect blue darken-2" style="width:100%; max-width:500px;"><i class="material-icons left">list</i>Help/Docs(Constructing)</a>
<a href="https://github.com/cutls/TheDesk" class="btn waves-effect black lighten-2" style="width:100%; max-width:500px;"><i class="fa fa-github left"></i>GitHub</a>
<a href="index.html?mode=user&code=Cutls@kirishima.cloud" class="btn waves-effect blue lighten-2" style="width:100%; max-width:500px;"><img src="./img/desk_full.svg" class="left" width="25" style="padding-top:5px;">Developer: Cutls@kirishima.cloud</a>
<a class="btn waves-effect red lighten-2" href="https://osushi.love/Cutls_P" target="_blank" style="width:100%; max-width:500px;"><img src="./img/sushi.svg" class="left" width="25" style="padding-top:5px;">Give me a sushi!</a>
<br>
<a onclick="localStorage.removeItem('new-ver-skip'); location.href='index.html';" class="pointer">Check update</a><br>
<a href="oss.html">OSS License</a><br>
<span style="font-family:Open Sans;">Copyright &copy; TheDesk 2018 All Rights Reserved.
<a href="https://github.com/cutls/TheDesk/blob/master/LICENSE.md">TheDesk LICENSE (Latest Ver.)</a>
<br>Developer: Cutls P(
<a href="index.html?mode=user&code=Cutls@kirishima.cloud">@Cutls@kirishima.cloud</a>)
<br>
</span><br>
TheDeskおよびCutls Pは<a href="https://donken.org/">被災地支援のためのマストドン研究会</a>をログイン機能提供等の形で応援しています。<br>
タグタイムラインを開く:<a href="index.html?mode=tag&code=被災地支援のためのマストドン研究会">#被災地支援のためのマストドン研究会</a><br>
<script type="text/javascript" src="./js/common/about.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script>
<script type="text/javascript" src="./js/login/logout.js"></script>
<script type="text/javascript" src="./js/ui/spotify.js"></script>
<script type="text/javascript" src="./js/tl/speech.js"></script>
<script type="text/javascript" src="./js/ui/settings.js"></script>
<script type="text/javascript" src="./js/ui/theme.js"></script>
<script type="text/javascript" src="./js/tl/date.js"></script>

View File

@ -316,7 +316,7 @@
<a href="https://astarte.thedesk.top">アスタルテ暇人ランキング</a>を開く
</li><br>
</div>
<button class="btn waves-effect red" style="width:100%; max-width:500px;" onclick="if(confirm('初期化します')){ localStorage.clear(); location.href='index.html'; }"><i class="material-icons left">delete</i>{{reset}}</button><br><br>
<button class="btn waves-effect red" style="width:100%; max-width:500px;" onclick="if(confirm('{{resetconfirm}}')){ localStorage.clear(); location.href='index.html'; }"><i class="material-icons left">delete</i>{{reset}}</button><br><br>
<button class="btn waves-effect indigo" onclick="about()" style="width:100%; max-width:500px;"><i class="material-icons left">info</i>{{about}}</button>
<a href="https://thedesk.top" class="btn waves-effect deep-purple lighten-2" style="width:100%; max-width:500px;"><i class="material-icons left">web</i>{{hp}}</a>
<a href="https://enty.jp/Cutls" class="btn waves-effect purple lighten-2" style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>{{support}}(Enty)</a>

View File

@ -1,91 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<title>Update - TheDesk</title>
<link href="./css/materialize.css" type="text/css" rel="stylesheet">
<link href="./css/master.css" type="text/css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Open+Sans:300" rel="stylesheet">
<meta charset="utf-8">
</head>
<body>
<style>
body{
font-family:'Open Sans';
-webkit-app-region: drag;
cursor: move;
padding:10px;
}
a,button{
-webkit-app-region: no-drag;
}</style>
<script type="text/javascript" src="./js/common/jquery.js"></script>
<script type="text/javascript" src="./js/platform/first.js"></script>
<script type="text/javascript" src="./js/common/materialize.js"></script>
<h5>Latest TheDesk[TheDesk <span id="ver"></span>]</h5>
<span id="det"></span><br>
Current version<span id="now"></span><br>
TheDesk will be quit TheDesk after downloading.<br>
<button id="update" class="waves-effect btn" onclick="update('true')">Download</button>
<p id="prog"></p>
<div class="progress">
<div class="determinate" style="width: 0%"></div>
</div><br>
Delivered by Amazon Web Services(S3/CloudFront)<br>
Visit a releasenote of <a href="https://github.com/cutls/TheDesk/blob/master/LATEST.md">GitHub</a><br><br>
Skip this uodate(<a onclick="window.close();" class="pointer">until next TL loading</a>/<a onclick="nextv();" class="pointer">until next version</a>)<br>
<a onclick="quit()" class="pointer">Quit</a><br>
<a onclick="about()" class="pointer">About TheDesk</a><br>
Some problems? Please download on <a href="https://thedesk.top">TheDesk HP</a>
<script type="text/javascript" src="./js/common/about.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script>
<script>
var electron = require("electron");
var ipc = electron.ipcRenderer;
verck();
function update(sel){
$("#prog").text("");
ipc.send('download-btn', [sel,enc(localStorage.getItem("next-ver"))]);
}
function quit(){
ipc.send('quit', 'go');
}
ipc.on('prog', function (event, arg) {
console.log(arg);
$(".determinate").css('width',arg*100+"%");
$("#prog").text("Downloading:"+Math.floor(arg*100)+"%");
})
ipc.on('mess', function (event, arg) {
console.log(arg);
$("#prog").text(arg);
})
function verck(){
var start="https://thedesk.top/ver.json";
fetch(start, {
method: 'GET',
headers: {'content-type': 'application/json'},
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
$("#ver").text(json.desk);
localStorage.setItem("next-ver",json.desk);
$("#det").text(json.detail);
$("#now").text(localStorage.getItem("ver"));
});
}
function nextv(){
localStorage.setItem("new-ver-skip","true");
window.close();
}
function enc(ver){
var ver = ver.replace( /\s/g , "" );
var ver = ver.replace( /\(/g , "-" );
var ver = ver.replace( /\)/g , "" );
var ver = ver.replace( /\[/g , "_" );
var ver = ver.replace( /\]/g , "" );
return ver;
}
</script>