Compare commits
756 Commits
v18.8.3
...
use-strict
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
957ef30fc0 | ||
|
|
bae73521e9 | ||
|
|
2583c3b80a | ||
|
|
b35ecbf79c | ||
|
|
2b6cf60868 | ||
|
|
ce72432039 | ||
|
|
b3689fe297 | ||
|
|
4a6e8c733f | ||
|
|
de2ac24382 | ||
|
|
e7aa01c547 | ||
|
|
72b060e7ae | ||
|
|
2a99a79d37 | ||
|
|
d1e6fac1b0 | ||
|
|
63802c98a3 | ||
|
|
3bd8520e7c | ||
|
|
662c15da93 | ||
|
|
dd0fd325b8 | ||
|
|
b772b03ef2 | ||
|
|
eda554eb8f | ||
|
|
2936bd1e5a | ||
|
|
df2f86f577 | ||
|
|
b9d1899cf2 | ||
|
|
b01497e391 | ||
|
|
af38681293 | ||
|
|
022565e176 | ||
|
|
00863d6917 | ||
|
|
e345b3a479 | ||
|
|
fe32723ad5 | ||
|
|
b9d562d8f0 | ||
|
|
83bd9499fd | ||
|
|
d3911792ec | ||
|
|
5c49715298 | ||
|
|
2b3feb40ad | ||
|
|
f7dbeaef84 | ||
|
|
31472e3206 | ||
|
|
2e88a8e0c3 | ||
|
|
224d762bc6 | ||
|
|
2fa1299391 | ||
|
|
dad459694c | ||
|
|
c2fa24c956 | ||
|
|
e55ea3bd0c | ||
|
|
ae9e6c4a56 | ||
|
|
2a5bb034ab | ||
|
|
49f190a471 | ||
|
|
3f5a870877 | ||
|
|
fd3cf1eb9f | ||
|
|
9a49979dcb | ||
|
|
6a11099b50 | ||
|
|
5c5c57739a | ||
|
|
8e663391b9 | ||
|
|
85ccbd1382 | ||
|
|
542ee57f93 | ||
|
|
f3fa854074 | ||
|
|
714feca455 | ||
|
|
f0db66d8d8 | ||
|
|
cd74236462 | ||
|
|
955c95e8a8 | ||
|
|
ebdacc013a | ||
|
|
d08c2ecd74 | ||
|
|
ef9b851309 | ||
|
|
083139efa7 | ||
|
|
bd11f7da50 | ||
|
|
472e9268a1 | ||
|
|
e6ce764084 | ||
|
|
b8fcd11a62 | ||
|
|
f35232cc52 | ||
|
|
615b89be3a | ||
|
|
ffa4ecd673 | ||
|
|
5dfb28f2de | ||
|
|
25d24ddef0 | ||
|
|
dcc9aba4a8 | ||
|
|
9977c009e0 | ||
|
|
2fd45f9e31 | ||
|
|
4f7eb88a13 | ||
|
|
1455f04261 | ||
|
|
9f9e4d6d6e | ||
|
|
3ab45a57e1 | ||
|
|
3d5485072c | ||
|
|
8c2083955f | ||
|
|
450c6a758f | ||
|
|
24f3e1e758 | ||
|
|
b9103abe96 | ||
|
|
a7f8793454 | ||
|
|
7b28981e9c | ||
|
|
ca41ca955c | ||
|
|
dd086e62cb | ||
|
|
3e2d40d248 | ||
|
|
bb08ec2435 | ||
|
|
0677c24887 | ||
|
|
29277236ca | ||
|
|
7579957fdf | ||
|
|
257d0d313d | ||
|
|
4b970ef770 | ||
|
|
6ec35e37ab | ||
|
|
72f461f0d2 | ||
|
|
32c7f52882 | ||
|
|
4943b3ad20 | ||
|
|
7eccc04e98 | ||
|
|
88e65c36bf | ||
|
|
5e13d86778 | ||
|
|
0e89f8bc4d | ||
|
|
a9a57822ef | ||
|
|
df25b4e609 | ||
|
|
b3ca402842 | ||
|
|
a52d7aee73 | ||
|
|
7214ff001a | ||
|
|
0e731c3e8a | ||
|
|
4f858cf7d6 | ||
|
|
3e5f9c51f5 | ||
|
|
8784cae01c | ||
|
|
81a3da550f | ||
|
|
7fc06d0750 | ||
|
|
1e0ebe9b7f | ||
|
|
73b7abd894 | ||
|
|
132f7253f6 | ||
|
|
827d581f1a | ||
|
|
9a315c241c | ||
|
|
5f9ddd969e | ||
|
|
cacf7f9920 | ||
|
|
d642729158 | ||
|
|
6b339b636a | ||
|
|
85468761d3 | ||
|
|
4cabeb2e99 | ||
|
|
f7d89b7659 | ||
|
|
6b5c527a3e | ||
|
|
57cbab10ac | ||
|
|
f50c2d3049 | ||
|
|
9957bd9b8a | ||
|
|
e6767dc3f9 | ||
|
|
136935d4f9 | ||
|
|
d654b63bca | ||
|
|
3ba4dee8a7 | ||
|
|
d4e0a50dbb | ||
|
|
3d4e35d942 | ||
|
|
5dcdbcdb53 | ||
|
|
d3a6ad1105 | ||
|
|
f233ca3284 | ||
|
|
f4914d9461 | ||
|
|
433aac37da | ||
|
|
fa34f5483e | ||
|
|
defa748497 | ||
|
|
c70b78d0c7 | ||
|
|
570b0c3e6a | ||
|
|
62a8d9b0f6 | ||
|
|
97e1e4ce53 | ||
|
|
b5655b530f | ||
|
|
b2c2530a1a | ||
|
|
c0a1139773 | ||
|
|
e452f8e006 | ||
|
|
7de625e004 | ||
|
|
8106296f6c | ||
|
|
7df901756f | ||
|
|
b41984e153 | ||
|
|
376c7f2545 | ||
|
|
d5df64f949 | ||
|
|
c9b2a66114 | ||
|
|
530917b85e | ||
|
|
b118e61741 | ||
|
|
635df4dd09 | ||
|
|
dccdc6290e | ||
|
|
573c461aa2 | ||
|
|
5a76eb28bf | ||
|
|
48028a8e09 | ||
|
|
1917531c54 | ||
|
|
a9d2bc08b7 | ||
|
|
e4ddd6ad8c | ||
|
|
aaf318de03 | ||
|
|
3c80cc0670 | ||
|
|
a01d89db30 | ||
|
|
26090084ff | ||
|
|
ab0ce56033 | ||
|
|
527854bbed | ||
|
|
f9de846ad5 | ||
|
|
57fbb15685 | ||
|
|
8986107256 | ||
|
|
2326d409a4 | ||
|
|
bcbccd5cb1 | ||
|
|
d47373e3b5 | ||
|
|
9ffcfa7f41 | ||
|
|
9a7ff92b5b | ||
|
|
a53f2ace64 | ||
|
|
280f6c4c9a | ||
|
|
cc33e8fa1b | ||
|
|
52b649b1c4 | ||
|
|
4194412540 | ||
|
|
9f2f0e29be | ||
|
|
e43107ccf7 | ||
|
|
c2ebadd87a | ||
|
|
3521e7b0e7 | ||
|
|
9d0aad933e | ||
|
|
3bd3df8fb2 | ||
|
|
71e1f5ae9d | ||
|
|
36c3d354cd | ||
|
|
9f0af1ba86 | ||
|
|
f74e2262dc | ||
|
|
2971144d7f | ||
|
|
2e2723427b | ||
|
|
ee6127ffcc | ||
|
|
dcd6fa6958 | ||
|
|
7442216962 | ||
|
|
bb0c781daa | ||
|
|
56e5a5ac53 | ||
|
|
419fa4906d | ||
|
|
16e7617b1e | ||
|
|
2ca5798f89 | ||
|
|
a08ddc1b8c | ||
|
|
83153e2777 | ||
|
|
5b72b93248 | ||
|
|
c7d911451c | ||
|
|
c400cc317d | ||
|
|
50784c9958 | ||
|
|
c4a5d406c7 | ||
|
|
d933eef8cc | ||
|
|
ce84069429 | ||
|
|
8140e56cbc | ||
|
|
de40e0e22a | ||
|
|
44ccd111b2 | ||
|
|
7ac0889b78 | ||
|
|
c4a5996b21 | ||
|
|
9eaca7bcb2 | ||
|
|
90629aecb4 | ||
|
|
cb6a75de3b | ||
|
|
9bb066596c | ||
|
|
a0b6610b7d | ||
|
|
c4e06f90f8 | ||
|
|
60a525f0b8 | ||
|
|
fe6067eeed | ||
|
|
f72294e2b9 | ||
|
|
409b98dd39 | ||
|
|
0168b882a8 | ||
|
|
9aa83354bd | ||
|
|
e311d82b0a | ||
|
|
531e526d33 | ||
|
|
a2a6c49ae0 | ||
|
|
15ae6d91d9 | ||
|
|
f3ba3706ba | ||
|
|
0ab6ea2e26 | ||
|
|
05d17f329f | ||
|
|
c7e9b67698 | ||
|
|
f654620816 | ||
|
|
5bd4885241 | ||
|
|
91643b06f2 | ||
|
|
d35ec1b7c4 | ||
|
|
d2609d11ab | ||
|
|
014d3499f0 | ||
|
|
edd8a412b5 | ||
|
|
7c57eef9f7 | ||
|
|
8df4d5d808 | ||
|
|
98b0fd4a4f | ||
|
|
3e8c9acb02 | ||
|
|
d829dd01de | ||
|
|
41803d21c9 | ||
|
|
b58b66178c | ||
|
|
7c40cf1fb7 | ||
|
|
a923c62dac | ||
|
|
00d9c91a53 | ||
|
|
6fa101c699 | ||
|
|
1372833dd8 | ||
|
|
7d57750d73 | ||
|
|
28c06706b4 | ||
|
|
18146d2ef7 | ||
|
|
52c65afce6 | ||
|
|
8f76c9b09d | ||
|
|
fffc94fbdd | ||
|
|
1f398a8b4c | ||
|
|
98f4010cb7 | ||
|
|
d34e8940a7 | ||
|
|
bbf3c33a89 | ||
|
|
f69fee98df | ||
|
|
f9b717965f | ||
|
|
01ad439d0a | ||
|
|
29ad8d9dbc | ||
|
|
6ffad11cba | ||
|
|
dc62840299 | ||
|
|
ae9c669ca3 | ||
|
|
cd4b9b3be6 | ||
|
|
e7fc5719e3 | ||
|
|
29350e0782 | ||
|
|
2c9821e670 | ||
|
|
a61050f8fa | ||
|
|
747d25b439 | ||
|
|
cafd36b85d | ||
|
|
d7450d9699 | ||
|
|
4224a02d16 | ||
|
|
82bf21d54b | ||
|
|
e2672d5d94 | ||
|
|
8d30ccf6fe | ||
|
|
be995930a0 | ||
|
|
fbd52c5a85 | ||
|
|
10e7a7fd27 | ||
|
|
92a0ec03b1 | ||
|
|
83a07f7ee4 | ||
|
|
32628be87b | ||
|
|
102e8964ee | ||
|
|
742ea9f245 | ||
|
|
25f843331c | ||
|
|
c6680d1f03 | ||
|
|
f5279fc91e | ||
|
|
ba50376c85 | ||
|
|
dd1395f3f4 | ||
|
|
450df2ce6a | ||
|
|
f9e384a87d | ||
|
|
81484b7ae3 | ||
|
|
a14809a96a | ||
|
|
1753b01a1b | ||
|
|
86e7924675 | ||
|
|
e0daa923c6 | ||
|
|
32c67d5f62 | ||
|
|
7580706bd0 | ||
|
|
68da5085ea | ||
|
|
55d0c0f66b | ||
|
|
5d35d56837 | ||
|
|
a9b150960e | ||
|
|
72a9e81ba1 | ||
|
|
0032a51051 | ||
|
|
faa9102815 | ||
|
|
525ce59b8b | ||
|
|
00055a9f32 | ||
|
|
3da62e366f | ||
|
|
66ba0fe18e | ||
|
|
cc7a7386be | ||
|
|
f1a89f1001 | ||
|
|
83ad5538b0 | ||
|
|
8e1497cf71 | ||
|
|
9b4da63b0d | ||
|
|
1fad5adbd2 | ||
|
|
72497154a7 | ||
|
|
5dcab4fe9e | ||
|
|
d592f5eb62 | ||
|
|
d85cbca8ea | ||
|
|
be92ae76d6 | ||
|
|
3cfedd4ae9 | ||
|
|
cd88acf337 | ||
|
|
adf628b3b0 | ||
|
|
bbb945283b | ||
|
|
10b7691313 | ||
|
|
1e93556f8e | ||
|
|
77bfb852e0 | ||
|
|
abeb0ad82f | ||
|
|
722304c4a1 | ||
|
|
9e5ea8c052 | ||
|
|
e6dc46a270 | ||
|
|
cf0fffcc3b | ||
|
|
64835b0de9 | ||
|
|
ca3ae925d1 | ||
|
|
245e17ed42 | ||
|
|
22605323c1 | ||
|
|
ca0e8f93f9 | ||
|
|
8f763f9c5c | ||
|
|
1e8e619762 | ||
|
|
5d3d5b4c72 | ||
|
|
81029b203e | ||
|
|
1fbfb3970d | ||
|
|
aa9e590574 | ||
|
|
495ef70d41 | ||
|
|
8d45bf6ee9 | ||
|
|
5ea7e397c6 | ||
|
|
70af77f06e | ||
|
|
21da8f0274 | ||
|
|
9be2b578a2 | ||
|
|
bcbc640840 | ||
|
|
a569240444 | ||
|
|
f071b9c4f2 | ||
|
|
681f116733 | ||
|
|
b1bfa713e2 | ||
|
|
8133bf1916 | ||
|
|
7fc61cdad3 | ||
|
|
0f926c96c8 | ||
|
|
557409ea72 | ||
|
|
f0a847b135 | ||
|
|
5181b271bc | ||
|
|
38fe00fbe0 | ||
|
|
be100b24d1 | ||
|
|
0ef338b1e8 | ||
|
|
12130f8601 | ||
|
|
dfe6c9e8e7 | ||
|
|
cfd4d18c62 | ||
|
|
7ee60c8986 | ||
|
|
0fee24734d | ||
|
|
4b7895c3ab | ||
|
|
63610a324c | ||
|
|
7a72daf3ec | ||
|
|
f33acd67ec | ||
|
|
9a5ac036d6 | ||
|
|
e0d8094268 | ||
|
|
1d5648f882 | ||
|
|
d528093510 | ||
|
|
738a11d96f | ||
|
|
01744889fb | ||
|
|
f5c4362f0d | ||
|
|
268dd4d469 | ||
|
|
41c207af14 | ||
|
|
513b7ecd78 | ||
|
|
83fb4663f6 | ||
|
|
7e88993b5c | ||
|
|
6e6b7f37b2 | ||
|
|
a1152446d9 | ||
|
|
3eab9b30a1 | ||
|
|
573587b894 | ||
|
|
adfb395492 | ||
|
|
b4b4f09287 | ||
|
|
31c80ff07b | ||
|
|
d20e94b422 | ||
|
|
1e7fefbde9 | ||
|
|
42f68a1109 | ||
|
|
f47c704e29 | ||
|
|
be3cfd8d2d | ||
|
|
d6ded9e64b | ||
|
|
6b0704ec76 | ||
|
|
a896ae69d0 | ||
|
|
9ba4fe2d0f | ||
|
|
29b904998e | ||
|
|
bf422cb0b2 | ||
|
|
bf87c3e3f1 | ||
|
|
b96c6bd324 | ||
|
|
0293318b59 | ||
|
|
38588b8204 | ||
|
|
f2d22e6b7f | ||
|
|
45848306bc | ||
|
|
b160b25d7d | ||
|
|
d1e6d533fc | ||
|
|
ee168ed5e2 | ||
|
|
6c8e3d88bd | ||
|
|
77b2e416c1 | ||
|
|
e02eefdc8e | ||
|
|
fd4f5ec574 | ||
|
|
b327b38113 | ||
|
|
76ad662f56 | ||
|
|
4ad3c397b6 | ||
|
|
75d2b46c7a | ||
|
|
a7659a0c2e | ||
|
|
e3a740f66a | ||
|
|
af281481d5 | ||
|
|
5f6758554d | ||
|
|
2b2a8c1d2e | ||
|
|
156f5aec91 | ||
|
|
9045e5aa90 | ||
|
|
5ca9d2f1b1 | ||
|
|
6cb5bcfb0c | ||
|
|
ffaff7c356 | ||
|
|
130fc4996f | ||
|
|
a95141048d | ||
|
|
2d82382f34 | ||
|
|
6afd975913 | ||
|
|
0df0eb104c | ||
|
|
f1c5d3605c | ||
|
|
afed289647 | ||
|
|
22fb1fb8c9 | ||
|
|
5809d4efca | ||
|
|
332e215c85 | ||
|
|
9eefbe9fb9 | ||
|
|
3fa86d3236 | ||
|
|
f0e125df08 | ||
|
|
8bf7d0efd4 | ||
|
|
8a71dfa591 | ||
|
|
928dee677f | ||
|
|
bf5500eb19 | ||
|
|
a5efb1b4b6 | ||
|
|
5aa77a67a8 | ||
|
|
c5c22f8dc9 | ||
|
|
ad3ae5e6b1 | ||
|
|
ed029ecb01 | ||
|
|
ff45c64a22 | ||
|
|
c953091e8d | ||
|
|
fd30ab7168 | ||
|
|
dca3dddba0 | ||
|
|
41eb4c54a4 | ||
|
|
15a2333010 | ||
|
|
1061d2867f | ||
|
|
64ba1f1ea1 | ||
|
|
196cc664c8 | ||
|
|
1d871d4d68 | ||
|
|
89475a9838 | ||
|
|
52d335cbfd | ||
|
|
333ca4f36a | ||
|
|
d2e18c5400 | ||
|
|
f04cc92b44 | ||
|
|
fa3a048a6c | ||
|
|
6200034dd0 | ||
|
|
9a25d82c48 | ||
|
|
95e0d3953e | ||
|
|
fb91da4b69 | ||
|
|
74fcd2df7b | ||
|
|
1a88a08454 | ||
|
|
688cf579d6 | ||
|
|
ba9ba5f55b | ||
|
|
8341733dc2 | ||
|
|
54f7a0f20e | ||
|
|
b2382d91d6 | ||
|
|
b729780ac1 | ||
|
|
6f4c516d0c | ||
|
|
b9bdcba4f9 | ||
|
|
bd69863799 | ||
|
|
375fdc444e | ||
|
|
e832592b35 | ||
|
|
a15d4e097e | ||
|
|
2597d2455c | ||
|
|
16e817d42c | ||
|
|
c6d39a9e60 | ||
|
|
b860f1a170 | ||
|
|
0cebd0b7f3 | ||
|
|
91742c1b80 | ||
|
|
64bc79de38 | ||
|
|
55239be477 | ||
|
|
0feebb662f | ||
|
|
1699f9d141 | ||
|
|
7ac9df9496 | ||
|
|
2074818cd0 | ||
|
|
ecb3eaf541 | ||
|
|
345455da4b | ||
|
|
1937fddbfd | ||
|
|
e7534bbcbd | ||
|
|
305192eae6 | ||
|
|
0541aa3373 | ||
|
|
81fe8b7435 | ||
|
|
4ca26b4e32 | ||
|
|
d348a67ba8 | ||
|
|
e2f03ee8d6 | ||
|
|
0e64c46064 | ||
|
|
987a4125ae | ||
|
|
a7e4c1a5a5 | ||
|
|
6d66982d35 | ||
|
|
7c78e05649 | ||
|
|
61383ef294 | ||
|
|
469d4ec566 | ||
|
|
418f1146b7 | ||
|
|
170c8885d0 | ||
|
|
e3f04f4ab8 | ||
|
|
791b8142bd | ||
|
|
ffff89ae96 | ||
|
|
3c8b0f6308 | ||
|
|
a01aa8c335 | ||
|
|
1dc1e6f081 | ||
|
|
b86447cdbf | ||
|
|
bf1e805269 | ||
|
|
0b0d551730 | ||
|
|
22016d2856 | ||
|
|
6ef5d66521 | ||
|
|
bbf80408d4 | ||
|
|
f7c7614625 | ||
|
|
c5e71230e3 | ||
|
|
d61e15a02c | ||
|
|
981d286e13 | ||
|
|
f58c3e9a67 | ||
|
|
c316c381f8 | ||
|
|
066ae678f9 | ||
|
|
c3a75a5525 | ||
|
|
14257ba448 | ||
|
|
2c7e86fa97 | ||
|
|
63d7b7a471 | ||
|
|
98a882f450 | ||
|
|
868fd1ddc5 | ||
|
|
9c19819a08 | ||
|
|
62ef634bc0 | ||
|
|
f4158deb0a | ||
|
|
e61a224fc6 | ||
|
|
c83fb868e4 | ||
|
|
0a118f1740 | ||
|
|
d5d6edd2fb | ||
|
|
e17382f441 | ||
|
|
6c6fe5378f | ||
|
|
b68a31b2ee | ||
|
|
0be362e82c | ||
|
|
17a917ad00 | ||
|
|
f975fbf221 | ||
|
|
1741813003 | ||
|
|
7e7e24021b | ||
|
|
a662106228 | ||
|
|
be98a562d4 | ||
|
|
2af4692e1a | ||
|
|
b525ac18bc | ||
|
|
3fdca1ba64 | ||
|
|
9cc721bf80 | ||
|
|
d9cbd5d173 | ||
|
|
59f5cb9d35 | ||
|
|
bd020c14fb | ||
|
|
7b9f814d37 | ||
|
|
7a6fe30ee5 | ||
|
|
9910adbb40 | ||
|
|
ad6a578863 | ||
|
|
365120ed9f | ||
|
|
dbd0541ad1 | ||
|
|
7ce16856ec | ||
|
|
8fff3e4ec0 | ||
|
|
53f559a750 | ||
|
|
924fc30697 | ||
|
|
41955f8927 | ||
|
|
83689f420c | ||
|
|
1c68a0fd4b | ||
|
|
9e25db7089 | ||
|
|
7eacd54a9c | ||
|
|
be44519431 | ||
|
|
66f35b2720 | ||
|
|
23902d2465 | ||
|
|
1c3717edef | ||
|
|
17fa0f3eb0 | ||
|
|
247e19f1e3 | ||
|
|
54fae816d2 | ||
|
|
3b70a2cc2d | ||
|
|
acd4a16dcb | ||
|
|
550c84c367 | ||
|
|
e35e0be251 | ||
|
|
db5ada2cfb | ||
|
|
643f452064 | ||
|
|
bbda6c6785 | ||
|
|
e6449cd818 | ||
|
|
708527db77 | ||
|
|
b1aa6c5699 | ||
|
|
eeaa1a7f07 | ||
|
|
52b7183935 | ||
|
|
386833ae64 | ||
|
|
d4a48ce585 | ||
|
|
4931cdd272 | ||
|
|
d7933dc73f | ||
|
|
9a1048cc17 | ||
|
|
a8fd0736b3 | ||
|
|
10d884a837 | ||
|
|
52b28c79c7 | ||
|
|
8a36e55813 | ||
|
|
5103bb2697 | ||
|
|
c6a07714ba | ||
|
|
48c3500033 | ||
|
|
d155e75a5d | ||
|
|
fa481129a9 | ||
|
|
3c1402dab7 | ||
|
|
a7f4189bd3 | ||
|
|
64ed13de7c | ||
|
|
21394eb29e | ||
|
|
fbb8c3613f | ||
|
|
7778da80d5 | ||
|
|
e791e102d5 | ||
|
|
deb73450c3 | ||
|
|
cc9d1bf4f2 | ||
|
|
b025ef8b22 | ||
|
|
7bda0f400a | ||
|
|
3b7a113a11 | ||
|
|
ee636bf88c | ||
|
|
52144d8e52 | ||
|
|
513c686dea | ||
|
|
29cc2429ae | ||
|
|
31219e9ac1 | ||
|
|
3beab5a9e1 | ||
|
|
7558311531 | ||
|
|
106d08a899 | ||
|
|
02f203475d | ||
|
|
b4460eddf7 | ||
|
|
90e06116d1 | ||
|
|
1e4397ed7b | ||
|
|
e9cc2d0e52 | ||
|
|
376847b489 | ||
|
|
5d61b83c50 | ||
|
|
561b3a594b | ||
|
|
2d0acb68b1 | ||
|
|
919c6c40e2 | ||
|
|
120e9da1c9 | ||
|
|
47c6454c00 | ||
|
|
02f49cd392 | ||
|
|
8117ddb6ce | ||
|
|
d372fa8e6e | ||
|
|
c3ed865a3a | ||
|
|
96c137ec4b | ||
|
|
c5cd683aa5 | ||
|
|
c5cdabaa3a | ||
|
|
d19be3f2cb | ||
|
|
a9f55aa64f | ||
|
|
dfb0f79c92 | ||
|
|
4a59438c0c | ||
|
|
f35710d652 | ||
|
|
c19a532f3e | ||
|
|
be6b278b3c | ||
|
|
78c16dc278 | ||
|
|
09d2839a00 | ||
|
|
d17d52436f | ||
|
|
5c522a33d0 | ||
|
|
c9cf89adeb | ||
|
|
c5c996cb7a | ||
|
|
f2ec258e7a | ||
|
|
8c29f21970 | ||
|
|
5b730d2c38 | ||
|
|
609e84a8ae | ||
|
|
7ca778f81b | ||
|
|
93b194af3b | ||
|
|
b3e1f32ffe | ||
|
|
d78b3bffeb | ||
|
|
bff5038a64 | ||
|
|
0c7fcfbcc5 | ||
|
|
9d6fc15959 | ||
|
|
5bad5e1031 | ||
|
|
f8d6ec3a8f | ||
|
|
9a3dc81630 | ||
|
|
3d9b97ccb5 | ||
|
|
2c3dbba052 | ||
|
|
907eecd030 | ||
|
|
75026bf42d | ||
|
|
d217fb33a9 | ||
|
|
8cea32d01b | ||
|
|
c8d2da0c07 | ||
|
|
a458f51b9a | ||
|
|
bd8ac2935b | ||
|
|
dd59cc1468 | ||
|
|
fd365c52cc | ||
|
|
ad7e77a067 | ||
|
|
6b9135a205 | ||
|
|
fdca5b1c60 | ||
|
|
f891b30f9f | ||
|
|
8fbd8070f2 | ||
|
|
657dec1c10 | ||
|
|
0d93dcdc45 | ||
|
|
5a50c0e1e6 | ||
|
|
ab8da89fbc | ||
|
|
c9edf47643 | ||
|
|
84328bf693 | ||
|
|
6fdbf0b48e | ||
|
|
8b1d5b3cb4 | ||
|
|
bf69d23379 | ||
|
|
a4e3031796 | ||
|
|
286e7956f2 | ||
|
|
e04b64a326 | ||
|
|
c86a99df06 | ||
|
|
3b69c4e7c1 | ||
|
|
bc5be9449d | ||
|
|
b968e59db1 | ||
|
|
fa06c4a729 | ||
|
|
81b99515cd | ||
|
|
5e6c713f9d | ||
|
|
376425cc98 | ||
|
|
38cff550e1 | ||
|
|
64781c1cca | ||
|
|
e82e85b5ea | ||
|
|
2b84a27cdc | ||
|
|
6f7f5cbabc | ||
|
|
174a8696b0 | ||
|
|
d5a27ba814 | ||
|
|
6e2e488565 | ||
|
|
7d02ef2b3e | ||
|
|
f8f2719c5d | ||
|
|
da6faaf1a5 | ||
|
|
350068d6f1 | ||
|
|
70bee4265b | ||
|
|
18ce8cf2f4 | ||
|
|
b50a55cce7 | ||
|
|
e6f0e18aed | ||
|
|
fd7daa407a | ||
|
|
0dead93606 | ||
|
|
5d6e8cf9b3 | ||
|
|
a0544e21e3 | ||
|
|
d54112d41c | ||
|
|
1a0ba40b43 | ||
|
|
5d8ca9566a | ||
|
|
834fa719b2 | ||
|
|
89bde2739a | ||
|
|
46dbc9ae62 | ||
|
|
71554fca59 | ||
|
|
1c76b5886f | ||
|
|
5007b70683 | ||
|
|
5694cbd945 |
12
.gitignore
vendored
12
.gitignore
vendored
@@ -12,4 +12,14 @@ enq.md
|
||||
app/.tkn
|
||||
app/node_modules
|
||||
app/js/login/tkn.js
|
||||
app/package-lock.json
|
||||
app/view/en
|
||||
app/view/ja
|
||||
app/view/ja-KS
|
||||
app/view/de
|
||||
app/view/bg
|
||||
app/view/cs
|
||||
app/view/ps
|
||||
app/view/es-AR
|
||||
app/git
|
||||
*.code-workspace
|
||||
releasenote.md
|
||||
|
||||
13
.travis.yml
13
.travis.yml
@@ -3,20 +3,26 @@ os:
|
||||
- linux
|
||||
- osx
|
||||
language: node_js
|
||||
env:
|
||||
- YARN_GPG=no
|
||||
node_js:
|
||||
- '10.15.2'
|
||||
cache:
|
||||
yarn: true
|
||||
script: node -v
|
||||
before_deploy:
|
||||
- npm install electron-builder -g
|
||||
- yarn global add electron-builder
|
||||
- cd app
|
||||
- VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,\",]//g' | tr -d '[[:space:]]')
|
||||
- npm install
|
||||
- yarn install --no-lockfile --prod
|
||||
- yarn construct
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ];then electron-builder --mac -p never;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];then electron-builder --linux --x64 -p never;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];then cd ../build;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];then ls;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];then mv thedesk-*.zip thedesk.zip;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];then cd ../app;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "windows" ];then yarn add electron-builder;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "windows" ];then electron-builder --win --ia32 -p never;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "windows" ];then cd ../build;else :;fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "windows" ];then ls;else :;fi
|
||||
@@ -44,4 +50,5 @@ deploy:
|
||||
on:
|
||||
repo: cutls/TheDesk
|
||||
tags: true
|
||||
all_branches: true
|
||||
branches:
|
||||
only: "/^v?[0-9\\.]+/"
|
||||
|
||||
22
LATEST.md
22
LATEST.md
@@ -1,22 +0,0 @@
|
||||
## For Astarte(kirishima.cloud), My Primary Instance
|
||||
|
||||
TheDesk :thedesk: Akane (16.1.0)
|
||||
・不具合修正(マウスオーバー,クリックに関する)
|
||||
・2.5.0に対する対応(リプ数やendorseなど)
|
||||
・軽量化を図った
|
||||
・一つのカラムをTwitter(TweetDeck)にできる機能
|
||||
・画像の保存先を変えられるように
|
||||
・インスタンス情報の拡充
|
||||
・デザイン変更
|
||||
・トゥートバーを左端に持ってこれるように
|
||||
・Windowsのネイティブ通知が復活
|
||||
|
||||
ほか
|
||||
https://thedesk.top
|
||||
:github: https://github.com/cutls/TheDesk #Desk #DeskUpdate
|
||||
|
||||
## For Other Instances
|
||||
|
||||
TheDesk :thedesk: Akane (16.0.1)
|
||||
|
||||
https://thedesk.top
|
||||
@@ -1,8 +0,0 @@
|
||||
# プライバシーポリシー
|
||||
|
||||
* TheDeskは「開発者からのお知らせ」配信のためにサーバー(thedesk.top)に常時アクセスしています。
|
||||
* 上記の接続によるユーザーの情報提供はありません。(IPアドレス等を含む)
|
||||
* thedesk.topのページにおいては、Googleアナリティクスによる解析を採用しています。
|
||||
* 配信についてAmazon Web Service CloudFrontを使用しています。CloudFrontにはアクセス解析機能がありますが、これの使用につきましては同プライバシーポリシーに則ります。
|
||||
* 接続するインスタンスのプライバシーポリシーはAPIを通じた全てのアクションに対して有効ですので、TheDeskについてもそれらに則ります。
|
||||
|
||||
40
README.md
40
README.md
@@ -41,6 +41,7 @@ The default sounds of notifications is provided [Creative Commons BY](https://cr
|
||||
|
||||
* 日本語(Japanese)
|
||||
* English
|
||||
* de, cs, bg(from Crowdin)
|
||||
|
||||
### Translation
|
||||
|
||||
@@ -79,15 +80,37 @@ Fellow coder
|
||||
|
||||
## Build
|
||||
|
||||
You have to use either **npm** or **yarn**. Whichever you use, it works well.
|
||||
|
||||
### npm
|
||||
|
||||
```sh
|
||||
git clone https://github.com/cutls/TheDesk
|
||||
cd TheDesk/app
|
||||
npm install
|
||||
npm install --only=dev
|
||||
npm run construct
|
||||
```
|
||||
|
||||
### yarn
|
||||
|
||||
```sh
|
||||
git clone https://github.com/cutls/TheDesk
|
||||
cd TheDesk/app
|
||||
# Linux or macOS
|
||||
yarn install --no-lockfile
|
||||
# Windows
|
||||
yarn install
|
||||
|
||||
yarn construct
|
||||
```
|
||||
|
||||
run `npm run dev` or `yarn dev` to launch developer version with console(click `view`)
|
||||
|
||||
### electron-builder(Recommended)
|
||||
Use npm scripts.
|
||||
Use scripts(they can work well with npm, **yarn**).
|
||||
|
||||
#### npm
|
||||
|
||||
```sh
|
||||
# Build for current platform
|
||||
@@ -101,6 +124,21 @@ npm run build:win
|
||||
npm run build:all
|
||||
```
|
||||
|
||||
#### yarn
|
||||
|
||||
```sh
|
||||
# Build for current platform
|
||||
yarn build
|
||||
|
||||
# Select build target
|
||||
## Windows
|
||||
yarn build:win
|
||||
|
||||
## Windows and Linux (The macOS target should run on macOS. So, this option hasn't include the build for macOS)
|
||||
yarn build:all
|
||||
```
|
||||
|
||||
|
||||
Config is all on package.json
|
||||
|
||||
### electron-packager
|
||||
|
||||
39
README_ja.md
39
README_ja.md
@@ -40,6 +40,7 @@ Download:[TheDesk](https://thedesk.top) [
|
||||
* ドイツ語, チェコ語, ブルガリア語(from Crowdin)
|
||||
|
||||
### 翻訳
|
||||
|
||||
@@ -72,22 +73,42 @@ Linuxビルダー
|
||||
|
||||
* [ぽぷんじゃ](https://popon.pptdn.jp/@popn_ja)
|
||||
|
||||
iTunes NowPlayingにアルバムアートワークを付けてくれた人
|
||||
コーダー
|
||||
|
||||
* [kPherox](https://pl.kpherox.dev/kPherox)
|
||||
|
||||
## ビルド
|
||||
|
||||
npmでもyarnでも好きな方を選んでください。
|
||||
|
||||
### npm
|
||||
|
||||
```sh
|
||||
git clone https://github.com/cutls/TheDesk
|
||||
cd TheDesk/app
|
||||
npm install
|
||||
npm install --only=dev
|
||||
npm run construct
|
||||
```
|
||||
|
||||
### yarn
|
||||
|
||||
```sh
|
||||
git clone https://github.com/cutls/TheDesk
|
||||
cd TheDesk/app
|
||||
# Linux or macOS
|
||||
yarn install --no-lockfile
|
||||
# Windows
|
||||
yarn install
|
||||
|
||||
yarn construct
|
||||
```
|
||||
|
||||
### electron-builder(推奨)
|
||||
npm scriptsを利用します
|
||||
|
||||
scriptsを利用します
|
||||
|
||||
#### npm
|
||||
|
||||
```sh
|
||||
# 実行している環境向けにビルド
|
||||
@@ -101,6 +122,20 @@ npm run build:win
|
||||
npm run build:all
|
||||
```
|
||||
|
||||
#### yarn
|
||||
|
||||
```sh
|
||||
# 実行している環境向けにビルド
|
||||
yarn build
|
||||
|
||||
# ターゲットを指定してビルド
|
||||
## Windows
|
||||
yarn build:win
|
||||
|
||||
## macOS向けのビルドにはmacOSで実行する必要があるためこのコマンドではビルドされません
|
||||
yarn build:all
|
||||
```
|
||||
|
||||
ビルド設定はすべてpackage.jsonに記載しています。
|
||||
|
||||
### electron-packager(非推奨)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
font-family: 'Open Sans';
|
||||
-webkit-app-region: drag;
|
||||
cursor: move;
|
||||
padding: 5px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
a,
|
||||
@@ -27,7 +29,7 @@
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
|
||||
grid-template-areas: 'name1 data1''name2 data2''name3 data3''name4 data4''name5 data5';
|
||||
grid-template-areas: 'name1 data1''name2 data2''name3 data3''name4 data4''name5 data5''name6 data6';
|
||||
text-align: left;
|
||||
margin: 5px;
|
||||
}
|
||||
@@ -71,6 +73,14 @@
|
||||
.area-data5 {
|
||||
grid-area: data5;
|
||||
}
|
||||
|
||||
.area-name6 {
|
||||
grid-area: name6;
|
||||
}
|
||||
|
||||
.area-data6 {
|
||||
grid-area: data6;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -85,12 +95,14 @@
|
||||
<div class="area-data1" id="now"></div>
|
||||
<div class="area-name2">Internal version</div>
|
||||
<div class="area-data2" id="ver"></div>
|
||||
<div class="area-name3">Chromium</div>
|
||||
<div class="area-data3" id="chrome"></div>
|
||||
<div class="area-name4">Electron</div>
|
||||
<div class="area-data4" id="electron"></div>
|
||||
<div class="area-name5">Node.js</div>
|
||||
<div class="area-data5" id="node"></div>
|
||||
<div class="area-name3">Commit(7chars)</div>
|
||||
<div class="area-data3" id="hash"></div>
|
||||
<div class="area-name4">Chromium</div>
|
||||
<div class="area-data4" id="chrome"></div>
|
||||
<div class="area-name5">Electron</div>
|
||||
<div class="area-data5" id="electron"></div>
|
||||
<div class="area-name6">Node.js</div>
|
||||
<div class="area-data6" id="node"></div>
|
||||
</div>
|
||||
<div class="cp">Copyright © TheDesk 2018<br>
|
||||
Main developer(author): <a href="https://cutls.com/@Cutls" target="_blank">Cutls P</a><br>
|
||||
@@ -114,6 +126,7 @@
|
||||
var ver = m[1];
|
||||
$("#ver").text(ver);
|
||||
}
|
||||
$("#hash").html('<a href="https://github.com/cutls/TheDesk/commits/' + about[3] + '" target="_blank">' + about[3].slice(0, 7) + '</a>');
|
||||
$(document).on('click', 'a', e => {
|
||||
var url = $(e.target).attr('href');
|
||||
postMessage(["openUrl", url], "*")
|
||||
|
||||
@@ -72,7 +72,7 @@ option {
|
||||
min-width: 0 !important;
|
||||
margin-left: 5px !important;
|
||||
}
|
||||
.unvisible{
|
||||
.unvisible {
|
||||
opacity: 0;
|
||||
}
|
||||
.bbcode-pulse-loadings,
|
||||
@@ -180,26 +180,6 @@ blockquote:before,
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
.twitter-tweet {
|
||||
color: black;
|
||||
background-color: #fff;
|
||||
padding: 1em 1em 1em;
|
||||
position: relative;
|
||||
border-top-left-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-left: 5px solid #0c7abf;
|
||||
}
|
||||
.twitter-tweet :before {
|
||||
content: "From Twitter";
|
||||
font-size: 1.8rem;
|
||||
line-height: 1em;
|
||||
font-family: Open Sans;
|
||||
color: #999;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
.pixiv-post {
|
||||
color: black;
|
||||
background-color: #fff;
|
||||
@@ -220,6 +200,17 @@ blockquote:before,
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
#start {
|
||||
display: none;
|
||||
position: fixed;
|
||||
width: 100vw;
|
||||
height: calc(100vh - 40px);
|
||||
background-color: var(--bg);
|
||||
color: var(--color);
|
||||
z-index: 99999;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
#drag {
|
||||
display: none;
|
||||
position: fixed;
|
||||
@@ -325,20 +316,23 @@ blockquote:before,
|
||||
#menu {
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
background-color: var(--box);
|
||||
background-color: var(--postbox);
|
||||
width: 540px;
|
||||
top: calc(50% - 150px);
|
||||
left: calc(50% - 250px);
|
||||
padding: 5px;
|
||||
border: thin solid gray;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
#menu-wrapper {
|
||||
margin-left: -5px;
|
||||
display: flex;
|
||||
height: calc(100% - 3.5rem);
|
||||
overflow: hidden;
|
||||
}
|
||||
#left-menu {
|
||||
width: 170px;
|
||||
width: 230px;
|
||||
}
|
||||
#left-menu div {
|
||||
padding-left: 5px;
|
||||
@@ -358,8 +352,7 @@ blockquote:before,
|
||||
background-color: var(--emphasized);
|
||||
}
|
||||
#right-menu {
|
||||
width: 380px;
|
||||
max-height: 375px;
|
||||
width: 100%;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
padding: 5px;
|
||||
@@ -376,6 +369,9 @@ blockquote:before,
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#tltype .type span {
|
||||
width: calc(100% - 30px);
|
||||
}
|
||||
#tltype .type:hover {
|
||||
background-color: var(--beforehover);
|
||||
}
|
||||
@@ -387,9 +383,11 @@ blockquote:before,
|
||||
}
|
||||
#tltype i.sub-icon {
|
||||
font-size: 20px;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
color: var(--beforehover);
|
||||
left: -15px;
|
||||
left: 10px;
|
||||
bottom: 5px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.drag-bar {
|
||||
cursor: move;
|
||||
@@ -441,17 +439,28 @@ blockquote:before,
|
||||
.select-wrapper .dropdown-content {
|
||||
width: 250px !important;
|
||||
}
|
||||
input, textarea {
|
||||
input,
|
||||
textarea {
|
||||
color: var(--color);
|
||||
font-size: 1rem !important;
|
||||
font-family: inherit;
|
||||
}
|
||||
.swal2-popup{
|
||||
.swal2-popup {
|
||||
background-color: var(--notfbox) !important;
|
||||
}
|
||||
.swal2-title, .swal2-content{
|
||||
.swal2-title,
|
||||
.swal2-content {
|
||||
color: var(--color) !important;
|
||||
}
|
||||
#src-contents svg {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.contributor {
|
||||
cursor: pointer;
|
||||
}
|
||||
.contributor img {
|
||||
width: 1rem;
|
||||
}
|
||||
|
||||
/*スクロールバー*/
|
||||
::-webkit-scrollbar {
|
||||
@@ -472,20 +481,25 @@ input, textarea {
|
||||
}
|
||||
/* Web Fonts */
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-family: "Open Sans";
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Open Sans Light'), local('OpenSans-Light'), url(https://fonts.gstatic.com/s/opensans/v17/mem5YaGs126MiZpBA-UN_r8OUuhp.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
src: local("Open Sans Light"), local("OpenSans-Light"),
|
||||
url(https://fonts.gstatic.com/s/opensans/v17/mem5YaGs126MiZpBA-UN_r8OUuhp.woff2)
|
||||
format("woff2");
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
|
||||
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
|
||||
U+FEFF, U+FFFD;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Material Icons';
|
||||
font-family: "Material Icons";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
|
||||
src: url(https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2)
|
||||
format("woff2");
|
||||
}
|
||||
.material-icons {
|
||||
font-family: 'Material Icons';
|
||||
font-family: "Material Icons";
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 24px;
|
||||
@@ -496,6 +510,6 @@ input, textarea {
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
direction: ltr;
|
||||
-webkit-font-feature-settings: 'liga';
|
||||
-webkit-font-feature-settings: "liga";
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,15 +7,18 @@
|
||||
background-color: var(--postbox);
|
||||
border: thin solid gray;
|
||||
z-index: 501;
|
||||
min-width: 300px;
|
||||
max-width: 100%;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
textarea {
|
||||
min-height: 100px !important;
|
||||
font-family: inherit;
|
||||
}
|
||||
#post-box .ui-resizable-s, #post-box .ui-resizable-se{
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.cancel {
|
||||
font-size: 0.5rem;
|
||||
@@ -108,21 +111,16 @@ textarea {
|
||||
}
|
||||
#left-side {
|
||||
float: left;
|
||||
width: 300px;
|
||||
overflow-x: hidden;
|
||||
height: calc(100% - 32px);
|
||||
}
|
||||
#right-side {
|
||||
display: none;
|
||||
float: left;
|
||||
width: 300px;
|
||||
padding: 5px;
|
||||
}
|
||||
#poll {
|
||||
}
|
||||
.poll-provider {
|
||||
position: absolute;
|
||||
height: calc(100% - 90px);
|
||||
overflow-y: scroll;
|
||||
top: 90px;
|
||||
overflow-x: hidden;
|
||||
height: calc(100% - 32px);
|
||||
}
|
||||
#posttgl,#toot-post-btn {
|
||||
background-color: var(--accentbtn);
|
||||
|
||||
944
app/css/tl.css
944
app/css/tl.css
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,9 @@
|
||||
background-image: url("../../loading.svg");
|
||||
overflow-y: hidden;
|
||||
}
|
||||
#his-data .btn .material-icons{
|
||||
float:left;
|
||||
}
|
||||
#his-data-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -22,6 +25,7 @@
|
||||
}
|
||||
#his-float-data {
|
||||
height: 100%;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
#his-leftside {
|
||||
width: 500px;
|
||||
@@ -60,10 +64,10 @@
|
||||
padding: 0;
|
||||
padding-left: 5px;
|
||||
}
|
||||
#his-data a span.ellipsis:after {
|
||||
.his-var-content a span.ellipsis:after {
|
||||
content: "...";
|
||||
}
|
||||
#his-data a:not(.mention) span:last-of-type {
|
||||
.his-var-content a:not(.mention) span:last-of-type {
|
||||
display: none;
|
||||
}
|
||||
#his-data a .rep_ct,
|
||||
@@ -99,7 +103,8 @@
|
||||
width: 20px;
|
||||
}
|
||||
#his-plus-action .btn {
|
||||
width: 170px;
|
||||
padding-right: 5px;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.tabs {
|
||||
display: flex;
|
||||
@@ -107,10 +112,30 @@
|
||||
.tabs .tab a {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
#his-des {
|
||||
max-height: 250px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
#his-sign-action {
|
||||
border: 1px solid;
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
#his-sign-action .btn {
|
||||
flex-basis: 31.2%;
|
||||
}
|
||||
#his-des .mention {
|
||||
color: #039be5;
|
||||
cursor: pointer;
|
||||
}
|
||||
#his-table{
|
||||
max-height: 150px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
#his-float-blocked {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//このソフトについて
|
||||
function about() {
|
||||
postMessage(["sendSinmpleIpc", "about"], "*")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
var digitCharacters = [
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
|
||||
|
||||
1
app/js/common/hammer.min.js
vendored
1
app/js/common/hammer.min.js
vendored
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
/*! Hammer.JS - v2.0.8 - 2016-04-23
|
||||
* http://hammerjs.github.io/
|
||||
*
|
||||
|
||||
@@ -1,180 +1,192 @@
|
||||
selectedColumn = 0
|
||||
selectedToot = 0
|
||||
$(function ($) {
|
||||
'use strict'
|
||||
var selectedColumn = 0
|
||||
var selectedToot = 0
|
||||
$(function($) {
|
||||
//キーボードショートカット
|
||||
$(window).keydown(function (e) {
|
||||
var hasFocus = $('input').is(':focus');
|
||||
var hasFocus2 = $('textarea').is(':focus');
|
||||
if (document.getElementById("webview")) {
|
||||
if ($("#webviewsel:checked").val()) {
|
||||
var wv = false;
|
||||
$(window).keydown(function(e) {
|
||||
var hasFocus = $('input').is(':focus')
|
||||
var hasFocus2 = $('textarea').is(':focus')
|
||||
if (document.getElementById('webview')) {
|
||||
if ($('#webviewsel:checked').val()) {
|
||||
var wv = false
|
||||
} else {
|
||||
var wv = true;
|
||||
var wv = true
|
||||
}
|
||||
} else {
|
||||
var wv = true;
|
||||
var wv = true
|
||||
}
|
||||
//Enter
|
||||
if (e.keyCode === 13) {
|
||||
if ($('#src').is(':focus')) {
|
||||
src()
|
||||
return false
|
||||
}
|
||||
if ($('#list-add').is(':focus')) {
|
||||
makeNewList()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Shift+Enter:Lgen
|
||||
if (event.metaKey || event.ctrlKey && wv) {
|
||||
if (event.metaKey || (event.ctrlKey && wv)) {
|
||||
if (event.shiftKey) {
|
||||
if (e.keyCode === 13) {
|
||||
post('local');
|
||||
return false;
|
||||
post('local')
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
//Ctrl+Enter:投稿
|
||||
if (event.metaKey || event.ctrlKey && wv) {
|
||||
if (event.metaKey || (event.ctrlKey && wv)) {
|
||||
if (e.keyCode === 13) {
|
||||
post();
|
||||
return false;
|
||||
post()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Alt+Enter:セカンダリー
|
||||
if (event.metaKey || event.altKey && wv) {
|
||||
if (event.metaKey || (event.altKey && wv)) {
|
||||
if (e.keyCode === 13) {
|
||||
sec();
|
||||
return false;
|
||||
sec()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Esc:消す
|
||||
if (e.keyCode === 27 && wv) {
|
||||
hide();
|
||||
return false;
|
||||
hide()
|
||||
return false
|
||||
}
|
||||
//F5リロード
|
||||
if (e.keyCode === 116 && wv) {
|
||||
location.href = "index.html";
|
||||
return false;
|
||||
location.href = 'index.html'
|
||||
return false
|
||||
}
|
||||
//Ctrl+Sift+C:全消し
|
||||
if (((event.metaKey || event.ctrlKey) && event.shiftKey) && wv) {
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey && wv) {
|
||||
if (e.keyCode === 67) {
|
||||
clear();
|
||||
return false;
|
||||
clear()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+N:NowPlaying
|
||||
if (((event.metaKey || event.ctrlKey) && event.shiftKey) && wv) {
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey && wv) {
|
||||
if (e.keyCode === 78) {
|
||||
show();
|
||||
show()
|
||||
nowplaying()
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//input/textareaにフォーカスなし時
|
||||
if ((!hasFocus && !hasFocus2) && wv) {
|
||||
if (!hasFocus && !hasFocus2 && wv) {
|
||||
if (!wv) {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
//Ctrl+V:いつもの
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode === 86) {
|
||||
show();
|
||||
show()
|
||||
}
|
||||
}
|
||||
//X:開閉
|
||||
if (e.keyCode === 88) {
|
||||
if (!$("#post-box").hasClass("appear")) {
|
||||
show();
|
||||
$('textarea').focus();
|
||||
if (!$('#post-box').hasClass('appear')) {
|
||||
show()
|
||||
$('textarea').focus()
|
||||
} else {
|
||||
hide();
|
||||
hide()
|
||||
}
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
//N:新トゥート
|
||||
if (e.keyCode === 78) {
|
||||
if (!$("#post-box").hasClass("appear")) {
|
||||
show();
|
||||
if (!$('#post-box').hasClass('appear')) {
|
||||
show()
|
||||
}
|
||||
$('textarea').focus();
|
||||
return false;
|
||||
$('textarea').focus()
|
||||
return false
|
||||
}
|
||||
//Ctrl+E:全ての通知未読を既読にする
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode === 69) {
|
||||
allNotfRead();
|
||||
return false;
|
||||
allNotfRead()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Space:読み込み
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode === 32) {
|
||||
parseColumn();
|
||||
return false;
|
||||
parseColumn()
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+S:設定
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode === 83) {
|
||||
location.href = "setting.html";
|
||||
return false;
|
||||
location.href = 'setting.html'
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+M:アカマネ
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode === 77) {
|
||||
location.href = "acct.html";
|
||||
return false;
|
||||
location.href = 'acct.html'
|
||||
return false
|
||||
}
|
||||
}
|
||||
//Ctrl+Sift+P:プロフ
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode === 80) {
|
||||
profShow()
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//数字:TL
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
if (e.keyCode >= 49 && e.keyCode <= 57) {
|
||||
var kz = e.keyCode - 49;
|
||||
goColumn(kz);
|
||||
return false;
|
||||
var kz = e.keyCode - 49
|
||||
goColumn(kz)
|
||||
return false
|
||||
}
|
||||
}
|
||||
//矢印:選択
|
||||
if (e.code == "ArrowLeft") {
|
||||
if (e.code == 'ArrowLeft') {
|
||||
//left
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
imgCont('prev');
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
imgCont('prev')
|
||||
return false
|
||||
}
|
||||
if (selectedColumn > 0) {
|
||||
selectedColumn--
|
||||
}
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
} else if (e.code == "ArrowUp") {
|
||||
return false
|
||||
} else if (e.code == 'ArrowUp') {
|
||||
//up
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
return false
|
||||
}
|
||||
if (selectedToot > 0) {
|
||||
selectedToot--
|
||||
}
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
} else if (e.code == "ArrowRight") {
|
||||
return false
|
||||
} else if (e.code == 'ArrowRight') {
|
||||
//right
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
imgCont('next');
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
imgCont('next')
|
||||
return false
|
||||
}
|
||||
if (selectedColumn < $(".tl-box").length - 1) {
|
||||
if (selectedColumn < $('.tl-box').length - 1) {
|
||||
selectedColumn++
|
||||
}
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
} else if (e.code == "ArrowDown") {
|
||||
return false
|
||||
} else if (e.code == 'ArrowDown') {
|
||||
//down
|
||||
if ($("#imagemodal").hasClass("open")) {
|
||||
return false;
|
||||
if ($('#imagemodal').hasClass('open')) {
|
||||
return false
|
||||
}
|
||||
selectedToot++
|
||||
tootSelector(selectedColumn, selectedToot)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
//Ctrl+U:0,0選択
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
@@ -182,29 +194,29 @@ $(function ($) {
|
||||
selectedToot = 0
|
||||
selectedColumn = 0
|
||||
tootSelector(0, 0)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//選択時
|
||||
if (e.keyCode == 70) {
|
||||
var id = $(".selectedToot").attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct")
|
||||
var id = $('.selectedToot').attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
|
||||
fav(id, acct_id, false)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
if (e.keyCode == 66) {
|
||||
var id = $(".selectedToot").attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct")
|
||||
var id = $('.selectedToot').attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
|
||||
rt(id, acct_id, false)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
if (e.keyCode == 82) {
|
||||
var id = $(".selectedToot").attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr("data-acct")
|
||||
var ats_cm = $('.selectedToot .rep-btn').attr("data-men")
|
||||
var mode = $('.selectedToot .rep-btn').attr("data-visen")
|
||||
var id = $('.selectedToot').attr('unique-id')
|
||||
var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
|
||||
var ats_cm = $('.selectedToot .rep-btn').attr('data-men')
|
||||
var mode = $('.selectedToot .rep-btn').attr('data-visen')
|
||||
re(id, ats_cm, acct_id, mode)
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
//textareaフォーカス時
|
||||
@@ -213,23 +225,27 @@ $(function ($) {
|
||||
//C+S+(No):ワンクリ
|
||||
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
||||
if (e.keyCode >= 49 && e.keyCode <= 51) {
|
||||
var no = e.keyCode - 48;
|
||||
if (localStorage.getItem("oks-" + no)) { $("#textarea").val($("#textarea").val() + localStorage.getItem("oks-" + no)) }
|
||||
return false;
|
||||
var no = e.keyCode - 48
|
||||
if (localStorage.getItem('oks-' + no)) {
|
||||
$('#textarea').val($('#textarea').val() + localStorage.getItem('oks-' + no))
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
//クリアボタン
|
||||
$("#clear").click(function () {
|
||||
clear();
|
||||
});
|
||||
});
|
||||
$('#clear').click(function() {
|
||||
clear()
|
||||
})
|
||||
})
|
||||
//選択する
|
||||
function tootSelector(column, toot) {
|
||||
$('.cvo').removeClass("selectedToot")
|
||||
$('#timeline_' + column + ' .cvo').eq(toot).addClass("selectedToot")
|
||||
$('.cvo').removeClass('selectedToot')
|
||||
$('#timeline_' + column + ' .cvo')
|
||||
.eq(toot)
|
||||
.addClass('selectedToot')
|
||||
var scr = $('.tl-box[tlid=' + column + ']').scrollTop()
|
||||
var elem = $('.selectedToot').offset().top
|
||||
var top = elem - $('.tl-box').height() + scr
|
||||
@@ -244,4 +260,4 @@ function tootSelector(column, toot) {
|
||||
$('.tl-box[tlid=' + column + ']').animate({ scrollTop: to })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//モーダル・ドロップダウンの各種設定
|
||||
$(document).ready(function () {
|
||||
// the "href" attribute of the modal trigger must specify the modal ID that wants to be triggered
|
||||
@@ -23,4 +24,7 @@ $(document).ready(function () {
|
||||
}
|
||||
);
|
||||
$('.collapsible').collapsible();
|
||||
$('#videomodal').modal({
|
||||
onCloseEnd: stopVideo
|
||||
});
|
||||
});
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
var sha256 = function sha256(ascii) {
|
||||
function rightRotate(value, amount) {
|
||||
return (value >>> amount) | (value << (32 - amount));
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
}
|
||||
};
|
||||
var $t = $.timeago;
|
||||
|
||||
$.extend($.timeago, {
|
||||
settings: {
|
||||
refreshMillis: 60000,
|
||||
@@ -47,22 +46,22 @@
|
||||
cutoff: 0,
|
||||
autoDispose: true,
|
||||
strings: {
|
||||
prefixAgo: null,
|
||||
prefixFromNow: "今から",
|
||||
suffixAgo: "",
|
||||
suffixFromNow: "",
|
||||
inPast: '',
|
||||
seconds: "%d秒前",
|
||||
minute: "1分前",
|
||||
minutes: "%d分前",
|
||||
hour: "1時間前",
|
||||
hours: "%d時間前",
|
||||
day: "昨日",
|
||||
days: "%d日前",
|
||||
month: "昨月",
|
||||
months: "%dヶ月前",
|
||||
year: "去年",
|
||||
years: "%d年前",
|
||||
prefixAgo: lang.lang_time_prefixAgo,
|
||||
prefixFromNow: lang.lang_time_prefixFromNow,
|
||||
suffixAgo: lang.lang_time_suffixAgo,
|
||||
suffixFromNow: lang.lang_time_suffixFromNow,
|
||||
inPast: lang.lang_time_inPast,
|
||||
seconds: lang.lang_time_seconds,
|
||||
minute: lang.lang_time_minute,
|
||||
minutes: lang.lang_time_minutes,
|
||||
hour: lang.lang_time_hour,
|
||||
hours: lang.lang_time_hours,
|
||||
day: lang.lang_time_day,
|
||||
days: lang.lang_time_days,
|
||||
month: lang.lang_time_month,
|
||||
months: lang.lang_time_months,
|
||||
year: lang.lang_time_year,
|
||||
years: lang.lang_time_years,
|
||||
wordSeparator: " ",
|
||||
numbers: []
|
||||
}
|
||||
|
||||
@@ -1,280 +1,336 @@
|
||||
'use strict'
|
||||
//バージョンチェッカー
|
||||
function verck(ver) {
|
||||
console.log("%c Welcome😊", "color: red;font-size:200%;")
|
||||
var date = new Date();
|
||||
function verck(ver, jp) {
|
||||
console.log('%c Welcome😊', 'color: red;font-size:200%;')
|
||||
var date = new Date()
|
||||
var show = false
|
||||
if (localStorage.getItem("ver") != ver && localStorage.getItem("winstore")) {
|
||||
if (localStorage.getItem('ver') != ver && localStorage.getItem('winstore')) {
|
||||
//ちょっと削除とリンク解析の都合上アレ(s)
|
||||
//対象外のアプデ:storageが20の最初まで"Usamin (18.6.5)"
|
||||
if (!localStorage.getItem("usamin_18_6_5_flag")) {
|
||||
localStorage.setItem("usamin_18_6_5_flag", true)
|
||||
var multi = localStorage.getItem("column");
|
||||
var obj = JSON.parse(multi);
|
||||
if (!localStorage.getItem('usamin_18_6_5_flag')) {
|
||||
localStorage.setItem('usamin_18_6_5_flag', true)
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
for (var i = 0; i < obj.length; i++) {
|
||||
localStorage.removeItem("card_" + i);
|
||||
localStorage.removeItem('card_' + i)
|
||||
}
|
||||
}
|
||||
//ちょっと削除とリンク解析の都合上アレ(e)
|
||||
localStorage.setItem("ver", ver);
|
||||
show = true
|
||||
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;");
|
||||
$(document).ready(function () {
|
||||
$('#releasenote').modal('open');
|
||||
verp = ver.replace('(', '');
|
||||
verp = verp.replace('.', '-');
|
||||
verp = verp.replace('.', '-');
|
||||
verp = verp.replace('[', '-');
|
||||
verp = verp.replace(']', '');
|
||||
verp = verp.replace(')', '');
|
||||
verp = verp.replace(' ', '_');
|
||||
console.log("%c " + verp, "color: red;font-size:200%;");
|
||||
if (lang.language == "ja") {
|
||||
$("#release-" + verp).show();
|
||||
} else {
|
||||
$("#release-en").show();
|
||||
console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
|
||||
$(document).ready(function() {
|
||||
if (localStorage.getItem('winstore')) {
|
||||
$('#releasenote').modal('open')
|
||||
}
|
||||
});
|
||||
var verp = ver.replace('(', '')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('[', '-')
|
||||
verp = verp.replace(']', '')
|
||||
verp = verp.replace(')', '')
|
||||
verp = verp.replace(' ', '_')
|
||||
console.log('%c ' + verp, 'color: red;font-size:200%;')
|
||||
if (lang.language == 'ja') {
|
||||
$('#release-' + verp).show()
|
||||
} else {
|
||||
$('#release-en').show()
|
||||
}
|
||||
})
|
||||
}
|
||||
localStorage.setItem('ver', ver)
|
||||
if (!show) {
|
||||
console.log(show)
|
||||
if (date.getMonth() + 1 >= localStorage.getItem("showSupportMe") || !localStorage.getItem("showSupportMe")) {
|
||||
if (
|
||||
date.getMonth() + 1 >= localStorage.getItem('showSupportMe') ||
|
||||
!localStorage.getItem('showSupportMe')
|
||||
) {
|
||||
if (date.getMonth() == 11) {
|
||||
var nextmonth = 1
|
||||
} else {
|
||||
var nextmonth = date.getMonth() + 2
|
||||
}
|
||||
if (lang.language != "ja") {
|
||||
$("#support-btm-ja").addClass("hide");
|
||||
$("#support-btm-en").removeClass("hide");
|
||||
if (lang.language != 'ja') {
|
||||
$('#support-btm-ja').addClass('hide')
|
||||
$('#support-btm-en').removeClass('hide')
|
||||
}
|
||||
localStorage.setItem("showSupportMe", nextmonth)
|
||||
$("#support-btm").removeClass("hide")
|
||||
$("#support-btm").animate({
|
||||
'bottom': '0'
|
||||
}, {
|
||||
'duration': 300
|
||||
});
|
||||
localStorage.setItem('showSupportMe', nextmonth)
|
||||
$('#support-btm').removeClass('hide')
|
||||
$('#support-btm').animate(
|
||||
{
|
||||
bottom: '0'
|
||||
},
|
||||
{
|
||||
duration: 300
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
var platform = localStorage.getItem("platform");
|
||||
console.log("Your platform:" + platform)
|
||||
if (!localStorage.getItem("winstore")) {
|
||||
storeDialog(platform, ver)
|
||||
var platform = localStorage.getItem('platform')
|
||||
console.log('Your platform:' + platform)
|
||||
if (!localStorage.getItem('winstore')) {
|
||||
$('#start').css('display', 'flex')
|
||||
}
|
||||
if (localStorage.getItem("winstore") == "brewcask" || localStorage.getItem("winstore") == "snapcraft" || localStorage.getItem("winstore") == "winstore") {
|
||||
var winstore = true;
|
||||
if (
|
||||
localStorage.getItem('winstore') == 'brewcask' ||
|
||||
localStorage.getItem('winstore') == 'snapcraft' ||
|
||||
localStorage.getItem('winstore') == 'winstore'
|
||||
) {
|
||||
var winstore = true
|
||||
} else {
|
||||
var winstore = false;
|
||||
var winstore = false
|
||||
}
|
||||
var l = 5;
|
||||
var l = 5
|
||||
// 生成する文字列に含める文字セット
|
||||
var c = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var cl = c.length;
|
||||
var r = "";
|
||||
var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
var cl = c.length
|
||||
var r = ''
|
||||
for (var i = 0; i < l; i++) {
|
||||
r += c[Math.floor(Math.random() * cl)];
|
||||
r += c[Math.floor(Math.random() * cl)]
|
||||
}
|
||||
var start = "https://thedesk.top/ver.json";
|
||||
var start = 'https://thedesk.top/ver.json'
|
||||
fetch(start, {
|
||||
method: 'GET'
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (mess) {
|
||||
console.table(mess);
|
||||
if (mess) {
|
||||
var platform = localStorage.getItem("platform");
|
||||
if (platform == "darwin") {
|
||||
var newest = mess.desk_mac;
|
||||
} else {
|
||||
var newest = mess.desk;
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
if (newest == ver) {
|
||||
todo(lang.lang_version_usever.replace("{{ver}}", mess.desk));
|
||||
//betaかWinstoreならアプデチェックしない
|
||||
} else if (ver.indexOf("beta") != -1 || winstore) {
|
||||
|
||||
} else {
|
||||
localStorage.removeItem("instance")
|
||||
if (localStorage.getItem("new-ver-skip")) {
|
||||
if (localStorage.getItem("next-ver") != newest) {
|
||||
postMessage(["sendSinmpleIpc", "update"], "*")
|
||||
} else {
|
||||
console.warn(lang.lang_version_skipver);
|
||||
todo(lang.lang_version_skipver);
|
||||
}
|
||||
} else {
|
||||
postMessage(["sendSinmpleIpc", "update"], "*")
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(mess) {
|
||||
console.table(mess)
|
||||
if (mess) {
|
||||
//askjp_jp_ua: 2019年10月24日、mstdn.jpによるユーザーエージェントアクセス制限
|
||||
if (jp && mess.jp_ua && !localStorage.getItem('askjp_jp_ua')) {
|
||||
localStorage.setItem('askjp_jp_ua', true)
|
||||
$('#askjp_jp_ua').removeClass('hide')
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!localStorage.getItem("last-notice-id")) {
|
||||
localStorage.setItem("last-notice-id", 0)
|
||||
}
|
||||
var start = "https://thedesk.top/notice?since_id=" + localStorage.getItem("last-notice-id");
|
||||
fetch(start, {
|
||||
method: 'GET'
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (mess) {
|
||||
if (mess.length < 1) {
|
||||
return false;
|
||||
} else {
|
||||
var last = localStorage.getItem("last-notice-id")
|
||||
localStorage.setItem("last-notice-id", mess[0].ID)
|
||||
for (i = 0; i < mess.length; i++) {
|
||||
var obj = mess[i];
|
||||
if (obj.ID * 1 <= last) {
|
||||
break;
|
||||
var platform = localStorage.getItem('platform')
|
||||
if (platform == 'darwin') {
|
||||
var newest = mess.desk_mac
|
||||
} else {
|
||||
if (obj.type == "textv2") {
|
||||
if (~obj.languages.indexOf(lang.language)) {
|
||||
var show = true;
|
||||
if (obj.toot != "") {
|
||||
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + '\',\'main\')">Show</button>';
|
||||
} else {
|
||||
var toot = "";
|
||||
}
|
||||
if (obj.ver != "") {
|
||||
if (obj.ver == ver) {
|
||||
show = true;
|
||||
} else {
|
||||
show = false;
|
||||
}
|
||||
}
|
||||
if (obj.domain != "") {
|
||||
var multi = localStorage.getItem("multi");
|
||||
if (multi) {
|
||||
show = false;
|
||||
var accts = JSON.parse(multi);
|
||||
Object.keys(accts).forEach(function (key) {
|
||||
var acct = accts[key];
|
||||
if (acct.domain == obj.domain) {
|
||||
show = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (show) {
|
||||
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 })
|
||||
}
|
||||
}
|
||||
}
|
||||
var newest = mess.desk
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
var infostreaming = false;
|
||||
function infowebsocket() {
|
||||
infows = new WebSocket("wss://thedesk.top/ws/");
|
||||
infows.onopen = function (mess) {
|
||||
console.log([tlid, ":Connect Streaming Info:", mess]);
|
||||
infostreaming = true;
|
||||
}
|
||||
infows.onmessage = function (mess) {
|
||||
console.log([tlid, ":Receive Streaming:", JSON.parse(mess.data)]);
|
||||
var obj = JSON.parse(mess.data);
|
||||
if (obj.type != "counter") {
|
||||
if (obj.type == "textv2") {
|
||||
if (~obj.languages.indexOf(lang.language)) {
|
||||
localStorage.setItem("last-notice-id", obj.id)
|
||||
var show = true;
|
||||
if (obj.toot != "") {
|
||||
var toot = '<button class="btn-flat toast-action" onclick="detEx(\'' + obj.toot + '\',\'main\')">Show</button>';
|
||||
} else {
|
||||
var toot = "";
|
||||
}
|
||||
if (obj.ver != "") {
|
||||
if (obj.ver == ver) {
|
||||
show = true;
|
||||
if (newest == ver) {
|
||||
todo(lang.lang_version_usever.replace('{{ver}}', mess.desk))
|
||||
//betaかWinstoreならアプデチェックしない
|
||||
} else if (ver.indexOf('beta') != -1 || winstore) {
|
||||
} else {
|
||||
localStorage.removeItem('instance')
|
||||
if (localStorage.getItem('new-ver-skip')) {
|
||||
if (localStorage.getItem('next-ver') != newest) {
|
||||
postMessage(['sendSinmpleIpc', 'update'], '*')
|
||||
} else {
|
||||
show = false;
|
||||
console.warn(lang.lang_version_skipver)
|
||||
todo(lang.lang_version_skipver)
|
||||
}
|
||||
} else {
|
||||
postMessage(['sendSinmpleIpc', 'update'], '*')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
if (!localStorage.getItem('last-notice-id')) {
|
||||
localStorage.setItem('last-notice-id', 0)
|
||||
}
|
||||
var start = 'https://thedesk.top/notice?since_id=' + localStorage.getItem('last-notice-id')
|
||||
fetch(start, {
|
||||
method: 'GET'
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(mess) {
|
||||
if (mess.length < 1) {
|
||||
return false
|
||||
} else {
|
||||
var last = localStorage.getItem('last-notice-id')
|
||||
localStorage.setItem('last-notice-id', mess[0].ID)
|
||||
for (i = 0; i < mess.length; i++) {
|
||||
var obj = mess[i]
|
||||
if (obj.ID * 1 <= last) {
|
||||
break
|
||||
} else {
|
||||
if (obj.type == 'textv2') {
|
||||
if (~obj.languages.indexOf(lang.language)) {
|
||||
var show = true
|
||||
if (obj.toot != '') {
|
||||
var toot =
|
||||
'<button class="btn-flat toast-action" onclick="detEx(\'' +
|
||||
obj.toot +
|
||||
"','main')\">Show</button>"
|
||||
} else {
|
||||
var toot = ''
|
||||
}
|
||||
if (obj.ver != '') {
|
||||
if (obj.ver == ver) {
|
||||
show = true
|
||||
} else {
|
||||
show = false
|
||||
}
|
||||
}
|
||||
if (obj.domain != '') {
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (multi) {
|
||||
show = false
|
||||
var accts = JSON.parse(multi)
|
||||
Object.keys(accts).forEach(function(key) {
|
||||
var acct = accts[key]
|
||||
if (acct.domain == obj.domain) {
|
||||
show = true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (show) {
|
||||
M.toast({
|
||||
html:
|
||||
escapeHTML(obj.text) +
|
||||
toot +
|
||||
'<span class="sml grey-text">(スライドして消去)</span>',
|
||||
displayLength: 86400
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj.domain != "") {
|
||||
var multi = localStorage.getItem("multi");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
var infostreaming = false
|
||||
function infowebsocket() {
|
||||
var infows = new WebSocket('wss://thedesk.top/ws/')
|
||||
infows.onopen = function(mess) {
|
||||
console.log([tlid, ':Connect Streaming Info:', mess])
|
||||
infostreaming = true
|
||||
}
|
||||
infows.onmessage = function(mess) {
|
||||
console.log([tlid, ':Receive Streaming:', JSON.parse(mess.data)])
|
||||
var obj = JSON.parse(mess.data)
|
||||
if (obj.type != 'counter') {
|
||||
if (obj.type == 'textv2') {
|
||||
if (~obj.languages.indexOf(lang.language)) {
|
||||
localStorage.setItem('last-notice-id', obj.id)
|
||||
var show = true
|
||||
if (obj.toot != '') {
|
||||
var toot =
|
||||
'<button class="btn-flat toast-action" onclick="detEx(\'' +
|
||||
obj.toot +
|
||||
"','main')\">Show</button>"
|
||||
} else {
|
||||
var toot = ''
|
||||
}
|
||||
if (obj.ver != '') {
|
||||
if (obj.ver == ver) {
|
||||
show = true
|
||||
} else {
|
||||
show = false
|
||||
}
|
||||
}
|
||||
if (obj.domain != '') {
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (multi) {
|
||||
show = false;
|
||||
var accts = JSON.parse(multi);
|
||||
Object.keys(accts).forEach(function (key) {
|
||||
var acct = accts[key];
|
||||
show = false
|
||||
var accts = JSON.parse(multi)
|
||||
Object.keys(accts).forEach(function(key) {
|
||||
var acct = accts[key]
|
||||
if (acct.domain == obj.domain) {
|
||||
show = true;
|
||||
show = true
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
if (show) {
|
||||
console.log(obj.text)
|
||||
console.log(escapeHTML(obj.text))
|
||||
M.toast({ html: escapeHTML(obj.text) + toot + '<span class="sml grey-text">(スライドして消去)</span>', displayLength: 86400 })
|
||||
M.toast({
|
||||
html:
|
||||
escapeHTML(obj.text) +
|
||||
toot +
|
||||
'<span class="sml grey-text">(スライドして消去)</span>',
|
||||
displayLength: 86400
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$("#persons").text(obj.text);
|
||||
$('#persons').text(obj.text)
|
||||
}
|
||||
}
|
||||
infows.onerror = function (error) {
|
||||
infostreaming = false;
|
||||
console.error("Error closing:info");
|
||||
console.error(error);
|
||||
return false;
|
||||
};
|
||||
infows.onclose = function () {
|
||||
infostreaming = false;
|
||||
console.error("Closing:info");
|
||||
};
|
||||
}
|
||||
setInterval(function () {
|
||||
if (!infostreaming) {
|
||||
console.log("try to connect to base-streaming")
|
||||
infowebsocket();
|
||||
infows.onerror = function(error) {
|
||||
infostreaming = false
|
||||
console.error('Error closing:info')
|
||||
console.error(error)
|
||||
return false
|
||||
}
|
||||
}, 10000);
|
||||
infows.onclose = function() {
|
||||
infostreaming = false
|
||||
console.error('Closing:info')
|
||||
}
|
||||
}
|
||||
setInterval(function() {
|
||||
if (!infostreaming) {
|
||||
console.log('try to connect to base-streaming')
|
||||
infowebsocket()
|
||||
}
|
||||
}, 10000)
|
||||
function openRN() {
|
||||
$('#releasenote').modal('open');
|
||||
if (lang.language == "ja") {
|
||||
verp = ver.replace('(', '');
|
||||
verp = verp.replace('.', '-');
|
||||
verp = verp.replace('.', '-');
|
||||
verp = verp.replace('[', '-');
|
||||
verp = verp.replace(']', '');
|
||||
verp = verp.replace(')', '');
|
||||
verp = verp.replace(' ', '_');
|
||||
$("#release-" + verp).show();
|
||||
$('#releasenote').modal('open')
|
||||
if (lang.language == 'ja') {
|
||||
verp = ver.replace('(', '')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('[', '-')
|
||||
verp = verp.replace(']', '')
|
||||
verp = verp.replace(')', '')
|
||||
verp = verp.replace(' ', '_')
|
||||
$('#release-' + verp).show()
|
||||
} else {
|
||||
$("#release-en").show();
|
||||
$('#release-en').show()
|
||||
}
|
||||
}
|
||||
function closeSupport() {
|
||||
$("#support-btm").animate({
|
||||
'bottom': '-300px'
|
||||
}, {
|
||||
'duration': 300,
|
||||
'complete': function () {
|
||||
$("#support-btm").addClass("hide")
|
||||
$('#support-btm').animate(
|
||||
{
|
||||
bottom: '-300px'
|
||||
},
|
||||
{
|
||||
duration: 300,
|
||||
complete: function() {
|
||||
$('#support-btm').addClass('hide')
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
}
|
||||
function storeDialog(platform, ver) {
|
||||
if (platform == "win32") {
|
||||
var mes = lang.lang_version_platform;
|
||||
} else if (platform == "linux") {
|
||||
var mes = lang.lang_version_platform_linux;
|
||||
} else if (platform == "darwin") {
|
||||
var mes = lang.lang_version_platform_mac;
|
||||
if (platform == 'win32') {
|
||||
var mes = lang.lang_version_platform
|
||||
} else if (platform == 'linux') {
|
||||
var mes = lang.lang_version_platform_linux
|
||||
} else if (platform == 'darwin') {
|
||||
var mes = lang.lang_version_platform_mac
|
||||
}
|
||||
Swal.fire({
|
||||
title: "Select your platform",
|
||||
title: 'Select your platform',
|
||||
text: mes,
|
||||
type: 'info',
|
||||
showCancelButton: true,
|
||||
@@ -282,31 +338,36 @@ function storeDialog(platform, ver) {
|
||||
cancelButtonColor: '#3085d6',
|
||||
confirmButtonText: lang.lang_no,
|
||||
cancelButtonText: lang.lang_yesno
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
//逆にしてる
|
||||
if (!result.value) {
|
||||
localStorage.setItem("winstore", "winstore")
|
||||
localStorage.setItem('winstore', 'winstore')
|
||||
} else {
|
||||
localStorage.setItem("winstore", "localinstall")
|
||||
localStorage.setItem('winstore', 'localinstall')
|
||||
}
|
||||
localStorage.setItem("ver", ver);
|
||||
show = true
|
||||
console.log("%c Thank you for your update🎉", "color: red;font-size:200%;");
|
||||
$(document).ready(function () {
|
||||
$('#releasenote').modal('open');
|
||||
verp = ver.replace('(', '');
|
||||
verp = verp.replace('.', '-');
|
||||
verp = verp.replace('.', '-');
|
||||
verp = verp.replace('[', '-');
|
||||
verp = verp.replace(']', '');
|
||||
verp = verp.replace(')', '');
|
||||
verp = verp.replace(' ', '_');
|
||||
console.log("%c " + verp, "color: red;font-size:200%;");
|
||||
if (lang.language == "ja") {
|
||||
$("#release-" + verp).show();
|
||||
localStorage.setItem('ver', ver)
|
||||
console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
|
||||
$(document).ready(function() {
|
||||
$('#releasenote').modal('open')
|
||||
var verp = ver.replace('(', '')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('.', '-')
|
||||
verp = verp.replace('[', '-')
|
||||
verp = verp.replace(']', '')
|
||||
verp = verp.replace(')', '')
|
||||
verp = verp.replace(' ', '_')
|
||||
console.log('%c ' + verp, 'color: red;font-size:200%;')
|
||||
if (lang.language == 'ja') {
|
||||
$('#release-' + verp).show()
|
||||
} else {
|
||||
$("#release-en").show();
|
||||
$('#release-en').show()
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
function closeStart() {
|
||||
$('#start').css('display', 'none')
|
||||
var platform = localStorage.getItem('platform')
|
||||
var ver = localStorage.getItem('ver')
|
||||
storeDialog(platform, ver)
|
||||
}
|
||||
|
||||
@@ -1,84 +1,97 @@
|
||||
var defaultemojiList = ["activity", "flag", "food", "nature", "object", "people", "place", "symbol"];
|
||||
'use strict'
|
||||
var defaultemojiList = ['activity', 'flag', 'food', 'nature', 'object', 'people', 'place', 'symbol']
|
||||
var defaultemoji = {
|
||||
activity: activity,
|
||||
flag: flag,
|
||||
food: food,
|
||||
nature: nature,
|
||||
object: object,
|
||||
people: people,
|
||||
place: place,
|
||||
symbol: symbol
|
||||
};
|
||||
if (lang == "ja") {
|
||||
var defaultemojiname = {
|
||||
activity: "活動",
|
||||
flag: "国旗",
|
||||
food: "食べ物",
|
||||
nature: "自然",
|
||||
object: "もの",
|
||||
people: "ひと",
|
||||
place: "場所",
|
||||
symbol: "記号"
|
||||
};
|
||||
activity: activity,
|
||||
flag: flag,
|
||||
food: food,
|
||||
nature: nature,
|
||||
object: object,
|
||||
people: people,
|
||||
place: place,
|
||||
symbol: symbol
|
||||
}
|
||||
if (lang == 'ja') {
|
||||
var defaultemojiname = {
|
||||
activity: '活動',
|
||||
flag: '国旗',
|
||||
food: '食べ物',
|
||||
nature: '自然',
|
||||
object: 'もの',
|
||||
people: 'ひと',
|
||||
place: '場所',
|
||||
symbol: '記号'
|
||||
}
|
||||
} else {
|
||||
var defaultemojiname = {
|
||||
activity: "Activities",
|
||||
flag: "Flags",
|
||||
food: "Foods",
|
||||
nature: "Nature",
|
||||
object: "Tools",
|
||||
people: "People",
|
||||
place: "Places",
|
||||
symbol: "Symbols"
|
||||
};
|
||||
var defaultemojiname = {
|
||||
activity: 'Activities',
|
||||
flag: 'Flags',
|
||||
food: 'Foods',
|
||||
nature: 'Nature',
|
||||
object: 'Tools',
|
||||
people: 'People',
|
||||
place: 'Places',
|
||||
symbol: 'Symbols'
|
||||
}
|
||||
}
|
||||
|
||||
function defaultEmoji(target) {
|
||||
var json = defaultemoji[target];
|
||||
var emojis = "";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var emoji = json[key];
|
||||
emojis = emojis + '<a onclick="defEmoji(\'' + emoji["shortcode"] + '\')" class="pointer"><span style="width: 20px; height: 20px; display: inline-block; background-image: url(\'../../img/sheet.png\'); background-size: 4900%; background-position: ' + emoji["css"] + ';"></span></a>';
|
||||
});
|
||||
$("#emoji-list").html(emojis);
|
||||
$("#now-emoji").text(lang.lang_defaultemojis_text.replace("{{cat}}", defaultemojiname[target]));
|
||||
$(".emoji-control").addClass("hide");
|
||||
var json = defaultemoji[target]
|
||||
var emojis = ''
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var emoji = json[key]
|
||||
emojis =
|
||||
emojis +
|
||||
'<a onclick="defEmoji(\'' +
|
||||
emoji['shortcode'] +
|
||||
'\')" class="pointer"><span style="width: 20px; height: 20px; display: inline-block; background-image: url(\'../../img/sheet.png\'); background-size: 4900%; background-position: ' +
|
||||
emoji['css'] +
|
||||
';"></span></a>'
|
||||
})
|
||||
$('#emoji-list').html(emojis)
|
||||
$('#now-emoji').text(lang.lang_defaultemojis_text.replace('{{cat}}', defaultemojiname[target]))
|
||||
$('.emoji-control').addClass('hide')
|
||||
}
|
||||
function customEmoji() {
|
||||
$("#emoji-suggest").val("");
|
||||
$(".emoji-control").removeClass("hide");
|
||||
emojiList('home')
|
||||
$('#emoji-suggest').val('')
|
||||
$('.emoji-control').removeClass('hide')
|
||||
emojiList('home')
|
||||
}
|
||||
function defEmoji(target) {
|
||||
var selin = $("#textarea").prop('selectionStart');
|
||||
if (!selin) {
|
||||
selin = 0;
|
||||
}
|
||||
var emojiraw = newpack.filter(function (item, index) {
|
||||
if (item.short_name == target) return true;
|
||||
});
|
||||
var hex = emojiraw[0].unified.split("-");
|
||||
if (hex.length === 2) {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1]);
|
||||
} else {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0]);
|
||||
}
|
||||
var now = $("#textarea").val();
|
||||
var before = now.substr(0, selin);
|
||||
var after = now.substr(selin, now.length);
|
||||
newt = before + emoji + after;
|
||||
$("#textarea").val(newt);
|
||||
$("#textarea").focus();
|
||||
var selin = $('#textarea').prop('selectionStart')
|
||||
if (!selin) {
|
||||
selin = 0
|
||||
}
|
||||
var emojiraw = newpack.filter(function(item, index) {
|
||||
if (item.short_name == target) return true
|
||||
})
|
||||
var hex = emojiraw[0].unified.split('-')
|
||||
if (hex.length === 2) {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1])
|
||||
} else {
|
||||
emoji = twemoji.convert.fromCodePoint(hex[0])
|
||||
}
|
||||
var now = $('#textarea').val()
|
||||
var before = now.substr(0, selin)
|
||||
var after = now.substr(selin, now.length)
|
||||
var newt = before + emoji + after
|
||||
$('#textarea').val(newt)
|
||||
$('#textarea').focus()
|
||||
}
|
||||
function faicon() {
|
||||
var json = faicons;
|
||||
var emojis = "";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var emoji = json[key];
|
||||
var eje = emoji.replace(/fa-/g, "");
|
||||
emojis = emojis + '<a onclick="emojiInsert(\'[faicon]' + eje + '[/faicon]\')" class="pointer white-text" style="font-size:24px"><i class="fa ' + emoji + '"></i></a>';
|
||||
});
|
||||
$("#emoji-list").html(emojis);
|
||||
$("#now-emoji").text("faicon");
|
||||
$(".emoji-control").addClass("hide");
|
||||
}
|
||||
var json = faicons
|
||||
var emojis = ''
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var emoji = json[key]
|
||||
var eje = emoji.replace(/fa-/g, '')
|
||||
emojis =
|
||||
emojis +
|
||||
'<a onclick="emojiInsert(\'[faicon]' +
|
||||
eje +
|
||||
'[/faicon]\')" class="pointer white-text" style="font-size:24px"><i class="fa ' +
|
||||
emoji +
|
||||
'"></i></a>'
|
||||
})
|
||||
$('#emoji-list').html(emojis)
|
||||
$('#now-emoji').text('faicon')
|
||||
$('.emoji-control').addClass('hide')
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
var activity=[
|
||||
{shortcode:"soccer",css:"4.16667% 10.4167%"},
|
||||
{shortcode:"basketball",css:"16.6667% 56.25%"},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//インスタンスリスト
|
||||
var idata = {
|
||||
"kirishima.cloud": "instance",
|
||||
@@ -9,16 +10,11 @@ var idata = {
|
||||
"kirishima.cloud_public": "パブリックタイムライン",
|
||||
"minohdon.jp": "instance",
|
||||
"minohdon.jp_name": "箕面どん",
|
||||
"minohdon.jp_letters": "500",
|
||||
"minohdon.jp_bbcode": "disabled",
|
||||
"minohdon.jp_markdown": "disabled",
|
||||
"minohdon.jp_glitch": "disabled",
|
||||
"fedibird.com":"instance",
|
||||
"fedibird.com_name":"Fedibird",
|
||||
"fedibird.com_quote":"enabled",
|
||||
"mastodos.com": "instance",
|
||||
"mastodos.com_name": "マストどす",
|
||||
"mastodos.com_letters": "500",
|
||||
"mastodos.com_bbcode": "disabled",
|
||||
"mastodos.com_markdown": "disabled",
|
||||
"mastodos.com_glitch": "disabled",
|
||||
"dev.kirishima.cloud": "hidden",
|
||||
"dev.kirishima.cloud_name": "アスタルテ(Dev)",
|
||||
"dev.kirishima.cloud_letters": "6229",
|
||||
@@ -27,15 +23,8 @@ var idata = {
|
||||
"dev.kirishima.cloud_glitch": "enabled",
|
||||
"mstdn.y-zu.org": "instance",
|
||||
"mstdn.y-zu.org_name": "Yづドン(Y-zuDon)",
|
||||
"mstdn.y-zu.org_letters": "500",
|
||||
"mstdn.y-zu.org_bbcode": "disabled",
|
||||
"mstdn.y-zu.org_markdown": "enabled",
|
||||
"mstdn.y-zu.org_glitch": "disabled",
|
||||
"imastodon.net": "instance",
|
||||
"imastodon.net_name": "im@stodon",
|
||||
"imastodon.net_letters": "500",
|
||||
"imastodon.net_bbcode": "disabled",
|
||||
"imastodon.net_markdown": "disabled",
|
||||
"imastodon.net_home": "オフィス",
|
||||
"imastodon.net_local": "楽屋",
|
||||
"imastodon.net_notification": "ホワイトボード",
|
||||
@@ -44,12 +33,6 @@ var idata = {
|
||||
"imastodon.net_fav": "の頭にティンときたようです",
|
||||
"imastodon.net_bt": ":「わかるわ」",
|
||||
"imastodon.net_follow": "名刺をいただきました",
|
||||
"imastodon.net_glitch": "disabled",
|
||||
"mstdn.osaka": "instance",
|
||||
"mstdn.osaka_name": "大阪丼",
|
||||
"mstdn.osaka_letters": "500",
|
||||
"mstdn.osaka_bbcode": "disabled",
|
||||
"mstdn.osaka_markdown": "disabled",
|
||||
"mstdn.osaka_home": "ウチ",
|
||||
"mstdn.osaka_local": "近所",
|
||||
"mstdn.osaka_notification": "あめちゃん",
|
||||
@@ -58,12 +41,9 @@ var idata = {
|
||||
"mstdn.osaka_fav": "がええやん言いました",
|
||||
"mstdn.osaka_bt": "がしばいた",
|
||||
"mstdn.osaka_follow": "ツルまれました",
|
||||
"mstdn.osaka_glitch": "disabled",
|
||||
"mstdn.kemono-friends.info": "instance",
|
||||
"mstdn.kemono-friends.info_name": "ますとどんちほー",
|
||||
"mstdn.kemono-friends.info_letters": "1024",
|
||||
"mstdn.kemono-friends.info_bbcode": "disabled",
|
||||
"mstdn.kemono-friends.info_markdown": "disabled",
|
||||
"mstdn.kemono-friends.info_home": "なわばり",
|
||||
"mstdn.kemono-friends.info_local": "ますとどんちほー",
|
||||
"mstdn.kemono-friends.info_notification": "ねえねえ!",
|
||||
@@ -71,19 +51,13 @@ var idata = {
|
||||
"mstdn.kemono-friends.info_post": "がおー!",
|
||||
"mstdn.kemono-friends.info_fav": ":「すごーい」",
|
||||
"mstdn.kemono-friends.info_bt": ":「たーのしー」",
|
||||
"mstdn.kemono-friends.info_glitch": "disabled",
|
||||
"itabashi.0j0.jp": "instance",
|
||||
"itabashi.0j0.jp_name": "板橋丼",
|
||||
"itabashi.0j0.jp_letters": "1024",
|
||||
"itabashi.0j0.jp_bbcode": "disabled",
|
||||
"itabashi.0j0.jp_markdown": "disabled",
|
||||
"itabashi.0j0.jp_glitch": "disabled",
|
||||
"itabashi.0j0.jp_quote":"enabled",
|
||||
"dtp-mstdn.jp": "instance",
|
||||
"dtp-mstdn.jp_name": "DTP鯖",
|
||||
"dtp-mstdn.jp_letters": "500",
|
||||
"dtp-mstdn.jp_bbcode": "disabled",
|
||||
"dtp-mstdn.jp_markdown": "disabled",
|
||||
"dtp-mstdn.jp_glitch": "disabled",
|
||||
"dtp-mstdn.jp_name": "dtp-mstdn.jp",
|
||||
"dtp-mstdn.jp_quote":"enabled",
|
||||
"misskey.io": "misskey",
|
||||
"misskey.io_name": "misskey.io",
|
||||
"misskey.io_letters": "1000",
|
||||
@@ -93,7 +67,7 @@ var idata = {
|
||||
"misskey.io_post": "Post",
|
||||
"misskey.io_fav": " reacted your post.",
|
||||
"misskey.io_bt": " reposted your post.",
|
||||
"misskey.dev": "misskey.dev",
|
||||
"misskey.dev": "misskey",
|
||||
"misskey.dev_name": "misskey.dev",
|
||||
"misskey.dev_letters": "1024",
|
||||
"misskey.dev_bbcode": "disabled",
|
||||
@@ -105,10 +79,11 @@ var idata = {
|
||||
"precure.ml": "instance",
|
||||
"precure.ml_name": "キュアスタ!",
|
||||
"precure.ml_letters": "1024",
|
||||
"precure.ml_bbcode": "disabled",
|
||||
"precure.ml_markdown": "disabled",
|
||||
"precure.ml_post": "キュア!",
|
||||
"precure.ml_glitch": "disabled"
|
||||
"odakyu.app_quote":"enabled",
|
||||
"nitiasa.com_quote":"enabled",
|
||||
"biwakodon.com_quote":"enabled",
|
||||
"comm.cx_quote":"enabled"
|
||||
};
|
||||
|
||||
localStorage.setItem("instance", JSON.stringify(idata));
|
||||
|
||||
@@ -1,90 +1,106 @@
|
||||
'use strict'
|
||||
/*ログイン処理・認証までのJS*/
|
||||
//最初に読むやつ
|
||||
//アスタルテ判定初期化
|
||||
|
||||
localStorage.removeItem("kirishima")
|
||||
localStorage.removeItem("imas")
|
||||
localStorage.removeItem("image");
|
||||
localStorage.removeItem("stable")
|
||||
localStorage.setItem("mode_misskey.xyz", "misskey")
|
||||
localStorage.removeItem('kirishima')
|
||||
localStorage.removeItem('quoters')
|
||||
localStorage.removeItem('imas')
|
||||
localStorage.removeItem('image')
|
||||
localStorage.removeItem('stable')
|
||||
localStorage.setItem('mode_misskey.xyz', 'misskey')
|
||||
function ck() {
|
||||
var main = localStorage.getItem("main");
|
||||
var main = localStorage.getItem('main')
|
||||
if (!main) {
|
||||
localStorage.setItem("main", 0)
|
||||
localStorage.setItem('main', 0)
|
||||
}
|
||||
var domainz = localStorage.getItem("domain_0");
|
||||
var at = localStorage.getItem("acct_0_at");
|
||||
|
||||
//コード受信
|
||||
if (location.search) {
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
|
||||
var mode = m[1];
|
||||
var codex = m[2];
|
||||
if (mode == "manager" || mode == "login") {
|
||||
code(codex, mode);
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
|
||||
var mode = m[1]
|
||||
var codex = m[2]
|
||||
if (mode == 'manager' || mode == 'login') {
|
||||
code(codex, mode)
|
||||
} else {
|
||||
}
|
||||
}
|
||||
var multi = localStorage.getItem("multi");
|
||||
if (!multi || multi == "[]") {
|
||||
var date = new Date();
|
||||
localStorage.setItem("showSupportMe", date.getMonth() + 2)
|
||||
location.href = "acct.html?mode=first&code=true"
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (!multi || multi == '[]') {
|
||||
var date = new Date()
|
||||
localStorage.setItem('showSupportMe', date.getMonth() + 2)
|
||||
location.href = 'acct.html?mode=first&code=true'
|
||||
} else {
|
||||
var obj = JSON.parse(multi);
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var acct = obj[key];
|
||||
var obj = JSON.parse(multi)
|
||||
var jp = false
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var acct = obj[key]
|
||||
if (acct.domain) {
|
||||
refresh(key, true)
|
||||
}
|
||||
});
|
||||
if (acct.domain == 'mstdn.jp') {
|
||||
jp = true
|
||||
}
|
||||
})
|
||||
if (obj[0].domain) {
|
||||
$("#tl").show();
|
||||
ticker();
|
||||
multiSelector(false);
|
||||
verck(ver);
|
||||
$(".stw").show()
|
||||
$("#something-wrong img").attr("src", "../../img/thinking.svg")
|
||||
$('#tl').show()
|
||||
ticker()
|
||||
multiSelector(false)
|
||||
verck(ver, jp)
|
||||
$('.stw').show()
|
||||
$('#something-wrong img').attr('src', '../../img/thinking.svg')
|
||||
}
|
||||
}
|
||||
}
|
||||
ck();
|
||||
|
||||
ck()
|
||||
|
||||
//ログインポップアップ
|
||||
function login(url) {
|
||||
if ($('#linux:checked').val() == "on") {
|
||||
var red = "urn:ietf:wg:oauth:2.0:oob"
|
||||
if ($('#linux:checked').val() == 'on') {
|
||||
var red = 'urn:ietf:wg:oauth:2.0:oob'
|
||||
} else {
|
||||
var red = 'thedesk://login';
|
||||
var red = 'thedesk://login'
|
||||
}
|
||||
localStorage.setItem("redirect", red);
|
||||
var start = "https://" + url + "/api/v1/apps";
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({
|
||||
scopes: 'read write follow',
|
||||
client_name: "TheDesk(PC)",
|
||||
redirect_uris: red,
|
||||
website: "https://thedesk.top"
|
||||
}));
|
||||
httpreq.onreadystatechange = function () {
|
||||
localStorage.setItem('redirect', red)
|
||||
var start = 'https://' + url + '/api/v1/apps'
|
||||
var httpreq = new XMLHttpRequest()
|
||||
httpreq.open('POST', start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.send(
|
||||
JSON.stringify({
|
||||
scopes: 'read write follow',
|
||||
client_name: 'TheDesk(PC)',
|
||||
redirect_uris: red,
|
||||
website: 'https://thedesk.top'
|
||||
})
|
||||
)
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var auth = "https://" + url + "/oauth/authorize?client_id=" + json[
|
||||
"client_id"] + "&client_secret=" + json["client_secret"] +
|
||||
"&response_type=code&redirect_uri=" + red + "&scope=read+write+follow";
|
||||
localStorage.setItem("domain_" + acct_id, url);
|
||||
localStorage.setItem("client_id", json["client_id"]);
|
||||
localStorage.setItem("client_secret", json["client_secret"]);
|
||||
$("#auth").show();
|
||||
$("#masara").hide();
|
||||
postMessage(["openUrl", auth], "*")
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
var auth =
|
||||
'https://' +
|
||||
url +
|
||||
'/oauth/authorize?client_id=' +
|
||||
json['client_id'] +
|
||||
'&client_secret=' +
|
||||
json['client_secret'] +
|
||||
'&response_type=code&redirect_uri=' +
|
||||
red +
|
||||
'&scope=read+write+follow'
|
||||
localStorage.setItem('domain_' + acct_id, url)
|
||||
localStorage.setItem('client_id', json['client_id'])
|
||||
localStorage.setItem('client_secret', json['client_secret'])
|
||||
$('#auth').show()
|
||||
$('#masara').hide()
|
||||
postMessage(['openUrl', auth], '*')
|
||||
|
||||
if ($('#linux:checked').val() == "on") {
|
||||
if ($('#linux:checked').val() == 'on') {
|
||||
} else {
|
||||
postMessage(["sendSinmpleIpc", "quit"], "*")
|
||||
postMessage(['sendSinmpleIpc', 'quit'], '*')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,437 +108,505 @@ function login(url) {
|
||||
|
||||
//テキストボックスにURL入れた
|
||||
function instance() {
|
||||
var url = $("#url").val();
|
||||
login(url);
|
||||
var url = $('#url').val()
|
||||
login(url)
|
||||
}
|
||||
|
||||
|
||||
//コードを入れた後認証
|
||||
function code(code, mode) {
|
||||
var red = localStorage.getItem("redirect");
|
||||
localStorage.removeItem("redirect")
|
||||
var red = localStorage.getItem('redirect')
|
||||
localStorage.removeItem('redirect')
|
||||
if (!code) {
|
||||
var code = $("#code").val();
|
||||
var code = $('#code').val()
|
||||
}
|
||||
if (localStorage.getItem("domain_tmp")) {
|
||||
var url = localStorage.getItem("domain_tmp");
|
||||
if (localStorage.getItem('domain_tmp')) {
|
||||
var url = localStorage.getItem('domain_tmp')
|
||||
} else {
|
||||
var url = localStorage.getItem("domain_" + acct_id);
|
||||
var url = localStorage.getItem('domain_' + acct_id)
|
||||
}
|
||||
var start = "https://" + url + "/oauth/token";
|
||||
var id = localStorage.getItem("client_id");
|
||||
var secret = localStorage.getItem("client_secret");
|
||||
var start = 'https://' + url + '/oauth/token'
|
||||
var id = localStorage.getItem('client_id')
|
||||
var secret = localStorage.getItem('client_secret')
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
grant_type: "authorization_code",
|
||||
grant_type: 'authorization_code',
|
||||
redirect_uri: red,
|
||||
client_id: id,
|
||||
client_secret: secret,
|
||||
code: code
|
||||
})
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
todo(json);
|
||||
if (json["access_token"]) {
|
||||
localStorage.setItem(url + "_at", json["access_token"]);
|
||||
if (mode == "manager") {
|
||||
getdataAdv(url, json["access_token"]);
|
||||
} else {
|
||||
getdata();
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
todo(json)
|
||||
if (json['access_token']) {
|
||||
localStorage.setItem(url + '_at', json['access_token'])
|
||||
if (mode == 'manager') {
|
||||
getdataAdv(url, json['access_token'])
|
||||
} else {
|
||||
getdata()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//ユーザーデータ取得(最初)
|
||||
function getdata() {
|
||||
var acct_id = 0;
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/verify_credentials";
|
||||
var acct_id = 0
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/accounts/verify_credentials'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.error) {
|
||||
console.error("Error:" + json.error);
|
||||
M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 })
|
||||
return;
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
var avatar = json["avatar"];
|
||||
//missingがmissingなやつ
|
||||
if (avatar == "/avatars/original/missing.png") {
|
||||
avatar = "./img/missing.svg";
|
||||
}
|
||||
var obj = [{
|
||||
at: at,
|
||||
name: json["display_name"],
|
||||
domain: domain,
|
||||
user: json["acct"],
|
||||
prof: avatar,
|
||||
id: json["id"],
|
||||
vis: json["source"]["privacy"]
|
||||
}];
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("multi", json);
|
||||
localStorage.setItem("name_" + acct_id, json["display_name"]);
|
||||
localStorage.setItem("user_" + acct_id, json["acct"]);
|
||||
localStorage.setItem("user-id_" + acct_id, json["id"]);
|
||||
localStorage.setItem("prof_" + acct_id, avatar);
|
||||
$("#masara").hide();
|
||||
$("#auth").hide();
|
||||
$("#tl").show();
|
||||
parseColumn()
|
||||
ckdb();
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.error) {
|
||||
console.error('Error:' + json.error)
|
||||
M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
|
||||
return
|
||||
}
|
||||
var avatar = json['avatar']
|
||||
//missingがmissingなやつ
|
||||
if (avatar == '/avatars/original/missing.png') {
|
||||
avatar = './img/missing.svg'
|
||||
}
|
||||
var obj = [
|
||||
{
|
||||
at: at,
|
||||
name: json['display_name'],
|
||||
domain: domain,
|
||||
user: json['acct'],
|
||||
prof: avatar,
|
||||
id: json['id'],
|
||||
vis: json['source']['privacy']
|
||||
}
|
||||
]
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('multi', json)
|
||||
localStorage.setItem('name_' + acct_id, json['display_name'])
|
||||
localStorage.setItem('user_' + acct_id, json['acct'])
|
||||
localStorage.setItem('user-id_' + acct_id, json['id'])
|
||||
localStorage.setItem('prof_' + acct_id, avatar)
|
||||
$('#masara').hide()
|
||||
$('#auth').hide()
|
||||
$('#tl').show()
|
||||
parseColumn()
|
||||
ckdb()
|
||||
})
|
||||
}
|
||||
//ユーザーデータ取得(追加)
|
||||
function getdataAdv(domain, at) {
|
||||
var start = "https://" + domain + "/api/v1/accounts/verify_credentials";
|
||||
var start = 'https://' + domain + '/api/v1/accounts/verify_credentials'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.error) {
|
||||
console.error("Error:" + json.error);
|
||||
M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 })
|
||||
return;
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
var avatar = json["avatar"];
|
||||
//missingがmissingなやつ
|
||||
if (avatar == "/avatars/original/missing.png") {
|
||||
avatar = "../../img/missing.svg";
|
||||
}
|
||||
if (json["source"]["privacy"]) {
|
||||
var priv = json["source"]["privacy"];
|
||||
} else {
|
||||
var priv = "public";
|
||||
}
|
||||
var add = {
|
||||
at: at,
|
||||
name: json["display_name"],
|
||||
domain: domain,
|
||||
user: json["acct"],
|
||||
prof: avatar,
|
||||
id: json["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["display_name"]);
|
||||
localStorage.setItem("user_" + target, json["acct"]);
|
||||
localStorage.setItem("user-id_" + target, json["id"]);
|
||||
localStorage.setItem("prof_" + target, avatar);
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("multi", json);
|
||||
location.href = "index.html";
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.error) {
|
||||
console.error('Error:' + json.error)
|
||||
M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
|
||||
return
|
||||
}
|
||||
var avatar = json['avatar']
|
||||
//missingがmissingなやつ
|
||||
if (avatar == '/avatars/original/missing.png') {
|
||||
avatar = '../../img/missing.svg'
|
||||
}
|
||||
if (json['source']['privacy']) {
|
||||
var priv = json['source']['privacy']
|
||||
} else {
|
||||
var priv = 'public'
|
||||
}
|
||||
var add = {
|
||||
at: at,
|
||||
name: json['display_name'],
|
||||
domain: domain,
|
||||
user: json['acct'],
|
||||
prof: avatar,
|
||||
id: json['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['display_name'])
|
||||
localStorage.setItem('user_' + target, json['acct'])
|
||||
localStorage.setItem('user-id_' + target, json['id'])
|
||||
localStorage.setItem('prof_' + target, avatar)
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('multi', json)
|
||||
location.href = 'index.html'
|
||||
})
|
||||
}
|
||||
//ユーザーデータ更新
|
||||
function refresh(target, loadskip) {
|
||||
var multi = localStorage.getItem("multi");
|
||||
var obj = JSON.parse(multi);
|
||||
if (obj[target].mode == "misskey") {
|
||||
var multi = localStorage.getItem('multi')
|
||||
var obj = JSON.parse(multi)
|
||||
if (obj[target].mode == 'misskey') {
|
||||
return
|
||||
}
|
||||
var start = "https://" + obj[target].domain +
|
||||
"/api/v1/accounts/verify_credentials";
|
||||
var start = 'https://' + obj[target].domain + '/api/v1/accounts/verify_credentials'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + obj[target].at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.error) {
|
||||
console.error("Error:" + json.error);
|
||||
M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 })
|
||||
return;
|
||||
Authorization: 'Bearer ' + obj[target].at
|
||||
}
|
||||
var avatar = json["avatar"];
|
||||
//missingがmissingなやつ
|
||||
if (avatar == "/avatars/original/missing.png" || !avatar) {
|
||||
avatar = "./img/missing.svg";
|
||||
}
|
||||
var ref = {
|
||||
at: obj[target].at,
|
||||
name: json["display_name"],
|
||||
domain: obj[target].domain,
|
||||
user: json["acct"],
|
||||
prof: avatar,
|
||||
id: json["id"],
|
||||
vis: json["source"]["privacy"]
|
||||
};
|
||||
localStorage.setItem("name_" + target, json["display_name"]);
|
||||
localStorage.setItem("user_" + target, json["acct"]);
|
||||
localStorage.setItem("user-id_" + target, json["id"]);
|
||||
localStorage.setItem("prof_" + target, avatar);
|
||||
localStorage.setItem("follow_" + target, json["following_count"]);
|
||||
console.log(obj)
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("multi", json);
|
||||
if (!loadskip) {
|
||||
load();
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.error) {
|
||||
console.error('Error:' + json.error)
|
||||
M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
|
||||
return
|
||||
}
|
||||
var avatar = json['avatar']
|
||||
//missingがmissingなやつ
|
||||
if (avatar == '/avatars/original/missing.png' || !avatar) {
|
||||
avatar = './img/missing.svg'
|
||||
}
|
||||
var ref = {
|
||||
at: obj[target].at,
|
||||
name: json['display_name'],
|
||||
domain: obj[target].domain,
|
||||
user: json['acct'],
|
||||
prof: avatar,
|
||||
id: json['id'],
|
||||
vis: json['source']['privacy']
|
||||
}
|
||||
if (obj[target].background) {
|
||||
ref.background = obj[target].background
|
||||
}
|
||||
if (obj[target].text) {
|
||||
ref.text = obj[target].text
|
||||
}
|
||||
localStorage.setItem('name_' + target, json['display_name'])
|
||||
localStorage.setItem('user_' + target, json['acct'])
|
||||
localStorage.setItem('user-id_' + target, json['id'])
|
||||
localStorage.setItem('prof_' + target, avatar)
|
||||
localStorage.setItem('follow_' + target, json['following_count'])
|
||||
if (json['source']['sensitive']) {
|
||||
localStorage.setItem('nsfw_' + target, 'true')
|
||||
} else {
|
||||
localStorage.removeItem('nsfw_' + target)
|
||||
}
|
||||
obj[target] = ref
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('multi', json)
|
||||
if (!loadskip) {
|
||||
load()
|
||||
}
|
||||
})
|
||||
}
|
||||
//MarkdownやBBCodeの対応、文字数制限をチェック
|
||||
//絶対ストリーミングを閉じさせないマン
|
||||
function ckdb(acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
localStorage.removeItem("home_" + acct_id);
|
||||
localStorage.removeItem("bb_" + acct_id);
|
||||
localStorage.removeItem("md_" + acct_id);
|
||||
localStorage.removeItem("local_" + acct_id);
|
||||
localStorage.removeItem("public_" + acct_id);
|
||||
localStorage.removeItem("notification_" + acct_id);
|
||||
localStorage.removeItem("post_" + acct_id);
|
||||
localStorage.removeItem("fav_" + acct_id);
|
||||
localStorage.removeItem("bt_" + acct_id);
|
||||
localStorage.removeItem("followlocale_" + acct_id);
|
||||
if (domain == "kirishima.cloud") {
|
||||
localStorage.setItem("kirishima", "true");
|
||||
$("#ranking-btn").show();
|
||||
} else if (domain == "imastodon.net") {
|
||||
localStorage.setItem("imas", "true");
|
||||
$(".imasonly").show();
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
localStorage.removeItem('home_' + acct_id)
|
||||
localStorage.removeItem('bb_' + acct_id)
|
||||
localStorage.removeItem('md_' + acct_id)
|
||||
localStorage.removeItem('local_' + acct_id)
|
||||
localStorage.removeItem('public_' + acct_id)
|
||||
localStorage.removeItem('notification_' + acct_id)
|
||||
localStorage.removeItem('post_' + acct_id)
|
||||
localStorage.removeItem('fav_' + acct_id)
|
||||
localStorage.removeItem('bt_' + acct_id)
|
||||
localStorage.removeItem('followlocale_' + acct_id)
|
||||
if (domain == 'kirishima.cloud') {
|
||||
localStorage.setItem('kirishima', 'true')
|
||||
} else if (domain == 'imastodon.net') {
|
||||
localStorage.setItem('imas', 'true')
|
||||
$('.imasonly').show()
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var bbcode = domain + "_bbcode";
|
||||
var letters = domain + "_letters";
|
||||
if (localStorage.getItem("instance")) {
|
||||
var json = JSON.parse(localStorage.getItem("instance"));
|
||||
var bbcode = domain + '_bbcode'
|
||||
var quoteMarker = domain + '_quote'
|
||||
if (localStorage.getItem('instance')) {
|
||||
var json = JSON.parse(localStorage.getItem('instance'))
|
||||
if (json[quoteMarker] == 'enabled') {
|
||||
localStorage.setItem('quoters', 'true')
|
||||
localStorage.setItem('quote_' + acct_id, 'true')
|
||||
}
|
||||
if (json[bbcode]) {
|
||||
if (json[bbcode] == "enabled") {
|
||||
localStorage.setItem("bb_" + acct_id, "true");
|
||||
if (json[bbcode] == 'enabled') {
|
||||
localStorage.setItem('bb_' + acct_id, 'true')
|
||||
} else {
|
||||
localStorage.removeItem("bb_" + acct_id);
|
||||
$("[data-activates='bbcode']").addClass("disabled");
|
||||
$("[data-activates='bbcode']").prop("disabled", true);
|
||||
localStorage.removeItem('bb_' + acct_id)
|
||||
$("[data-activates='bbcode']").addClass('disabled')
|
||||
$("[data-activates='bbcode']").prop('disabled', true)
|
||||
}
|
||||
} else {
|
||||
localStorage.removeItem("bb_" + acct_id);
|
||||
$("[data-activates='bbcode']").addClass("disabled");
|
||||
$("[data-activates='bbcode']").addClass("disabled", true);
|
||||
localStorage.removeItem('bb_' + acct_id)
|
||||
$("[data-activates='bbcode']").addClass('disabled')
|
||||
$("[data-activates='bbcode']").addClass('disabled', true)
|
||||
}
|
||||
|
||||
if (json[domain + "_markdown"] == "enabled") {
|
||||
localStorage.setItem("md_" + acct_id, "true");
|
||||
$(".markdown").show();
|
||||
if (json[domain + '_markdown'] == 'enabled') {
|
||||
localStorage.setItem('md_' + acct_id, 'true')
|
||||
$('.markdown').show()
|
||||
} else {
|
||||
$(".anti-markdown").hide();
|
||||
$(".markdown").hide();
|
||||
localStorage.removeItem("bb_" + acct_id);
|
||||
$('.anti-markdown').hide()
|
||||
$('.markdown').hide()
|
||||
localStorage.removeItem('bb_' + acct_id)
|
||||
}
|
||||
if (json[domain + "_home"]) {
|
||||
localStorage.setItem("home_" + acct_id, json[domain + "_home"]);
|
||||
if (json[domain + '_home']) {
|
||||
localStorage.setItem('home_' + acct_id, json[domain + '_home'])
|
||||
}
|
||||
if (json[domain + "_local"]) {
|
||||
localStorage.setItem("local_" + acct_id, json[domain + "_local"]);
|
||||
if (json[domain + '_local']) {
|
||||
localStorage.setItem('local_' + acct_id, json[domain + '_local'])
|
||||
}
|
||||
if (json[domain + "_public"]) {
|
||||
localStorage.setItem("public_" + acct_id, json[domain + "_public"]);
|
||||
if (json[domain + '_public']) {
|
||||
localStorage.setItem('public_' + acct_id, json[domain + '_public'])
|
||||
}
|
||||
if (json[domain + "_notification"]) {
|
||||
localStorage.setItem("notification_" + acct_id, json[domain + "_notification"]);
|
||||
if (json[domain + '_notification']) {
|
||||
localStorage.setItem('notification_' + acct_id, json[domain + '_notification'])
|
||||
}
|
||||
if (json[domain + "_post"]) {
|
||||
localStorage.setItem("post_" + acct_id, json[domain + "_post"]);
|
||||
if (json[domain + '_post']) {
|
||||
localStorage.setItem('post_' + acct_id, json[domain + '_post'])
|
||||
}
|
||||
if (json[domain + "_fav"]) {
|
||||
localStorage.setItem("fav_" + acct_id, json[domain + "_fav"]);
|
||||
if (json[domain + '_fav']) {
|
||||
localStorage.setItem('fav_' + acct_id, json[domain + '_fav'])
|
||||
}
|
||||
if (json[domain + "_bt"]) {
|
||||
localStorage.setItem("bt_" + acct_id, json[domain + "_bt"]);
|
||||
if (json[domain + '_bt']) {
|
||||
localStorage.setItem('bt_' + acct_id, json[domain + '_bt'])
|
||||
}
|
||||
if (json[domain + "_follow"]) {
|
||||
localStorage.setItem("followlocale_" + acct_id, json[domain + "_follow"]);
|
||||
if (json[domain + '_follow']) {
|
||||
localStorage.setItem('followlocale_' + acct_id, json[domain + '_follow'])
|
||||
}
|
||||
}
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
var start = "https://" + domain + "/api/v1/instance";
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
var start = 'https://' + domain + '/api/v1/instance'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.error) {
|
||||
console.error(json.error);
|
||||
return;
|
||||
}
|
||||
if (json) {
|
||||
if (json["max_toot_chars"]) {
|
||||
localStorage.setItem("letters_" + acct_id, json["max_toot_chars"]);
|
||||
})
|
||||
.then(function(response) {
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.error) {
|
||||
console.error(json.error)
|
||||
return
|
||||
}
|
||||
if (json["urls"]["streaming_api"]) {
|
||||
localStorage.setItem("streaming_" + acct_id, json["urls"]["streaming_api"]);
|
||||
if (json) {
|
||||
if (json['max_toot_chars']) {
|
||||
localStorage.setItem('letters_' + acct_id, json['max_toot_chars'])
|
||||
}
|
||||
if (json['urls']['streaming_api']) {
|
||||
localStorage.setItem('streaming_' + acct_id, json['urls']['streaming_api'])
|
||||
} else {
|
||||
localStorage.removeItem('streaming_' + acct_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//アカウントを選択…を実装
|
||||
function multiSelector(parseC) {
|
||||
var multi = localStorage.getItem("multi");
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (!multi) {
|
||||
var obj = [];
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("multi", json);
|
||||
var obj = []
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('multi', json)
|
||||
} else {
|
||||
var obj = JSON.parse(multi);
|
||||
var obj = JSON.parse(multi)
|
||||
}
|
||||
var templete;
|
||||
if (localStorage.getItem("mainuse") == "main") {
|
||||
var last = localStorage.getItem("main");
|
||||
} else if (localStorage.getItem("last-use")) {
|
||||
var last = localStorage.getItem("last-use");
|
||||
if (last == "webview" || last == "noauth") {
|
||||
last = "0";
|
||||
var templete
|
||||
if (localStorage.getItem('mainuse') == 'main') {
|
||||
var last = localStorage.getItem('main')
|
||||
} else if (localStorage.getItem('last-use')) {
|
||||
var last = localStorage.getItem('last-use')
|
||||
if (last == 'webview' || last == 'noauth') {
|
||||
last = '0'
|
||||
}
|
||||
} else {
|
||||
var last = "0";
|
||||
var last = '0'
|
||||
}
|
||||
last = last + "";
|
||||
var sel;
|
||||
last = last + ''
|
||||
var sel
|
||||
if (obj.length < 1) {
|
||||
$("#src-acct-sel").html('<option value="tootsearch">Tootsearch</option>');
|
||||
$("#add-acct-sel").html('<option value="noauth">' + lang.lang_login_noauth + '</option>');
|
||||
$('#src-acct-sel').html('<option value="tootsearch">Tootsearch</option>')
|
||||
$('#add-acct-sel').html('<option value="noauth">' + lang.lang_login_noauth + '</option>')
|
||||
} else {
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var acct = obj[key];
|
||||
var list = key * 1 + 1;
|
||||
if (key+"" === last) {
|
||||
sel = "selected";
|
||||
var domain = acct.domain;
|
||||
localStorage.setItem("domain_" + key, domain);
|
||||
if (idata[domain + "_letters"]) {
|
||||
$("#textarea").attr("data-length", idata[domain + "_letters"])
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var acct = obj[key]
|
||||
var list = key * 1 + 1
|
||||
if (key + '' === last) {
|
||||
sel = 'selected'
|
||||
var domain = acct.domain
|
||||
localStorage.setItem('domain_' + key, domain)
|
||||
if (idata[domain + '_letters']) {
|
||||
$('#textarea').attr('data-length', idata[domain + '_letters'])
|
||||
} else {
|
||||
var maxletters = localStorage.getItem("letters_" + key);
|
||||
var maxletters = localStorage.getItem('letters_' + key)
|
||||
if (maxletters > 0) {
|
||||
$("#textarea").attr("data-length", maxletters)
|
||||
$('#textarea').attr('data-length', maxletters)
|
||||
} else {
|
||||
$("#textarea").attr("data-length", 500)
|
||||
$('#textarea').attr('data-length', 500)
|
||||
}
|
||||
}
|
||||
if (idata[domain + "_glitch"]) {
|
||||
$("#local-button").removeClass("hide")
|
||||
if (idata[domain + '_glitch']) {
|
||||
$('#local-button').removeClass('hide')
|
||||
}
|
||||
var profimg = acct.prof;
|
||||
var profimg = acct.prof
|
||||
//localStorage.setItem("prof_" + key, profimg);
|
||||
if (!profimg) {
|
||||
profimg = "../../img/missing.svg";
|
||||
profimg = '../../img/missing.svg'
|
||||
}
|
||||
$("#acct-sel-prof").attr("src", profimg);
|
||||
$('#acct-sel-prof').attr('src', profimg)
|
||||
if (domain) {
|
||||
var cc = "(" + domain + ")";
|
||||
var cc = '(' + domain + ')'
|
||||
} else {
|
||||
var cc = "";
|
||||
var cc = ''
|
||||
}
|
||||
$("#toot-post-btn").text(lang.lang_toot + cc);
|
||||
if (acct.background && acct.background != "def" && acct.text && acct.text != "def") {
|
||||
$("#toot-post-btn").removeClass("indigo");
|
||||
$("#toot-post-btn").css("background-color", "#" + acct.background);
|
||||
$("#toot-post-btn").css("color", acct.text);
|
||||
$('#toot-post-btn').text(lang.lang_toot + cc)
|
||||
if (acct.background && acct.background != 'def' && acct.text && acct.text != 'def') {
|
||||
$('#toot-post-btn').removeClass('indigo')
|
||||
$('#toot-post-btn').css('background-color', '#' + acct.background)
|
||||
$('#toot-post-btn').css('color', acct.text)
|
||||
} else {
|
||||
}
|
||||
if (domain == "kirishima.cloud") {
|
||||
$("#faicon-btn").show();
|
||||
if (domain == 'kirishima.cloud') {
|
||||
$('#faicon-btn').show()
|
||||
} else {
|
||||
$("#faicon-btn").hide();
|
||||
$('#faicon-btn').hide()
|
||||
}
|
||||
if (domain == "imastodon.net") {
|
||||
trendTag();
|
||||
if (domain == 'imastodon.net') {
|
||||
trendTag()
|
||||
} else {
|
||||
$("#trendtag").html("");
|
||||
$('#trendtag').html('')
|
||||
}
|
||||
} else {
|
||||
sel = "";
|
||||
sel = ''
|
||||
}
|
||||
templete = '<option value="' + key + '" data-icon="' + acct.prof +
|
||||
'" class="left circle" ' + sel + '>' + acct.user + '@' + acct.domain +
|
||||
'</option>';
|
||||
$(".acct-sel").append(templete);
|
||||
|
||||
});
|
||||
$("#src-acct-sel").append('<option value="tootsearch">Tootsearch</option>');
|
||||
$("#add-acct-sel").append('<option value="noauth">' + lang.lang_login_noauth + '</option><option value="webview">Twitter</option>');
|
||||
templete =
|
||||
'<option value="' +
|
||||
key +
|
||||
'" data-icon="' +
|
||||
acct.prof +
|
||||
'" class="left circle" ' +
|
||||
sel +
|
||||
'>' +
|
||||
acct.user +
|
||||
'@' +
|
||||
acct.domain +
|
||||
'</option>'
|
||||
$('.acct-sel').append(templete)
|
||||
})
|
||||
$('#src-acct-sel').append('<option value="tootsearch">Tootsearch</option>')
|
||||
$('#add-acct-sel').append(
|
||||
'<option value="noauth">' +
|
||||
lang.lang_login_noauth +
|
||||
'</option><option value="webview">Twitter</option>'
|
||||
)
|
||||
$('#dir-acct-sel').append('<option value="noauth">' + lang.lang_login_noauth + '</option>')
|
||||
}
|
||||
$('select').formSelect();
|
||||
if(!parseC){
|
||||
parseColumn(null, true);
|
||||
$('select').formSelect()
|
||||
if (!parseC) {
|
||||
parseColumn(null, true)
|
||||
}
|
||||
}
|
||||
|
||||
//バージョンエンコ
|
||||
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;
|
||||
var ver = ver.replace(/\s/g, '')
|
||||
ver = ver.replace(/\(/g, '-')
|
||||
ver = ver.replace(/\)/g, '')
|
||||
ver = ver.replace(/\[/g, '_')
|
||||
ver = ver.replace(/\]/g, '')
|
||||
return ver
|
||||
}
|
||||
//インスタンスティッカー
|
||||
function ticker() {
|
||||
var start = "https://toot.app/toot/";
|
||||
var start = 'https://toot.app/toot/'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.error) {
|
||||
return;
|
||||
}
|
||||
if (json) {
|
||||
localStorage.setItem("ticker", JSON.stringify(json));
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
localStorage.setItem('ticker', JSON.stringify(json))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//ログアウトします
|
||||
function logout() {
|
||||
localStorage.removeItem("acct_" + acct_id + "_at");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,173 +1,188 @@
|
||||
'use strict'
|
||||
//プラットフォーム別 最後に読むやつ
|
||||
//リンクを外部で開くか内部で出すか
|
||||
//リンクを外部で開くか内部で出すか
|
||||
$(document).on('click', 'a', e => {
|
||||
var $a = $(e.target);
|
||||
var url = $a.attr('href');
|
||||
var $a = $(e.target)
|
||||
var url = $a.attr('href')
|
||||
if (!url) {
|
||||
var url = $a.parent().attr('href');
|
||||
var url = $a.parent().attr('href')
|
||||
}
|
||||
var urls = [];
|
||||
var urls = []
|
||||
if (url) {
|
||||
urls = url.match(/https?:\/\/(.+)/);
|
||||
urls = url.match(/https?:\/\/(.+)/)
|
||||
//トゥートのURLぽかったら
|
||||
toot = url.match(/https:\/\/([^+_]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/);
|
||||
if(!toot){
|
||||
var toot = url.match(/https:\/\/([^+_]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/)
|
||||
if (!toot) {
|
||||
//Pleroma対策
|
||||
toot = url.match(/https:\/\/([^+_]+)\/users\/([a-zA-Z0-9_]+)\/statuses\/([0-9]+)/);
|
||||
toot = url.match(/https:\/\/([^+_]+)\/users\/([a-zA-Z0-9_]+)\/statuses\/([0-9]+)/)
|
||||
}
|
||||
//タグのURLぽかったら
|
||||
var tags = [];
|
||||
tags = url.match(
|
||||
/https:\/\/([^+_]+)\/tags\/([-_.!~*\'()a-zA-Z0-9;\/?:\&=+\$,%#]+)/
|
||||
);
|
||||
var tags = []
|
||||
tags = url.match(/https:\/\/([^+_]+)\/tags\/([_a-zA-Z0-9\&=+\%]+)/)
|
||||
//メンションっぽかったら
|
||||
var ats = [];
|
||||
ats = url.match(
|
||||
/https:\/\/([^+_]+)\/@([-_.!~*\'()a-zA-Z0-9;\/?:\&=+\$,%#@]+)/
|
||||
);
|
||||
var ats = []
|
||||
ats = url.match(/https:\/\/([^+_]+)\/@([_a-zA-Z0-9\&=+\%]+)/)
|
||||
if (toot) {
|
||||
if (toot[1]) {
|
||||
var acct_id = $a.parent().attr("data-acct");
|
||||
var acct_id = $a.parent().attr('data-acct')
|
||||
if (!acct_id) {
|
||||
acct_id = 0;
|
||||
acct_id = 0
|
||||
}
|
||||
$a.parent().addClass("loadp")
|
||||
$a.parent().text("Loading...")
|
||||
detEx(url, acct_id);
|
||||
$a.parent().addClass('loadp')
|
||||
$a.parent().text('Loading...')
|
||||
detEx(url, acct_id)
|
||||
}
|
||||
|
||||
} else if (tags) {
|
||||
if (tags[2]) {
|
||||
var acct_id = $a.parent().attr("data-acct");
|
||||
var acct_id = $a.parent().attr('data-acct')
|
||||
if (!acct_id) {
|
||||
acct_id = 0;
|
||||
acct_id = 0
|
||||
}
|
||||
tl('tag', decodeURI(tags[2]), acct_id, 'add')
|
||||
}
|
||||
} else if (ats) {
|
||||
if (ats[2]) {
|
||||
//Quesdon判定
|
||||
if (!~ats[2].indexOf("@")) {
|
||||
udgEx(ats[2] + "@" + ats[1], "main");
|
||||
if (!~ats[2].indexOf('@')) {
|
||||
udgEx(url, 'main')
|
||||
return false
|
||||
} else {
|
||||
postMessage(["openUrl", url], "*")
|
||||
postMessage(['openUrl', url], '*')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
//hrefがhttp/httpsならブラウザで
|
||||
if (urls) {
|
||||
if (urls[0]) {
|
||||
if (~url.indexOf("thedeks.top")) {
|
||||
if (~url.indexOf('thedeks.top')) {
|
||||
//alert("If you recieve this alert, let the developer(Cutls@kirishima.cloud) know it with a screenshot.");
|
||||
url = "https://thedesk.top";
|
||||
url = 'https://thedesk.top'
|
||||
}
|
||||
postMessage(["openUrl", url], "*")
|
||||
postMessage(['openUrl', url], '*')
|
||||
} else {
|
||||
|
||||
location.href = url;
|
||||
location.href = url
|
||||
}
|
||||
} else {
|
||||
location.href = url;
|
||||
location.href = url
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return false
|
||||
})
|
||||
|
||||
//よく使うライブラリ
|
||||
|
||||
//コピー
|
||||
function execCopy(string) {
|
||||
var temp = $("#copy");
|
||||
temp.val(string);
|
||||
temp.select();
|
||||
var result = document.execCommand('copy');
|
||||
return result;
|
||||
postMessage(['copy', string], '*')
|
||||
return true
|
||||
}
|
||||
function progshow(e) {
|
||||
if (e.lengthComputable) {
|
||||
var percent = e.loaded / e.total;
|
||||
console.log("Progress: " + percent * 100);
|
||||
$("#imgsel").hide();
|
||||
var percent = e.loaded / e.total
|
||||
console.log('Progress: ' + percent * 100)
|
||||
$('#imgsel').hide()
|
||||
if (percent < 1) {
|
||||
$("#imgup").text(Math.floor(percent * 100) + "%");
|
||||
$('#imgup').text(Math.floor(percent * 100) + '%')
|
||||
} else {
|
||||
$("#imgup").text(lang.lang_progress);
|
||||
$('#imgup').text(lang.lang_progress)
|
||||
}
|
||||
}
|
||||
}
|
||||
function opendev() {
|
||||
var webview = document.getElementById("webview");
|
||||
webview.openDevTools();
|
||||
var webview = document.getElementById('webview')
|
||||
webview.openDevTools()
|
||||
/*webview.sendInputEvent({
|
||||
type: "keyDown",
|
||||
keyCode: '2'
|
||||
});
|
||||
*/
|
||||
}
|
||||
var soundFile
|
||||
function playSound() {
|
||||
window.AudioContext = window.AudioContext || window.webkitAudioContext;
|
||||
context = new AudioContext();
|
||||
context.createBufferSource().start(0);
|
||||
context.decodeAudioData(request.response, function (buf) {
|
||||
console.log("Playing:" + source)
|
||||
source.buffer = buf;
|
||||
source.loop = false;
|
||||
});
|
||||
source = context.createBufferSource();
|
||||
volumeControl = context.createGain();
|
||||
source.connect(volumeControl);
|
||||
volumeControl.connect(context.destination);
|
||||
volumeControl.gain.value = 0.8
|
||||
source.start(0);
|
||||
window.AudioContext = window.AudioContext || window.webkitAudioContext
|
||||
if (soundFile) {
|
||||
soundFile.stop()
|
||||
}
|
||||
var context = new AudioContext()
|
||||
context.createBufferSource().start(0)
|
||||
context.decodeAudioData(request.response, function(buf) {
|
||||
//console.log("Playing:" , source)
|
||||
source.buffer = buf
|
||||
source.loop = false
|
||||
})
|
||||
source = context.createBufferSource()
|
||||
volumeControl = context.createGain()
|
||||
source.connect(volumeControl)
|
||||
volumeControl.connect(context.destination)
|
||||
var cvol = localStorage.getItem('customVol')
|
||||
if (cvol) {
|
||||
vol = cvol
|
||||
} else {
|
||||
vol = 0.8
|
||||
}
|
||||
volumeControl.gain.value = vol
|
||||
source.start(0)
|
||||
soundFile = source
|
||||
}
|
||||
function nano() {
|
||||
postMessage(["nano", null], "*")
|
||||
postMessage(['nano', null], '*')
|
||||
}
|
||||
onmessage = function (e) {
|
||||
if (e.data[0] == "details") {
|
||||
onmessage = function(e) {
|
||||
if (e.data[0] == 'details') {
|
||||
details(e.data[1][0], e.data[1][1])
|
||||
} else if (e.data[0] == "udg") {
|
||||
} else if (e.data[0] == 'udg') {
|
||||
udg(e.data[1][0], e.data[1][1])
|
||||
} else if (e.data[0] == "media") {
|
||||
} else if (e.data[0] == 'media') {
|
||||
media(e.data[1][0], e.data[1][1], e.data[1][2])
|
||||
} else if (e.data[0] == "post") {
|
||||
post("pass")
|
||||
} else if (e.data[0] == "toastSaved") {
|
||||
M.toast({ html: lang.lang_img_DLDone + e.data[1][0] + '<button class="btn-flat toast-action" onclick="openFinder(\'' + e.data[1][1] + '\')">Show</button>', displayLength: 5000 })
|
||||
} else if (e.data[0] == "parseColumn") {
|
||||
} else if (e.data[0] == 'post') {
|
||||
post('pass')
|
||||
} else if (e.data[0] == 'toastSaved') {
|
||||
var show = `${lang.lang_img_DLDone}${
|
||||
e.data[1][0]
|
||||
}<button class="btn-flat toast-action" onclick="openFinder(${e.data[1][1]}')">Show</button>`
|
||||
M.toast({ html: show, displayLength: 5000 })
|
||||
} else if (e.data[0] == 'parseColumn') {
|
||||
parseColumn(e.data[1])
|
||||
} else if (e.data[0] == "exportSettingsCore") {
|
||||
exportSettingsCore()
|
||||
} else if (e.data[0] == "fontList") {
|
||||
} else if (e.data[0] == 'exportSettingsCore') {
|
||||
var exp = exportSettingsCore()
|
||||
postMessage(['exportSettingsCoreComplete', [e.data[1], exp]], '*')
|
||||
} else if (e.data[0] == 'importSettingsCore') {
|
||||
importSettingsCore(e.data[1])
|
||||
} else if (e.data[0] == 'fontList') {
|
||||
fontList(e.data[1])
|
||||
} else if (e.data[0] == "customSoundSave") {
|
||||
} else if (e.data[0] == 'customSoundSave') {
|
||||
customSoundSave(e.data[1][0], e.data[1][1])
|
||||
} else if (e.data[0] == "ctLoadCore") {
|
||||
} else if (e.data[0] == 'ctLoadCore') {
|
||||
ctLoadCore(e.data[1])
|
||||
} else if (e.data[0] == "ctLoad") {
|
||||
} else if (e.data[0] == 'ctLoad') {
|
||||
ctLoad()
|
||||
} else if (e.data[0] == "customConnect") {
|
||||
} else if (e.data[0] == 'customConnect') {
|
||||
customConnect(e.data[1])
|
||||
} else if (e.data[0] == "clearCustomImport") {
|
||||
} else if (e.data[0] == 'clearCustomImport') {
|
||||
clearCustomImport()
|
||||
} else if (e.data[0] == "npCore") {
|
||||
npCore(e.data[1]);
|
||||
} else if (e.data[0] == "renderMem") {
|
||||
} else if (e.data[0] == 'npCore') {
|
||||
npCore(e.data[1])
|
||||
} else if (e.data[0] == 'renderMem') {
|
||||
renderMem(e.data[1][0], e.data[1][1], e.data[1][2])
|
||||
} else if (e.data[0] == "updateProg") {
|
||||
updateProg(e.data[1]);
|
||||
} else if (e.data[0] == "updateMess") {
|
||||
updateMess(e.data[1]);
|
||||
} else if (e.data[0] == "renderAbout") {
|
||||
renderAbout(e.data[1]);
|
||||
} else if (e.data[0] == "alert") {
|
||||
} else if (e.data[0] == 'updateProg') {
|
||||
updateProg(e.data[1])
|
||||
} else if (e.data[0] == 'updateMess') {
|
||||
updateMess(e.data[1])
|
||||
} else if (e.data[0] == 'renderAbout') {
|
||||
renderAbout(e.data[1])
|
||||
} else if (e.data[0] == 'asRead') {
|
||||
asRead()
|
||||
} else if (e.data[0] == 'asReadEnd') {
|
||||
asReadEnd()
|
||||
} else if (e.data[0] == 'logData') {
|
||||
$('#logs').val(e.data[1])
|
||||
var obj = document.getElementById('logs')
|
||||
obj.scrollTop = obj.scrollHeight
|
||||
} else if (e.data[0] == 'alert') {
|
||||
Swal.fire({
|
||||
type: 'info',
|
||||
title: e.data[1]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
'use strict'
|
||||
//jQuery読む
|
||||
|
||||
@@ -1,199 +1,214 @@
|
||||
document.title="TheDesk"
|
||||
$.strip_tags = function (str, allowed) {
|
||||
'use strict'
|
||||
document.title = 'TheDesk'
|
||||
$.strip_tags = function(str, allowed) {
|
||||
if (!str) {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || [])
|
||||
.join('');
|
||||
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('')
|
||||
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
|
||||
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
|
||||
return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
|
||||
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
|
||||
});
|
||||
};
|
||||
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi
|
||||
return str.replace(commentsAndPhpTags, '').replace(tags, function($0, $1) {
|
||||
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
|
||||
})
|
||||
}
|
||||
function escapeHTML(str) {
|
||||
if (!str) {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
return str.replace(/&/g, '&')
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
.replace(/'/g, ''')
|
||||
}
|
||||
//PHPのnl2brと同様
|
||||
function nl2br(str) {
|
||||
if (!str) {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
str = str.replace(/\r\n/g, "<br />");
|
||||
str = str.replace(/(\n|\r)/g, "<br />");
|
||||
return str;
|
||||
str = str.replace(/\r\n/g, '<br />')
|
||||
str = str.replace(/(\n|\r)/g, '<br />')
|
||||
return str
|
||||
}
|
||||
function br2nl(str) {
|
||||
if (!str) {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
str = str.replace(/<br \/>/g, "\r\n");
|
||||
return str;
|
||||
str = str.replace(/<br \/>/g, '\r\n')
|
||||
return str
|
||||
}
|
||||
function formattime(date) {
|
||||
var str = date.getFullYear() + "-";
|
||||
var str = date.getFullYear() + '-'
|
||||
if (date.getMonth() + 1 < 10) {
|
||||
str = str + "0" + (date.getMonth() + 1) + "-";
|
||||
str = str + '0' + (date.getMonth() + 1) + '-'
|
||||
} else {
|
||||
str = str + (date.getMonth() + 1) + "-";
|
||||
str = str + (date.getMonth() + 1) + '-'
|
||||
}
|
||||
if (date.getDate() < 10) {
|
||||
str = str + "0" + date.getDate()
|
||||
str = str + '0' + date.getDate()
|
||||
} else {
|
||||
str = str + date.getDate()
|
||||
}
|
||||
str = str + "T";
|
||||
str = str + 'T'
|
||||
if (date.getHours() < 10) {
|
||||
str = str + "0" + date.getHours() + ":"
|
||||
str = str + '0' + date.getHours() + ':'
|
||||
} else {
|
||||
str = str + date.getHours() + ":"
|
||||
str = str + date.getHours() + ':'
|
||||
}
|
||||
if (date.getMinutes() < 10) {
|
||||
str = str + "0" + date.getMinutes()
|
||||
str = str + '0' + date.getMinutes()
|
||||
} else {
|
||||
str = str + date.getMinutes()
|
||||
}
|
||||
return escapeHTML(str);
|
||||
return escapeHTML(str)
|
||||
}
|
||||
function formattimeutc(date) {
|
||||
var str = date.getUTCFullYear() + "-";
|
||||
var str = date.getUTCFullYear() + '-'
|
||||
if (date.getUTCMonth() + 1 < 10) {
|
||||
str = str + "0" + (date.getUTCMonth() + 1) + "-";
|
||||
str = str + '0' + (date.getUTCMonth() + 1) + '-'
|
||||
} else {
|
||||
str = str + (date.getUTCMonth() + 1) + "-";
|
||||
str = str + (date.getUTCMonth() + 1) + '-'
|
||||
}
|
||||
if (date.getUTCDate() < 10) {
|
||||
str = str + "0" + date.getUTCDate()
|
||||
str = str + '0' + date.getUTCDate()
|
||||
} else {
|
||||
str = str + date.getUTCDate()
|
||||
}
|
||||
str = str + "T";
|
||||
str = str + 'T'
|
||||
if (date.getUTCHours() < 10) {
|
||||
str = str + "0" + date.getUTCHours() + ":"
|
||||
str = str + '0' + date.getUTCHours() + ':'
|
||||
} else {
|
||||
str = str + date.getUTCHours() + ":"
|
||||
str = str + date.getUTCHours() + ':'
|
||||
}
|
||||
if (date.getUTCMinutes() < 10) {
|
||||
str = str + "0" + date.getUTCMinutes()
|
||||
str = str + '0' + date.getUTCMinutes()
|
||||
} else {
|
||||
str = str + date.getUTCMinutes()
|
||||
}
|
||||
return escapeHTML(str);
|
||||
return escapeHTML(str)
|
||||
}
|
||||
postMessage(["sendSinmpleIpc", "custom-css-request"], "*")
|
||||
postMessage(['sendSinmpleIpc', 'custom-css-request'], '*')
|
||||
function makeCID() {
|
||||
return randomStr(8) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(12);
|
||||
return (
|
||||
randomStr(8) +
|
||||
'-' +
|
||||
randomStr(4) +
|
||||
'-' +
|
||||
randomStr(4) +
|
||||
'-' +
|
||||
randomStr(4) +
|
||||
'-' +
|
||||
randomStr(12)
|
||||
)
|
||||
}
|
||||
function randomStr(l) {
|
||||
// 生成する文字列に含める文字セット
|
||||
var c = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var cl = c.length;
|
||||
var r = "";
|
||||
var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
var cl = c.length
|
||||
var r = ''
|
||||
for (var i = 0; i < l; i++) {
|
||||
r += c[Math.floor(Math.random() * cl)];
|
||||
r += c[Math.floor(Math.random() * cl)]
|
||||
}
|
||||
return r;
|
||||
return r
|
||||
}
|
||||
function rgbToHex(color) {
|
||||
// HEXに変換したものを代入する変数
|
||||
var hex = '';
|
||||
var hex = ''
|
||||
|
||||
// 第1引数がHEXのとき変換処理は必要ないのでそのままreturn
|
||||
// IE8の場合はjQueryのcss()関数でHEXを返すので除外
|
||||
if (color.match(/^#[a-f\d]{3}$|^#[a-f\d]{6}$/i)) {
|
||||
return color;
|
||||
return color
|
||||
}
|
||||
|
||||
// 正規表現
|
||||
var regex = color.match(/^rgb\(([0-9.]+),\s*([0-9.]+),\s*([0-9.]+)\)$/);
|
||||
var regex = color.match(/^rgb\(([0-9.]+),\s*([0-9.]+),\s*([0-9.]+)\)$/)
|
||||
|
||||
// 正規表現でマッチしたとき
|
||||
if (regex) {
|
||||
var rgb =
|
||||
[
|
||||
// RGBからHEXへ変換
|
||||
parseInt(regex[1]).toString(16),
|
||||
parseInt(regex[2]).toString(16),
|
||||
parseInt(regex[3]).toString(16)
|
||||
];
|
||||
var rgb = [
|
||||
// RGBからHEXへ変換
|
||||
parseInt(regex[1]).toString(16),
|
||||
parseInt(regex[2]).toString(16),
|
||||
parseInt(regex[3]).toString(16)
|
||||
]
|
||||
|
||||
for (var i = 0; i < rgb.length; ++i) {
|
||||
// rgb(1,1,1)のようなときHEXに変換すると1桁になる
|
||||
// 1桁のときは前に0を足す
|
||||
if (rgb[i].length == 1) {
|
||||
rgb[i] = '0' + rgb[i];
|
||||
rgb[i] = '0' + rgb[i]
|
||||
}
|
||||
hex += rgb[i];
|
||||
hex += rgb[i]
|
||||
}
|
||||
|
||||
return hex;
|
||||
return hex
|
||||
}
|
||||
|
||||
console.error(color + ':第1引数はRGB形式で入力');
|
||||
console.error(color + ':第1引数はRGB形式で入力')
|
||||
}
|
||||
/*マルチバイト用切り出し*/
|
||||
$.isSurrogatePear = function (upper, lower) {
|
||||
return 0xD800 <= upper && upper <= 0xDBFF && 0xDC00 <= lower && lower <= 0xDFFF;
|
||||
};
|
||||
$.mb_strlen = function (str) {
|
||||
var ret = 0;
|
||||
for (var i = 0; i < str.length; i++ , ret++) {
|
||||
var upper = str.charCodeAt(i);
|
||||
var lower = str.length > (i + 1) ? str.charCodeAt(i + 1) : 0;
|
||||
if ($.isSurrogatePear(upper, lower)) {
|
||||
i++;
|
||||
$.isSurrogatePear = function(upper, lower) {
|
||||
return 0xd800 <= upper && upper <= 0xdbff && 0xdc00 <= lower && lower <= 0xdfff
|
||||
}
|
||||
$.mb_strlen = function(str) {
|
||||
var splitter = new GraphemeSplitter()
|
||||
var arr = splitter.splitGraphemes(str)
|
||||
return arr.length
|
||||
}
|
||||
$.mb_substr = function(str, begin, end) {
|
||||
//配列にする
|
||||
var splitter = new GraphemeSplitter()
|
||||
var arr = splitter.splitGraphemes(str)
|
||||
var newarr = []
|
||||
for(var i = 0; i < arr.length; i++){
|
||||
if(i >= begin && i <= end){
|
||||
newarr.push(arr[i])
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
$.mb_substr = function (str, begin, end) {
|
||||
var ret = '';
|
||||
for (var i = 0, len = 0; i < str.length; i++ , len++) {
|
||||
var upper = str.charCodeAt(i);
|
||||
var lower = str.length > (i + 1) ? str.charCodeAt(i + 1) : 0;
|
||||
var s = '';
|
||||
if ($.isSurrogatePear(upper, lower)) {
|
||||
i++;
|
||||
s = String.fromCharCode(upper, lower);
|
||||
} else {
|
||||
s = String.fromCharCode(upper);
|
||||
}
|
||||
if (begin <= len && len < end) {
|
||||
ret += s;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
return newarr.join('')
|
||||
}
|
||||
//ソートするやつ
|
||||
function object_array_sort(data, key, order, fn) {
|
||||
var num_a = -1;
|
||||
var num_b = 1;
|
||||
var num_a = -1
|
||||
var num_b = 1
|
||||
if (order === 'asc') {
|
||||
num_a = 1;
|
||||
num_b = -1;
|
||||
num_a = 1
|
||||
num_b = -1
|
||||
}
|
||||
data = data.sort(function (a, b) {
|
||||
var x = a[key];
|
||||
var y = b[key];
|
||||
if (x > y) return num_a;
|
||||
if (x < y) return num_b;
|
||||
return 0;
|
||||
});
|
||||
var arrObj = {};
|
||||
data = data.sort(function(a, b) {
|
||||
var x = a[key]
|
||||
var y = b[key]
|
||||
if (x > y) return num_a
|
||||
if (x < y) return num_b
|
||||
return 0
|
||||
})
|
||||
var arrObj = {}
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
arrObj[data[i]['family']] = data[i];
|
||||
arrObj[data[i]['family']] = data[i]
|
||||
}
|
||||
data = [];
|
||||
data = []
|
||||
for (var key in arrObj) {
|
||||
data.push(arrObj[key]);
|
||||
data.push(arrObj[key])
|
||||
}
|
||||
fn(data);
|
||||
fn(data)
|
||||
}
|
||||
function setLog(txt1, txt2, txt3) {
|
||||
//url,statuscode,responsetext
|
||||
var text = new Date().toUTCString()
|
||||
text = text + ',' + txt1 + ',' + txt2 + ',' + escapeCsv(txt3)
|
||||
console.error(text)
|
||||
postMessage(['log', text], '*')
|
||||
}
|
||||
function escapeCsv(str) {
|
||||
if (!str) {
|
||||
return str
|
||||
}
|
||||
var result
|
||||
result = str.replace(/\"/g, '""')
|
||||
if (result.indexOf(',') >= 0) {
|
||||
result = '"' + result + '"'
|
||||
}
|
||||
return result
|
||||
}
|
||||
localStorage.removeItem("errors");
|
||||
@@ -1,136 +1,264 @@
|
||||
|
||||
'use strict'
|
||||
//TL取得
|
||||
var websocket
|
||||
function tl(data) {
|
||||
var tlid = 0;
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var type = $("#type-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var tlid = 0
|
||||
if (websocket) {
|
||||
websocket.close()
|
||||
}
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var type = $('#type-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
//タグの場合はカラム追加して描画
|
||||
if (!type) {
|
||||
//デフォルト
|
||||
var type = "local";
|
||||
var type = 'local'
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
$("#notice_nano").text(cap(type, data) + " TL(" + localStorage.getItem(
|
||||
"user_" + acct_id) + "@" + domain + ")");
|
||||
var start = "https://" + domain + "/api/v1/timelines/" + com(type, data);
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
$('#notice_nano').text(
|
||||
cap(type, data) + ' TL(' + localStorage.getItem('user_' + acct_id) + '@' + domain + ')'
|
||||
)
|
||||
var start = 'https://' + domain + '/api/v1/timelines/' + com(type, data)
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
var templete = parse([json[0]], '', acct_id, tlid);
|
||||
$("#timeline_nano").html(templete);
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
var templete = parse([json[0]], '', acct_id, tlid)
|
||||
$('#timeline_nano').html(templete)
|
||||
jQuery('time.timeago').timeago()
|
||||
$('#menu').addClass('hide')
|
||||
})
|
||||
//Streaming接続
|
||||
var websocket = [];
|
||||
var tlid = 0;
|
||||
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 == "local") {
|
||||
var start = "wss://" + domain +
|
||||
"/api/v1/streaming/?stream=public:local&access_token=" + at;
|
||||
} else if (type == "tag") {
|
||||
var start = "wss://" + domain +
|
||||
"/api/v1/streaming/?stream=hashtag&tag=" + data + "&access_token=" + at;
|
||||
var tlid = 0
|
||||
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 == 'local') {
|
||||
var start = 'wss://' + domain + '/api/v1/streaming/?stream=public:local&access_token=' + at
|
||||
} else if (type == 'tag') {
|
||||
var start =
|
||||
'wss://' + domain + '/api/v1/streaming/?stream=hashtag&tag=' + data + '&access_token=' + at
|
||||
}
|
||||
var wsid = websocket.length;
|
||||
websocket[wsid] = new WebSocket(start);
|
||||
websocket[wsid].onopen = function (mess) {
|
||||
$("#notice_icon_" + tlid).removeClass("red-text");
|
||||
websocket = new WebSocket(start)
|
||||
websocket.onopen = function(mess) {
|
||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||
}
|
||||
websocket[wsid].onmessage = function (mess) {
|
||||
var typeA = JSON.parse(mess.data).event;
|
||||
if (typeA == "delete") {
|
||||
var obj = JSON.parse(mess.data).payload;
|
||||
$("[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);
|
||||
var templete = parse([obj], '', acct_id, tlid);
|
||||
$("#timeline_nano").html(templete);
|
||||
}
|
||||
websocket[wsid].onclose = function (mess) {
|
||||
console.error("Close Streaming API:" + type);
|
||||
websocket.onmessage = function(mess) {
|
||||
var typeA = JSON.parse(mess.data).event
|
||||
if (typeA == 'update') {
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||
var templete = parse([obj], '', acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
$('#timeline_nano').html(templete)
|
||||
}
|
||||
}
|
||||
websocket[wsid].onerror = function (error) {
|
||||
console.error('WebSocket Error ' + error);
|
||||
};
|
||||
websocket.onerror = function(error) {
|
||||
console.error('WebSocket Error ' + error)
|
||||
}
|
||||
websocket.onclose = function(mess) {
|
||||
console.error('Close Streaming API:' + type)
|
||||
}
|
||||
}
|
||||
//TLのタイトル
|
||||
function cap(type, data) {
|
||||
if (type == "home") {
|
||||
return "Home"
|
||||
} else if (type == "local") {
|
||||
return "Local"
|
||||
} else if (type == "pub") {
|
||||
return "Public"
|
||||
} else if (type == "tag") {
|
||||
return "#" + data
|
||||
} else if (type == "list") {
|
||||
return "List(id:" + data + ")"
|
||||
} else if (type == "notf") {
|
||||
return "Notification"
|
||||
if (type == 'home') {
|
||||
return 'Home'
|
||||
} else if (type == 'local') {
|
||||
return 'Local'
|
||||
} else if (type == 'pub') {
|
||||
return 'Public'
|
||||
} else if (type == 'tag') {
|
||||
return '#' + data
|
||||
} else if (type == 'list') {
|
||||
return 'List(id:' + data + ')'
|
||||
} else if (type == 'notf') {
|
||||
return 'Notification'
|
||||
}
|
||||
}
|
||||
|
||||
//TLのURL
|
||||
function com(type, data) {
|
||||
if (type == "home") {
|
||||
return "home?"
|
||||
} else if (type == "local") {
|
||||
return "public?local=true&"
|
||||
} else if (type == "pub") {
|
||||
return "public?"
|
||||
} else if (type == "tag") {
|
||||
return "tag/" + data + "?"
|
||||
if (type == 'home') {
|
||||
return 'home?'
|
||||
} else if (type == 'local') {
|
||||
return 'public?local=true&'
|
||||
} else if (type == 'pub') {
|
||||
return 'public?'
|
||||
} else if (type == 'tag') {
|
||||
return 'tag/' + data + '?'
|
||||
}
|
||||
if (type == "list") {
|
||||
return "list/" + data + "?"
|
||||
if (type == 'list') {
|
||||
return 'list/' + data + '?'
|
||||
}
|
||||
}
|
||||
|
||||
//TLのアイコン
|
||||
function icon(type) {
|
||||
if (type == "home") {
|
||||
return "home"
|
||||
} else if (type == "local") {
|
||||
return "people_outline"
|
||||
} else if (type == "pub") {
|
||||
return "language"
|
||||
} else if (type == "tag") {
|
||||
return "search"
|
||||
if (type == 'home') {
|
||||
return 'home'
|
||||
} else if (type == 'local') {
|
||||
return 'people_outline'
|
||||
} else if (type == 'pub') {
|
||||
return 'language'
|
||||
} else if (type == 'tag') {
|
||||
return 'search'
|
||||
}
|
||||
if (type == "list") {
|
||||
return "subject"
|
||||
if (type == 'list') {
|
||||
return 'subject'
|
||||
}
|
||||
}
|
||||
function todo() { }
|
||||
function todc() { }
|
||||
function hide() { }
|
||||
$(function ($) {
|
||||
function todo() {}
|
||||
function todc() {}
|
||||
function hide() {}
|
||||
$(function($) {
|
||||
//キーボードショートカット
|
||||
$(window).keydown(function (e) {
|
||||
var hasFocus = $('input').is(':focus');
|
||||
var hasFocus2 = $('textarea').is(':focus');
|
||||
$(window).keydown(function(e) {
|
||||
var hasFocus = $('input').is(':focus')
|
||||
var hasFocus2 = $('textarea').is(':focus')
|
||||
//Ctrl+Enter:投稿
|
||||
if (event.ctrlKey) {
|
||||
if (e.keyCode === 13) {
|
||||
post();
|
||||
return false;
|
||||
post()
|
||||
return false
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
function set() {
|
||||
$('#menu').toggleClass('hide')
|
||||
if ($('#menu').hasClass('hide')) {
|
||||
$('#setting').text('Setting')
|
||||
} else {
|
||||
$('#setting').text('Close')
|
||||
}
|
||||
}
|
||||
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (!multi) {
|
||||
var obj = [
|
||||
{
|
||||
at: localStorage.getItem(localStorage.getItem('domain_' + acct_id) + '_at'),
|
||||
name: localStorage.getItem('name_' + acct_id),
|
||||
domain: localStorage.getItem('domain_' + acct_id),
|
||||
user: localStorage.getItem('user_' + acct_id),
|
||||
prof: localStorage.getItem('prof_' + acct_id)
|
||||
}
|
||||
]
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('multi', json)
|
||||
} else {
|
||||
var obj = JSON.parse(multi)
|
||||
}
|
||||
var templete
|
||||
var last = localStorage.getItem('last-use')
|
||||
var sel
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var acct = obj[key]
|
||||
var list = key * 1 + 1
|
||||
if (key == last) {
|
||||
sel = 'selected'
|
||||
} else {
|
||||
sel = ''
|
||||
}
|
||||
templete = `<option value="${key}" ${sel}>${acct.user}@${acct.domain}</option>`
|
||||
$('#post-acct-sel').append(templete)
|
||||
})
|
||||
function mov() {
|
||||
return false
|
||||
}
|
||||
function resetmv() {
|
||||
return false
|
||||
}
|
||||
function post() {
|
||||
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/statuses'
|
||||
var str = $('#textarea').val()
|
||||
var toot = {
|
||||
status: str
|
||||
}
|
||||
var vis = loadVis(acct_id)
|
||||
toot.visibility = vis
|
||||
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(JSON.stringify(toot))
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
$('#textarea').val('')
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadVis(acct_id) {
|
||||
var vist = localStorage.getItem('vis')
|
||||
if (!vist) {
|
||||
return 'public'
|
||||
} else {
|
||||
if (vist == 'memory') {
|
||||
var memory = localStorage.getItem('vis-memory-' + acct_id)
|
||||
if (!memory) {
|
||||
memory = 'public'
|
||||
}
|
||||
return memory
|
||||
} else if (vist == 'server' || vist == 'useapi') {
|
||||
var multi = localStorage.getItem('multi')
|
||||
var obj = JSON.parse(multi)
|
||||
var memory = obj[acct_id]['vis']
|
||||
if (!memory) {
|
||||
memory = 'public'
|
||||
}
|
||||
return memory
|
||||
} else {
|
||||
return vist
|
||||
}
|
||||
}
|
||||
}
|
||||
function loader() {
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
console.log(loadVis(acct_id))
|
||||
$('#vis-sel').val(loadVis(acct_id))
|
||||
}
|
||||
loader()
|
||||
$('textarea').height(15) //init
|
||||
$('textarea').css('lineHeight', '1rem') //init
|
||||
|
||||
$('textarea').on('input', function(evt) {
|
||||
if (evt.target.scrollHeight > evt.target.offsetHeight) {
|
||||
$(evt.target).height(evt.target.scrollHeight)
|
||||
} else {
|
||||
var lineHeight = Number(
|
||||
$(evt.target)
|
||||
.css('lineHeight')
|
||||
.split('px')[0]
|
||||
)
|
||||
while (true) {
|
||||
$(evt.target).height($(evt.target).height() - lineHeight)
|
||||
if (evt.target.scrollHeight > evt.target.offsetHeight) {
|
||||
$(evt.target).height(evt.target.scrollHeight)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,169 +1,195 @@
|
||||
var electron = require("electron");
|
||||
const shell = electron.shell;
|
||||
var ipc = electron.ipcRenderer;
|
||||
onmessage = function (e) {
|
||||
if (e.data[0] == "openUrl") {
|
||||
urls = e.data[1].match(/https?:\/\/(.+)/);
|
||||
if (urls) {
|
||||
shell.openExternal(e.data[1]);
|
||||
}
|
||||
} else if (e.data[0] == "sendSinmpleIpc") {
|
||||
ipc.send(e.data[1], "")
|
||||
} else if (e.data[0] == "dialogStore") {
|
||||
ipc.send("dialogStore", e.data[1])
|
||||
} else if (e.data[0] == "bmpImage") {
|
||||
ipc.send('bmp-image', e.data[1]);
|
||||
} else if (e.data[0] == "dialogCW") {
|
||||
ipc.send("dialogCW", e.data[1])
|
||||
} else if (e.data[0] == "nativeNotf") {
|
||||
console.log(e.data[1])
|
||||
ipc.send('native-notf', e.data[1]);
|
||||
} else if (e.data[0] == "dialogClient") {
|
||||
ipc.send("dialogClient", e.data[1])
|
||||
} else if (e.data[0] == "generalDL") {
|
||||
ipc.send('general-dl', e.data[1]);
|
||||
} else if (e.data[0] == "openFinder") {
|
||||
ipc.send('open-finder', e.data[1]);
|
||||
} else if (e.data[0] == "columnDel") {
|
||||
ipc.send('column-del', e.data[1]);
|
||||
} else if (e.data[0] == "lang") {
|
||||
ipc.send('lang', e.data[1]);
|
||||
} else if (e.data[0] == "exportSettings") {
|
||||
ipc.send('exportSettings', e.data[1]);
|
||||
} else if (e.data[0] == "importSettings") {
|
||||
ipc.send('importSettings', e.data[1]);
|
||||
} else if (e.data[0] == "customSound") {
|
||||
ipc.send('customSound', e.data[1]);
|
||||
} else if (e.data[0] == "themeJsonDelete") {
|
||||
ipc.send('theme-json-delete', e.data[1]);
|
||||
} else if (e.data[0] == "themeJsonCreate") {
|
||||
ipc.send('theme-json-create', e.data[1]);
|
||||
} else if (e.data[0] == "themeJsonRequest") {
|
||||
ipc.send('theme-json-request', e.data[1]);
|
||||
} else if (e.data[0] == "ha") {
|
||||
ipc.send('ha', e.data[1]);
|
||||
} else if (e.data[0] == "aboutData") {
|
||||
ipc.send('aboutData', "");
|
||||
} else if (e.data[0] == "itunes") {
|
||||
console.log("NowPlaying")
|
||||
ipc.send("itunes", e.data[1])
|
||||
} else if (e.data[0] == "themeCSSRequest") {
|
||||
ipc.send('theme-css-request', e.data[1]);
|
||||
} else if (e.data[0] == "downloadButton") {
|
||||
ipc.send('download-btn', e.data[1]);
|
||||
} else if (e.data[0] == "nano") {
|
||||
ipc.send('nano', null);
|
||||
}
|
||||
'use strict'
|
||||
var electron = require('electron')
|
||||
const shell = electron.shell
|
||||
var ipc = electron.ipcRenderer
|
||||
onmessage = function(e) {
|
||||
if (e.data[0] == 'openUrl') {
|
||||
var urls = e.data[1].match(/https?:\/\/(.+)/)
|
||||
if (urls) {
|
||||
shell.openExternal(e.data[1])
|
||||
}
|
||||
} else if (e.data[0] == 'sendSinmpleIpc') {
|
||||
ipc.send(e.data[1], '')
|
||||
} else if (e.data[0] == 'dialogStore') {
|
||||
ipc.send('dialogStore', e.data[1])
|
||||
} else if (e.data[0] == 'bmpImage') {
|
||||
ipc.send('bmp-image', e.data[1])
|
||||
} else if (e.data[0] == 'dialogCW') {
|
||||
ipc.send('dialogCW', e.data[1])
|
||||
} else if (e.data[0] == 'nativeNotf') {
|
||||
console.log(e.data[1])
|
||||
ipc.send('native-notf', e.data[1])
|
||||
} else if (e.data[0] == 'dialogClient') {
|
||||
ipc.send('dialogClient', e.data[1])
|
||||
} else if (e.data[0] == 'generalDL') {
|
||||
ipc.send('general-dl', e.data[1])
|
||||
} else if (e.data[0] == 'openFinder') {
|
||||
ipc.send('open-finder', e.data[1])
|
||||
} else if (e.data[0] == 'columnDel') {
|
||||
ipc.send('column-del', e.data[1])
|
||||
} else if (e.data[0] == 'lang') {
|
||||
ipc.send('lang', e.data[1])
|
||||
} else if (e.data[0] == 'exportSettings') {
|
||||
ipc.send('exportSettings', e.data[1])
|
||||
} else if (e.data[0] == 'exportSettingsCoreComplete') {
|
||||
ipc.send('export', e.data[1])
|
||||
} else if (e.data[0] == 'importSettings') {
|
||||
ipc.send('importSettings', e.data[1])
|
||||
} else if (e.data[0] == 'customSound') {
|
||||
ipc.send('customSound', e.data[1])
|
||||
} else if (e.data[0] == 'themeJsonDelete') {
|
||||
ipc.send('theme-json-delete', e.data[1])
|
||||
} else if (e.data[0] == 'themeJsonCreate') {
|
||||
ipc.send('theme-json-create', e.data[1])
|
||||
} else if (e.data[0] == 'themeJsonRequest') {
|
||||
ipc.send('theme-json-request', e.data[1])
|
||||
} else if (e.data[0] == 'ha') {
|
||||
ipc.send('ha', e.data[1])
|
||||
} else if (e.data[0] == 'ua') {
|
||||
ipc.send('ua', e.data[1])
|
||||
} else if (e.data[0] == 'aboutData') {
|
||||
ipc.send('aboutData', '')
|
||||
} else if (e.data[0] == 'itunes') {
|
||||
console.log('NowPlaying')
|
||||
ipc.send('itunes', e.data[1])
|
||||
} else if (e.data[0] == 'themeCSSRequest') {
|
||||
ipc.send('theme-css-request', e.data[1])
|
||||
} else if (e.data[0] == 'customCSSRequest') {
|
||||
ipc.send('custom-css-request', e.data[1])
|
||||
} else if (e.data[0] == 'downloadButton') {
|
||||
ipc.send('download-btn', e.data[1])
|
||||
} else if (e.data[0] == 'nano') {
|
||||
ipc.send('nano', null)
|
||||
} else if (e.data[0] == 'asReadComp') {
|
||||
ipc.send('sendMarkersComplete', null)
|
||||
} else if (e.data[0] == 'copy') {
|
||||
ipc.send('copy', e.data[1])
|
||||
} else if (e.data[0] == 'log') {
|
||||
ipc.send('log', e.data[1])
|
||||
}
|
||||
}
|
||||
//version.js
|
||||
ipc.send("getPlatform", "")
|
||||
ipc.on('platform', function (event, args) {
|
||||
localStorage.setItem("platform", args[0])
|
||||
localStorage.setItem("bit", args[1])
|
||||
localStorage.setItem("about", JSON.stringify([args[2], args[3], args[4]]))
|
||||
ipc.send('getPlatform', '')
|
||||
ipc.on('platform', function(event, args) {
|
||||
localStorage.setItem('platform', args[0])
|
||||
localStorage.setItem('bit', args[1])
|
||||
localStorage.setItem('about', JSON.stringify([args[2], args[3], args[4], args[5]]))
|
||||
})
|
||||
|
||||
ipc.on('reload', function (event, arg) {
|
||||
location.reload();
|
||||
ipc.on('reload', function(event, arg) {
|
||||
location.reload()
|
||||
})
|
||||
//Native Notf
|
||||
ipc.on('shownotf', function (event, args) {
|
||||
if (args["type"] == "toot") {
|
||||
postMessage(["details", [id, acct_id]], "*")
|
||||
} else if (args["type"] == "userdata") {
|
||||
postMessage(["udg", [user, acct_id]], "*")
|
||||
}
|
||||
ipc.on('shownotf', function(event, args) {
|
||||
if (args['type'] == 'toot') {
|
||||
postMessage(['details', [id, acct_id]], '*')
|
||||
} else if (args['type'] == 'userdata') {
|
||||
postMessage(['udg', [user, acct_id]], '*')
|
||||
}
|
||||
})
|
||||
|
||||
//first.js
|
||||
ipc.on('custom-css-response', function (event, arg) {
|
||||
if (arg == "") { return false; }
|
||||
var styleNode = document.createElement("style");
|
||||
styleNode.setAttribute("type", "text/css")
|
||||
ipc.on('custom-css-response', function(event, arg) {
|
||||
if (arg == '') {
|
||||
return false
|
||||
}
|
||||
var styleNode = document.createElement('style')
|
||||
styleNode.setAttribute('type', 'text/css')
|
||||
|
||||
var content = document.createTextNode(arg)
|
||||
styleNode.append(content)
|
||||
document.getElementsByTagName("head")[0].append(styleNode)
|
||||
var content = document.createTextNode(arg)
|
||||
styleNode.append(content)
|
||||
document.getElementsByTagName('head')[0].append(styleNode)
|
||||
})
|
||||
ipc.on('theme-css-response', function (event, arg) {
|
||||
if (arg == "") { return false; }
|
||||
var styleNode = document.createElement("style");
|
||||
styleNode.setAttribute("type", "text/css")
|
||||
ipc.on('theme-css-response', function(event, arg) {
|
||||
if (arg == '') {
|
||||
return false
|
||||
}
|
||||
var styleNode = document.createElement('style')
|
||||
styleNode.setAttribute('type', 'text/css')
|
||||
|
||||
var content = document.createTextNode(arg)
|
||||
styleNode.append(content)
|
||||
document.getElementsByTagName("head")[0].append(styleNode)
|
||||
var content = document.createTextNode(arg)
|
||||
styleNode.append(content)
|
||||
document.getElementsByTagName('head')[0].append(styleNode)
|
||||
})
|
||||
//img.js
|
||||
ipc.on('bmp-img-comp', function (event, b64) {
|
||||
postMessage(["media", [b64[0], "image/png", b64[1]]], "*")
|
||||
});
|
||||
//ui,img.js
|
||||
ipc.on('general-dl-prog', function (event, arg) {
|
||||
console.log("Progress: " + arg);
|
||||
ipc.on('bmp-img-comp', function(event, b64) {
|
||||
postMessage(['media', [b64[0], 'image/png', b64[1]]], '*')
|
||||
})
|
||||
ipc.on('general-dl-message', function (event, arg) {
|
||||
var argC = arg.replace(/\\/g, "\\\\") + "\\\\.";
|
||||
console.log("saved")
|
||||
postMessage(["toastSaved", [arg, argC]], "*")
|
||||
//ui,img.js
|
||||
ipc.on('general-dl-prog', function(event, arg) {
|
||||
console.log('Progress: ' + arg)
|
||||
})
|
||||
ipc.on('general-dl-message', function(event, arg) {
|
||||
var argC = arg.replace(/\\/g, '\\\\') + '\\\\.'
|
||||
console.log('saved')
|
||||
postMessage(['toastSaved', [arg, argC]], '*')
|
||||
})
|
||||
//setting.js
|
||||
ipc.on('langres', function (event, arg) {
|
||||
location.href = "../" + arg + "/setting.html"
|
||||
});
|
||||
ipc.on('exportSettingsFile', function (event, savedFiles) {
|
||||
var exp = exportSettingsCore()
|
||||
ipc.send('export', [savedFiles, JSON.stringify(exp)]);
|
||||
postMessage(["alert", "Done"], "*")
|
||||
//cards
|
||||
//lang
|
||||
});
|
||||
ipc.on('config', function (event, arg) {
|
||||
postMessage(["importSettingsCore", arg], "*")
|
||||
});
|
||||
ipc.on('savefolder', function (event, arg) {
|
||||
localStorage.setItem("savefolder", arg);
|
||||
});
|
||||
ipc.on('font-list', function (event, arg) {
|
||||
postMessage(["fontList", arg], "*")
|
||||
});
|
||||
ipc.on('customSoundRender', function (event, args) {
|
||||
postMessage(["customSoundSave", [args[0], args[1]]], "*")
|
||||
});
|
||||
ipc.on('theme-json-list-response', function (event, args) {
|
||||
postMessage(["ctLoadCore", args], "*")
|
||||
});
|
||||
ipc.on('theme-json-delete-complete', function (event, args) {
|
||||
postMessage(["ctLoad", ""], "*")
|
||||
});
|
||||
ipc.on('theme-json-response', function (event, args) {
|
||||
postMessage(["customConnect", args], "*")
|
||||
});
|
||||
ipc.on('theme-json-create-complete', function (event, args) {
|
||||
postMessage(["clearCustomImport", ""], "*")
|
||||
postMessage(["ctLoad", ""], "*")
|
||||
});
|
||||
ipc.on('langres', function(event, arg) {
|
||||
location.href = '../' + arg + '/setting.html'
|
||||
})
|
||||
ipc.on('exportSettingsFile', function(event, arg) {
|
||||
postMessage(['exportSettingsCore', arg], '*')
|
||||
})
|
||||
ipc.on('exportAllComplete', function(event, arg) {
|
||||
postMessage(['alert', 'Complete'], '*')
|
||||
})
|
||||
ipc.on('config', function(event, arg) {
|
||||
postMessage(['importSettingsCore', arg], '*')
|
||||
})
|
||||
ipc.on('savefolder', function(event, arg) {
|
||||
localStorage.setItem('savefolder', arg)
|
||||
})
|
||||
ipc.on('font-list', function(event, arg) {
|
||||
postMessage(['fontList', arg], '*')
|
||||
})
|
||||
ipc.on('customSoundRender', function(event, args) {
|
||||
postMessage(['customSoundSave', [args[0], args[1]]], '*')
|
||||
})
|
||||
ipc.on('theme-json-list-response', function(event, args) {
|
||||
postMessage(['ctLoadCore', args], '*')
|
||||
})
|
||||
ipc.on('theme-json-delete-complete', function(event, args) {
|
||||
postMessage(['ctLoad', ''], '*')
|
||||
})
|
||||
ipc.on('theme-json-response', function(event, args) {
|
||||
postMessage(['customConnect', args], '*')
|
||||
})
|
||||
ipc.on('theme-json-create-complete', function(event, args) {
|
||||
postMessage(['clearCustomImport', ''], '*')
|
||||
postMessage(['ctLoad', ''], '*')
|
||||
})
|
||||
//spotify.js
|
||||
ipc.on('itunes-np', function (event, arg) {
|
||||
postMessage(["npCore", arg], "*")
|
||||
ipc.on('itunes-np', function(event, arg) {
|
||||
postMessage(['npCore', arg], '*')
|
||||
})
|
||||
//tips.js
|
||||
ipc.on('memory', function (event, arg) {
|
||||
var use = arg[0];
|
||||
var cpu = arg[1];
|
||||
var total = arg[2]
|
||||
postMessage(["renderMem", [use, cpu, total]], "*")
|
||||
ipc.on('memory', function(event, arg) {
|
||||
var use = arg[0]
|
||||
var cpu = arg[1]
|
||||
var total = arg[2]
|
||||
postMessage(['renderMem', [use, cpu, total]], '*')
|
||||
})
|
||||
//log
|
||||
ipc.on('logData', function(event, args) {
|
||||
postMessage(['logData', args], '*')
|
||||
})
|
||||
//update.html
|
||||
ipc.on('prog', function (event, arg) {
|
||||
postMessage(["updateProg", arg], "*")
|
||||
ipc.on('prog', function(event, arg) {
|
||||
postMessage(['updateProg', arg], '*')
|
||||
})
|
||||
ipc.on('mess', function (event, arg) {
|
||||
postMessage(["updateMess", arg], "*")
|
||||
ipc.on('mess', function(event, arg) {
|
||||
postMessage(['updateMess', arg], '*')
|
||||
})
|
||||
var webviewDom = document.getElementById('webview');
|
||||
ipc.on('asRead', function(event, arg) {
|
||||
postMessage(['asRead', ''], '*')
|
||||
})
|
||||
ipc.on('asReadEnd', function(event, arg) {
|
||||
postMessage(['asReadEnd', ''], '*')
|
||||
})
|
||||
var webviewDom = document.getElementById('webview')
|
||||
if (webviewDom) {
|
||||
webviewDom.addEventListener('new-window', function (e) {
|
||||
shell.openExternal(e.url);
|
||||
});
|
||||
webviewDom.addEventListener('new-window', function(e) {
|
||||
shell.openExternal(e.url)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
'use strict'
|
||||
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
||||
;(function(root) {
|
||||
|
||||
/** Detect free variables */
|
||||
var freeExports = typeof exports == 'object' && exports &&
|
||||
!exports.nodeType && exports;
|
||||
var freeModule = typeof module == 'object' && module &&
|
||||
!module.nodeType && module;
|
||||
var freeGlobal = typeof global == 'object' && global;
|
||||
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports
|
||||
var freeModule = typeof module == 'object' && module && !module.nodeType && module
|
||||
var freeGlobal = typeof global == 'object' && global
|
||||
if (
|
||||
freeGlobal.global === freeGlobal ||
|
||||
freeGlobal.window === freeGlobal ||
|
||||
freeGlobal.self === freeGlobal
|
||||
) {
|
||||
root = freeGlobal;
|
||||
root = freeGlobal
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,39 +19,33 @@
|
||||
* @type Object
|
||||
*/
|
||||
var punycode,
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
||||
/** Bootstring parameters */
|
||||
base = 36,
|
||||
tMin = 1,
|
||||
tMax = 26,
|
||||
skew = 38,
|
||||
damp = 700,
|
||||
initialBias = 72,
|
||||
initialN = 128, // 0x80
|
||||
delimiter = '-', // '\x2D'
|
||||
|
||||
/** Regular expressions */
|
||||
regexPunycode = /^xn--/,
|
||||
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
||||
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
||||
|
||||
/** Error messages */
|
||||
errors = {
|
||||
'overflow': 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
},
|
||||
|
||||
/** Convenience shortcuts */
|
||||
baseMinusTMin = base - tMin,
|
||||
floor = Math.floor,
|
||||
stringFromCharCode = String.fromCharCode,
|
||||
|
||||
/** Temporary variable */
|
||||
key;
|
||||
/** Highest positive signed 32-bit float value */
|
||||
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
||||
/** Bootstring parameters */
|
||||
base = 36,
|
||||
tMin = 1,
|
||||
tMax = 26,
|
||||
skew = 38,
|
||||
damp = 700,
|
||||
initialBias = 72,
|
||||
initialN = 128, // 0x80
|
||||
delimiter = '-', // '\x2D'
|
||||
/** Regular expressions */
|
||||
regexPunycode = /^xn--/,
|
||||
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
||||
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
||||
/** Error messages */
|
||||
errors = {
|
||||
overflow: 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
},
|
||||
/** Convenience shortcuts */
|
||||
baseMinusTMin = base - tMin,
|
||||
floor = Math.floor,
|
||||
stringFromCharCode = String.fromCharCode,
|
||||
/** Temporary variable */
|
||||
key
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@@ -64,7 +56,7 @@
|
||||
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||||
*/
|
||||
function error(type) {
|
||||
throw new RangeError(errors[type]);
|
||||
throw new RangeError(errors[type])
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,12 +68,12 @@
|
||||
* @returns {Array} A new array of values returned by the callback function.
|
||||
*/
|
||||
function map(array, fn) {
|
||||
var length = array.length;
|
||||
var result = [];
|
||||
var length = array.length
|
||||
var result = []
|
||||
while (length--) {
|
||||
result[length] = fn(array[length]);
|
||||
result[length] = fn(array[length])
|
||||
}
|
||||
return result;
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,19 +87,19 @@
|
||||
* function.
|
||||
*/
|
||||
function mapDomain(string, fn) {
|
||||
var parts = string.split('@');
|
||||
var result = '';
|
||||
var parts = string.split('@')
|
||||
var result = ''
|
||||
if (parts.length > 1) {
|
||||
// In email addresses, only the domain name should be punycoded. Leave
|
||||
// the local part (i.e. everything up to `@`) intact.
|
||||
result = parts[0] + '@';
|
||||
string = parts[1];
|
||||
result = parts[0] + '@'
|
||||
string = parts[1]
|
||||
}
|
||||
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||||
string = string.replace(regexSeparators, '\x2E');
|
||||
var labels = string.split('.');
|
||||
var encoded = map(labels, fn).join('.');
|
||||
return result + encoded;
|
||||
string = string.replace(regexSeparators, '\x2E')
|
||||
var labels = string.split('.')
|
||||
var encoded = map(labels, fn).join('.')
|
||||
return result + encoded
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,28 +117,29 @@
|
||||
*/
|
||||
function ucs2decode(string) {
|
||||
var output = [],
|
||||
counter = 0,
|
||||
length = string.length,
|
||||
value,
|
||||
extra;
|
||||
counter = 0,
|
||||
length = string.length,
|
||||
value,
|
||||
extra
|
||||
while (counter < length) {
|
||||
value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
value = string.charCodeAt(counter++)
|
||||
if (value >= 0xd800 && value <= 0xdbff && counter < length) {
|
||||
// high surrogate, and there is a next character
|
||||
extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
extra = string.charCodeAt(counter++)
|
||||
if ((extra & 0xfc00) == 0xdc00) {
|
||||
// low surrogate
|
||||
output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000)
|
||||
} else {
|
||||
// unmatched surrogate; only append this code unit, in case the next
|
||||
// code unit is the high surrogate of a surrogate pair
|
||||
output.push(value);
|
||||
counter--;
|
||||
output.push(value)
|
||||
counter--
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
output.push(value)
|
||||
}
|
||||
}
|
||||
return output;
|
||||
return output
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,15 +152,15 @@
|
||||
*/
|
||||
function ucs2encode(array) {
|
||||
return map(array, function(value) {
|
||||
var output = '';
|
||||
if (value > 0xFFFF) {
|
||||
value -= 0x10000;
|
||||
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
||||
value = 0xDC00 | value & 0x3FF;
|
||||
var output = ''
|
||||
if (value > 0xffff) {
|
||||
value -= 0x10000
|
||||
output += stringFromCharCode(((value >>> 10) & 0x3ff) | 0xd800)
|
||||
value = 0xdc00 | (value & 0x3ff)
|
||||
}
|
||||
output += stringFromCharCode(value);
|
||||
return output;
|
||||
}).join('');
|
||||
output += stringFromCharCode(value)
|
||||
return output
|
||||
}).join('')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,15 +174,15 @@
|
||||
*/
|
||||
function basicToDigit(codePoint) {
|
||||
if (codePoint - 48 < 10) {
|
||||
return codePoint - 22;
|
||||
return codePoint - 22
|
||||
}
|
||||
if (codePoint - 65 < 26) {
|
||||
return codePoint - 65;
|
||||
return codePoint - 65
|
||||
}
|
||||
if (codePoint - 97 < 26) {
|
||||
return codePoint - 97;
|
||||
return codePoint - 97
|
||||
}
|
||||
return base;
|
||||
return base
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +199,7 @@
|
||||
function digitToBasic(digit, flag) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,13 +208,13 @@
|
||||
* @private
|
||||
*/
|
||||
function adapt(delta, numPoints, firstTime) {
|
||||
var k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
var k = 0
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1
|
||||
delta += floor(delta / numPoints)
|
||||
for (; /* no initialization */ delta > (baseMinusTMin * tMax) >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin)
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
return floor(k + ((baseMinusTMin + 1) * delta) / (delta + skew))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,95 +227,91 @@
|
||||
function decode(input) {
|
||||
// Don't use UCS-2
|
||||
var output = [],
|
||||
inputLength = input.length,
|
||||
out,
|
||||
i = 0,
|
||||
n = initialN,
|
||||
bias = initialBias,
|
||||
basic,
|
||||
j,
|
||||
index,
|
||||
oldi,
|
||||
w,
|
||||
k,
|
||||
digit,
|
||||
t,
|
||||
/** Cached calculation results */
|
||||
baseMinusT;
|
||||
inputLength = input.length,
|
||||
out,
|
||||
i = 0,
|
||||
n = initialN,
|
||||
bias = initialBias,
|
||||
basic,
|
||||
j,
|
||||
index,
|
||||
oldi,
|
||||
w,
|
||||
k,
|
||||
digit,
|
||||
t,
|
||||
/** Cached calculation results */
|
||||
baseMinusT
|
||||
|
||||
// Handle the basic code points: let `basic` be the number of input code
|
||||
// points before the last delimiter, or `0` if there is none, then copy
|
||||
// the first basic code points to the output.
|
||||
|
||||
basic = input.lastIndexOf(delimiter);
|
||||
basic = input.lastIndexOf(delimiter)
|
||||
if (basic < 0) {
|
||||
basic = 0;
|
||||
basic = 0
|
||||
}
|
||||
|
||||
for (j = 0; j < basic; ++j) {
|
||||
// if it's not a basic code point
|
||||
if (input.charCodeAt(j) >= 0x80) {
|
||||
error('not-basic');
|
||||
error('not-basic')
|
||||
}
|
||||
output.push(input.charCodeAt(j));
|
||||
output.push(input.charCodeAt(j))
|
||||
}
|
||||
|
||||
// Main decoding loop: start just after the last delimiter if any basic code
|
||||
// points were copied; start at the beginning otherwise.
|
||||
|
||||
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||||
|
||||
for (index = basic > 0 ? basic + 1 : 0; index < inputLength /* no final expression */; ) {
|
||||
// `index` is the index of the next character to be consumed.
|
||||
// Decode a generalized variable-length integer into `delta`,
|
||||
// which gets added to `i`. The overflow checking is easier
|
||||
// if we increase `i` as we go, then subtract off its starting
|
||||
// value at the end to obtain `delta`.
|
||||
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
||||
|
||||
for (oldi = i, w = 1, k = base /* no condition */; ; k += base) {
|
||||
if (index >= inputLength) {
|
||||
error('invalid-input');
|
||||
error('invalid-input')
|
||||
}
|
||||
|
||||
digit = basicToDigit(input.charCodeAt(index++));
|
||||
digit = basicToDigit(input.charCodeAt(index++))
|
||||
|
||||
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
||||
error('overflow');
|
||||
error('overflow')
|
||||
}
|
||||
|
||||
i += digit * w;
|
||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
i += digit * w
|
||||
t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias
|
||||
|
||||
if (digit < t) {
|
||||
break;
|
||||
break
|
||||
}
|
||||
|
||||
baseMinusT = base - t;
|
||||
baseMinusT = base - t
|
||||
if (w > floor(maxInt / baseMinusT)) {
|
||||
error('overflow');
|
||||
error('overflow')
|
||||
}
|
||||
|
||||
w *= baseMinusT;
|
||||
|
||||
w *= baseMinusT
|
||||
}
|
||||
|
||||
out = output.length + 1;
|
||||
bias = adapt(i - oldi, out, oldi == 0);
|
||||
out = output.length + 1
|
||||
bias = adapt(i - oldi, out, oldi == 0)
|
||||
|
||||
// `i` was supposed to wrap around from `out` to `0`,
|
||||
// incrementing `n` each time, so we'll fix that now:
|
||||
if (floor(i / out) > maxInt - n) {
|
||||
error('overflow');
|
||||
error('overflow')
|
||||
}
|
||||
|
||||
n += floor(i / out);
|
||||
i %= out;
|
||||
n += floor(i / out)
|
||||
i %= out
|
||||
|
||||
// Insert `n` at position `i` of the output
|
||||
output.splice(i++, 0, n);
|
||||
|
||||
output.splice(i++, 0, n)
|
||||
}
|
||||
|
||||
return ucs2encode(output);
|
||||
return ucs2encode(output)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,109 +323,105 @@
|
||||
*/
|
||||
function encode(input) {
|
||||
var n,
|
||||
delta,
|
||||
handledCPCount,
|
||||
basicLength,
|
||||
bias,
|
||||
j,
|
||||
m,
|
||||
q,
|
||||
k,
|
||||
t,
|
||||
currentValue,
|
||||
output = [],
|
||||
/** `inputLength` will hold the number of code points in `input`. */
|
||||
inputLength,
|
||||
/** Cached calculation results */
|
||||
handledCPCountPlusOne,
|
||||
baseMinusT,
|
||||
qMinusT;
|
||||
delta,
|
||||
handledCPCount,
|
||||
basicLength,
|
||||
bias,
|
||||
j,
|
||||
m,
|
||||
q,
|
||||
k,
|
||||
t,
|
||||
currentValue,
|
||||
output = [],
|
||||
/** `inputLength` will hold the number of code points in `input`. */
|
||||
inputLength,
|
||||
/** Cached calculation results */
|
||||
handledCPCountPlusOne,
|
||||
baseMinusT,
|
||||
qMinusT
|
||||
|
||||
// Convert the input in UCS-2 to Unicode
|
||||
input = ucs2decode(input);
|
||||
input = ucs2decode(input)
|
||||
|
||||
// Cache the length
|
||||
inputLength = input.length;
|
||||
inputLength = input.length
|
||||
|
||||
// Initialize the state
|
||||
n = initialN;
|
||||
delta = 0;
|
||||
bias = initialBias;
|
||||
n = initialN
|
||||
delta = 0
|
||||
bias = initialBias
|
||||
|
||||
// Handle the basic code points
|
||||
for (j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
currentValue = input[j]
|
||||
if (currentValue < 0x80) {
|
||||
output.push(stringFromCharCode(currentValue));
|
||||
output.push(stringFromCharCode(currentValue))
|
||||
}
|
||||
}
|
||||
|
||||
handledCPCount = basicLength = output.length;
|
||||
handledCPCount = basicLength = output.length
|
||||
|
||||
// `handledCPCount` is the number of code points that have been handled;
|
||||
// `basicLength` is the number of basic code points.
|
||||
|
||||
// Finish the basic string - if it is not empty - with a delimiter
|
||||
if (basicLength) {
|
||||
output.push(delimiter);
|
||||
output.push(delimiter)
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
|
||||
// All non-basic code points < n have been handled already. Find the next
|
||||
// larger one:
|
||||
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
currentValue = input[j]
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
m = currentValue
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||||
// but guard against overflow
|
||||
handledCPCountPlusOne = handledCPCount + 1;
|
||||
handledCPCountPlusOne = handledCPCount + 1
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
error('overflow');
|
||||
error('overflow')
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
delta += (m - n) * handledCPCountPlusOne
|
||||
n = m
|
||||
|
||||
for (j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
currentValue = input[j]
|
||||
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
error('overflow');
|
||||
error('overflow')
|
||||
}
|
||||
|
||||
if (currentValue == n) {
|
||||
// Represent delta as a generalized variable-length integer
|
||||
for (q = delta, k = base; /* no condition */; k += base) {
|
||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
for (q = delta, k = base /* no condition */; ; k += base) {
|
||||
t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias
|
||||
if (q < t) {
|
||||
break;
|
||||
break
|
||||
}
|
||||
qMinusT = q - t;
|
||||
baseMinusT = base - t;
|
||||
output.push(
|
||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||||
);
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
qMinusT = q - t
|
||||
baseMinusT = base - t
|
||||
output.push(stringFromCharCode(digitToBasic(t + (qMinusT % baseMinusT), 0)))
|
||||
q = floor(qMinusT / baseMinusT)
|
||||
}
|
||||
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
||||
delta = 0;
|
||||
++handledCPCount;
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)))
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength)
|
||||
delta = 0
|
||||
++handledCPCount
|
||||
}
|
||||
}
|
||||
|
||||
++delta;
|
||||
++n;
|
||||
|
||||
++delta
|
||||
++n
|
||||
}
|
||||
return output.join('');
|
||||
return output.join('')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -452,10 +437,8 @@
|
||||
*/
|
||||
function toUnicode(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexPunycode.test(string)
|
||||
? decode(string.slice(4).toLowerCase())
|
||||
: string;
|
||||
});
|
||||
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,10 +454,8 @@
|
||||
*/
|
||||
function toASCII(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexNonASCII.test(string)
|
||||
? 'xn--' + encode(string)
|
||||
: string;
|
||||
});
|
||||
return regexNonASCII.test(string) ? 'xn--' + encode(string) : string
|
||||
})
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -486,7 +467,7 @@
|
||||
* @memberOf punycode
|
||||
* @type String
|
||||
*/
|
||||
'version': '1.4.1',
|
||||
version: '1.4.1',
|
||||
/**
|
||||
* An object of methods to convert from JavaScript's internal character
|
||||
* representation (UCS-2) to Unicode code points, and back.
|
||||
@@ -494,40 +475,35 @@
|
||||
* @memberOf punycode
|
||||
* @type Object
|
||||
*/
|
||||
'ucs2': {
|
||||
'decode': ucs2decode,
|
||||
'encode': ucs2encode
|
||||
ucs2: {
|
||||
decode: ucs2decode,
|
||||
encode: ucs2encode
|
||||
},
|
||||
'decode': decode,
|
||||
'encode': encode,
|
||||
'toASCII': toASCII,
|
||||
'toUnicode': toUnicode
|
||||
};
|
||||
decode: decode,
|
||||
encode: encode,
|
||||
toASCII: toASCII,
|
||||
toUnicode: toUnicode
|
||||
}
|
||||
|
||||
/** Expose `punycode` */
|
||||
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
||||
// like the following:
|
||||
if (
|
||||
typeof define == 'function' &&
|
||||
typeof define.amd == 'object' &&
|
||||
define.amd
|
||||
) {
|
||||
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
||||
define('punycode', function() {
|
||||
return punycode;
|
||||
});
|
||||
return punycode
|
||||
})
|
||||
} else if (freeExports && freeModule) {
|
||||
if (module.exports == freeExports) {
|
||||
// in Node.js, io.js, or RingoJS v0.8.0+
|
||||
freeModule.exports = punycode;
|
||||
freeModule.exports = punycode
|
||||
} else {
|
||||
// in Narwhal or RingoJS v0.7.0-
|
||||
for (key in punycode) {
|
||||
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
||||
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// in Rhino or a web browser
|
||||
root.punycode = punycode;
|
||||
root.punycode = punycode
|
||||
}
|
||||
|
||||
}(this));
|
||||
})(this)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,316 +1,342 @@
|
||||
'use strict'
|
||||
//BBCodeとMarkdownの入力・パーサー
|
||||
//アカウント変えた時にBBとかMDとか
|
||||
function mdCheck() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var profimg = localStorage.getItem("prof_" + acct_id);
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var profimg = localStorage.getItem('prof_' + acct_id)
|
||||
if (!profimg) {
|
||||
profimg = "../../img/missing.svg";
|
||||
profimg = '../../img/missing.svg'
|
||||
}
|
||||
$("#acct-sel-prof").attr("src", profimg);
|
||||
if (localStorage.getItem("post_" + acct_id)) {
|
||||
$("#toot-post-btn").text(localStorage.getItem("post_" + acct_id) + "(" + localStorage.getItem("domain_" + acct_id) + ")");
|
||||
$('#acct-sel-prof').attr('src', profimg)
|
||||
if (localStorage.getItem('post_' + acct_id)) {
|
||||
$('#toot-post-btn').text(
|
||||
localStorage.getItem('post_' + acct_id) +
|
||||
'(' +
|
||||
localStorage.getItem('domain_' + acct_id) +
|
||||
')'
|
||||
)
|
||||
} else {
|
||||
$("#toot-post-btn").text(lang.lang_toot + "(" + localStorage.getItem("domain_" + acct_id) + ")");
|
||||
$('#toot-post-btn').text(lang.lang_toot + '(' + localStorage.getItem('domain_' + acct_id) + ')')
|
||||
}
|
||||
if (!localStorage.getItem("bb_" + acct_id) && !localStorage.getItem("md_" + acct_id)) {
|
||||
$(".markdown").addClass("hide");
|
||||
$(".anti-markdown").addClass("hide");
|
||||
if (!localStorage.getItem('bb_' + acct_id) && !localStorage.getItem('md_' + acct_id)) {
|
||||
$('.markdown').addClass('hide')
|
||||
$('.anti-markdown').addClass('hide')
|
||||
} else {
|
||||
$(".anti-markdown").removeClass("hide");
|
||||
$('.anti-markdown').removeClass('hide')
|
||||
}
|
||||
if ($(".markdown").hasClass("hide")) {
|
||||
localStorage.setItem("md", "hide");
|
||||
if ($('.markdown').hasClass('hide')) {
|
||||
localStorage.setItem('md', 'hide')
|
||||
} else {
|
||||
localStorage.removeItem("md");
|
||||
localStorage.removeItem('md')
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (domain == "itabashi.0j0.jp") {
|
||||
$("#limited-button").removeClass("hide");
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
if (domain == 'itabashi.0j0.jp') {
|
||||
$('#limited-button').removeClass('hide')
|
||||
} else {
|
||||
$("#limited-button").addClass("hide");
|
||||
$('#limited-button').addClass('hide')
|
||||
}
|
||||
if (domain == "kirishima.cloud") {
|
||||
$("#faicon-btn").show();
|
||||
if (domain == 'kirishima.cloud') {
|
||||
$('#faicon-btn').show()
|
||||
} else {
|
||||
$("#faicon-btn").hide();
|
||||
$('#faicon-btn').hide()
|
||||
}
|
||||
if (domain == "imastodon.net") {
|
||||
trendTag();
|
||||
if (domain == 'imastodon.net') {
|
||||
trendTag()
|
||||
} else {
|
||||
$("#trendtag").html("");
|
||||
$('#trendtag').html('')
|
||||
}
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
M.toast({ html: lang.lang_bbmd_misskey, displayLength: 5000 })
|
||||
}
|
||||
if (idata[domain + "_letters"]) {
|
||||
$("#textarea").attr("data-length", idata[domain + "_letters"])
|
||||
if (idata[domain + '_letters']) {
|
||||
$('#textarea').attr('data-length', idata[domain + '_letters'])
|
||||
} else {
|
||||
$("#textarea").attr("data-length", 500)
|
||||
$('#textarea').attr('data-length', 500)
|
||||
}
|
||||
if (idata[domain + "_glitch"] === "true") {
|
||||
$("#local-button").removeClass("hide");
|
||||
if (idata[domain + '_glitch'] === 'true') {
|
||||
$('#local-button').removeClass('hide')
|
||||
} else {
|
||||
$("#local-button").addClass("hide");
|
||||
$('#local-button').addClass('hide')
|
||||
}
|
||||
var multi = localStorage.getItem("multi");
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (multi) {
|
||||
var obj = JSON.parse(multi);
|
||||
if (obj[acct_id].background && obj[acct_id].background != "def" && obj[acct_id].text && obj[acct_id].text != "def") {
|
||||
$("#toot-post-btn").removeClass("indigo");
|
||||
$("#toot-post-btn").css("background-color", "#" + obj[acct_id].background);
|
||||
$("#toot-post-btn").css("color", obj[acct_id].text);
|
||||
var obj = JSON.parse(multi)
|
||||
if (
|
||||
obj[acct_id].background &&
|
||||
obj[acct_id].background != 'def' &&
|
||||
obj[acct_id].text &&
|
||||
obj[acct_id].text != 'def'
|
||||
) {
|
||||
$('#toot-post-btn').removeClass('indigo')
|
||||
$('#toot-post-btn').css('background-color', '#' + obj[acct_id].background)
|
||||
$('#toot-post-btn').css('color', obj[acct_id].text)
|
||||
} else {
|
||||
$("#toot-post-btn").css("background-color", "");
|
||||
$("#toot-post-btn").css("color", "");
|
||||
$("#toot-post-btn").addClass("indigo");
|
||||
|
||||
$('#toot-post-btn').css('background-color', '')
|
||||
$('#toot-post-btn').css('color', '')
|
||||
$('#toot-post-btn').addClass('indigo')
|
||||
}
|
||||
}
|
||||
loadVis();
|
||||
loadVis()
|
||||
}
|
||||
//BOXのトグルボタン
|
||||
function mdToggle() {
|
||||
$(".markdown").toggleClass("hide");
|
||||
$(".anti-markdown").toggleClass("hide");
|
||||
if ($(".markdown").hasClass("hide")) {
|
||||
localStorage.setItem("md", "hide");
|
||||
$('.markdown').toggleClass('hide')
|
||||
$('.anti-markdown').toggleClass('hide')
|
||||
if ($('.markdown').hasClass('hide')) {
|
||||
localStorage.setItem('md', 'hide')
|
||||
} else {
|
||||
localStorage.removeItem("md");
|
||||
localStorage.removeItem('md')
|
||||
}
|
||||
|
||||
}
|
||||
//最初に読み込みます(MD対応インスタンスかチェック)
|
||||
if (localStorage.getItem("md") == "hide") {
|
||||
$(".markdown").addClass("hide");
|
||||
$(".anti-markdown").removeClass("hide");
|
||||
if (localStorage.getItem('md') == 'hide') {
|
||||
$('.markdown').addClass('hide')
|
||||
$('.anti-markdown').removeClass('hide')
|
||||
}
|
||||
//タグを選んだ時に(BB版)
|
||||
function tagsel(tag) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (!localStorage.getItem("bb_" + acct_id)) {
|
||||
return false;
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
if (!localStorage.getItem('bb_' + acct_id)) {
|
||||
return false
|
||||
}
|
||||
if (tag == "large" || tag == "size" || tag == "color" || tag == "colorhex") {
|
||||
var sub = $("#" + tag).val();
|
||||
var sub = sub.replace(/#/g, "");
|
||||
surroundHTML(tag + "=" + sub, tag);
|
||||
} else if (tag == "flip=vertical" || tag == "flip=horizontal") {
|
||||
surroundHTML(tag, "flip");
|
||||
if (tag == 'large' || tag == 'size' || tag == 'color' || tag == 'colorhex') {
|
||||
var sub = $('#' + tag).val()
|
||||
var sub = sub.replace(/#/g, '')
|
||||
surroundHTML(tag + '=' + sub, tag)
|
||||
} else if (tag == 'flip=vertical' || tag == 'flip=horizontal') {
|
||||
surroundHTML(tag, 'flip')
|
||||
} else {
|
||||
surroundHTML(tag, tag);
|
||||
surroundHTML(tag, tag)
|
||||
}
|
||||
$("#textarea").focus();
|
||||
$('#textarea').focus()
|
||||
}
|
||||
//HTMLをエスケープしてXSSを防ぐ
|
||||
function escape_html(string) {
|
||||
if (typeof string !== 'string') {
|
||||
return string;
|
||||
return string
|
||||
}
|
||||
return string.replace(/[&'`"<>]/g, function (match) {
|
||||
return string.replace(/[&'`"<>]/g, function(match) {
|
||||
return {
|
||||
'&': '&',
|
||||
"'": ''',
|
||||
'`': '`',
|
||||
'"': '"',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'>': '>'
|
||||
}[match]
|
||||
});
|
||||
})
|
||||
}
|
||||
//テキストボックスで選択したやつをタグで囲む(BB版)
|
||||
function surroundHTML(tagS, tagE) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (!localStorage.getItem("bb_" + acct_id)) {
|
||||
return false;
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
if (!localStorage.getItem('bb_' + acct_id)) {
|
||||
return false
|
||||
}
|
||||
var target = document.getElementById("textarea");
|
||||
var pos = getAreaRange(target);
|
||||
var target = document.getElementById('textarea')
|
||||
var pos = getAreaRange(target)
|
||||
|
||||
var val = target.value;
|
||||
var range = val.slice(pos.start, pos.end);
|
||||
var beforeNode = val.slice(0, pos.start);
|
||||
var afterNode = val.slice(pos.end);
|
||||
var insertNode;
|
||||
var val = target.value
|
||||
var range = val.slice(pos.start, pos.end)
|
||||
var beforeNode = val.slice(0, pos.start)
|
||||
var afterNode = val.slice(pos.end)
|
||||
var insertNode
|
||||
if (range || pos.start != pos.end) {
|
||||
insertNode = '[' + tagS + ']' + range + '[/' + tagE + ']';
|
||||
target.value = beforeNode + insertNode + afterNode;
|
||||
}
|
||||
|
||||
else if (pos.start == pos.end) {
|
||||
insertNode = '[' + tagS + ']' + '[/' + tagE + ']';
|
||||
target.value = beforeNode + insertNode + afterNode;
|
||||
insertNode = '[' + tagS + ']' + range + '[/' + tagE + ']'
|
||||
target.value = beforeNode + insertNode + afterNode
|
||||
} else if (pos.start == pos.end) {
|
||||
insertNode = '[' + tagS + ']' + '[/' + tagE + ']'
|
||||
target.value = beforeNode + insertNode + afterNode
|
||||
}
|
||||
}
|
||||
function markdown(tag, ck, br, space) {
|
||||
if (space == "before") {
|
||||
tagE = tag;
|
||||
tag = " " + tag;
|
||||
if (space == 'before') {
|
||||
tagE = tag
|
||||
tag = ' ' + tag
|
||||
} else {
|
||||
tagE = tag;
|
||||
tagE = tag
|
||||
}
|
||||
surroundMD(tag, tagE, ck, br);
|
||||
$("#textarea").focus();
|
||||
surroundMD(tag, tagE, ck, br)
|
||||
$('#textarea').focus()
|
||||
}
|
||||
function surroundMD(tagS, tagE, ck, br) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (!localStorage.getItem("md_" + acct_id)) {
|
||||
return false;
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
if (!localStorage.getItem('md_' + acct_id)) {
|
||||
return false
|
||||
}
|
||||
var target = document.getElementById("textarea");
|
||||
var pos = getAreaRange(target);
|
||||
var target = document.getElementById('textarea')
|
||||
var pos = getAreaRange(target)
|
||||
|
||||
var val = target.value;
|
||||
var range = val.slice(pos.start, pos.end);
|
||||
var beforeNode = val.slice(0, pos.start);
|
||||
var afterNode = val.slice(pos.end);
|
||||
var insertNode;
|
||||
if (br == "yes") {
|
||||
var br = "\n";
|
||||
var val = target.value
|
||||
var range = val.slice(pos.start, pos.end)
|
||||
var beforeNode = val.slice(0, pos.start)
|
||||
var afterNode = val.slice(pos.end)
|
||||
var insertNode
|
||||
if (br == 'yes') {
|
||||
var br = '\n'
|
||||
} else {
|
||||
var br = "";
|
||||
var br = ''
|
||||
}
|
||||
|
||||
if ((range || pos.start != pos.end) && ck == "yes") {
|
||||
insertNode = tagS + range + tagE;
|
||||
target.value = beforeNode + insertNode + br + afterNode;
|
||||
}
|
||||
|
||||
else if (pos.start == pos.end || ck == "no") {
|
||||
insertNode = tagS + range;
|
||||
target.value = beforeNode + insertNode + br + afterNode;
|
||||
if ((range || pos.start != pos.end) && ck == 'yes') {
|
||||
insertNode = tagS + range + tagE
|
||||
target.value = beforeNode + insertNode + br + afterNode
|
||||
} else if (pos.start == pos.end || ck == 'no') {
|
||||
insertNode = tagS + range
|
||||
target.value = beforeNode + insertNode + br + afterNode
|
||||
}
|
||||
}
|
||||
|
||||
//テキストボックスの前後チェック
|
||||
function getAreaRange(obj) {
|
||||
var pos = new Object();
|
||||
var pos = new Object()
|
||||
if (window.getSelection()) {
|
||||
pos.start = obj.selectionStart;
|
||||
pos.end = obj.selectionEnd;
|
||||
pos.start = obj.selectionStart
|
||||
pos.end = obj.selectionEnd
|
||||
}
|
||||
|
||||
return pos;
|
||||
return pos
|
||||
}
|
||||
|
||||
//Markdownのリンク挿入
|
||||
function markdownLink() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (!localStorage.getItem("md_" + acct_id)) {
|
||||
return false;
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
if (!localStorage.getItem('md_' + acct_id)) {
|
||||
return false
|
||||
}
|
||||
var linkIns = "[" + $("#linkt").val() + "]" + "(" + $("#link2").val() + ")";
|
||||
if (linkIns != "[]()") {
|
||||
$("#textarea").val($("#textarea").val() + linkIns);
|
||||
$("#linkt").val("");
|
||||
$("#link2").val("");
|
||||
$("#textarea").focus();
|
||||
var linkIns = '[' + $('#linkt').val() + ']' + '(' + $('#link2').val() + ')'
|
||||
if (linkIns != '[]()') {
|
||||
$('#textarea').val($('#textarea').val() + linkIns)
|
||||
$('#linkt').val('')
|
||||
$('#link2').val('')
|
||||
$('#textarea').focus()
|
||||
}
|
||||
}
|
||||
//Markdownのimg挿入
|
||||
function markdownImage() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (!localStorage.getItem("md_" + acct_id)) {
|
||||
return false;
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
if (!localStorage.getItem('md_' + acct_id)) {
|
||||
return false
|
||||
}
|
||||
var imgIns = "![" + $("#image").val() + "]" + "(" + $("#image2").val() + ")";
|
||||
if (imgIns != "![]()") {
|
||||
$("#textarea").val($("#textarea").val() + imgIns);
|
||||
$("#image").val("");
|
||||
$("#image2").val("");
|
||||
$("#textarea").focus();
|
||||
var imgIns = '![' + $('#image').val() + ']' + '(' + $('#image2').val() + ')'
|
||||
if (imgIns != '![]()') {
|
||||
$('#textarea').val($('#textarea').val() + imgIns)
|
||||
$('#image').val('')
|
||||
$('#image2').val('')
|
||||
$('#textarea').focus()
|
||||
}
|
||||
}
|
||||
//文字数をチェック(hタグ用)
|
||||
function str_count(all, part) {
|
||||
return (all.match(new RegExp(part, "g")) || []).length;
|
||||
return (all.match(new RegExp(part, 'g')) || []).length
|
||||
}
|
||||
|
||||
//プレビュー
|
||||
function preview() {
|
||||
$("#preview-field").show();
|
||||
$("#toot-field").hide();
|
||||
$("#preview-btn").hide();
|
||||
var bb = escape_html($("#textarea").val());
|
||||
$('#preview-field').show()
|
||||
$('#toot-field').hide()
|
||||
$('#preview-btn').hide()
|
||||
var bb = escape_html($('#textarea').val())
|
||||
//quote
|
||||
var bb = bb.replace(/>(.+)$/g, '<blockquote>$1<\/blockquote>');
|
||||
var bb = bb.replace(/>(.+)$/g, '<blockquote>$1</blockquote>')
|
||||
//spin
|
||||
var bb = bb.replace(/\[spin\](.+)\[\/spin\]/g, '<span class="fa fa-spin">$1<\/span>');
|
||||
var bb = bb.replace(/\[spin\](.+)\[\/spin\]/g, '<span class="fa fa-spin">$1</span>')
|
||||
//pulse
|
||||
var bb = bb.replace(/\[pulse\](.+)\[\/pulse\]/g, '<span class="bbcode-pulse-loading">$1<\/span>');
|
||||
var bb = bb.replace(/\[pulse\](.+)\[\/pulse\]/g, '<span class="bbcode-pulse-loading">$1</span>')
|
||||
//large
|
||||
var bb = bb.replace(/\[large=([0-9]{1,2})x\](.+)\[\/large\]/g, '<span class="fa fa-$1x">$2<\/span>');
|
||||
var bb = bb.replace(
|
||||
/\[large=([0-9]{1,2})x\](.+)\[\/large\]/g,
|
||||
'<span class="fa fa-$1x">$2</span>'
|
||||
)
|
||||
//vertical
|
||||
var bb = bb.replace(/\[flip=vertical\](.+)\[\/flip\]/g, '<span class="fa fa-flip-vertical">$1<\/span>');
|
||||
var bb = bb.replace(
|
||||
/\[flip=vertical\](.+)\[\/flip\]/g,
|
||||
'<span class="fa fa-flip-vertical">$1</span>'
|
||||
)
|
||||
//horizontal
|
||||
var bb = bb.replace(/\[flip=horizontal\](.+)\[\/flip\]/g, '<span class="fa fa-flip-horizontal">$1<\/span>');
|
||||
var bb = bb.replace(
|
||||
/\[flip=horizontal\](.+)\[\/flip\]/g,
|
||||
'<span class="fa fa-flip-horizontal">$1</span>'
|
||||
)
|
||||
//b
|
||||
var bb = bb.replace(/\[b\](.+)\[\/b\]/g, '<b>$1<\/b>');
|
||||
var bb = bb.replace(/\[b\](.+)\[\/b\]/g, '<b>$1</b>')
|
||||
//i
|
||||
var bb = bb.replace(/\[i\](.+)\[\/i\]/g, '<i>$1<\/i>');
|
||||
var bb = bb.replace(/\[i\](.+)\[\/i\]/g, '<i>$1</i>')
|
||||
//u
|
||||
var bb = bb.replace(/\[u\](.+)\[\/u\]/g, '<u>$1<\/u>');
|
||||
var bb = bb.replace(/\[u\](.+)\[\/u\]/g, '<u>$1</u>')
|
||||
//s
|
||||
var bb = bb.replace(/\[s\](.+)\[\/s\]/g, '<s>$1<\/s>');
|
||||
var bb = bb.replace(/\[s\](.+)\[\/s\]/g, '<s>$1</s>')
|
||||
//size
|
||||
var bb = bb.replace(/\[size=([0-9]{1,2})\](.+)\[\/size\]/g, '<span style="font-size:$1px">$2<\/span>');
|
||||
var bb = bb.replace(
|
||||
/\[size=([0-9]{1,2})\](.+)\[\/size\]/g,
|
||||
'<span style="font-size:$1px">$2</span>'
|
||||
)
|
||||
//colorhex
|
||||
var bb = bb.replace(/\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g, '<span style="color:#$1">$2<\/span>');
|
||||
var bb = bb.replace(
|
||||
/\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g,
|
||||
'<span style="color:#$1">$2</span>'
|
||||
)
|
||||
//code
|
||||
var bb = bb.replace(/`(.+)`/g, '<code>$1<\/code>');
|
||||
var bb = bb.replace(/`(.+)`/g, '<code>$1</code>')
|
||||
//head
|
||||
var m;
|
||||
m = bb.match(/^#{1,6}(.+)$/gm);
|
||||
var m
|
||||
m = bb.match(/^#{1,6}(.+)$/gm)
|
||||
if (m) {
|
||||
for (let i = 0; i < m.length; i++) {
|
||||
var t = m[i].match(/^#{1,6}(.+)$/);
|
||||
var indexct = '<h' + str_count(m[i], "#") + '>' + t[1] + '</h' + str_count(m[i], "#") + '>';
|
||||
var bb = bb.replace(new RegExp(m[i], ""), indexct);
|
||||
var t = m[i].match(/^#{1,6}(.+)$/)
|
||||
var indexct = '<h' + str_count(m[i], '#') + '>' + t[1] + '</h' + str_count(m[i], '#') + '>'
|
||||
var bb = bb.replace(new RegExp(m[i], ''), indexct)
|
||||
}
|
||||
}
|
||||
//list(ul)
|
||||
var li;
|
||||
li = bb.match(/^\- (.+)$/gm);
|
||||
var li
|
||||
li = bb.match(/^\- (.+)$/gm)
|
||||
if (li) {
|
||||
for (let l = 0; l < li.length; l++) {
|
||||
var u = li[l].match(/^\- (.+)$/);
|
||||
var listUl = '<li>' + u[1] + '</li>';
|
||||
var u = li[l].match(/^\- (.+)$/)
|
||||
var listUl = '<li>' + u[1] + '</li>'
|
||||
if (l == 0) {
|
||||
listUl = '<ul>' + listUl;
|
||||
listUl = '<ul>' + listUl
|
||||
}
|
||||
if (l == li.length - 1) {
|
||||
listUl = listUl + '</ul>';
|
||||
listUl = listUl + '</ul>'
|
||||
}
|
||||
var bb = bb.replace(new RegExp(li[l], ""), listUl);
|
||||
var bb = bb.replace(new RegExp(li[l], ''), listUl)
|
||||
}
|
||||
}
|
||||
//list(ol)
|
||||
var li;
|
||||
li = bb.match(/^1\. (.+)$/gm);
|
||||
var li
|
||||
li = bb.match(/^1\. (.+)$/gm)
|
||||
if (li) {
|
||||
for (let l = 0; l < li.length; l++) {
|
||||
var u = li[l].match(/^1\. (.+)$/);
|
||||
var listUl = '<li>' + u[1] + '</li>';
|
||||
var u = li[l].match(/^1\. (.+)$/)
|
||||
var listUl = '<li>' + u[1] + '</li>'
|
||||
if (l === 0) {
|
||||
listUl = '<ol>' + listUl;
|
||||
listUl = '<ol>' + listUl
|
||||
}
|
||||
if (l === li.length - 1) {
|
||||
listUl = listUl + '</ol>';
|
||||
listUl = listUl + '</ol>'
|
||||
}
|
||||
var bb = bb.replace(new RegExp(li[l], ""), listUl);
|
||||
var bb = bb.replace(new RegExp(li[l], ''), listUl)
|
||||
}
|
||||
}
|
||||
//img
|
||||
var bb = bb.replace(/!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, '<img src="$2" text="$1" style="width:100%">');
|
||||
var bb = bb.replace(
|
||||
/!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,
|
||||
'<img src="$2" text="$1" style="width:100%">'
|
||||
)
|
||||
//link
|
||||
var bb = bb.replace(/\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, '<a href="$2" target="_blank">$1<\/a>');
|
||||
bb = nl2br(bb);
|
||||
bb = bb.replace(new RegExp("</li><br />", "g"), "");
|
||||
$("#md-preview").html(bb);
|
||||
var bb = bb.replace(
|
||||
/\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,
|
||||
'<a href="$2" target="_blank">$1</a>'
|
||||
)
|
||||
bb = nl2br(bb)
|
||||
bb = bb.replace(new RegExp('</li><br />', 'g'), '')
|
||||
$('#md-preview').html(bb)
|
||||
}
|
||||
//Editで戻る
|
||||
function previewEdit() {
|
||||
$("#preview-field").hide();
|
||||
$("#toot-field").show();
|
||||
$("#preview-btn").show();
|
||||
$("#md-preview").html("");
|
||||
}
|
||||
$('#preview-field').hide()
|
||||
$('#toot-field').show()
|
||||
$('#preview-btn').show()
|
||||
$('#md-preview').html('')
|
||||
}
|
||||
|
||||
@@ -1,209 +1,331 @@
|
||||
'use strict'
|
||||
//絵文字ピッカー
|
||||
//最初に読み込む
|
||||
$("#emoji-before").addClass("disabled");
|
||||
$("#emoji-next").addClass("disabled");
|
||||
$('#emoji-before').addClass('disabled')
|
||||
$('#emoji-next').addClass('disabled')
|
||||
|
||||
//絵文字ボタンのトグル
|
||||
function emojiToggle(reaction) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var selin = $("#textarea").prop('selectionStart');
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var selin = $('#textarea').prop('selectionStart')
|
||||
if (!selin) {
|
||||
selin = 0;
|
||||
selin = 0
|
||||
}
|
||||
if ($("#emoji").hasClass("hide")) {
|
||||
$("#emoji").removeClass("hide")
|
||||
$("#right-side").show()
|
||||
$("#suggest").html("");
|
||||
if (!localStorage.getItem("emoji_" + acct_id)) {
|
||||
var html =
|
||||
'<button class="btn waves-effect green" style="width:100%; padding:0; margin-top:0;" onclick="emojiGet(\'true\');">' + lang.lang_emoji_get + '</button>';
|
||||
$("#emoji-list").html(html);
|
||||
if ($('#emoji').hasClass('hide')) {
|
||||
$('#emoji').removeClass('hide')
|
||||
$('#right-side').show()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', 'calc(100% - 300px)')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1 + 300
|
||||
} else {
|
||||
emojiList('home', reaction);
|
||||
width = 600
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
$('#suggest').html('')
|
||||
if (!localStorage.getItem('emojis_' + acct_id)) {
|
||||
var html = `<button class="btn waves-effect green" style="width:100%; padding:0; margin-top:0;" onclick="emojiGet('true');">${lang.lang_emoji_get}</button>`
|
||||
$('#emoji-list').html(html)
|
||||
} else {
|
||||
emojiList('home', reaction)
|
||||
}
|
||||
} else {
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
$("#suggest").html("");
|
||||
$("#right-side").hide()
|
||||
$('#poll').addClass('hide')
|
||||
$('#right-side').hide()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#emoji').addClass('hide')
|
||||
$('#suggest').html('')
|
||||
$('#left-side').css('width', '100%')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1
|
||||
} else {
|
||||
width = 300
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//絵文字リスト挿入
|
||||
function emojiGet(parse, started) {
|
||||
$('#emoji-list').text('Loading...');
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
var start = "https://" + domain + "/api/v1/custom_emojis";
|
||||
$('#emoji-list').text('Loading...')
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
var start = 'https://' + domain + '/api/v1/custom_emojis'
|
||||
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) {
|
||||
if (parse == "true") {
|
||||
$('#emoji-list').text('Parsing...');
|
||||
//絵文字をマストドン公式と同順にソート
|
||||
json.sort(function (a, b) {
|
||||
if (a.shortcode < b.shortcode) return -1;
|
||||
if (a.shortcode > b.shortcode) return 1;
|
||||
return 0;
|
||||
});
|
||||
localStorage.setItem("emoji_" + acct_id, JSON.stringify(json));
|
||||
} else {
|
||||
localStorage.setItem("emoji_" + acct_id, JSON.stringify(json));
|
||||
}
|
||||
localStorage.setItem("emojiseek", 0);
|
||||
if (!started) {
|
||||
emojiList('home')
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (parse == 'true') {
|
||||
$('#emoji-list').text('Parsing...')
|
||||
var md = {
|
||||
categorized: {},
|
||||
uncategorized: []
|
||||
}
|
||||
var if_categorized = false
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var emoji = json[key]
|
||||
if (emoji.visible_in_picker) {
|
||||
var listed = true
|
||||
} else {
|
||||
var listed = false
|
||||
}
|
||||
if (emoji.category) {
|
||||
var cat = emoji.category
|
||||
if (!md['categorized'][cat]) {
|
||||
md['categorized'][cat] = []
|
||||
}
|
||||
md['categorized'][cat].push({
|
||||
shortcode: emoji.shortcode,
|
||||
url: emoji.url,
|
||||
listed: listed
|
||||
})
|
||||
if_categorized = true
|
||||
} else {
|
||||
md['uncategorized'].push({
|
||||
shortcode: emoji.shortcode,
|
||||
url: emoji.url,
|
||||
listed: listed
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(md)
|
||||
//絵文字をマストドン公式と同順にソート
|
||||
md['uncategorized'].sort(function(a, b) {
|
||||
if (a.shortcode < b.shortcode) return -1
|
||||
if (a.shortcode > b.shortcode) return 1
|
||||
return 0
|
||||
})
|
||||
Object.keys(md['categorized']).forEach(function(key) {
|
||||
md['categorized'][key].sort(function(a, b) {
|
||||
if (a.shortcode < b.shortcode) return -1
|
||||
if (a.shortcode > b.shortcode) return 1
|
||||
return 0
|
||||
})
|
||||
})
|
||||
|
||||
md['if_categorized'] = if_categorized
|
||||
localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
|
||||
} else {
|
||||
localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
|
||||
}
|
||||
localStorage.setItem('emojiseek', 0)
|
||||
if (!started) {
|
||||
emojiList('home')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/meta";
|
||||
var start = 'https://' + domain + '/api/meta'
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.enableEmojiReaction) {
|
||||
localStorage.setItem("emojiReaction_" + acct_id, "true");
|
||||
} else {
|
||||
localStorage.setItem("emojiReaction_" + acct_id, "disabled");
|
||||
}
|
||||
var emojis = json.emojis;
|
||||
var md = [];
|
||||
Object.keys(emojis).forEach(function (key) {
|
||||
var emoji = emojis[key];
|
||||
md.push({
|
||||
"shortcode": emoji.name,
|
||||
"url": emoji.url
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.enableEmojiReaction) {
|
||||
localStorage.setItem('emojiReaction_' + acct_id, 'true')
|
||||
} else {
|
||||
localStorage.setItem('emojiReaction_' + acct_id, 'disabled')
|
||||
}
|
||||
var emojis = json.emojis
|
||||
var md = { uncategorized: [] }
|
||||
Object.keys(emojis).forEach(function(key) {
|
||||
var emoji = emojis[key]
|
||||
md['uncategorized'].push({
|
||||
shortcode: emoji.name,
|
||||
url: emoji.url,
|
||||
listed: true
|
||||
})
|
||||
})
|
||||
});
|
||||
if (parse == "true") {
|
||||
$('#emoji-list').text('Parsing...');
|
||||
//絵文字をマストドン公式と同順にソート
|
||||
md.sort(function (a, b) {
|
||||
if (a.shortcode < b.shortcode) return -1;
|
||||
if (a.shortcode > b.shortcode) return 1;
|
||||
return 0;
|
||||
});
|
||||
localStorage.setItem("emoji_" + acct_id, JSON.stringify(md));
|
||||
} else {
|
||||
localStorage.setItem("emoji_" + acct_id, JSON.stringify(md));
|
||||
}
|
||||
localStorage.setItem("emojiseek", 0);
|
||||
if (!started) {
|
||||
emojiList('home')
|
||||
}
|
||||
});
|
||||
md['if_categorized'] = false
|
||||
if (parse == 'true') {
|
||||
$('#emoji-list').text('Parsing...')
|
||||
//絵文字をマストドン公式と同順にソート
|
||||
md['uncategorized'].sort(function(a, b) {
|
||||
if (a.shortcode < b.shortcode) return -1
|
||||
if (a.shortcode > b.shortcode) return 1
|
||||
return 0
|
||||
})
|
||||
localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
|
||||
} else {
|
||||
localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
|
||||
}
|
||||
localStorage.setItem('emojiseek', 0)
|
||||
if (!started) {
|
||||
emojiList('home')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//リストの描画
|
||||
function emojiList(target, reaction) {
|
||||
$("#now-emoji").text(lang.lang_emoji_custom);
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (reaction && localStorage.getItem("emojiReaction_" + acct_id) != "true") {
|
||||
console.error("Disabled")
|
||||
$('#now-emoji').text(lang.lang_emoji_custom)
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
if (reaction && localStorage.getItem('emojiReaction_' + acct_id) != 'true') {
|
||||
console.error('Disabled')
|
||||
clear()
|
||||
hide();
|
||||
return false;
|
||||
hide()
|
||||
return false
|
||||
}
|
||||
var start = localStorage.getItem("emojiseek");
|
||||
if (target == "next") {
|
||||
var start = start * 1 + 127;
|
||||
localStorage.setItem("emojiseek", start);
|
||||
} else if (target == "before") {
|
||||
var start = start - 127;
|
||||
localStorage.setItem("emojiseek", start);
|
||||
var start = localStorage.getItem('emojiseek')
|
||||
if (target == 'next') {
|
||||
var start = start * 1 + 127
|
||||
localStorage.setItem('emojiseek', start)
|
||||
} else if (target == 'before') {
|
||||
var start = start - 127
|
||||
localStorage.setItem('emojiseek', start)
|
||||
} else {
|
||||
var start = 0;
|
||||
localStorage.getItem("emojiseek", 0)
|
||||
var start = 0
|
||||
localStorage.getItem('emojiseek', 0)
|
||||
}
|
||||
var html = '';
|
||||
var obj = JSON.parse(localStorage.getItem("emoji_" + acct_id));
|
||||
var num = obj.length;
|
||||
var html = ''
|
||||
var raw = JSON.parse(localStorage.getItem('emojis_' + acct_id))
|
||||
console.log(raw)
|
||||
if (raw.if_categorized) {
|
||||
var obj = [
|
||||
{
|
||||
divider: true,
|
||||
cat: lang.lang_emoji_uncat
|
||||
}
|
||||
]
|
||||
var cats = raw['uncategorized']
|
||||
obj = obj.concat(cats)
|
||||
Object.keys(raw['categorized']).forEach(function(key) {
|
||||
var cats = raw['categorized'][key]
|
||||
obj = obj.concat([
|
||||
{
|
||||
divider: true,
|
||||
cat: key
|
||||
}
|
||||
])
|
||||
obj = obj.concat(cats)
|
||||
})
|
||||
} else {
|
||||
var obj = raw['uncategorized']
|
||||
}
|
||||
console.log(obj)
|
||||
|
||||
var num = obj.length
|
||||
if (num < start) {
|
||||
var start = 0;
|
||||
localStorage.setItem("emojiseek", start);
|
||||
var start = 0
|
||||
localStorage.setItem('emojiseek', start)
|
||||
}
|
||||
var page = Math.ceil(num / 126);
|
||||
$("#emoji-sum").text(page);
|
||||
var ct = Math.ceil(start / 126);
|
||||
var page = Math.ceil(num / 126)
|
||||
$('#emoji-sum').text(page)
|
||||
var ct = Math.ceil(start / 126)
|
||||
if (ct === 0) {
|
||||
var ct = 1;
|
||||
$("#emoji-before").addClass("disabled");
|
||||
if (num > 0) {
|
||||
var ct = 1
|
||||
}
|
||||
$('#emoji-before').addClass('disabled')
|
||||
} else {
|
||||
$("#emoji-before").removeClass("disabled");
|
||||
$('#emoji-before').removeClass('disabled')
|
||||
}
|
||||
$("#emoji-next").removeClass("disabled");
|
||||
$("#emoji-count").text(ct);
|
||||
if (page != 1) {
|
||||
$('#emoji-next').removeClass('disabled')
|
||||
} else {
|
||||
$('#emoji-next').addClass('disabled')
|
||||
}
|
||||
$('#emoji-count').text(ct)
|
||||
for (i = start; i < start + 126; i++) {
|
||||
var emoji = obj[i];
|
||||
var emoji = obj[i]
|
||||
if (emoji) {
|
||||
if (reaction) {
|
||||
html = html + '<a onclick="emojiReaction(\':' + emoji.shortcode +
|
||||
':\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
|
||||
html =
|
||||
html +
|
||||
`<a onclick="emojiReaction(':${emoji.shortcode}:')" class="pointer"><img src="${emoji.url}" width="20" title="${emoji.shortcode}"></a>`
|
||||
} else {
|
||||
html = html + '<a onclick="emojiInsert(\':' + emoji.shortcode +
|
||||
':\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
|
||||
if (emoji.divider) {
|
||||
html = html + '<p style="margin-bottom:0">' + emoji.cat + '</p>'
|
||||
} else {
|
||||
if (emoji.listed) {
|
||||
html =
|
||||
html +
|
||||
`<a onclick="emojiInsert(':${emoji.shortcode}:')" class="pointer"><img src="${emoji.url}" width="20" title="${emoji.shortcode}"></a>`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$("#emoji-list").html(html);
|
||||
$('#emoji-list').html(html)
|
||||
}
|
||||
|
||||
//絵文字など様々なものをテキストボックスに挿入
|
||||
function emojiInsert(code, del) {
|
||||
var now = $("#textarea").val();
|
||||
var selin = $("#textarea").prop('selectionStart');
|
||||
if (localStorage.getItem("emoji-zero-width") == "yes") {
|
||||
var blank = "";
|
||||
if (localStorage.getItem('emoji-zero-width') == 'yes') {
|
||||
var blankBefore = ''
|
||||
var blankAfter = ''
|
||||
} else {
|
||||
var blank = " ";
|
||||
var blankBefore = ' '
|
||||
var blankAfter = ' '
|
||||
}
|
||||
var before = now.substr(0, selin);
|
||||
if (before.slice(-1) != " ") {
|
||||
before = before + blank
|
||||
}
|
||||
var after = now.substr(selin, now.length);
|
||||
if (after.slice(-1) != " ") {
|
||||
after = blank + after
|
||||
}
|
||||
newt = before + code + after;
|
||||
if (!del) {
|
||||
$("#textarea").val(newt);
|
||||
//emoji();
|
||||
var textarea = document.querySelector('#textarea')
|
||||
var sentence = textarea.value
|
||||
var len = sentence.length
|
||||
var pos = textarea.selectionStart
|
||||
if (del) {
|
||||
var delLen = del.length
|
||||
} else {
|
||||
var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
|
||||
var now = now.replace(regExp, "");
|
||||
$("#textarea").val(now + blank + code);
|
||||
var delLen = 0
|
||||
}
|
||||
|
||||
$("#textarea").focus();
|
||||
var before = sentence.substr(0, pos - delLen)
|
||||
var last = before.substr(-1, 1)
|
||||
if (last == ' ') blankBefore = ''
|
||||
var after = sentence.substr(pos, len)
|
||||
var start = after.substr(0, 1)
|
||||
if (start == ' ') blankAfter = ''
|
||||
if (len == 0) {
|
||||
var word = code
|
||||
} else if (len == pos) {
|
||||
var word = blankBefore + code
|
||||
} else if (pos == 0) {
|
||||
var word = code + blankAfter
|
||||
} else {
|
||||
var word = blankBefore + code + blankAfter
|
||||
}
|
||||
sentence = before + word + after
|
||||
textarea.value = sentence
|
||||
}
|
||||
//改行挿入
|
||||
function brInsert(code) {
|
||||
if (!$('#post-box').hasClass("appear")) {
|
||||
localStorage.setItem("nohide", true);
|
||||
show();
|
||||
if (!$('#post-box').hasClass('appear')) {
|
||||
localStorage.setItem('nohide', true)
|
||||
show()
|
||||
}
|
||||
var now = $("#textarea").val();
|
||||
$("#textarea").val(now + code);
|
||||
$("#textarea").focus();
|
||||
var now = $('#textarea').val()
|
||||
$('#textarea').val(now + code)
|
||||
$('#textarea').focus()
|
||||
}
|
||||
|
||||
@@ -1,219 +1,229 @@
|
||||
'use strict'
|
||||
//ドラッグ・アンド・ドロップからアップロードまで。uiのimg.jsとは異なります。
|
||||
var obj = $("body");
|
||||
var system;
|
||||
var obj = $('body')
|
||||
var system
|
||||
//ドラッグスタート
|
||||
obj.on('dragstart', function (e) {
|
||||
system = "locked"
|
||||
});
|
||||
obj.on('dragstart', function(e) {
|
||||
system = 'locked'
|
||||
})
|
||||
//何もなくファイルが通過
|
||||
obj.on('dragend', function (e) {
|
||||
system = "";
|
||||
});
|
||||
obj.on('dragend', function(e) {
|
||||
system = ''
|
||||
})
|
||||
//ドラッグファイルが画面上に
|
||||
obj.on('dragenter', function (e) {
|
||||
if (system != "locked") {
|
||||
$("#drag").css('display', 'flex');
|
||||
obj.on('dragenter', function(e) {
|
||||
if (system != 'locked') {
|
||||
$('#drag').css('display', 'flex')
|
||||
}
|
||||
|
||||
});
|
||||
$("body").on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
})
|
||||
$('body').on('dragover', function(e) {
|
||||
e.stopPropagation()
|
||||
e.preventDefault()
|
||||
})
|
||||
//ドロップした
|
||||
$("body").on('drop', function (e) {
|
||||
if (system != "locked") {
|
||||
$("#drag").css('display', 'none');
|
||||
e.preventDefault();
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
pimg(files);
|
||||
$('body').on('drop', function(e) {
|
||||
if (system != 'locked') {
|
||||
$('#drag').css('display', 'none')
|
||||
e.preventDefault()
|
||||
var files = e.originalEvent.dataTransfer.files
|
||||
pimg(files)
|
||||
}
|
||||
});
|
||||
})
|
||||
//何もなくファイルが通過
|
||||
$("#drag").on('dragleave', function (e) {
|
||||
$("#drag").css('display', 'none');
|
||||
});
|
||||
$('#drag').on('dragleave', function(e) {
|
||||
$('#drag').css('display', 'none')
|
||||
})
|
||||
|
||||
//複数アップ
|
||||
function pimg(files) {
|
||||
console.table(files);
|
||||
console.table(files)
|
||||
for (i = 0; i < files.length; i++) {
|
||||
var dot = files[i].path.match(/\.(.+)$/)[1];
|
||||
if (dot == "bmp" || dot == "BMP") {
|
||||
postMessage(["bmpImage", [files[i].path, i]], "*")
|
||||
todo(lang.lang_progress);
|
||||
|
||||
var dot = files[i].path.match(/\.(.+)$/)[1]
|
||||
if (dot == 'bmp' || dot == 'BMP') {
|
||||
postMessage(['bmpImage', [files[i].path, i]], '*')
|
||||
todo(lang.lang_progress)
|
||||
} else {
|
||||
handleFileUpload(files[i], obj, i);
|
||||
handleFileUpload(files[i], obj, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
//ドラッグ・アンド・ドロップを終了
|
||||
function closedrop() {
|
||||
$("#drag").css('display', 'none');
|
||||
$('#drag').css('display', 'none')
|
||||
}
|
||||
//ファイル選択
|
||||
function fileselect() {
|
||||
postMessage(["sendSinmpleIpc", "file-select"], "*")
|
||||
postMessage(['sendSinmpleIpc', 'file-select'], '*')
|
||||
}
|
||||
|
||||
//ファイル読み込み
|
||||
function handleFileUpload(files, obj, no) {
|
||||
var fr = new FileReader();
|
||||
fr.onload = function (evt) {
|
||||
var b64 = evt.target.result;
|
||||
$('#b64-box').val(b64);
|
||||
var ret = media(b64, files["type"], no)
|
||||
var fr = new FileReader()
|
||||
fr.onload = function(evt) {
|
||||
var b64 = evt.target.result
|
||||
$('#b64-box').val(b64)
|
||||
var ret = media(b64, files['type'], no)
|
||||
}
|
||||
fr.readAsDataURL(files);
|
||||
$("#mec").append(files["name"] + "/");
|
||||
fr.readAsDataURL(files)
|
||||
$('#mec').append(files['name'] + '/')
|
||||
}
|
||||
|
||||
//ファイルアップロード
|
||||
function media(b64, type, no) {
|
||||
var l = 4;
|
||||
var c = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var cl = c.length;
|
||||
var r = "";
|
||||
var l = 4
|
||||
var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
||||
var cl = c.length
|
||||
var r = ''
|
||||
for (var i = 0; i < l; i++) {
|
||||
r += c[Math.floor(Math.random() * cl)];
|
||||
r += c[Math.floor(Math.random() * cl)]
|
||||
}
|
||||
if ($("#media").val()) {
|
||||
$("#media").val($("#media").val() + ',' + "tmp_" + r);
|
||||
if ($('#media').val()) {
|
||||
$('#media').val($('#media').val() + ',' + 'tmp_' + r)
|
||||
} else {
|
||||
$("#media").val("tmp_" + r);
|
||||
$('#media').val('tmp_' + r)
|
||||
}
|
||||
$(".toot-btn-group").prop("disabled", true);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
localStorage.setItem("image", "busy");
|
||||
todo("Image Upload...");
|
||||
var media = toBlob(b64, type);
|
||||
var fd = new FormData();
|
||||
fd.append('file', media);
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var httpreq = new XMLHttpRequest();
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
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;
|
||||
$('.toot-btn-group').prop('disabled', true)
|
||||
$('#post-acct-sel').prop('disabled', true)
|
||||
localStorage.setItem('image', 'busy')
|
||||
todo('Image Upload...')
|
||||
var media = toBlob(b64, type)
|
||||
var fd = new FormData()
|
||||
fd.append('file', media)
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var httpreq = new XMLHttpRequest()
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
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 nsfw = false
|
||||
}
|
||||
var previewer = "url"
|
||||
fd.append('i', at);
|
||||
var previewer = 'url'
|
||||
fd.append('i', at)
|
||||
//fd.append('isSensitive', nsfw);
|
||||
httpreq.send(fd);
|
||||
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);
|
||||
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 () {
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
if (!json.id) {
|
||||
todc();
|
||||
$("#imgup").text("");
|
||||
$(".toot-btn-group").prop("disabled", false);
|
||||
$("#post-acct-sel").prop("disabled", false);
|
||||
$('select').formSelect();
|
||||
$("#imgsel").show();
|
||||
todc()
|
||||
$('#imgup').text('')
|
||||
$('.toot-btn-group').prop('disabled', false)
|
||||
$('#post-acct-sel').prop('disabled', false)
|
||||
$('select').formSelect()
|
||||
$('#imgsel').show()
|
||||
M.toast({ html: lang.lang_postimg_failupload, displayLength: 5000 })
|
||||
return false
|
||||
}
|
||||
var img = localStorage.getItem("img");
|
||||
if (json.type.indexOf("image") != -1) {
|
||||
var html = '<img src="' + json[previewer] + '" class="preview-img pointer" data-media="' + json["id"] + '" onclick="deleteImage(\'' + json["id"] + '\')" title="' + lang.lang_postimg_delete + '">';
|
||||
$('#preview').append(html);
|
||||
var img = localStorage.getItem('img')
|
||||
if (json.type.indexOf('image') != -1) {
|
||||
var html = `<img src="${json[previewer]}" class="preview-img pointer" data-media="${
|
||||
json['id']
|
||||
}" oncontextmenu="deleteImage('${json['id']}')" onclick="altImage('${acct_id}','${
|
||||
json['id']
|
||||
}')" title="${lang.lang_postimg_delete}">`
|
||||
$('#preview').append(html)
|
||||
} else {
|
||||
$('#preview').append(lang.lang_postimg_previewdis);
|
||||
$('#preview').append(lang.lang_postimg_previewdis)
|
||||
}
|
||||
if (!img) {
|
||||
var img = "no-act";
|
||||
var img = 'no-act'
|
||||
}
|
||||
if (img != "inline") {
|
||||
var mediav = $("#media").val();
|
||||
var regExp = new RegExp("tmp_" + r, "g");
|
||||
mediav = mediav.replace(regExp, json["id"]);
|
||||
$("#media").val(mediav);
|
||||
|
||||
if (img != 'inline') {
|
||||
var mediav = $('#media').val()
|
||||
var regExp = new RegExp('tmp_' + r, 'g')
|
||||
mediav = mediav.replace(regExp, json['id'])
|
||||
$('#media').val(mediav)
|
||||
}
|
||||
if (img == "url") {
|
||||
$("#textarea").val($("#textarea").val() + " " + json["text_url"])
|
||||
if (img == 'url') {
|
||||
$('#textarea').val($('#textarea').val() + ' ' + json['text_url'])
|
||||
}
|
||||
todc();
|
||||
$(".toot-btn-group").prop("disabled", false);
|
||||
$('select').formSelect();
|
||||
$("#mec").text(lang.lang_there);
|
||||
todc()
|
||||
if (localStorage.getItem('nsfw_' + acct_id)) {
|
||||
$('#nsfw').addClass('yellow-text')
|
||||
$('#nsfw').html('visibility')
|
||||
$('#nsfw').addClass('nsfw-avail')
|
||||
}
|
||||
$('.toot-btn-group').prop('disabled', false)
|
||||
$('select').formSelect()
|
||||
$('#mec').text(lang.lang_there)
|
||||
M.toast({ html: lang.lang_postimg_aftupload, displayLength: 1000 })
|
||||
$("#imgup").text("");
|
||||
$("#imgsel").show();
|
||||
localStorage.removeItem("image");
|
||||
$('#imgup').text('')
|
||||
$('#imgsel').show()
|
||||
localStorage.removeItem('image')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Base64からBlobへ
|
||||
function toBlob(base64, type) {
|
||||
var bin = atob(base64.replace(/^.*,/, ''));
|
||||
var buffer = new Uint8Array(bin.length);
|
||||
var bin = atob(base64.replace(/^.*,/, ''))
|
||||
var buffer = new Uint8Array(bin.length)
|
||||
for (var i = 0; i < bin.length; i++) {
|
||||
buffer[i] = bin.charCodeAt(i);
|
||||
buffer[i] = bin.charCodeAt(i)
|
||||
}
|
||||
// Blobを作成
|
||||
try {
|
||||
var blob = new Blob([new Uint8Array(buffer)], {
|
||||
type: type
|
||||
});
|
||||
})
|
||||
} catch (e) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
return blob;
|
||||
return blob
|
||||
}
|
||||
//画像を貼り付けたら…
|
||||
var element = document.querySelector("#textarea");
|
||||
element.addEventListener("paste", function (e) {
|
||||
var element = document.querySelector('#textarea')
|
||||
element.addEventListener('paste', function(e) {
|
||||
if (!e.clipboardData || !e.clipboardData.items) {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
// DataTransferItemList に画像が含まれいない場合は終了する
|
||||
var imageItems = [...e.clipboardData.items].filter(i => i.type.startsWith('image'));
|
||||
var imageItems = [...e.clipboardData.items].filter(i => i.type.startsWith('image'))
|
||||
if (imageItems.length == 0) {
|
||||
console.warn("it is not image")
|
||||
return true;
|
||||
console.warn('it is not image')
|
||||
return true
|
||||
}
|
||||
|
||||
// ファイルとして得る
|
||||
// DataTransferItem の kind は file なので getAsString ではなく getAsFile を呼ぶ
|
||||
var imageFile = imageItems[0].getAsFile();
|
||||
var imageType = imageItems[0].type;
|
||||
var imageFile = imageItems[0].getAsFile()
|
||||
var imageType = imageItems[0].type
|
||||
|
||||
// FileReaderで読み込む
|
||||
var fr = new FileReader();
|
||||
fr.onload = function (e) {
|
||||
var fr = new FileReader()
|
||||
fr.onload = function(e) {
|
||||
// onload内ではe.target.resultにbase64が入っているのであとは煮るなり焼くなり
|
||||
var base64 = e.target.result;
|
||||
var mediav = $("#media").val();
|
||||
var base64 = e.target.result
|
||||
var mediav = $('#media').val()
|
||||
if (mediav) {
|
||||
var i = mediav.split(",").length;
|
||||
var i = mediav.split(',').length
|
||||
}
|
||||
// DataTransferItem の type に mime tipes があるのでそれを使う
|
||||
media(base64, imageType, i)
|
||||
};
|
||||
fr.readAsDataURL(imageFile);
|
||||
}
|
||||
fr.readAsDataURL(imageFile)
|
||||
|
||||
// 画像以外がペーストされたときのために、元に戻しておく
|
||||
});
|
||||
})
|
||||
function deleteImage(key) {
|
||||
Swal.fire({
|
||||
title: lang.lang_postimg_delete,
|
||||
@@ -223,19 +233,71 @@ function deleteImage(key) {
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: lang.lang_yesno,
|
||||
cancelButtonText: lang.lang_no
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
var media = $("#media").val();
|
||||
var arr = media.split(",");
|
||||
var media = $('#media').val()
|
||||
var arr = media.split(',')
|
||||
for (var i = 0; i < media.length; i++) {
|
||||
if (arr[i] == key) {
|
||||
arr.splice(i, 1);
|
||||
break;
|
||||
arr.splice(i, 1)
|
||||
break
|
||||
}
|
||||
}
|
||||
$("#media").val(arr.join(","));
|
||||
$('#preview [data-media=' + key + ']').remove();
|
||||
$('#media').val(arr.join(','))
|
||||
$('#preview [data-media=' + key + ']').remove()
|
||||
}
|
||||
})
|
||||
}
|
||||
function altImage(acct_id, id) {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/media/' + id
|
||||
|
||||
}
|
||||
Swal.fire({
|
||||
title: lang.lang_postimg_desc,
|
||||
text: lang.lang_postimg_leadContext,
|
||||
input: 'text',
|
||||
inputAttributes: {
|
||||
autocapitalize: 'off'
|
||||
},
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Post',
|
||||
showLoaderOnConfirm: true,
|
||||
preConfirm: data => {
|
||||
return fetch(start, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({
|
||||
description: data
|
||||
})
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
console.log(json)
|
||||
$('[data-media=' + id + ']').attr('title', data)
|
||||
})
|
||||
},
|
||||
allowOutsideClick: () => !Swal.isLoading()
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
Swal.fire({
|
||||
title: 'Complete'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,241 +1,273 @@
|
||||
'use strict'
|
||||
//Renpost
|
||||
function renote(id, acct_id, remote) {
|
||||
if ($("#pub_" + id).hasClass("rted")) {
|
||||
return false;
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/create";
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
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(["Success: renote", json]);
|
||||
$("[toot-id=" + id + "]").addClass("rted");
|
||||
$(".rt_" + id).toggleClass("teal-text");
|
||||
}
|
||||
}
|
||||
if ($('#pub_' + id).hasClass('rted')) {
|
||||
return false
|
||||
}
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/notes/create'
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
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
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
console.log(['Success: renote', 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').formSelect();
|
||||
$("#textarea").attr("placeholder", lang.lang_misskeyparse_qt);
|
||||
$("#textarea").focus();
|
||||
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').formSelect()
|
||||
$('#textarea').attr('placeholder', lang.lang_misskeyparse_qt)
|
||||
$('#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').formSelect();
|
||||
$("#textarea").attr("placeholder", lang.lang_misskeyparse_qt);
|
||||
$("#textarea").focus();
|
||||
localStorage.setItem('nohide', true)
|
||||
show()
|
||||
$('#reply').val(id)
|
||||
$('#rec').text('Renote')
|
||||
$('#post-acct-sel').val(acct_id)
|
||||
$('#post-acct-sel').prop('disabled', true)
|
||||
$('select').formSelect()
|
||||
$('#textarea').attr('placeholder', lang.lang_misskeyparse_qt)
|
||||
$('#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 (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
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(["Success: reaction", json]);
|
||||
if (json.reactions) {
|
||||
var reactions = ["like", "love", "laugh", "hmm", "surprise", "congrats", "angry", "confused", "pudding", "rip"];
|
||||
for (var i = 0; i < reactions.length; i++) {
|
||||
if (json.reactions[reactions[i]]) {
|
||||
$("#pub_" + id + " .re-" + reactions[i] + "ct").text(json.reactions[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.reactions[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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#pub_" + id + " .freeReact").toggleClass("hide");
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/notes/show'
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
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
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
console.log(['Success: reaction', json])
|
||||
if (json.reactions) {
|
||||
var reactions = [
|
||||
'like',
|
||||
'love',
|
||||
'laugh',
|
||||
'hmm',
|
||||
'surprise',
|
||||
'congrats',
|
||||
'angry',
|
||||
'confused',
|
||||
'pudding',
|
||||
'rip'
|
||||
]
|
||||
for (var i = 0; i < reactions.length; i++) {
|
||||
if (json.reactions[reactions[i]]) {
|
||||
$('#pub_' + id + ' .re-' + reactions[i] + 'ct').text(json.reactions[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.reactions[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')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$('#pub_' + id + ' .freeReact').toggleClass('hide')
|
||||
}
|
||||
//reactioncustom
|
||||
function reactioncustom(acct_id, id) {
|
||||
$("#reply").val(id);
|
||||
$("#unreact").hide();
|
||||
$("#addreact").removeClass("hide");
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$('select').formSelect();
|
||||
localStorage.setItem("nohide", true);
|
||||
show()
|
||||
emojiToggle(true)
|
||||
$("#left-side").hide();
|
||||
$("#default-emoji").hide();
|
||||
$('#reply').val(id)
|
||||
$('#unreact').hide()
|
||||
$('#addreact').removeClass('hide')
|
||||
$('#post-acct-sel').val(acct_id)
|
||||
$('select').formSelect()
|
||||
localStorage.setItem('nohide', true)
|
||||
show()
|
||||
emojiToggle(true)
|
||||
$('#left-side').hide()
|
||||
$('#default-emoji').hide()
|
||||
}
|
||||
function reactRefresh(acct_id, id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/show";
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/notes/show'
|
||||
|
||||
var req = {};
|
||||
req.i = at;
|
||||
req.noteId = id;
|
||||
var i = {
|
||||
method: "POST",
|
||||
body: JSON.stringify(req),
|
||||
}
|
||||
fetch(start, i,
|
||||
).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (!json) {
|
||||
return false;
|
||||
}
|
||||
var poll = "";
|
||||
if (json.error) {
|
||||
$("[toot-id=" + id + "]").hide();
|
||||
$("[toot-id=" + id + "]").remove();
|
||||
} else {
|
||||
reactRefreshCore(json)
|
||||
}
|
||||
});
|
||||
var req = {}
|
||||
req.i = at
|
||||
req.noteId = id
|
||||
var i = {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(req)
|
||||
}
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (!json) {
|
||||
return false
|
||||
}
|
||||
var poll = ''
|
||||
if (json.error) {
|
||||
$('[toot-id=' + id + ']').hide()
|
||||
$('[toot-id=' + id + ']').remove()
|
||||
} else {
|
||||
reactRefreshCore(json)
|
||||
}
|
||||
})
|
||||
}
|
||||
function reactRefreshCore(json) {
|
||||
var id = json.id;
|
||||
if (json.reactions) {
|
||||
$("#pub_" + id + " .reactions").removeClass("hide")
|
||||
var regExp = new RegExp(":", "g");
|
||||
Object.keys(json.reactions).forEach(function (keye) {
|
||||
keyeClass = keye.replace(regExp, '');
|
||||
if (json.reactions[keye]) {
|
||||
$("#pub_" + id + " .re-" + keyeClass + "ct").text(json.reactions[keye])
|
||||
$("#pub_" + id + " .re-" + keyeClass).removeClass("hide")
|
||||
} else {
|
||||
$("#pub_" + id + " .re-" + keyeClass + "ct").text(0)
|
||||
if ($("#pub_" + id + " .reactions").hasClass("fullreact")) {
|
||||
$("#pub_" + id + " .re-" + keyeClass).addClass("hide")
|
||||
}
|
||||
$("#pub_" + id + " .re-" + keyeClass + "ct").text(json.reactions[keye])
|
||||
}
|
||||
});
|
||||
}
|
||||
var id = json.id
|
||||
if (json.reactions) {
|
||||
$('#pub_' + id + ' .reactions').removeClass('hide')
|
||||
var regExp = new RegExp(':', 'g')
|
||||
Object.keys(json.reactions).forEach(function(keye) {
|
||||
keyeClass = keye.replace(regExp, '')
|
||||
if (json.reactions[keye]) {
|
||||
$('#pub_' + id + ' .re-' + keyeClass + 'ct').text(json.reactions[keye])
|
||||
$('#pub_' + id + ' .re-' + keyeClass).removeClass('hide')
|
||||
} else {
|
||||
$('#pub_' + id + ' .re-' + keyeClass + 'ct').text(0)
|
||||
if ($('#pub_' + id + ' .reactions').hasClass('fullreact')) {
|
||||
$('#pub_' + id + ' .re-' + keyeClass).addClass('hide')
|
||||
}
|
||||
$('#pub_' + id + ' .re-' + keyeClass + 'ct').text(json.reactions[keye])
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function emojiReaction(emoji) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var id = $("#reply").val();
|
||||
reaction(emoji, id, acct_id, null)
|
||||
clear();
|
||||
hide();
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var id = $('#reply').val()
|
||||
reaction(emoji, id, acct_id, null)
|
||||
clear()
|
||||
hide()
|
||||
}
|
||||
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 (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
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");
|
||||
}
|
||||
}
|
||||
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 (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
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) {
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
$('.fav_' + id).toggleClass('yellow-text')
|
||||
}
|
||||
}
|
||||
}
|
||||
//Vote
|
||||
function vote(acct_id, id, to) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/polls/vote";
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
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, choice: to }));
|
||||
httpreq.onreadystatechange = function () {
|
||||
voterefresh(acct_id, id)
|
||||
}
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/notes/polls/vote'
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
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, choice: to }))
|
||||
httpreq.onreadystatechange = function() {
|
||||
voterefresh(acct_id, id)
|
||||
}
|
||||
}
|
||||
function voterefresh(acct_id, id) {
|
||||
var httpreqd = new XMLHttpRequest();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/show";
|
||||
httpreqd.open('POST', start, true);
|
||||
httpreqd.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreqd.responseType = 'json';
|
||||
httpreqd.send(JSON.stringify({ i: at, noteId: id }));
|
||||
httpreqd.onreadystatechange = function () {
|
||||
if (httpreqd.readyState == 4) {
|
||||
var json = httpreqd.response;
|
||||
if (!json) {
|
||||
return false;
|
||||
}
|
||||
var poll = "";
|
||||
if (json.poll) {
|
||||
var choices = json.poll.choices;
|
||||
Object.keys(choices).forEach(function (keyc) {
|
||||
var choice = choices[keyc];
|
||||
if (choice.isVoted) {
|
||||
var myvote = twemoji.parse("✅");
|
||||
} else {
|
||||
var myvote = "";
|
||||
}
|
||||
poll = poll + '<div class="pointer vote" onclick="vote(\'' + acct_id + '\',\'' + json.id + '\',' + choice.id + ')">' + escapeHTML(choice.text) + '(' + choice.votes + '' + myvote + ')</div>';
|
||||
});
|
||||
$(".vote_" + json.id).html(poll)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var httpreqd = new XMLHttpRequest()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/notes/show'
|
||||
httpreqd.open('POST', start, true)
|
||||
httpreqd.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreqd.responseType = 'json'
|
||||
httpreqd.send(JSON.stringify({ i: at, noteId: id }))
|
||||
httpreqd.onreadystatechange = function() {
|
||||
if (httpreqd.readyState == 4) {
|
||||
var json = httpreqd.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
if (!json) {
|
||||
return false
|
||||
}
|
||||
var poll = ''
|
||||
if (json.poll) {
|
||||
var choices = json.poll.choices
|
||||
Object.keys(choices).forEach(function(keyc) {
|
||||
var choice = choices[keyc]
|
||||
if (choice.isVoted) {
|
||||
var myvote = twemoji.parse('✅')
|
||||
} else {
|
||||
var myvote = ''
|
||||
}
|
||||
poll = poll + `<div class="pointer vote" onclick="vote('${acct_id}','${json.id}',"${choice.id}')">${escapeHTML(choice.text)}(${choice.votes})${myvote})</div>`
|
||||
})
|
||||
$('.vote_' + json.id).html(poll)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,40 @@
|
||||
'use strict'
|
||||
/*投稿系*/
|
||||
//投稿
|
||||
function sec() {
|
||||
var mode = localStorage.getItem("sec");
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (~domain.indexOf("kirishima.cloud") >= 0 && mode == "local") {
|
||||
mode = "unlisted";
|
||||
var mode = localStorage.getItem('sec')
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
if (~domain.indexOf('kirishima.cloud') >= 0 && mode == 'local') {
|
||||
mode = 'unlisted'
|
||||
}
|
||||
post(null, mode);
|
||||
post(null, mode)
|
||||
}
|
||||
function post(mode, postvis) {
|
||||
if ($("#toot-post-btn").prop("disabled")) {
|
||||
return false;
|
||||
if ($('#toot-post-btn').prop('disabled')) {
|
||||
return false
|
||||
}
|
||||
var str = $("#textarea").val();
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("last-use", acct_id);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (!localStorage.getItem("cw_sentence")) {
|
||||
var cw_sent = 500;
|
||||
var str = $('#textarea').val()
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
localStorage.setItem('last-use', acct_id)
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
if (!localStorage.getItem('cw_sentence')) {
|
||||
var cw_sent = 500
|
||||
} else {
|
||||
var cw_sent = localStorage.getItem("cw_sentence");
|
||||
var cw_sent = localStorage.getItem('cw_sentence')
|
||||
}
|
||||
if (!localStorage.getItem("cw_letters")) {
|
||||
var cw_ltres = 7000;
|
||||
if (!localStorage.getItem('cw_letters')) {
|
||||
var cw_ltres = 7000
|
||||
} else {
|
||||
var cw_ltres = localStorage.getItem("cw_letters");
|
||||
var cw_ltres = localStorage.getItem('cw_letters')
|
||||
}
|
||||
if (domain != "kirishima.cloud") {
|
||||
if (mode != "pass" && !$("#cw").hasClass("cw-avail") && (str.length > cw_sent || (str.split("\n").length - 1) > cw_ltres)) {
|
||||
var plus = str.replace(/\n/g, "").slice(0, 10) + "...";
|
||||
if (domain != 'kirishima.cloud') {
|
||||
if (
|
||||
mode != 'pass' &&
|
||||
!$('#cw').hasClass('cw-avail') &&
|
||||
(str.length > cw_sent || str.split('\n').length - 1 > cw_ltres)
|
||||
) {
|
||||
var plus = str.replace(/\n/g, '').slice(0, 10) + '...'
|
||||
Swal.fire({
|
||||
title: lang.lang_post_cwtitle,
|
||||
text: lang.lang_post_cwtxt + plus,
|
||||
@@ -40,34 +45,34 @@ function post(mode, postvis) {
|
||||
confirmButtonText: lang.lang_post_btn2,
|
||||
cancelButtonText: lang.lang_post_btn3,
|
||||
showCloseButton: true,
|
||||
focusConfirm: false,
|
||||
}).then((result) => {
|
||||
if (result.dismiss == "cancel") {
|
||||
focusConfirm: false
|
||||
}).then(result => {
|
||||
if (result.dismiss == 'cancel') {
|
||||
//btn3:sonomama
|
||||
post("pass")
|
||||
post('pass')
|
||||
} else if (result.value) {
|
||||
//btn2:auto-CW
|
||||
$("#cw-text").show();
|
||||
$("#cw").addClass("yellow-text");
|
||||
$("#cw").addClass("cw-avail");
|
||||
$("#cw-text").val(plus);
|
||||
post("pass")
|
||||
$('#cw-text').show()
|
||||
$('#cw').addClass('yellow-text')
|
||||
$('#cw').addClass('cw-avail')
|
||||
$('#cw-text').val(plus)
|
||||
post('pass')
|
||||
}
|
||||
})
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
misskeyPost();
|
||||
return;
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
misskeyPost()
|
||||
return
|
||||
}
|
||||
$(".toot-btn-group").prop("disabled", true);
|
||||
todo("Posting");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses";
|
||||
var reply = $("#reply").val();
|
||||
if (str.indexOf(localStorage.getItem("stable")) == -1) {
|
||||
str + " #" + localStorage.getItem("stable");
|
||||
$('.toot-btn-group').prop('disabled', true)
|
||||
todo('Posting')
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/statuses'
|
||||
var reply = $('#reply').val()
|
||||
if (str.indexOf(localStorage.getItem('stable')) == -1) {
|
||||
str + ' #' + localStorage.getItem('stable')
|
||||
}
|
||||
var toot = {
|
||||
status: str
|
||||
@@ -75,62 +80,66 @@ function post(mode, postvis) {
|
||||
if (reply) {
|
||||
toot.in_reply_to_id = reply
|
||||
}
|
||||
var media = $("#media").val();
|
||||
var media = $('#media').val()
|
||||
if (media) {
|
||||
toot.media_ids = media.split(",");
|
||||
toot.media_ids = media.split(',')
|
||||
}
|
||||
if ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
var nsfw = "true";
|
||||
toot.sensitive = nsfw;
|
||||
var quote = $('#quote').val()
|
||||
if (quote) {
|
||||
toot.quote_id = quote
|
||||
}
|
||||
if ($('#nsfw').hasClass('nsfw-avail')) {
|
||||
var nsfw = 'true'
|
||||
toot.sensitive = nsfw
|
||||
} else {
|
||||
var nsfw = "false";
|
||||
var nsfw = 'false'
|
||||
}
|
||||
if (postvis) {
|
||||
var vis = postvis;
|
||||
var vis = postvis
|
||||
} else {
|
||||
var vis = $("#vis").text();
|
||||
var vis = $('#vis').text()
|
||||
}
|
||||
if (vis != "inherit" && vis != "local") {
|
||||
toot.visibility = vis;
|
||||
} else if (vis == "local") {
|
||||
toot.status = str + "👁️";
|
||||
if (vis != 'inherit' && vis != 'local') {
|
||||
toot.visibility = vis
|
||||
} else if (vis == 'local') {
|
||||
toot.status = str + '👁️'
|
||||
}
|
||||
if ($("#cw").hasClass("cw-avail")) {
|
||||
var spo = $("#cw-text").val();
|
||||
cw();
|
||||
toot.spoiler_text = spo;
|
||||
if ($('#cw').hasClass('cw-avail')) {
|
||||
var spo = $('#cw-text').val()
|
||||
cw()
|
||||
toot.spoiler_text = spo
|
||||
} else {
|
||||
var spo = "";
|
||||
var spo = ''
|
||||
}
|
||||
if ($("#sch-box").hasClass("sch-avail")) {
|
||||
var scheduled = formattimeutc(new Date(Date.parse($("#sch-date").val())))
|
||||
console.log("This toot will be posted at:" + scheduled)
|
||||
schedule();
|
||||
toot.scheduled_at = scheduled;
|
||||
if ($('#sch-box').hasClass('sch-avail')) {
|
||||
var scheduled = formattimeutc(new Date(Date.parse($('#sch-date').val())))
|
||||
console.log('This toot will be posted at:' + scheduled)
|
||||
schedule()
|
||||
toot.scheduled_at = scheduled
|
||||
} else {
|
||||
var scheduled = "";
|
||||
var scheduled = ''
|
||||
}
|
||||
if ($("#poll-sel").val() == "mastodon-poll") {
|
||||
var options = [];
|
||||
$(".mastodon-choice").map(function () {
|
||||
var choice = $(this).val();
|
||||
if (choice != "") {
|
||||
options.push(choice);
|
||||
if (!$('#poll').hasClass('hide')) {
|
||||
var options = []
|
||||
$('.mastodon-choice').map(function() {
|
||||
var choice = $(this).val()
|
||||
if (choice != '') {
|
||||
options.push(choice)
|
||||
}
|
||||
});
|
||||
if ($("#poll-multiple:checked").val() == "1") {
|
||||
var mul = true;
|
||||
})
|
||||
if ($('#poll-multiple:checked').val() == '1') {
|
||||
var mul = true
|
||||
} else {
|
||||
var mul = false;
|
||||
var mul = false
|
||||
}
|
||||
if ($("#poll-until:checked").val() == "1") {
|
||||
var htt = true;
|
||||
if ($('#poll-until:checked').val() == '1') {
|
||||
var htt = true
|
||||
} else {
|
||||
var htt = false;
|
||||
var htt = false
|
||||
}
|
||||
var exin = pollCalc();
|
||||
var exin = pollCalc()
|
||||
if (!exin) {
|
||||
todc("Error: Poll expires_in param")
|
||||
todc('Error: Poll expires_in param')
|
||||
}
|
||||
toot.poll = {
|
||||
options: options,
|
||||
@@ -139,151 +148,174 @@ function post(mode, postvis) {
|
||||
hide_totals: htt
|
||||
}
|
||||
}
|
||||
console.table(toot);
|
||||
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(JSON.stringify(toot));
|
||||
httpreq.onreadystatechange = function () {
|
||||
console.table(toot)
|
||||
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(JSON.stringify(toot))
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var box = localStorage.getItem("box");
|
||||
if (box == "yes" || !box) {
|
||||
$("#textarea").blur();
|
||||
hide();
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
$(".toot-btn-group").prop("disabled", false);
|
||||
todc();
|
||||
clear();
|
||||
var box = localStorage.getItem('box')
|
||||
if (box == 'yes' || !box) {
|
||||
$('#textarea').blur()
|
||||
hide()
|
||||
}
|
||||
$('.toot-btn-group').prop('disabled', false)
|
||||
todc()
|
||||
clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
function misskeyPost() {
|
||||
var str = $("#textarea").val();
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("last-use", acct_id);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
$(".toot-btn-group").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 str = $('#textarea').val()
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
localStorage.setItem('last-use', acct_id)
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
$('.toot-btn-group').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_", "")
|
||||
if (reply.indexOf('renote') !== -1) {
|
||||
toot.renoteId = reply.replace('renote_', '')
|
||||
} else {
|
||||
toot.replyId = reply
|
||||
}
|
||||
}
|
||||
|
||||
var media = $("#media").val();
|
||||
var media = $('#media').val()
|
||||
if (media) {
|
||||
toot.mediaIds = media.split(",");
|
||||
toot.mediaIds = media.split(',')
|
||||
}
|
||||
if ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
var nsfw = "true";
|
||||
toot.sensitive = nsfw;
|
||||
if ($('#nsfw').hasClass('nsfw-avail')) {
|
||||
var nsfw = 'true'
|
||||
toot.sensitive = nsfw
|
||||
} else {
|
||||
var nsfw = "false";
|
||||
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("@");
|
||||
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 (vis != 'inherit') {
|
||||
toot.visibility = vis
|
||||
}
|
||||
if ($("#cw").hasClass("cw-avail")) {
|
||||
var spo = $("#cw-text").val();
|
||||
cw();
|
||||
toot.cw = spo;
|
||||
if ($('#cw').hasClass('cw-avail')) {
|
||||
var spo = $('#cw-text').val()
|
||||
cw()
|
||||
toot.cw = spo
|
||||
} else {
|
||||
var spo = "";
|
||||
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 () {
|
||||
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")
|
||||
if (str.indexOf(localStorage.getItem('stable')) == -1) {
|
||||
localStorage.removeItem('stable')
|
||||
}
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: toot", json]);
|
||||
var box = localStorage.getItem("box");
|
||||
if (box == "yes") {
|
||||
hide();
|
||||
} else if (box == "hide") {
|
||||
$("body").addClass("mini-post");
|
||||
$(".mini-btn").text("expand_less");
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
$(".toot-btn-group").prop("disabled", false);
|
||||
todc();
|
||||
clear();
|
||||
console.log(['Success: toot', json])
|
||||
var box = localStorage.getItem('box')
|
||||
if (box == 'yes') {
|
||||
hide()
|
||||
} else if (box == 'hide') {
|
||||
$('body').addClass('mini-post')
|
||||
$('.mini-btn').text('expand_less')
|
||||
}
|
||||
$('.toot-btn-group').prop('disabled', false)
|
||||
todc()
|
||||
clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//クリア(Shift+C)
|
||||
function clear() {
|
||||
$("#textarea").val("");
|
||||
if (localStorage.getItem("stable")) {
|
||||
$("#textarea").val("#" + localStorage.getItem("stable") + " ")
|
||||
$('#textarea').val('')
|
||||
if (localStorage.getItem('stable')) {
|
||||
$('#textarea').val('#' + localStorage.getItem('stable') + ' ')
|
||||
}
|
||||
$("#textarea").attr("placeholder", lang.lang_toot);
|
||||
$("#reply").val("");
|
||||
$("#media").val("");
|
||||
var cwt = localStorage.getItem("cw-text");
|
||||
$('#textarea').attr('placeholder', lang.lang_toot)
|
||||
$('#reply').val('')
|
||||
$('#quote').val('')
|
||||
$('#media').val('')
|
||||
var cwt = localStorage.getItem('cw-text')
|
||||
if (cwt) {
|
||||
$("#cw-text").val(cwt);
|
||||
$('#cw-text').val(cwt)
|
||||
} else {
|
||||
$("#cw-text").val("");
|
||||
$('#cw-text').val('')
|
||||
}
|
||||
var acw = localStorage.getItem("always-cw");
|
||||
if (acw != "yes") {
|
||||
$("#cw").removeClass("yellow-text");
|
||||
$("#cw").removeClass("cw-avail");
|
||||
$("#cw-text").hide();
|
||||
var acw = localStorage.getItem('always-cw')
|
||||
if (acw != 'yes') {
|
||||
$('#cw').removeClass('yellow-text')
|
||||
$('#cw').removeClass('cw-avail')
|
||||
$('#cw-text').hide()
|
||||
} else {
|
||||
$("#cw").addClass("yellow-text");
|
||||
$("#cw").addClass("cw-avail");
|
||||
$("#cw-text").show();
|
||||
$('#cw').addClass('yellow-text')
|
||||
$('#cw').addClass('cw-avail')
|
||||
$('#cw-text').show()
|
||||
}
|
||||
$("#rec").text(lang.lang_no);
|
||||
$("#mec").text(lang.lang_nothing);
|
||||
loadVis();
|
||||
$("#nsfw").removeClass("yellow-text");
|
||||
$("#nsfw").html("visibility_off");
|
||||
$("#nsfw").removeClass("nsfw-avail");
|
||||
$("#nsc").text(lang.lang_nothing);
|
||||
$("#drag").css("background-color", "#e0e0e0");
|
||||
$("#preview").html("");
|
||||
$(".toot-btn-group").prop("disabled", false);
|
||||
$("#post-acct-sel").prop("disabled", false);
|
||||
$("#days_poll").val(0);
|
||||
$("#hours_poll").val(0);
|
||||
$("#mins_poll").val(6);
|
||||
$(".mastodon-choice").map(function () {
|
||||
$(this).val("");
|
||||
});
|
||||
localStorage.removeItem("image");
|
||||
if (localStorage.getItem("mainuse") == "main") {
|
||||
$("#post-acct-sel").val(localStorage.getItem("main"));
|
||||
$('#rec').text(lang.lang_no)
|
||||
$('#mec').text(lang.lang_nothing)
|
||||
loadVis()
|
||||
$('#nsfw').removeClass('yellow-text')
|
||||
$('#nsfw').html('visibility_off')
|
||||
$('#nsfw').removeClass('nsfw-avail')
|
||||
$('#nsc').text(lang.lang_nothing)
|
||||
$('#drag').css('background-color', '#e0e0e0')
|
||||
$('#preview').html('')
|
||||
$('.toot-btn-group').prop('disabled', false)
|
||||
$('#post-acct-sel').prop('disabled', false)
|
||||
$('#days_poll').val(0)
|
||||
$('#hours_poll').val(0)
|
||||
$('#mins_poll').val(6)
|
||||
$('#poll').addClass('hide')
|
||||
$('#pollsta').text(lang.lang_no)
|
||||
$('.mastodon-choice').map(function() {
|
||||
$(this).val('')
|
||||
})
|
||||
localStorage.removeItem('image')
|
||||
if (localStorage.getItem('mainuse') == 'main') {
|
||||
$('#post-acct-sel').val(localStorage.getItem('main'))
|
||||
}
|
||||
$('select').formSelect();
|
||||
$("#left-side").show();
|
||||
$("#default-emoji").show();
|
||||
$("#unreact").show();
|
||||
$("#addreact").addClass("hide");
|
||||
}
|
||||
$('#emoji').addClass('hide')
|
||||
$('select').formSelect()
|
||||
$('#default-emoji').show()
|
||||
$('#unreact').show()
|
||||
$('#addreact').addClass('hide')
|
||||
$('#right-side').hide()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', '100%')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1
|
||||
} else {
|
||||
width = 300
|
||||
}
|
||||
$('#post-box').css('width', width)
|
||||
mdCheck()
|
||||
}
|
||||
|
||||
@@ -1,130 +1,129 @@
|
||||
'use strict'
|
||||
/*保護系*/
|
||||
//画像保護
|
||||
function nsfw() {
|
||||
if ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
$("#nsfw").removeClass("yellow-text");
|
||||
$("#nsfw").html("visibility_off");
|
||||
$("#nsfw").removeClass("nsfw-avail");
|
||||
if ($('#nsfw').hasClass('nsfw-avail')) {
|
||||
$('#nsfw').removeClass('yellow-text')
|
||||
$('#nsfw').html('visibility_off')
|
||||
$('#nsfw').removeClass('nsfw-avail')
|
||||
} else {
|
||||
$("#nsfw").addClass("yellow-text");
|
||||
$("#nsfw").html("visibility");
|
||||
$("#nsfw").addClass("nsfw-avail");
|
||||
$('#nsfw').addClass('yellow-text')
|
||||
$('#nsfw').html('visibility')
|
||||
$('#nsfw').addClass('nsfw-avail')
|
||||
}
|
||||
}
|
||||
|
||||
//投稿公開範囲
|
||||
function vis(set) {
|
||||
$("#vis").text(set);
|
||||
$("#vis-icon").removeClass("red-text");
|
||||
$("#vis-icon").removeClass("orange-text");
|
||||
$("#vis-icon").removeClass("blue-text");
|
||||
$("#vis-icon").removeClass("purple-text");
|
||||
$("#vis-icon").removeClass("light-blue-text");
|
||||
$("#vis-icon").removeClass("teal-text");
|
||||
if (set == "public") {
|
||||
$("#vis-icon").text("public");
|
||||
$("#vis-icon").addClass("purple-text");
|
||||
} else if (set == "unlisted") {
|
||||
$("#vis-icon").text("lock_open");
|
||||
$("#vis-icon").addClass("blue-text");
|
||||
} else if (set == "private") {
|
||||
$("#vis-icon").text("lock");
|
||||
$("#vis-icon").addClass("orange-text");
|
||||
} else if (set == "direct") {
|
||||
$("#vis-icon").text("mail");
|
||||
$("#vis-icon").addClass("red-text");
|
||||
} else if (set == "limited") {
|
||||
$("#vis-icon").text("group");
|
||||
$("#vis-icon").addClass("teal-text");
|
||||
} else if (set == "local") {
|
||||
$("#vis-icon").text("visibility");
|
||||
$("#vis-icon").addClass("light-blue-text");
|
||||
$('#vis').text(set)
|
||||
$('#vis-icon').removeClass('red-text')
|
||||
$('#vis-icon').removeClass('orange-text')
|
||||
$('#vis-icon').removeClass('blue-text')
|
||||
$('#vis-icon').removeClass('purple-text')
|
||||
$('#vis-icon').removeClass('light-blue-text')
|
||||
$('#vis-icon').removeClass('teal-text')
|
||||
if (set == 'public') {
|
||||
$('#vis-icon').text('public')
|
||||
$('#vis-icon').addClass('purple-text')
|
||||
} else if (set == 'unlisted') {
|
||||
$('#vis-icon').text('lock_open')
|
||||
$('#vis-icon').addClass('blue-text')
|
||||
} else if (set == 'private') {
|
||||
$('#vis-icon').text('lock')
|
||||
$('#vis-icon').addClass('orange-text')
|
||||
} else if (set == 'direct') {
|
||||
$('#vis-icon').text('mail')
|
||||
$('#vis-icon').addClass('red-text')
|
||||
} else if (set == 'limited') {
|
||||
$('#vis-icon').text('group')
|
||||
$('#vis-icon').addClass('teal-text')
|
||||
} else if (set == 'local') {
|
||||
$('#vis-icon').text('visibility')
|
||||
$('#vis-icon').addClass('light-blue-text')
|
||||
}
|
||||
var vis = localStorage.getItem("vis");
|
||||
if (vis == "memory") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("vis-memory-" + acct_id, set);
|
||||
var vis = localStorage.getItem('vis')
|
||||
if (vis == 'memory') {
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
localStorage.setItem('vis-memory-' + acct_id, set)
|
||||
}
|
||||
var ins = M.Dropdown.getInstance($('#dropdown1'))
|
||||
if(ins){
|
||||
ins.close();
|
||||
if (ins) {
|
||||
ins.close()
|
||||
}
|
||||
}
|
||||
function loadVis() {
|
||||
var vist = localStorage.getItem("vis");
|
||||
var vist = localStorage.getItem('vis')
|
||||
if (!vist) {
|
||||
vis("public");
|
||||
vis('public')
|
||||
} else {
|
||||
if (vist == "memory") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var memory = localStorage.getItem("vis-memory-" + acct_id);
|
||||
if (vist == 'memory') {
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var memory = localStorage.getItem('vis-memory-' + acct_id)
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
memory = 'public'
|
||||
}
|
||||
vis(memory);
|
||||
} else if (vist == "useapi") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var multi = localStorage.getItem("multi");
|
||||
var obj = JSON.parse(multi);
|
||||
var memory = obj[acct_id]["vis"];
|
||||
vis(memory)
|
||||
} else if (vist == 'useapi') {
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var multi = localStorage.getItem('multi')
|
||||
var obj = JSON.parse(multi)
|
||||
var memory = obj[acct_id]['vis']
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
memory = 'public'
|
||||
}
|
||||
vis(memory);
|
||||
vis(memory)
|
||||
} else {
|
||||
vis(vist);
|
||||
vis(vist)
|
||||
}
|
||||
}
|
||||
}
|
||||
loadVis();
|
||||
loadVis()
|
||||
|
||||
//コンテントワーニング
|
||||
function cw() {
|
||||
if ($("#cw").hasClass("cw-avail")) {
|
||||
$("#cw-text").val();
|
||||
$("#cw-text").hide();
|
||||
$("#cw").removeClass("yellow-text");
|
||||
$("#cw").removeClass("cw-avail");
|
||||
if ($('#cw').hasClass('cw-avail')) {
|
||||
$('#cw-text').val()
|
||||
$('#cw-text').hide()
|
||||
$('#cw').removeClass('yellow-text')
|
||||
$('#cw').removeClass('cw-avail')
|
||||
} else {
|
||||
$("#cw-text").show();
|
||||
$("#cw").addClass("yellow-text");
|
||||
$("#cw").addClass("cw-avail");
|
||||
var cwt = localStorage.getItem("cw-text");
|
||||
$('#cw-text').show()
|
||||
$('#cw').addClass('yellow-text')
|
||||
$('#cw').addClass('cw-avail')
|
||||
var cwt = localStorage.getItem('cw-text')
|
||||
if (cwt) {
|
||||
$("#cw-text").val(cwt);
|
||||
$('#cw-text').val(cwt)
|
||||
}
|
||||
}
|
||||
}
|
||||
//TLでコンテントワーニングを表示トグル
|
||||
function cw_show(id) {
|
||||
$(".cw_hide_" + id).toggleClass("cw");
|
||||
$(".cw-long-" + id).toggleClass("hide");
|
||||
$('.cw_hide_' + id).toggleClass('cw')
|
||||
$('.cw-long-' + id).toggleClass('hide')
|
||||
}
|
||||
$(function () {
|
||||
$('#cw-text').on('change', function (event) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var cwlen = $('#cw-text').val().length;
|
||||
$(function() {
|
||||
$('#cw-text').on('change', function(event) {
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var cwlen = $('#cw-text').val().length
|
||||
|
||||
if (idata[domain + "_letters"]) {
|
||||
$("#textarea").attr("data-length", idata[domain + "_letters"] - cwlen)
|
||||
if (idata[domain + '_letters']) {
|
||||
$('#textarea').attr('data-length', idata[domain + '_letters'] - cwlen)
|
||||
} else {
|
||||
$("#textarea").attr("data-length", 500 - cwlen)
|
||||
$('#textarea').attr('data-length', 500 - cwlen)
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
//スケジュール
|
||||
function schedule() {
|
||||
if ($("#sch-box").hasClass("sch-avail")) {
|
||||
$("#sch-box").hide();
|
||||
$("#sch-box").removeClass("sch-avail");
|
||||
if ($('#sch-box').hasClass('sch-avail')) {
|
||||
$('#sch-box').hide()
|
||||
$('#sch-box').removeClass('sch-avail')
|
||||
} else {
|
||||
var date = new Date();
|
||||
var date = new Date()
|
||||
|
||||
$("#sch-box").show();
|
||||
$("#sch-date").val(formattime(date));
|
||||
$("#sch-box").addClass("sch-avail");
|
||||
$('#sch-box').show()
|
||||
$('#sch-date').val(formattime(date))
|
||||
$('#sch-box').addClass('sch-avail')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,53 @@
|
||||
'use strict'
|
||||
//お気に入り登録やブースト等、フォローやブロック等
|
||||
//お気に入り登録
|
||||
function fav(id, acct_id, remote) {
|
||||
if ($("#pub_" + id).hasClass("faved")) {
|
||||
var flag = "unfavourite";
|
||||
if ($('#pub_' + id).hasClass('faved')) {
|
||||
var flag = 'unfavourite'
|
||||
} else {
|
||||
var flag = "favourite";
|
||||
var flag = 'favourite'
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
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.onreadystatechange = function () {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if (remote != "remote") {
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
if (json.reblog) {
|
||||
json = json.reblog
|
||||
}
|
||||
if (remote != 'remote') {
|
||||
//APIのふぁぼカウントがおかしい
|
||||
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count) {
|
||||
if (flag == "unfavourite") {
|
||||
var fav = json.favourites_count - 1;
|
||||
if ($('[unique-id=' + id + '] .fav_ct').text() == json.favourites_count) {
|
||||
if (flag == 'unfavourite') {
|
||||
var fav = json.favourites_count - 1
|
||||
if (fav * 1 < 0) {
|
||||
fav = 0
|
||||
}
|
||||
} else {
|
||||
var fav = json.favourites_count + 1;
|
||||
var fav = json.favourites_count
|
||||
//var fav = json.favourites_count;
|
||||
}
|
||||
} else {
|
||||
var fav = json.favourites_count;
|
||||
var fav = json.favourites_count
|
||||
}
|
||||
$("[toot-id=" + id + "] .fav_ct").text(fav);
|
||||
if (!json.reblog) {
|
||||
$('[unique-id=' + id + '] .fav_ct').text(fav)
|
||||
$('[unique-id=' + id + '] .rt_ct').text(json.reblogs_count)
|
||||
if ($('[unique-id=' + id + ']').hasClass('faved')) {
|
||||
$('[unique-id=' + id + ']').removeClass('faved')
|
||||
$('.fav_' + id).removeClass('yellow-text')
|
||||
} else {
|
||||
$("[toot-id=" + id + "] .rt_ct").text(fav);
|
||||
}
|
||||
if ($("[toot-id=" + id + "]").hasClass("faved")) {
|
||||
$("[toot-id=" + id + "]").removeClass("faved");
|
||||
$(".fav_" + id).removeClass("yellow-text");
|
||||
} else {
|
||||
$("[toot-id=" + id + "]").addClass("faved");
|
||||
$(".fav_" + id).addClass("yellow-text");
|
||||
$('[unique-id=' + id + ']').addClass('faved')
|
||||
$('.fav_' + id).addClass('yellow-text')
|
||||
}
|
||||
} else {
|
||||
M.toast({ html: lang.lang_status_favWarn, displayLength: 1000 })
|
||||
@@ -50,232 +57,322 @@ function fav(id, acct_id, remote) {
|
||||
}
|
||||
|
||||
//ブースト
|
||||
function rt(id, acct_id, remote) {
|
||||
if ($("#pub_" + id).hasClass("rted")) {
|
||||
var flag = "unreblog";
|
||||
function rt(id, acct_id, remote, vis) {
|
||||
if ($('#pub_' + id).hasClass('rted')) {
|
||||
var flag = 'unreblog'
|
||||
} else {
|
||||
var flag = "reblog";
|
||||
var flag = 'reblog'
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
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.onreadystatechange = function () {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
|
||||
var httpreq = new XMLHttpRequest()
|
||||
httpreq.open('POST', start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
httpreq.responseType = 'json'
|
||||
if (vis) {
|
||||
httpreq.send(JSON.stringify({ visibility: vis }))
|
||||
} else {
|
||||
httpreq.send()
|
||||
}
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: boost", json]);
|
||||
if (remote != "remote") {
|
||||
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
|
||||
if (!json.reblog) {
|
||||
if (flag == "unreblog") {
|
||||
var rt = json.reblogs_count - 1;
|
||||
} else {
|
||||
var rt = json.reblogs_count + 1;
|
||||
}
|
||||
$("[toot-id=" + id + "] .rt_ct").text(rt);
|
||||
} else {
|
||||
$("[toot-id=" + id + "] .rt_ct").text(json.reblog.reblogs_count);
|
||||
}
|
||||
|
||||
if ($("[toot-id=" + id + "]").hasClass("rted")) {
|
||||
$("[toot-id=" + id + "]").removeClass("rted");
|
||||
$(".rt_" + id).removeClass("light-blue-text");
|
||||
} else {
|
||||
$("[toot-id=" + id + "]").addClass("rted");
|
||||
$(".rt_" + id).addClass("light-blue-text");
|
||||
}
|
||||
} else {
|
||||
M.toast({ html: lang.lang_status_btWarn, displayLength: 1000 })
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
if (json.reblog) {
|
||||
json = json.reblog
|
||||
}
|
||||
console.log(['Success: boost', json])
|
||||
$('[unique-id=' + id + '] .fav_ct').text(json.favourites_count)
|
||||
if (!json.reblog) {
|
||||
if (flag == 'unreblog') {
|
||||
var rt = json.reblogs_count - 1
|
||||
if (rt * 1 < 0) {
|
||||
rt = 0
|
||||
}
|
||||
} else {
|
||||
var rt = json.reblogs_count
|
||||
}
|
||||
$('[unique-id=' + id + '] .rt_ct').text(rt)
|
||||
} else {
|
||||
$('[unique-id=' + id + '] .rt_ct').text(json.reblogs_count)
|
||||
}
|
||||
|
||||
if ($('[unique-id=' + id + ']').hasClass('rted')) {
|
||||
$('[unique-id=' + id + ']').removeClass('rted')
|
||||
$('.rt_' + id).removeClass('light-blue-text')
|
||||
} else {
|
||||
$('[unique-id=' + id + ']').addClass('rted')
|
||||
$('.rt_' + id).addClass('light-blue-text')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function boostWith(vis) {
|
||||
var id = $('#tootmodal').attr('data-id')
|
||||
var acct_id = $('#tootmodal').attr('data-acct')
|
||||
rt(id, acct_id, false, vis)
|
||||
}
|
||||
//ブックマーク
|
||||
function bkm(id, acct_id, tlid) {
|
||||
if ($('#pub_' + id).hasClass('bkmed')) {
|
||||
var flag = 'unbookmark'
|
||||
} else {
|
||||
var flag = 'bookmark'
|
||||
}
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
if (json.reblog) {
|
||||
json = json.reblog
|
||||
}
|
||||
var fav = json.favourites_count
|
||||
$('[toot-id=' + id + '] .fav_ct').text(fav)
|
||||
$('[toot-id=' + id + '] .rt_ct').text(json.reblogs_count)
|
||||
if (flag == 'unbookmark') {
|
||||
$('.bkmStr_' + id).text(lang.lang_parse_bookmark)
|
||||
$('.bkm_' + id).removeClass('red-text')
|
||||
$('[toot-id=' + id + ']').removeClass('bkmed')
|
||||
} else {
|
||||
$('.bkmStr_' + id).text(lang.lang_parse_unbookmark)
|
||||
$('.bkm_' + id).addClass('red-text')
|
||||
$('[toot-id=' + id + ']').addClass('bkmed')
|
||||
}
|
||||
var tlidTar = $(`.bookmark-timeline[data-acct=${acct_id}]`).attr('tlid')
|
||||
columnReload(tlidTar,'bookmark')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//フォロー
|
||||
function follow(acct_id, remote) {
|
||||
if (!acct_id && acct_id != "selector") {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
} else if (acct_id == "selector") {
|
||||
var acct_id = $("#user-acct-sel").val();
|
||||
async function follow(acct_id, resolve) {
|
||||
if (!acct_id && acct_id != 'selector') {
|
||||
var acct_id = $('#his-data').attr('use-acct')
|
||||
} else if (acct_id == 'selector') {
|
||||
var acct_id = $('#user-acct-sel').val()
|
||||
}
|
||||
if (!remote && $("#his-data").hasClass("following")) {
|
||||
var flag = "unfollow";
|
||||
var flagm = "delete";
|
||||
if (!resolve && $('#his-data').hasClass('following')) {
|
||||
var flag = 'unfollow'
|
||||
var flagm = 'delete'
|
||||
} else {
|
||||
var flag = "follow";
|
||||
var flagm = "create";
|
||||
var flag = 'follow'
|
||||
var flagm = 'create'
|
||||
}
|
||||
var id = $("#his-data").attr("user-id");
|
||||
if (!remote) {
|
||||
var remote = $("#his-data").attr("remote");
|
||||
var id = $('#his-data').attr('user-id')
|
||||
if (resolve == 'selector') {
|
||||
var fullacct = $('#his-acct').attr('fullname')
|
||||
var id = await acctResolve(acct_id, fullacct)
|
||||
console.log(id)
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var user = $("#his-acct").text();
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/following/" + flagm;
|
||||
var ent = { "i": at, "userId": id }
|
||||
} else if (remote == "true" && flag == "follow") {
|
||||
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 (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var start = 'https://' + domain + '/api/following/' + flagm
|
||||
var ent = { i: at, userId: id }
|
||||
} else if (flag == 'follow') {
|
||||
var ent = {}
|
||||
}
|
||||
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(JSON.stringify(ent));
|
||||
httpreq.onreadystatechange = function () {
|
||||
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(JSON.stringify(ent))
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: folllow", json]);
|
||||
if ($("#his-data").hasClass("following")) {
|
||||
$("#his-data").removeClass("following");
|
||||
$("#his-follow-btn").text(lang.lang_status_follow);
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, json)
|
||||
}
|
||||
console.log(['Success: folllow', json])
|
||||
if ($('#his-data').hasClass('following')) {
|
||||
$('#his-data').removeClass('following')
|
||||
$('#his-follow-btn-text').text(lang.lang_status_follow)
|
||||
} else {
|
||||
$("#his-data").addClass("following");
|
||||
$("#his-follow-btn").text(lang.lang_status_unfollow);
|
||||
$('#his-data').addClass('following')
|
||||
$('#his-follow-btn-text').text(lang.lang_status_unfollow)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
async function acctResolve(acct_id, user) {
|
||||
console.log('Get user data of ' + user)
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
return false
|
||||
}
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + user
|
||||
let promise = await fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
var idJson = await promise.json()
|
||||
if (idJson.accounts[0]) {
|
||||
var id = idJson.accounts[0].id
|
||||
} else {
|
||||
M.toast({ html: lang.lang_fatalerroroccured, displayLength: 2000 })
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
//ブロック
|
||||
function block(acct_id) {
|
||||
if ($("#his-data").hasClass("blocking")) {
|
||||
var flag = "unblock";
|
||||
if ($('#his-data').hasClass('blocking')) {
|
||||
var flag = 'unblock'
|
||||
var txt = lang.lang_status_unmute
|
||||
} else {
|
||||
var flag = "block";
|
||||
var flag = 'block'
|
||||
var txt = lang.lang_status_block
|
||||
}
|
||||
Swal.fire({
|
||||
title: txt,
|
||||
text: "",
|
||||
text: '',
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: lang.lang_yesno,
|
||||
cancelButtonText: lang.lang_no
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
if (!acct_id) {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
var acct_id = $('#his-data').attr('use-acct')
|
||||
}
|
||||
var id = $("#his-data").attr("user-id");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
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.onreadystatechange = function () {
|
||||
var id = $('#his-data').attr('user-id')
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/accounts/' + id + '/' + flag
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
if ($("#his-data").hasClass("blocking")) {
|
||||
$("#his-data").removeClass("blocking");
|
||||
$("#his-block-btn").text(lang.lang_status_block);
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
if ($('#his-data').hasClass('blocking')) {
|
||||
$('#his-data').removeClass('blocking')
|
||||
$('#his-block-btn-text').text(lang.lang_status_block)
|
||||
} else {
|
||||
$("#his-data").addClass("blocking");
|
||||
$("#his-block-btn").text(lang.lang_status_unblock);
|
||||
$('#his-data').addClass('blocking')
|
||||
$('#his-block-btn-text').text(lang.lang_status_unblock)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
//ミュート
|
||||
function muteDo(acct_id) {
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
var flag = "unmute";
|
||||
var flagm = "delete";
|
||||
if ($('#his-data').hasClass('muting')) {
|
||||
var flag = 'unmute'
|
||||
var flagm = 'delete'
|
||||
var txt = lang.lang_status_unmute
|
||||
} else {
|
||||
var flag = "mute";
|
||||
var flagm = "create";
|
||||
var flag = 'mute'
|
||||
var flagm = 'create'
|
||||
var txt = lang.lang_status_mute
|
||||
}
|
||||
Swal.fire({
|
||||
title: txt,
|
||||
text: "",
|
||||
text: '',
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: lang.lang_yesno,
|
||||
cancelButtonText: lang.lang_no
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
if (!acct_id) {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
var acct_id = $('#his-data').attr('use-acct')
|
||||
}
|
||||
var id = $("#his-data").attr("user-id");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/mute/" + flagm;
|
||||
var ent = { "i": at, "userId": id }
|
||||
var rq = JSON.stringify(ent);
|
||||
var id = $('#his-data').attr('user-id')
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
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 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(rq);
|
||||
httpreq.onreadystatechange = function () {
|
||||
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(rq)
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
$("#his-data").removeClass("muting");
|
||||
$("#his-mute-btn").text(lang.lang_status_mute);
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
if ($('#his-data').hasClass('muting')) {
|
||||
$('#his-data').removeClass('muting')
|
||||
$('#his-mute-btn-text').text(lang.lang_status_mute)
|
||||
} else {
|
||||
$("#his-data").addClass("muting");
|
||||
$("#his-mute-btn").text(lang.lang_status_unmute);
|
||||
$('#his-data').addClass('muting')
|
||||
$('#his-mute-btn-text').text(lang.lang_status_unmute)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
//投稿削除
|
||||
function del(id, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
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 }));
|
||||
$("[toot-id=" + id + "]").hide();
|
||||
$("[toot-id=" + id + "]").remove();
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
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 }))
|
||||
$('[toot-id=' + id + ']').hide()
|
||||
$('[toot-id=' + id + ']').remove()
|
||||
} 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();
|
||||
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 () {
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,68 +387,76 @@ function redraft(id, acct_id) {
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: lang.lang_yesno,
|
||||
cancelButtonText: lang.lang_no
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
show();
|
||||
del(id, acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
var medias = $("[toot-id=" + id + "]").attr("data-medias");
|
||||
var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis");
|
||||
vis(vismode);
|
||||
$("#media").val(medias);
|
||||
var ct = medias.split(",").length;
|
||||
$("[toot-id=" + id + "] img.toot-img").each(function (i, elem) {
|
||||
show()
|
||||
del(id, acct_id)
|
||||
$('#post-acct-sel').prop('disabled', true)
|
||||
$('#post-acct-sel').val(acct_id)
|
||||
$('select').formSelect()
|
||||
mdCheck()
|
||||
var medias = $('[toot-id=' + id + ']').attr('data-medias')
|
||||
var vismode = $('[toot-id=' + id + '] .vis-data').attr('data-vis')
|
||||
vis(vismode)
|
||||
$('#media').val(medias)
|
||||
var ct = medias.split(',').length
|
||||
$('[toot-id=' + id + '] img.toot-img').each(function(i, elem) {
|
||||
if (i < ct) {
|
||||
var url = $(elem).attr("src");
|
||||
console.log("Play back image data:" + url);
|
||||
$('#preview').append('<img src="' + url + '" style="width:50px; max-height:100px;">');
|
||||
var url = $(elem).attr('src')
|
||||
console.log('Play back image data:' + url)
|
||||
$('#preview').append('<img src="' + url + '" style="width:50px; max-height:100px;">')
|
||||
}
|
||||
});
|
||||
var html = $("[toot-id=" + id + "] .toot").html();
|
||||
html = html.replace(/^<p>(.+)<\/p>$/, "$1");
|
||||
html = html.replace(/<br\s?\/?>/, "\n");
|
||||
html = html.replace(/<p>/, "\n");
|
||||
html = html.replace(/<\/p>/, "\n");
|
||||
html = html.replace(/<img[\s\S]*alt="(.+?)"[\s\S]*?>/g, "$1");
|
||||
html = $.strip_tags(html);
|
||||
localStorage.setItem("nohide", true);
|
||||
show();
|
||||
$("#textarea").val(html);
|
||||
var cwtxt = $("[toot-id=" + id + "] .cw_text").html();
|
||||
if (cwtxt != "") {
|
||||
cwtxt = $.strip_tags(cwtxt);
|
||||
cw();
|
||||
$("#cw-text").val(cwtxt);
|
||||
})
|
||||
var html = $('[toot-id=' + id + '] .toot').html()
|
||||
html = html.replace(/^<p>(.+)<\/p>$/, '$1')
|
||||
html = html.replace(/<br\s?\/?>/, '\n')
|
||||
html = html.replace(/<p>/, '\n')
|
||||
html = html.replace(/<\/p>/, '\n')
|
||||
html = html.replace(/<img[\s\S]*alt="(.+?)"[\s\S]*?>/g, '$1')
|
||||
html = $.strip_tags(html)
|
||||
localStorage.setItem('nohide', true)
|
||||
show()
|
||||
$('#textarea').val(html)
|
||||
var cwtxt = $('[toot-id=' + id + '] .cw_text').html()
|
||||
if (cwtxt != '') {
|
||||
cwtxt = $.strip_tags(cwtxt)
|
||||
cw()
|
||||
$('#cw-text').val(cwtxt)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
//ピン留め
|
||||
function pin(id, acct_id) {
|
||||
if ($("#pub_" + id).hasClass("pined")) {
|
||||
var flag = "unpin";
|
||||
if ($('#pub_' + id).hasClass('pined')) {
|
||||
var flag = 'unpin'
|
||||
} else {
|
||||
var flag = "pin";
|
||||
var flag = 'pin'
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
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.onreadystatechange = function () {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: pinned", json]);
|
||||
if ($("[toot-id=" + id + "]").hasClass("pined")) {
|
||||
$("[toot-id=" + id + "]").removeClass("pined");
|
||||
$(".pin_" + id).removeClass("blue-text");
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
console.log(['Success: pinned', json])
|
||||
if (flag == 'unpin') {
|
||||
$('[toot-id=' + id + ']').removeClass('pined')
|
||||
$('.pin_' + id).removeClass('blue-text')
|
||||
$('.pinStr_' + id).text(lang.lang_parse_pin)
|
||||
} else {
|
||||
$("[toot-id=" + id + "]").addClass("pined");
|
||||
$(".pin_" + id).addClass("blue-text");
|
||||
$('[toot-id=' + id + ']').addClass('pined')
|
||||
$('.pin_' + id).addClass('blue-text')
|
||||
$('.pinStr_' + id).text(lang.lang_parse_unpin)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -359,20 +464,23 @@ function pin(id, acct_id) {
|
||||
|
||||
//フォロリク
|
||||
function request(id, flag, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/follow_requests/" + id + "/" + flag;
|
||||
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.onreadystatechange = function () {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/follow_requests/' + id + '/' + flag
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: request", "type:" + flag, json]);
|
||||
showReq();
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
console.log(['Success: request', 'type:' + flag, json])
|
||||
showReq()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,141 +488,166 @@ function request(id, flag, acct_id) {
|
||||
//ドメインブロック(未実装)
|
||||
function domainblock(add, flag, acct_id) {
|
||||
if (!acct_id) {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
var acct_id = $('#his-data').attr('use-acct')
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/domain_blocks"
|
||||
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.onreadystatechange = function () {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/domain_blocks'
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: domain block", json]);
|
||||
showDom();
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
console.log(['Success: domain block', json])
|
||||
showDom()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addDomainblock() {
|
||||
var domain = $("#domainblock").val();
|
||||
domainblock(domain, 'POST');
|
||||
var domain = $('#domainblock').val()
|
||||
domainblock(domain, 'POST')
|
||||
}
|
||||
//ユーザー強調
|
||||
function empUser() {
|
||||
var usr = localStorage.getItem("user_emp");
|
||||
var obj = JSON.parse(usr);
|
||||
var id = $("#his-acct").attr("fullname");
|
||||
var usr = localStorage.getItem('user_emp')
|
||||
var obj = JSON.parse(usr)
|
||||
var id = $('#his-acct').attr('fullname')
|
||||
if (!obj) {
|
||||
var obj = [];
|
||||
obj.push(id);
|
||||
var obj = []
|
||||
obj.push(id)
|
||||
M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 })
|
||||
} else {
|
||||
var can;
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var usT = obj[key];
|
||||
var can
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var usT = obj[key]
|
||||
if (usT != id && !can) {
|
||||
can = false;
|
||||
can = false
|
||||
} else {
|
||||
can = true;
|
||||
obj.splice(key, 1);
|
||||
can = true
|
||||
obj.splice(key, 1)
|
||||
M.toast({ html: id + lang.lang_status_unemphas, displayLength: 4000 })
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("user_emp", json);
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('user_emp', json)
|
||||
}
|
||||
//Endorse
|
||||
function pinUser() {
|
||||
var id = $("#his-data").attr("user-id");
|
||||
var acct_id = $("#his-data").attr("use-acct");
|
||||
if ($("#his-end-btn").hasClass("endorsed")) {
|
||||
var flag = "unpin";
|
||||
var id = $('#his-data').attr('user-id')
|
||||
var acct_id = $('#his-data').attr('use-acct')
|
||||
if ($('#his-end-btn').hasClass('endorsed')) {
|
||||
var flag = 'unpin'
|
||||
} else {
|
||||
var flag = "pin";
|
||||
var flag = 'pin'
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
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.onreadystatechange = function () {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/accounts/' + id + '/' + flag
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if ($("#his-end-btn").hasClass("endorsed")) {
|
||||
$("#his-end-btn").removeClass("endorsed")
|
||||
$("#his-end-btn").text(lang.lang_status_endorse)
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
if ($('#his-end-btn').hasClass('endorsed')) {
|
||||
$('#his-end-btn').removeClass('endorsed')
|
||||
$('#his-end-btn').text(lang.lang_status_endorse)
|
||||
} else {
|
||||
$("#his-end-btn").addClass("endorsed")
|
||||
$("#his-end-btn").text(lang.lang_status_unendorse)
|
||||
|
||||
$('#his-end-btn').addClass('endorsed')
|
||||
$('#his-end-btn').text(lang.lang_status_unendorse)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//URLコピー
|
||||
function tootUriCopy(url) {
|
||||
execCopy(url);
|
||||
execCopy(url)
|
||||
M.toast({ html: lang.lang_details_url, displayLength: 1500 })
|
||||
}
|
||||
|
||||
//他のアカウントで…
|
||||
function staEx(mode) {
|
||||
var url = $("#tootmodal").attr("data-url");
|
||||
var acct_id = $("#status-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/search?resolve=true&q=" + url
|
||||
var url = $('#tootmodal').attr('data-url')
|
||||
var acct_id = $('#status-acct-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + url
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
var id = json.statuses[0].id;
|
||||
if (mode == "rt") {
|
||||
rt(id, acct_id, 'remote')
|
||||
} else if (mode == "fav") {
|
||||
fav(id, acct_id, 'remote')
|
||||
} else if (mode == "reply") {
|
||||
reEx(id)
|
||||
}
|
||||
});
|
||||
return;
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
var id = json.statuses[0].id
|
||||
if (mode == 'rt') {
|
||||
rt(id, acct_id, 'remote')
|
||||
} else if (mode == 'fav') {
|
||||
fav(id, acct_id, 'remote')
|
||||
} else if (mode == 'reply') {
|
||||
reEx(id)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
function toggleAction(id, tlid, acct_id) {
|
||||
if (tlid == "notf") {
|
||||
var tlide = "[data-acct=" + acct_id + "] .notf-timeline";
|
||||
} else if (tlid == "user") {
|
||||
var tlide = "#his-tl-contents";
|
||||
function toggleAction(elem, height) {
|
||||
var cont = elem.parents('.cvo').find('.contextMenu')
|
||||
if (cont.hasClass('hide')) {
|
||||
$('#contextWrap').removeClass('hide')
|
||||
var left = elem.offset().left + 60
|
||||
var top = elem.offset().top - height
|
||||
if (top < 75) {
|
||||
top = elem.offset().top + 45
|
||||
cont.removeClass('bottom')
|
||||
cont.addClass('top')
|
||||
} else {
|
||||
cont.removeClass('top')
|
||||
cont.addClass('bottom')
|
||||
}
|
||||
if(elem.parents('.cvo').attr('id') == 'toot-this'){
|
||||
console.log($('#toot-this').offset().top, elem.offset().top)
|
||||
left = $('#toot-this').offset().left + elem.offset().left + 10
|
||||
top = $('#toot-this').offset().top - $('#toot-this').height() -height + 25
|
||||
}
|
||||
cont.css('top', top + 'px')
|
||||
cont.css('right', `calc(100vw - ${left}px)`)
|
||||
cont.removeClass('hide')
|
||||
elem
|
||||
.parents('.cvo')
|
||||
.find('.act-icon')
|
||||
.text('expand_less')
|
||||
} else {
|
||||
var tlide = "[tlid=" + tlid + "]";
|
||||
$('#contextWrap').addClass('hide')
|
||||
$('.contextMenu').addClass('hide')
|
||||
$('.act-icon').text('expand_more')
|
||||
}
|
||||
if (!$(tlide + " [toot-id=" + id + "]").hasClass("ext-mode")) {
|
||||
$(tlide + " [toot-id=" + id + "] .type-a").hide();
|
||||
$(tlide + " [toot-id=" + id + "] .type-b").show();
|
||||
$(tlide + " [toot-id=" + id + "]").addClass("ext-mode")
|
||||
$(tlide + " [toot-id=" + id + "] .act-icon").text("expand_less");
|
||||
} else {
|
||||
$(tlide + " [toot-id=" + id + "] .type-b").hide();
|
||||
$(tlide + " [toot-id=" + id + "] .type-a").show();
|
||||
$(tlide + " [toot-id=" + id + "]").removeClass("ext-mode")
|
||||
$(tlide + " [toot-id=" + id + "] .act-icon").text("expand_more");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,205 +1,280 @@
|
||||
'use strict'
|
||||
//入力時にハッシュタグと@をサジェスト
|
||||
var timer = null;
|
||||
var timer = null
|
||||
|
||||
var input = document.getElementById("textarea");
|
||||
var input = document.getElementById('textarea')
|
||||
|
||||
var prev_val = input.value;
|
||||
var oldSuggest;
|
||||
var suggest;
|
||||
var prev_val = input.value
|
||||
var oldSuggest
|
||||
var suggest
|
||||
|
||||
input.addEventListener("focus", function () {
|
||||
localStorage.removeItem("cursor");
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
$("#suggest").html("");
|
||||
window.clearInterval(timer);
|
||||
timer = window.setInterval(function () {
|
||||
var new_val = input.value;
|
||||
if (new_val == "") {
|
||||
$("#suggest").html("");
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (prev_val != new_val) {
|
||||
var semoji = new_val.match(/:(\S{3,})/);
|
||||
if (semoji) {
|
||||
var obj = JSON.parse(localStorage.getItem("emoji_" + acct_id));
|
||||
if (!obj) {
|
||||
var ehtml = lang.lang_suggest_nodata;
|
||||
} else {
|
||||
var num = obj.length;
|
||||
var ehtml = "";
|
||||
for (i = 0; i < num; i++) {
|
||||
var emoji = obj[i];
|
||||
if (~emoji.shortcode.indexOf(semoji[1])) {
|
||||
if (emoji) {
|
||||
ehtml = ehtml + '<a onclick="emojiInsert(\':' + emoji.shortcode +
|
||||
': \',\':' + semoji[1] + '\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ehtml != "") {
|
||||
$("#right-side").show()
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
} else {
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
}
|
||||
$("#suggest").html(ehtml);
|
||||
}
|
||||
|
||||
var tag = new_val.match(/#(\S{3,})/);
|
||||
var acct = new_val.match(/@(\S{3,})/);
|
||||
if (tag && tag[1]) {
|
||||
var q = tag[1];
|
||||
} else if (acct && acct[1]) {
|
||||
var q = acct[1];
|
||||
} else {
|
||||
$("#suggest").html("");
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
return;
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
suggest = "https://" + domain + "/api/v2/search?q=" + q
|
||||
if (suggest != oldSuggest) {
|
||||
console.log("Try to get suggest at " + suggest)
|
||||
fetch(suggest, {
|
||||
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) {
|
||||
console.log(["Search", json]);
|
||||
//ハッシュタグ
|
||||
if (json.hashtags[0] && tag) {
|
||||
if (tag[1]) {
|
||||
var tags = [];
|
||||
Object.keys(json.hashtags).forEach(function (key4) {
|
||||
var tag = json.hashtags[key4];
|
||||
var his = tag.history;
|
||||
var uses = his[0].uses * 1 + his[1].uses * 1 + his[2].uses * 1 + his[3].uses * 1 + his[4].uses * 1 + his[5].uses * 1 + his[6].uses * 1;
|
||||
tagHTML = '<br><a onclick="tagInsert(\'#' + escapeHTML(tag.name) + '\',\'#' + q + '\')" class="pointer">#' +
|
||||
escapeHTML(tag.name) + '</a> ' + uses + 'toot(s)'
|
||||
var item = {
|
||||
"uses": uses,
|
||||
"html": tagHTML
|
||||
}
|
||||
tags.push(item)
|
||||
});
|
||||
var num_a = -1;
|
||||
var num_b = 1;
|
||||
tags = tags.sort(function (a, b) {
|
||||
var x = a["uses"];
|
||||
var y = b["uses"];
|
||||
if (x > y) return num_a;
|
||||
if (x < y) return num_b;
|
||||
return 0;
|
||||
});
|
||||
var ins = ""
|
||||
var nev = false
|
||||
Object.keys(tags).forEach(function (key7) {
|
||||
ins = ins + tags[key7].html
|
||||
if (key7 <= 0 && !nev) {
|
||||
ins = ins + '<br>'
|
||||
nev = true
|
||||
}
|
||||
});
|
||||
$("#suggest").html(ins);
|
||||
$("#right-side").show()
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
}
|
||||
} else if (json.accounts[0] && acct[1]) {
|
||||
var accts = "";
|
||||
Object.keys(json.accounts).forEach(function (key3) {
|
||||
var acct = json.accounts[key3];
|
||||
if (acct.acct != q) {
|
||||
accts = accts + '<a onclick="tagInsert(\'@' + acct.acct +
|
||||
'\',\'@' + q + '\')" class="pointer">@' + acct.acct + '</a><br>';
|
||||
}
|
||||
});
|
||||
$("#right-side").show()
|
||||
$("#suggest").html(accts);
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
input.addEventListener(
|
||||
'focus',
|
||||
function() {
|
||||
localStorage.removeItem('cursor')
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
$('#suggest').html('')
|
||||
window.clearInterval(timer)
|
||||
timer = window.setInterval(function() {
|
||||
var new_val = input.value
|
||||
if (new_val == '') {
|
||||
$('#suggest').html('')
|
||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
||||
$('#right-side').hide()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', '100%')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1
|
||||
} else {
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
width = 300
|
||||
}
|
||||
});
|
||||
$('#post-box').css('width', width + 'px')
|
||||
}
|
||||
return
|
||||
}
|
||||
};
|
||||
oldSuggest = suggest;
|
||||
prev_value = new_val;
|
||||
}, 1000);
|
||||
}, false);
|
||||
if (prev_val != new_val) {
|
||||
var tag = new_val.match(/#(\S{3,})/)
|
||||
var acct = new_val.match(/@(\S{3,})/)
|
||||
if (tag && tag[1]) {
|
||||
var q = tag[1]
|
||||
} else if (acct && acct[1]) {
|
||||
var q = acct[1]
|
||||
} else {
|
||||
$('#suggest').html('')
|
||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
||||
$('#right-side').hide()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', '100%')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1
|
||||
} else {
|
||||
width = 300
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
}
|
||||
return
|
||||
}
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
suggest = 'https://' + domain + '/api/v2/search?q=' + q
|
||||
if (suggest != oldSuggest) {
|
||||
console.log('Try to get suggest at ' + suggest)
|
||||
fetch(suggest, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
console.log(['Search', json])
|
||||
//ハッシュタグ
|
||||
if (json.hashtags[0] && tag) {
|
||||
if (tag[1]) {
|
||||
var tags = []
|
||||
Object.keys(json.hashtags).forEach(function(key4) {
|
||||
var tag = json.hashtags[key4]
|
||||
var his = tag.history
|
||||
var uses =
|
||||
his[0].uses * 1 +
|
||||
his[1].uses * 1 +
|
||||
his[2].uses * 1 +
|
||||
his[3].uses * 1 +
|
||||
his[4].uses * 1 +
|
||||
his[5].uses * 1 +
|
||||
his[6].uses * 1
|
||||
tagHTML = `<br><a onclick="tagInsert('#${escapeHTML(
|
||||
tag.name
|
||||
)}','#${q}')" class="pointer">#${escapeHTML(tag.name)}</a> ${uses}toot(s)`
|
||||
|
||||
input.addEventListener("blur", function () {
|
||||
window.clearInterval(timer);
|
||||
favTag();
|
||||
}, false);
|
||||
var item = {
|
||||
uses: uses,
|
||||
html: tagHTML
|
||||
}
|
||||
tags.push(item)
|
||||
})
|
||||
var num_a = -1
|
||||
var num_b = 1
|
||||
tags = tags.sort(function(a, b) {
|
||||
var x = a['uses']
|
||||
var y = b['uses']
|
||||
if (x > y) return num_a
|
||||
if (x < y) return num_b
|
||||
return 0
|
||||
})
|
||||
var ins = ''
|
||||
var nev = false
|
||||
Object.keys(tags).forEach(function(key7) {
|
||||
ins = ins + tags[key7].html
|
||||
if (key7 <= 0 && !nev) {
|
||||
ins = ins + '<br>'
|
||||
nev = true
|
||||
}
|
||||
})
|
||||
$('#suggest').html(ins)
|
||||
$('#right-side').show()
|
||||
$('#right-side').css('width', '200px')
|
||||
$('#left-side').css('width', 'calc(100% - 200px)')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1 + 200
|
||||
} else {
|
||||
width = 500
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
$('#poll').addClass('hide')
|
||||
$('#emoji').addClass('hide')
|
||||
}
|
||||
} else if (json.accounts[0] && acct[1]) {
|
||||
var accts = ''
|
||||
Object.keys(json.accounts).forEach(function(key3) {
|
||||
var acct = json.accounts[key3]
|
||||
if (acct.acct != q) {
|
||||
//Instance Actorって…
|
||||
if (acct.username.indexOf('.') < 0) {
|
||||
accts =
|
||||
accts +
|
||||
`<a onclick="tagInsert('@${acct.acct}','@${q}')" class="pointer">@${acct.acct}</a><br>`
|
||||
}
|
||||
}
|
||||
})
|
||||
$('#right-side').show()
|
||||
$('#right-side').css('width', '200px')
|
||||
$('#left-side').css('width', 'calc(100% - 200px)')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1 + 200
|
||||
} else {
|
||||
width = 500
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
$('#suggest').html(accts)
|
||||
$('#poll').addClass('hide')
|
||||
$('#emoji').addClass('hide')
|
||||
} else {
|
||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
||||
$('#right-side').hide()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', '100%')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1
|
||||
} else {
|
||||
width = 300
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
oldSuggest = suggest
|
||||
prev_value = new_val
|
||||
}, 1000)
|
||||
},
|
||||
false
|
||||
)
|
||||
|
||||
input.addEventListener(
|
||||
'blur',
|
||||
function() {
|
||||
window.clearInterval(timer)
|
||||
favTag()
|
||||
},
|
||||
false
|
||||
)
|
||||
function tagInsert(code, del) {
|
||||
var now = $("#textarea").val();
|
||||
var selin = $("#textarea").prop('selectionStart');
|
||||
if (!del) {
|
||||
var blankBefore = ' '
|
||||
var blankAfter = ' '
|
||||
var textarea = document.querySelector('#textarea')
|
||||
var sentence = textarea.value
|
||||
var len = sentence.length
|
||||
var pos = textarea.selectionStart
|
||||
if (del) {
|
||||
var delLen = del.length
|
||||
} else {
|
||||
var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
|
||||
var now = now.replace(regExp, "");
|
||||
selin = selin - del.length;
|
||||
var delLen = 0
|
||||
}
|
||||
if (selin > 0) {
|
||||
var before = now.substr(0, selin);
|
||||
var after = now.substr(selin, now.length);
|
||||
newt = before + " " + code + " " + after;
|
||||
var before = sentence.substr(0, pos - delLen)
|
||||
var last = before.substr(-1, 1)
|
||||
if (last == ' ') blankBefore = ''
|
||||
var after = sentence.substr(pos, len)
|
||||
var start = after.substr(0, 1)
|
||||
if (start == ' ') blankAfter = ''
|
||||
if (len == 0) {
|
||||
var word = code
|
||||
} else if (len == pos) {
|
||||
var word = blankBefore + code
|
||||
} else if (pos == 0) {
|
||||
var word = code + blankAfter
|
||||
} else {
|
||||
newt = code + " " + now;
|
||||
var word = blankBefore + code + blankAfter
|
||||
}
|
||||
$("#textarea").val(newt);
|
||||
$("#textarea").focus();
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
sentence = before + word + after
|
||||
textarea.value = sentence
|
||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
||||
$('#right-side').hide()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', '50%')
|
||||
var width = localStorage.getItem('postbox-width').replace('px', '') * 1
|
||||
if (!width) {
|
||||
width = 300
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
}
|
||||
$("#suggest").html("");
|
||||
$('#suggest').html('')
|
||||
}
|
||||
function cgNPs(q) {
|
||||
suggest = "https://cg.toot.app/api/v1/search/light?q=" + q
|
||||
suggest = 'https://cg.toot.app/api/v1/search/light?q=' + q
|
||||
if (suggest != oldSuggest) {
|
||||
console.log("Try to get suggest at " + suggest)
|
||||
console.log('Try to get suggest at ' + suggest)
|
||||
fetch(suggest, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json[0]) {
|
||||
var tags = "";
|
||||
Object.keys(json).forEach(function (key4) {
|
||||
var tag = json[key4];
|
||||
tags = tags + '<a onclick="cgNP(\'' + json[key4] + '\')" class="pointer">' + escapeHTML(json[key4]) + '</a> ';
|
||||
});
|
||||
$("#suggest").html("Cinderella NowPlaying:" + tags);
|
||||
} else {
|
||||
$("#suggest").html("Cinderella NowPlaying:Not Found");
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json[0]) {
|
||||
var tags = ''
|
||||
Object.keys(json).forEach(function(key4) {
|
||||
var tag = json[key4]
|
||||
tags =
|
||||
tags +
|
||||
`<a onclick="cgNp('${json[key4]}')" class="pointer">${escapeHTML(json[key4])}</a>`
|
||||
})
|
||||
$('#suggest').html('Cinderella NowPlaying:' + tags)
|
||||
} else {
|
||||
$('#suggest').html('Cinderella NowPlaying:Not Found')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +1,82 @@
|
||||
'use strict'
|
||||
/*リプライ*/
|
||||
function re(id, ats_cm, acct_id, mode) {
|
||||
clear();
|
||||
var ats = ats_cm.split(',');
|
||||
localStorage.setItem("nohide", true);
|
||||
show();
|
||||
$("#reply").val(id);
|
||||
clear()
|
||||
var ats = ats_cm.split(',')
|
||||
localStorage.setItem('nohide', true)
|
||||
show()
|
||||
$('#reply').val(id)
|
||||
for (var i = 0; i < ats.length; i++) {
|
||||
var at = ats[i];
|
||||
var te = $("#textarea").val();
|
||||
if (at != localStorage.getItem("user_" + acct_id)) {
|
||||
$("#textarea").val("@" + at + " " + te);
|
||||
var at = ats[i]
|
||||
var te = $('#textarea').val()
|
||||
if (at != localStorage.getItem('user_' + acct_id)) {
|
||||
$('#textarea').val('@' + at + ' ' + te)
|
||||
}
|
||||
}
|
||||
$("#rec").text(lang.lang_yesno);
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').formSelect();
|
||||
$("#textarea").attr("placeholder", lang.lang_usetxtbox_reply);
|
||||
$("#textarea").focus();
|
||||
var profimg = localStorage.getItem("prof_" + acct_id);
|
||||
$('#rec').text(lang.lang_yesno)
|
||||
$('#post-acct-sel').val(acct_id)
|
||||
$('#post-acct-sel').prop('disabled', true)
|
||||
$('select').formSelect()
|
||||
mdCheck()
|
||||
$('#textarea').attr('placeholder', lang.lang_usetxtbox_reply)
|
||||
$('#textarea').focus()
|
||||
var profimg = localStorage.getItem('prof_' + acct_id)
|
||||
if (!profimg) {
|
||||
profimg = "../../img/missing.svg";
|
||||
profimg = '../../img/missing.svg'
|
||||
}
|
||||
$("#acct-sel-prof").attr("src", profimg);
|
||||
vis(mode);
|
||||
$('#acct-sel-prof').attr('src', profimg)
|
||||
vis(mode)
|
||||
}
|
||||
function reEx(id) {
|
||||
$('#tootmodal').modal('close');
|
||||
var at = $("#tootmodal").attr("data-user");
|
||||
var acct_id = $("#status-acct-sel").val();
|
||||
var mode = $("#tootmodal .vis-data").attr("data-vis");
|
||||
re(id, at, acct_id, mode);
|
||||
$('#tootmodal').modal('close')
|
||||
var at = $('#tootmodal').attr('data-user')
|
||||
var acct_id = $('#status-acct-sel').val()
|
||||
var mode = $('#tootmodal .vis-data').attr('data-vis')
|
||||
re(id, at, acct_id, mode)
|
||||
}
|
||||
//引用
|
||||
function qt(id, acct_id, at, url) {
|
||||
localStorage.setItem("nohide", true);
|
||||
var qt = localStorage.getItem("quote");
|
||||
localStorage.setItem('nohide', true)
|
||||
var qt = localStorage.getItem('quote')
|
||||
if (!qt) {
|
||||
var qt = "simple";
|
||||
var qt = 'simple'
|
||||
}
|
||||
if (qt == "nothing") {
|
||||
return false;
|
||||
if (qt == 'nothing') {
|
||||
return false
|
||||
}
|
||||
if (qt == "simple") {
|
||||
show();
|
||||
$("#textarea").val("\n" + url);
|
||||
} else if (qt == "mention") {
|
||||
show();
|
||||
$("#textarea").val("\n" + url + " From:@" + at);
|
||||
} else if (qt == "full") {
|
||||
show();
|
||||
var html = $("[toot-id=" + id + "] .toot").html();
|
||||
html = html.match(/^<p>(.+)<\/p>$/)[1];
|
||||
html = html.replace(/<br\s?\/?>/, "\n");
|
||||
html = html.replace(/<p>/, "\n");
|
||||
html = html.replace(/<\/p>/, "\n");
|
||||
html = $.strip_tags(html);
|
||||
$("#textarea").val("\n" + "@" + at + " " + html + "\n" + url);
|
||||
if (qt == 'simple') {
|
||||
show()
|
||||
$('#textarea').val('\n' + url)
|
||||
} else if (qt == 'mention') {
|
||||
show()
|
||||
$('#textarea').val('\n' + url + ' From:@' + at)
|
||||
} else if (qt == 'full') {
|
||||
show()
|
||||
var html = $('[toot-id=' + id + '] .toot').html()
|
||||
html = html.match(/^<p>(.+)<\/p>$/)[1]
|
||||
html = html.replace(/<br\s?\/?>/, '\n')
|
||||
html = html.replace(/<p>/, '\n')
|
||||
html = html.replace(/<\/p>/, '\n')
|
||||
html = $.strip_tags(html)
|
||||
$('#textarea').val('\n' + '@' + at + ' ' + html + '\n' + url)
|
||||
} else if (qt == 'apiQuote') {
|
||||
clear()
|
||||
localStorage.setItem('nohide', true)
|
||||
show()
|
||||
$('#quote').val(id)
|
||||
$('#post-acct-sel').val(acct_id)
|
||||
$('#post-acct-sel').prop('disabled', true)
|
||||
$('select').formSelect()
|
||||
$('#textarea').attr('placeholder', lang.lang_usetxtbox_reply)
|
||||
$('#textarea').focus()
|
||||
var profimg = localStorage.getItem('prof_' + acct_id)
|
||||
if (!profimg) {
|
||||
profimg = '../../img/missing.svg'
|
||||
}
|
||||
$('#acct-sel-prof').attr('src', profimg)
|
||||
}
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$('select').formSelect();
|
||||
$("#textarea").focus();
|
||||
}
|
||||
$('#post-acct-sel').val(acct_id)
|
||||
$('select').formSelect()
|
||||
mdCheck()
|
||||
$('#textarea').focus()
|
||||
}
|
||||
|
||||
@@ -1,281 +1,393 @@
|
||||
'use strict'
|
||||
//カード処理やメンション、ハッシュタグの別途表示
|
||||
//全てのTL処理で呼び出し
|
||||
function additional(acct_id, tlid) {
|
||||
//メンション系
|
||||
//$(".mention").attr("href", "");
|
||||
|
||||
$("#timeline-container .mention").addClass("parsed");
|
||||
$('#timeline-container .mention').addClass('parsed')
|
||||
|
||||
$("#timeline-container .hashtag").each(function (i, elem) {
|
||||
var tags = $(this).attr("href").match(
|
||||
/https?:\/\/([-a-zA-Z0-9@.]+)\/tags\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
|
||||
);
|
||||
$(this).attr("href", "#");
|
||||
$('#timeline-container .hashtag, #timeline-container [rel=tag]').each(function(i, elem) {
|
||||
var tags = $(this)
|
||||
.attr('href')
|
||||
.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/tags?\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/)
|
||||
if (tags) {
|
||||
if (tags[2]) {
|
||||
$(this).attr("onclick", 'tagShow(\'' + tags[2] + '\')');
|
||||
}
|
||||
|
||||
var tagThis = tags[2]
|
||||
} else {
|
||||
var tagThis = $(this).attr('data-regTag')
|
||||
}
|
||||
});
|
||||
|
||||
if (tagThis) {
|
||||
$(this).attr('href', "javascript:tagShow('" + tagThis + "')")
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
//トゥートサムネ
|
||||
$("#timeline_" + tlid + " .toot a:not(.parsed)").each(function (i, elem) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var card = localStorage.getItem("card_" + tlid);
|
||||
var text = $(this).attr('href');
|
||||
$('#timeline_' + tlid + ' .toot a:not(.parsed)').each(function(i, elem) {
|
||||
var text = $(this).attr('href')
|
||||
if (text) {
|
||||
if (text.indexOf("twimg.com") === -1) {
|
||||
if (text.indexOf('twimg.com') === -1) {
|
||||
var urls = text.match(
|
||||
/https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
|
||||
);
|
||||
)
|
||||
}
|
||||
} else {
|
||||
text = ""
|
||||
text = ''
|
||||
var urls = []
|
||||
}
|
||||
|
||||
//トゥートのURLぽかったら
|
||||
toot = text.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/);
|
||||
var toot = text.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/)
|
||||
if (toot) {
|
||||
if (toot[1]) {
|
||||
$(this).attr("data-acct", acct_id);
|
||||
$(this).attr('data-acct', acct_id)
|
||||
}
|
||||
}
|
||||
if (urls) {
|
||||
$(this).remove();
|
||||
} else if (!card) {
|
||||
var id = $(this).parents('.cvo').attr("toot-id");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/url?url=" + text;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
//body: JSON.stringify({})
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.title) {
|
||||
$("[toot-id=" + id + "] .additional").html(
|
||||
"<span class=\"gray\">URL" + lang.lang_cards_check + ":<br>Title:" + escapeHTML(json.title) + "<br>" +
|
||||
escapeHTML(json.description) + "</span>");
|
||||
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
|
||||
$("[toot-id=" + id + "]").addClass("parsed");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(this).remove()
|
||||
} else {
|
||||
$(this).attr("title", text);
|
||||
$(this).attr('title', text)
|
||||
}
|
||||
});
|
||||
$("i.unparsed").each(function (i, elem) {
|
||||
var dem = $(this).text();
|
||||
var dom = $(this);
|
||||
var start = "./js/emoji/emoji-map.json";
|
||||
var xmlHttpRequest = new XMLHttpRequest();
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
})
|
||||
$('i.unparsed').each(function(i, elem) {
|
||||
var dem = $(this).text()
|
||||
var dom = $(this)
|
||||
var start = './js/emoji/emoji-map.json'
|
||||
var xmlHttpRequest = new XMLHttpRequest()
|
||||
xmlHttpRequest.onreadystatechange = function() {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
if (this.response) {
|
||||
var json = this.response;
|
||||
var emojis = json.emojis;
|
||||
var json = this.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
var emojis = json.emojis
|
||||
for (i = 0; i < emojis.length; i++) {
|
||||
var emojie = emojis[i];
|
||||
var regExp = new RegExp(dem, "g");
|
||||
var emojie = emojis[i]
|
||||
var regExp = new RegExp(dem, 'g')
|
||||
if (emojie.emoji.match(regExp)) {
|
||||
var sc = emojie.name;
|
||||
var sc = "twa-" + sc.replace(/_/g, "-");
|
||||
dom.addClass(sc);
|
||||
dom.text("");
|
||||
dom.removeClass("unparsed");
|
||||
break;
|
||||
var sc = emojie.name
|
||||
var sc = 'twa-' + sc.replace(/_/g, '-')
|
||||
dom.addClass(sc)
|
||||
dom.text('')
|
||||
dom.removeClass('unparsed')
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
xmlHttpRequest.open('GET', start, true);
|
||||
xmlHttpRequest.responseType = 'json';
|
||||
xmlHttpRequest.send(null);
|
||||
});
|
||||
xmlHttpRequest.open('GET', start, true)
|
||||
xmlHttpRequest.responseType = 'json'
|
||||
xmlHttpRequest.send(null)
|
||||
})
|
||||
|
||||
$("#timeline_" + tlid + " .toot:not(:has(a:not(.add-show,.parsed)))").each(function (i, elem) {
|
||||
$(this).parent().find(".add-show").hide();
|
||||
});
|
||||
$('#timeline_' + tlid + ' .toot:not(:has(a:not(.add-show,.parsed)))').each(function(i, elem) {
|
||||
$(this)
|
||||
.parent()
|
||||
.find('.add-show')
|
||||
.hide()
|
||||
})
|
||||
//Markdownイメージビューワー
|
||||
$("#timeline_" + tlid + " .toot a:not(.img-parsed):has(img)").each(function (i, elem) {
|
||||
var ilink = $(this).attr("href");
|
||||
var id = $(this).parents('.cvo').attr("toot-id");
|
||||
$(this).attr("href", "#");
|
||||
$(this).attr("onclick", "imgv('" + id + "','" + i + "')");
|
||||
$(this).attr("data-type", "image");
|
||||
$(this).attr("id", id + "-image-" + i);
|
||||
$(this).attr("data-url", ilink);
|
||||
$(this).addClass("img-parsed");
|
||||
});
|
||||
$('#timeline_' + tlid + ' .toot a:not(.img-parsed):has(img)').each(function(i, elem) {
|
||||
var ilink = $(this).attr('href')
|
||||
var id = $(this)
|
||||
.parents('.cvo')
|
||||
.attr('toot-id')
|
||||
$(this).attr('href', `javascript:imgv('${id}','${i}')`)
|
||||
$(this).attr('data-type', 'image')
|
||||
$(this).attr('id', id + '-image-' + i)
|
||||
$(this).attr('data-url', ilink)
|
||||
$(this).addClass('img-parsed')
|
||||
})
|
||||
}
|
||||
|
||||
function additionalIndv(tlid, acct_id, id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var text = $("[toot-id=" + id + "] .toot a").attr('href');
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var text = $('[toot-id=' + id + '] .toot a').attr('href')
|
||||
var urls = text.match(
|
||||
/https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
|
||||
);
|
||||
)
|
||||
if (urls) {
|
||||
$("[toot-id=" + id + "] .toot a").remove();
|
||||
$('[toot-id=' + id + '] .toot a').remove()
|
||||
} else {
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/url?url=" + text;
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var start = 'https://' + domain + '/url?url=' + text
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
//body: JSON.stringify({})
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.title) {
|
||||
$("[toot-id=" + id + "] .additional").html(
|
||||
"<span class=\"gray\">URL" + lang.lang_cards_check + ":<br>Title:" + escapeHTML(json.title) + "<br>" +
|
||||
escapeHTML(json.description) + "</span>");
|
||||
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
|
||||
$("[toot-id=" + id + "]").addClass("parsed");
|
||||
}
|
||||
});
|
||||
//body: JSON.stringify({})
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.title) {
|
||||
$('[toot-id=' + id + '] .additional').html(
|
||||
`<span class="gray">URL${lang.lang_cards_check}:<br>Title:${escapeHTML(
|
||||
json.title
|
||||
)}<br>${escapeHTML(json.description)}</span>`
|
||||
)
|
||||
$('[toot-id=' + id + '] a:not(.parsed)').addClass('parsed')
|
||||
$('[toot-id=' + id + ']').addClass('parsed')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var id = $("[toot-id=" + id + "] .toot a").parents('.cvo').attr("toot-id");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id;
|
||||
var id = $('[toot-id=' + id + '] .toot a')
|
||||
.parents('.cvo')
|
||||
.attr('toot-id')
|
||||
var start = 'https://' + domain + '/api/v1/statuses/' + id
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
//body: JSON.stringify({})
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
json = json.card;
|
||||
//このリンク鳥やんけ、ってとき
|
||||
if (json.provider_name == "Twitter") {
|
||||
if (json.image) {
|
||||
var twiImg = '<br><img src="' + json.image + '" style="max-width:100%" onclick="imgv(\'twi_' + id + '\', 0, \'twitter\');" id="twi_' + id + '-image-0" data-url="' + json.image + '" data-type="image">';
|
||||
} else {
|
||||
var twiImg = '';
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
$("[toot-id=" + id + "] .additional").html(
|
||||
'<div class="twitter-tweet"><b>' + escapeHTML(json.author_name) + '</b><br>' + escapeHTML(json.description) + twiImg + '</div>');
|
||||
} else if (json.provider_name == "pixiv") {
|
||||
if (json.image) {
|
||||
var pxvImg = '<br><img src="' + json.image + '" style="max-width:100%" onclick="imgv(\'pixiv_' + id + '\', 0, \'pixiv\');" id="pixiv_' + id + '-image-0" data-url="' + json.embed_url + '" data-type="image">';
|
||||
} else {
|
||||
var pxvImg = '';
|
||||
}
|
||||
$("[toot-id=" + id + "] .additional").html(
|
||||
'<div class="pixiv-post"><b><a href="' + json.author_url + '" target="_blank">' + escapeHTML(json.author_name) + '</a></b><br>' + escapeHTML(json.title) + pxvImg + '</div>');
|
||||
} else {
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
var cards = json.card
|
||||
var analyze = cardHtml(cards, acct_id, id)
|
||||
$('[toot-id=' + id + '] .additional').html(analyze)
|
||||
if (json.title) {
|
||||
$("[toot-id=" + id + "] .additional").html(
|
||||
"<span class=\"gray\">URL" + lang.lang_cards_check + ":<br>Title:" + escapeHTML(json.title) + "<br>" +
|
||||
escapeHTML(json.description) + "</span>");
|
||||
$('[toot-id=' + id + '] a:not(.parsed)').addClass('parsed')
|
||||
$('[toot-id=' + id + ']').addClass('parsed')
|
||||
}
|
||||
if (json.html) {
|
||||
$("[toot-id=" + id + "] .additional").html(json.html + '<i class="material-icons sml pointer" onclick="pip(\'' + id + '\')" title="' + lang.lang_cards_pip + '">picture_in_picture_alt</i>');
|
||||
|
||||
}
|
||||
}
|
||||
if (json.title) {
|
||||
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
|
||||
$("[toot-id=" + id + "]").addClass("parsed");
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
function cardHtml(json, acct_id, id) {
|
||||
var analyze = ''
|
||||
var domain = json.url.match(/^https?:\/{2,}(.*?)(?:\/|\?|#|$)/)[1];
|
||||
var ok = [
|
||||
"pixiv.net",
|
||||
"twitter.com",
|
||||
"mobile.twitter.com",
|
||||
"open.spotify.com",
|
||||
"youtube.com",
|
||||
"youtu.be",
|
||||
"m.youtube.com",
|
||||
"www.youtube.com",
|
||||
"nicovideo.jp",
|
||||
"twitcasting.tv"
|
||||
]
|
||||
var isHad = _.includes(ok, domain);
|
||||
if (json.provider_name == 'pixiv') {
|
||||
if (json.image) {
|
||||
var pxvImg = `
|
||||
<br><img src="${json.image}" style="max-width:100%"
|
||||
onclick="imgv('pixiv_${id}',0,'pixiv')" id="pixiv_${id}-image-0"
|
||||
data-url="${json.embed_url}"
|
||||
data-type="image">
|
||||
`
|
||||
} else {
|
||||
var pxvImg = ''
|
||||
}
|
||||
analyze = `<div class="pixiv-post"><b><a href="
|
||||
${json.author_url}
|
||||
" target="_blank">
|
||||
${escapeHTML(json.author_name)}
|
||||
</a></b><br>
|
||||
${escapeHTML(json.title)}
|
||||
${pxvImg}
|
||||
</div>`
|
||||
} else {
|
||||
if (json.title) {
|
||||
analyze = `<span class="gray">URL
|
||||
${lang.lang_cards_check}
|
||||
:<br>Title:
|
||||
${escapeHTML(json.title)}
|
||||
<br>
|
||||
${escapeHTML(json.description)}
|
||||
</span>`
|
||||
}
|
||||
|
||||
if (json.html || json.provider_name == 'Twitter') {
|
||||
if(isHad) {
|
||||
var prved = `<img class="emoji" draggable="false" alt="✅"
|
||||
src="https://twemoji.maxcdn.com/v/12.1.3/72x72/2705.png">`
|
||||
var title = lang.lang_cards_trusted
|
||||
}else{
|
||||
var prved = '<img class="emoji" draggable="false" alt="⚠️" src="https://twemoji.maxcdn.com/v/12.1.4/72x72/26a0.png">'
|
||||
var title = lang.lang_cards_untrusted
|
||||
}
|
||||
analyze =`<a onclick="cardHtmlShow('${acct_id}','${id}')" class="add-show pointer" title="${title}">
|
||||
${lang.lang_parse_html}(${domain})${prved}
|
||||
</a>${analyze}<br>`
|
||||
}
|
||||
}
|
||||
return analyze
|
||||
}
|
||||
function cardHtmlShow(acct_id, id) {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var text = $('[toot-id=' + id + '] .toot a').attr('href')
|
||||
var urls = text.match(
|
||||
/https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
|
||||
)
|
||||
var id = $('[toot-id=' + id + '] .toot a')
|
||||
.parents('.cvo')
|
||||
.attr('toot-id')
|
||||
var start = 'https://' + domain + '/api/v1/statuses/' + id
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
//body: JSON.stringify({})
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
json = json.card
|
||||
if (json.html) {
|
||||
analyze =
|
||||
json.html +
|
||||
`<i class="material-icons sml pointer" onclick="pip('
|
||||
${id}
|
||||
')" title="
|
||||
${lang.lang_cards_pip}
|
||||
">picture_in_picture_alt</i>`
|
||||
}
|
||||
if (json.provider_name == 'Twitter') {
|
||||
var url = json.author_url
|
||||
var status = json.url.match(/^https:\/\/twitter.com\/[_a-zA-Z0-9-]+\/status\/([0-9]+)/);
|
||||
var statusId = false
|
||||
if(status){
|
||||
if(status.length > 0){
|
||||
var statusId = status[1]
|
||||
}
|
||||
}
|
||||
console.log(statusId)
|
||||
if(statusId){
|
||||
url = json.url
|
||||
analyze = `
|
||||
<blockquote class="twitter-tweet" data-dnt="true"><strong>${json.author_name}</strong><br>${json.description}<a href="${url}">${json.url}</a></blockquote>
|
||||
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
|
||||
`
|
||||
}
|
||||
}
|
||||
$('[toot-id=' + id + '] .additional').html(analyze)
|
||||
})
|
||||
}
|
||||
//各TL上方のLink[On/Off]
|
||||
function cardToggle(tlid) {
|
||||
var card = localStorage.getItem("card_" + tlid);
|
||||
var card = localStorage.getItem('card_' + tlid)
|
||||
if (!card) {
|
||||
localStorage.setItem("card_" + tlid, "true");
|
||||
$("#sta-card-" + tlid).text("Off");
|
||||
$("#sta-card-" + tlid).css("color", 'red');
|
||||
localStorage.setItem('card_' + tlid, 'true')
|
||||
$('#sta-card-' + tlid).text('Off')
|
||||
$('#sta-card-' + tlid).css('color', 'red')
|
||||
} else {
|
||||
localStorage.removeItem("card_" + tlid);
|
||||
$("#sta-card-" + tlid).text("On");
|
||||
$("#sta-card-" + tlid).css("color", '#009688');
|
||||
localStorage.removeItem('card_' + tlid)
|
||||
$('#sta-card-' + tlid).text('On')
|
||||
$('#sta-card-' + tlid).css('color', '#009688')
|
||||
}
|
||||
}
|
||||
//各TL上方のLink[On/Off]をチェック
|
||||
function cardCheck(tlid) {
|
||||
var card = localStorage.getItem("card_" + tlid);
|
||||
var card = localStorage.getItem('card_' + tlid)
|
||||
if (!card) {
|
||||
$("#sta-card-" + tlid).text("On");
|
||||
$("#sta-card-" + tlid).css("color", '#009688');
|
||||
$('#sta-card-' + tlid).text('On')
|
||||
$('#sta-card-' + tlid).css('color', '#009688')
|
||||
} else {
|
||||
$("#sta-card-" + tlid).text("Off");
|
||||
$("#sta-card-" + tlid).css("color", 'red');
|
||||
$('#sta-card-' + tlid).text('Off')
|
||||
$('#sta-card-' + tlid).css('color', 'red')
|
||||
}
|
||||
}
|
||||
|
||||
function mov(id, tlid, type) {
|
||||
if (tlid == "notf") {
|
||||
var tlide = "[data-notf=" + acct_id + "]";
|
||||
} else if (tlid == "user") {
|
||||
var tlide = "#his-data";
|
||||
var click = false
|
||||
if (tlid == 'notf') {
|
||||
var tlide = '[data-notf=' + acct_id + ']'
|
||||
} else if (tlid == 'user') {
|
||||
var tlide = '#his-data'
|
||||
} else {
|
||||
var tlide = "[tlid=" + tlid + "]";
|
||||
var tlide = '[tlid=' + tlid + ']'
|
||||
}
|
||||
var mouseover = localStorage.getItem("mouseover");
|
||||
var mouseover = localStorage.getItem('mouseover')
|
||||
if (!mouseover) {
|
||||
mouseover = "";
|
||||
mouseover = ''
|
||||
}
|
||||
if (mouseover == "yes") {
|
||||
mouseover = "hide";
|
||||
} else if (mouseover == "click") {
|
||||
if (type == "mv") {
|
||||
mouseover = "";
|
||||
if (mouseover == 'yes') {
|
||||
mouseover = 'hide'
|
||||
} else if (mouseover == 'click') {
|
||||
if (type == 'mv') {
|
||||
mouseover = ''
|
||||
} else {
|
||||
mouseover = "hide";
|
||||
mouseover = 'hide'
|
||||
}
|
||||
} else if (mouseover == "no") {
|
||||
mouseover = "";
|
||||
click = true
|
||||
} else if (mouseover == 'no') {
|
||||
mouseover = ''
|
||||
}
|
||||
if (mouseover == "hide") {
|
||||
$(tlide + " [toot-id=" + id + "] .area-actions").toggleClass("hide")
|
||||
$(tlide + " [toot-id=" + id + "] .area-side").toggleClass("hide")
|
||||
if (mouseover == 'hide') {
|
||||
if (click) {
|
||||
$(tlide + ' [toot-id=' + id + ']').toggleClass('hide-actions')
|
||||
} else {
|
||||
$(tlide + ' [toot-id=' + id + ']').removeClass('hide-actions')
|
||||
}
|
||||
|
||||
//$(tlide + " [toot-id=" + id + "] .area-vis").toggleClass("hide")
|
||||
//$(tlide + " [toot-id=" + id + "] .area-actions").toggleClass("hide")
|
||||
//$(tlide + " [toot-id=" + id + "] .area-side").toggleClass("hide")
|
||||
}
|
||||
}
|
||||
|
||||
function resetmv(type) {
|
||||
var mouseover = localStorage.getItem("mouseover");
|
||||
var mouseover = localStorage.getItem('mouseover')
|
||||
if (!mouseover) {
|
||||
mouseover = "";
|
||||
} else if (mouseover == "yes") {
|
||||
mouseover = "hide";
|
||||
} else if (mouseover == "no") {
|
||||
mouseover = "";
|
||||
} else if (mouseover == "click" && type != "mv") {
|
||||
mouseover = "hide";
|
||||
mouseover = ''
|
||||
} else if (mouseover == 'yes') {
|
||||
mouseover = 'hide'
|
||||
} else if (mouseover == 'no') {
|
||||
mouseover = ''
|
||||
} else if (mouseover == 'click' && type != 'mv') {
|
||||
mouseover = 'hide'
|
||||
}
|
||||
if (mouseover == "hide") {
|
||||
$(".area-actions").addClass("hide");
|
||||
$(".area-side").addClass("hide");
|
||||
if (mouseover == 'hide') {
|
||||
$('.cvo').addClass('hide-actions')
|
||||
//$(".area-vis").addClass("hide");
|
||||
//$(".area-actions").addClass("hide");
|
||||
//$(".area-side").addClass("hide");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//日付パーサー
|
||||
function date(str, datetype) {
|
||||
if (datetype == "relative") {
|
||||
|
||||
77
app/js/tl/directory.js
Normal file
77
app/js/tl/directory.js
Normal file
@@ -0,0 +1,77 @@
|
||||
'use strict'
|
||||
//ディレクトリ
|
||||
//ディレクトリトグル
|
||||
function dirMenu() {
|
||||
$("#dir-contents").html("");
|
||||
directory();
|
||||
$("#left-menu div").removeClass("active");
|
||||
$("#dirMenu").addClass("active");
|
||||
$(".menu-content").addClass("hide");
|
||||
$("#dir-box").removeClass("hide");
|
||||
}
|
||||
function dirselCk() {
|
||||
var acct = $("#dir-acct-sel").val();
|
||||
if (acct == "noauth") {
|
||||
$("#dirNoAuth").removeClass("hide");
|
||||
} else {
|
||||
$("#dirNoAuth").addClass("hide");
|
||||
directory();
|
||||
}
|
||||
}
|
||||
function directory(isMore) {
|
||||
var order = $("[name=sort]:checked").val();
|
||||
if (!order) {
|
||||
order = "active";
|
||||
}
|
||||
var local_only = $("#local_only:checked").val();
|
||||
if (local_only) {
|
||||
local_only = "true";
|
||||
} else {
|
||||
local_only = "false";
|
||||
}
|
||||
var acct_id = $("#dir-acct-sel").val();
|
||||
if (acct_id == "noauth") {
|
||||
var domain = $("#dirNoAuth-url").val();
|
||||
var at = "";
|
||||
} else {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
}
|
||||
if (isMore) {
|
||||
var addOffset = $("#dir-contents .cvo").length;
|
||||
} else {
|
||||
var addOffset = 0;
|
||||
$("#dir-contents").html("");
|
||||
}
|
||||
var start = "https://" + domain + "/api/v1/directory?order=" + order + "&local=" + local_only + "&offset=" + addOffset;
|
||||
console.log(start);
|
||||
fetch(start, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
$("#moreDir").removeClass("disabled");
|
||||
var html = userparse(json, null, acct_id, "dir", null);
|
||||
$("#dir-contents").append(html);
|
||||
jQuery("time.timeago").timeago();
|
||||
} else {
|
||||
$("#moreDir").addClass("disabled");
|
||||
}
|
||||
});
|
||||
}
|
||||
234
app/js/tl/dm.js
234
app/js/tl/dm.js
@@ -1,31 +1,38 @@
|
||||
//DM(Conv) TL
|
||||
function dm(acct_id, tlid, type, delc, voice) {
|
||||
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/conversations";
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
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 = '<div id="convList' + tlid + '">' + dmListParse(json, type, acct_id, tlid, "", mute) + '</div>';
|
||||
localStorage.setItem("lastobj_" + tlid, json[0].id)
|
||||
$("#timeline_" + tlid).html(templete);
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
todc();
|
||||
//reload(type, '', acct_id, tlid, data, mute, delc,voice);
|
||||
$(window).scrollTop(0);
|
||||
});
|
||||
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
var templete = '<div id="convList' + tlid + '">' + dmListParse(json, type, acct_id, tlid, "", mute) + "</div>";
|
||||
localStorage.setItem("lastobj_" + tlid, json[0].id);
|
||||
$("#timeline_" + tlid).html(templete);
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
todc();
|
||||
//reload(type, '', acct_id, tlid, data, mute, delc,voice);
|
||||
$(window).scrollTop(0);
|
||||
});
|
||||
}
|
||||
function dmmore(tlid) {
|
||||
var multi = localStorage.getItem("column");
|
||||
@@ -33,39 +40,50 @@ function dmmore(tlid) {
|
||||
var acct_id = obj[tlid].domain;
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var sid = $("#timeline_" + tlid + " .cvo").last().attr("unique-id");
|
||||
var sid = $("#timeline_" + tlid + " .cvo")
|
||||
.last()
|
||||
.attr("unique-id");
|
||||
var start = "https://" + domain + "/api/v1/conversations?max_id=" + sid;
|
||||
var type = "dm";
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
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 = '<div id="convList' + tlid + '">' + dmListParse(json, type, acct_id, tlid, "", mute) + '</div>';
|
||||
$("#timeline_" + tlid).append(templete);
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
moreloading = false;
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
var templete = '<div id="convList' + tlid + '">' + dmListParse(json, type, acct_id, tlid, "", mute) + "</div>";
|
||||
$("#timeline_" + tlid).append(templete);
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
moreloading = false;
|
||||
});
|
||||
}
|
||||
//DMオブジェクトパーサー(トゥート)
|
||||
function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
var templete = '';
|
||||
var templete = "";
|
||||
if (obj[0]) {
|
||||
localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, 'unix'));
|
||||
localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, "unix"));
|
||||
}
|
||||
|
||||
var actb = localStorage.getItem("action_btns");
|
||||
var actb = 're,rt,fav,qt,del,pin,red';
|
||||
var actb = "re,rt,fav,qt,del,pin,red";
|
||||
if (actb) {
|
||||
var actb = actb.split(',');
|
||||
var actb = actb.split(",");
|
||||
var disp = {};
|
||||
for (var k = 0; k < actb.length; k++) {
|
||||
if (k < 4) {
|
||||
@@ -198,7 +216,7 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
}
|
||||
var local = [];
|
||||
var times = [];
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var conv_id = obj[key].id;
|
||||
var toot = obj[key].last_status;
|
||||
var dis_name = escapeHTML(toot.account.display_name);
|
||||
@@ -209,14 +227,12 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
}
|
||||
//絵文字があれば
|
||||
if (actemojick) {
|
||||
Object.keys(toot.account.emojis).forEach(function (key5) {
|
||||
Object.keys(toot.account.emojis).forEach(function(key5) {
|
||||
var emoji = toot.account.emojis[key5];
|
||||
var shortcode = emoji.shortcode;
|
||||
var emoji_url = '<img src="' + emoji.url +
|
||||
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
||||
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
||||
var regExp = new RegExp(":" + shortcode + ":", "g");
|
||||
dis_name = dis_name.replace(regExp, emoji_url);
|
||||
|
||||
});
|
||||
}
|
||||
var noticeavatar = "";
|
||||
@@ -232,7 +248,7 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
var fullname = toot.account.acct + "@" + domain;
|
||||
}
|
||||
if (useremp) {
|
||||
Object.keys(useremp).forEach(function (key10) {
|
||||
Object.keys(useremp).forEach(function(key10) {
|
||||
var user = useremp[key10];
|
||||
if (user == fullname) {
|
||||
boostback = "emphasized";
|
||||
@@ -247,19 +263,19 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
var locked = "";
|
||||
}
|
||||
if (!toot.application) {
|
||||
var via = '';
|
||||
var via = "";
|
||||
viashow = "hide";
|
||||
} else {
|
||||
var via = escapeHTML(toot.application.name);
|
||||
//強調チェック
|
||||
Object.keys(emp).forEach(function (key6) {
|
||||
Object.keys(emp).forEach(function(key6) {
|
||||
var cli = emp[key6];
|
||||
if (cli == via) {
|
||||
boostback = "emphasized";
|
||||
}
|
||||
});
|
||||
//ミュートチェック
|
||||
Object.keys(mute).forEach(function (key7) {
|
||||
Object.keys(mute).forEach(function(key7) {
|
||||
var cli = mute[key7];
|
||||
if (cli == via) {
|
||||
boostback = "hide";
|
||||
@@ -274,20 +290,20 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
var spoil = escapeHTML(toot.spoiler_text);
|
||||
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.lang_parse_cwshow + '</a><br>';
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id + '\')" class="nex parsed">' + lang.lang_parse_cwshow + "</a><br>";
|
||||
} else {
|
||||
var ct1 = toot.content.split('</p>').length + toot.content.split('<br />').length - 2;
|
||||
var ct2 = toot.content.split('</p>').length + toot.content.split('<br>').length - 2;
|
||||
if (ct1 > ct2) { var ct = ct1; } else { var ct = ct2; }
|
||||
var ct1 = toot.content.split("</p>").length + toot.content.split("<br />").length - 2;
|
||||
var ct2 = toot.content.split("</p>").length + toot.content.split("<br>").length - 2;
|
||||
if (ct1 > ct2) {
|
||||
var ct = ct1;
|
||||
} else {
|
||||
var ct = ct2;
|
||||
}
|
||||
if ((sent < ct && $.mb_strlen($.strip_tags(toot.content)) > 5) || ($.strip_tags(toot.content).length > ltr && $.mb_strlen($.strip_tags(toot.content)) > 5)) {
|
||||
var content = '<span class="gray">' + lang.lang_parse_fulltext + '</span><br>' + toot.content
|
||||
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tags(
|
||||
toot.content), 0, 100) +
|
||||
'</span><span class="gray">' + lang.lang_parse_autofold + '</span>';
|
||||
var content = '<span class="gray">' + lang.lang_parse_fulltext + "</span><br>" + toot.content;
|
||||
var spoil = '<span class="cw-long-' + toot.id + '">' + $.mb_substr($.strip_tags(toot.content), 0, 100) + '</span><span class="gray">' + lang.lang_parse_autofold + "</span>";
|
||||
var spoiler = "cw cw_hide_" + toot.id;
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
||||
'\')" class="nex parsed">' + lang.lang_parse_more + '</a><br>';
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id + '\')" class="nex parsed">' + lang.lang_parse_more + "</a><br>";
|
||||
} else {
|
||||
var content = toot.content;
|
||||
var spoil = escapeHTML(toot.spoiler_text);
|
||||
@@ -295,14 +311,13 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
var spoiler_show = "";
|
||||
}
|
||||
}
|
||||
var urls = $.strip_tags(content).replace(/\n/g, " ").match(
|
||||
/https?:\/\/([-a-zA-Z0-9@.]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/
|
||||
);
|
||||
var urls = $.strip_tags(content)
|
||||
.replace(/\n/g, " ")
|
||||
.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/);
|
||||
if (urls) {
|
||||
var analyze = '<a onclick="additionalIndv(\'' + tlid + '\',' + acct_id +
|
||||
',\'' + id + '\')" class="add-show pointer">' + lang.lang_parse_url + '</a><br>';
|
||||
var analyze = "<a onclick=\"additionalIndv('" + tlid + "'," + acct_id + ",'" + id + '\')" class="add-show pointer">' + lang.lang_parse_url + "</a><br>";
|
||||
} else {
|
||||
var analyze = '';
|
||||
var analyze = "";
|
||||
}
|
||||
var viewer = "";
|
||||
var hasmedia = "";
|
||||
@@ -314,11 +329,10 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
}
|
||||
//絵文字があれば
|
||||
if (emojick) {
|
||||
Object.keys(toot.emojis).forEach(function (key5) {
|
||||
Object.keys(toot.emojis).forEach(function(key5) {
|
||||
var emoji = toot.emojis[key5];
|
||||
var shortcode = emoji.shortcode;
|
||||
var emoji_url = '<img src="' + emoji.url +
|
||||
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
||||
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
||||
var regExp = new RegExp(":" + shortcode + ":", "g");
|
||||
content = content.replace(regExp, emoji_url);
|
||||
spoil = spoil.replace(regExp, emoji_url);
|
||||
@@ -332,11 +346,10 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
}
|
||||
//絵文字があれば
|
||||
if (nicoemojick) {
|
||||
Object.keys(toot.profile_emojis).forEach(function (keynico) {
|
||||
Object.keys(toot.profile_emojis).forEach(function(keynico) {
|
||||
var emoji = toot.profile_emojis[keynico];
|
||||
var shortcode = emoji.shortcode;
|
||||
var emoji_url = '<img src="' + emoji.url +
|
||||
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
||||
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
|
||||
var regExp = new RegExp(":" + shortcode + ":", "g");
|
||||
content = content.replace(regExp, emoji_url);
|
||||
spoil = spoil.replace(regExp, emoji_url);
|
||||
@@ -356,21 +369,17 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
if (mediack) {
|
||||
hasmedia = "hasmedia";
|
||||
var cwdt = 100 / toot.media_attachments.length;
|
||||
Object.keys(toot.media_attachments).forEach(function (key2) {
|
||||
Object.keys(toot.media_attachments).forEach(function(key2) {
|
||||
var media = toot.media_attachments[key2];
|
||||
var purl = media.preview_url;
|
||||
media_ids = media_ids + media.id + ",";
|
||||
var url = media.url;
|
||||
if (toot.sensitive && nsfw) {
|
||||
var sense = "sensitive"
|
||||
var sense = "sensitive";
|
||||
} else {
|
||||
var sense = ""
|
||||
var sense = "";
|
||||
}
|
||||
viewer = viewer + '<a onclick="imgv(\'' + id + '\',\'' + key2 + '\',\'' +
|
||||
acct_id + '\')" id="' + id + '-image-' + key2 + '" data-url="' + url +
|
||||
'" data-type="' + media.type + '" class="img-parsed"><img src="' +
|
||||
purl + '" class="' + sense +
|
||||
' toot-img pointer" style="width:' + cwdt + '%; height:' + imh + 'px;"></a></span>';
|
||||
viewer = viewer + "<a onclick=\"imgv('" + id + "','" + key2 + "','" + acct_id + '\')" id="' + id + "-image-" + key2 + '" data-url="' + url + '" data-type="' + media.type + '" class="img-parsed"><img src="' + purl + '" class="' + sense + ' toot-img pointer" style="width:' + cwdt + "%; height:" + imh + 'px;"></a></span>';
|
||||
});
|
||||
media_ids = media_ids.slice(0, -1);
|
||||
} else {
|
||||
@@ -382,24 +391,21 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
//メンションであれば
|
||||
if (menck) {
|
||||
mentions = "";
|
||||
Object.keys(toot.mentions).forEach(function (key3) {
|
||||
Object.keys(toot.mentions).forEach(function(key3) {
|
||||
var mention = toot.mentions[key3];
|
||||
mentions = mentions + '<a onclick="udg(\'' + mention.id + '\',' +
|
||||
acct_id + ')" class="pointer">@' + mention.acct + '</a> ';
|
||||
mentions = mentions + "<a onclick=\"udg('" + mention.id + "'," + acct_id + ')" class="pointer">@' + mention.acct + "</a> ";
|
||||
});
|
||||
mentions = '<div style="float:right">' + mentions + '</div>';
|
||||
mentions = '<div style="float:right">' + mentions + "</div>";
|
||||
}
|
||||
var tagck = toot.tags[0];
|
||||
var tags = "";
|
||||
//タグであれば
|
||||
if (tagck) {
|
||||
Object.keys(toot.tags).forEach(function (key4) {
|
||||
Object.keys(toot.tags).forEach(function(key4) {
|
||||
var tag = toot.tags[key4];
|
||||
tags = tags + '<span class="hide" data-tag="' + tag.name + '">#' + tag.name + ':<a onclick="tl(\'tag\',\'' + tag.name + '\',' + acct_id +
|
||||
',\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag.name) + '">TL</a> <a onclick="brInsert(\'#' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag.name) + '">Toot</a> ' +
|
||||
'<a onclick="tagPin(\'' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag.name) + '">Pin</a></span> ';
|
||||
tags = tags + '<span class="hide" data-tag="' + tag.name + '">#' + tag.name + ":<a onclick=\"tl('tag','" + tag.name + "'," + acct_id + ',\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", "#" + tag.name) + '">TL</a> <a onclick="brInsert(\'#' + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", "#" + tag.name) + '">Toot</a> ' + "<a onclick=\"tagPin('" + tag.name + '\')" class="pointer" title="' + lang.lang_parse_tagpin.replace("{{tag}}", "#" + tag.name) + '">Pin</a></span> ';
|
||||
});
|
||||
tags = '<div style="float:right">' + tags + '</div>';
|
||||
tags = '<div style="float:right">' + tags + "</div>";
|
||||
}
|
||||
//アニメ再生
|
||||
if (gif == "yes") {
|
||||
@@ -409,13 +415,13 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
}
|
||||
//ワードミュート
|
||||
if (wordmute) {
|
||||
Object.keys(wordmute).forEach(function (key8) {
|
||||
Object.keys(wordmute).forEach(function(key8) {
|
||||
var worde = wordmute[key8];
|
||||
if (worde) {
|
||||
if (worde.tag) {
|
||||
var word = worde.tag;
|
||||
} else {
|
||||
var word = worde
|
||||
var word = worde;
|
||||
}
|
||||
var regExp = new RegExp(word, "g");
|
||||
if ($.strip_tags(content).match(regExp)) {
|
||||
@@ -426,7 +432,7 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
}
|
||||
//ワード強調
|
||||
if (wordemp) {
|
||||
Object.keys(wordemp).forEach(function (key9) {
|
||||
Object.keys(wordemp).forEach(function(key9) {
|
||||
var word = wordemp[key9];
|
||||
if (word) {
|
||||
var word = word.tag;
|
||||
@@ -455,23 +461,21 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
if (cards.image) {
|
||||
var twiImg = '<br><img src="' + cards.image + '">';
|
||||
} else {
|
||||
var twiImg = '';
|
||||
var twiImg = "";
|
||||
}
|
||||
analyze = '<blockquote class="twitter-tweet"><b>' + escapeHTML(cards.author_name) + '</b><br>' + escapeHTML(cards.description) + twiImg + '</blockquote>';
|
||||
analyze = '<blockquote class="twitter-tweet"><b>' + escapeHTML(cards.author_name) + "</b><br>" + escapeHTML(cards.description) + twiImg + "</blockquote>";
|
||||
}
|
||||
if (cards.title) {
|
||||
analyze = "<span class=\"gray\">URL" + lang.lang_cards_check + ":<br>Title:" + escapeHTML(cards.title) + "<br>" +
|
||||
escapeHTML(cards.description) + "</span>";
|
||||
analyze = '<span class="gray">URL' + lang.lang_cards_check + ":<br>Title:" + escapeHTML(cards.title) + "<br>" + escapeHTML(cards.description) + "</span>";
|
||||
}
|
||||
if (cards.html) {
|
||||
analyze = cards.html + '<i class="material-icons" onclick="pip(' + id + ')" title="' + lang.lang_cards_pip + '">picture_in_picture_alt</i>';
|
||||
}
|
||||
|
||||
}
|
||||
//Ticker
|
||||
var tickerdom = "";
|
||||
if (ticker) {
|
||||
var tickerdata = localStorage.getItem("ticker")
|
||||
var tickerdata = localStorage.getItem("ticker");
|
||||
if (tickerdata) {
|
||||
var tickerdata = JSON.parse(tickerdata);
|
||||
|
||||
@@ -482,41 +486,13 @@ function dmListParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
for (var i = 0; i < tickerdata.length; i++) {
|
||||
var value = tickerdata[i];
|
||||
if (value.domain == thisdomain) {
|
||||
var tickerdom = '<div style="background:linear-gradient(to left,transparent, ' + value.bg + ' 96%) !important; color:' + value.text + ';width:100%; height:0.9rem; font-size:0.8rem;"><img src="' + value.image + '" style="height:100%;"><span style="position:relative; top:-0.2rem;"> ' + escapeHTML(value.name) + '</span></div>';
|
||||
var tickerdom = '<div style="background:linear-gradient(to left,transparent, ' + value.bg + " 96%) !important; color:" + value.text + ';width:100%; height:0.9rem; font-size:0.8rem;"><img src="' + value.image + '" style="height:100%;"><span style="position:relative; top:-0.2rem;"> ' + escapeHTML(value.name) + "</span></div>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
|
||||
boostback + ' ' + fav_app +
|
||||
' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[
|
||||
key].created_at, 'unix') + '" ' + if_notf + ' onclick="dmStatus()">' +
|
||||
'<div class="area-notice"><span class="gray sharesta">' + notice + home +
|
||||
'</span></div>' +
|
||||
'<div class="area-icon"><a onclick="udg(\'' + toot.account.id +
|
||||
'\',' + acct_id + ');" user="' + toot.account.acct + '" class="udg">' +
|
||||
'<img src="' + avatar +
|
||||
'" width="40" class="prof-img" user="' + toot.account.acct +
|
||||
'"></a>' + noticeavatar + '</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.account.acct + locked + '</span></div>' +
|
||||
'<div class="flex-time"><span class="cbadge cbadge-hover pointer waves-effect" onclick="tootUriCopy(\'' +
|
||||
toot.url + '\');" title="' + date(toot.created_at, 'absolute') +
|
||||
'(' + lang.lang_parse_clickcopyurl + ')"><i class="far fa-clock-o"></i>' +
|
||||
date(toot.created_at, datetype) + '</span>' +
|
||||
'</div></div>' +
|
||||
'<div class="area-toot">' + tickerdom + '<span class="' +
|
||||
api_spoil + ' cw_text_' + toot.id + '"><span class="cw_text">' + spoil + "</span>" + spoiler_show +
|
||||
'</span><span class="toot ' + spoiler + '">' + content +
|
||||
'</span>' +
|
||||
'' + viewer + '' +
|
||||
'<br><a onclick="details(\'' + toot.id + '\',' + acct_id +
|
||||
',\'' + tlid + '\',\'dm\')" class="pointer waves-effect">' + lang.lang_parse_thread + '</a></div>' +
|
||||
'<div class="area-vis"></div>' +
|
||||
'</div></div>';
|
||||
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' + boostback + " " + fav_app + " " + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="' + media_ids + ' " unixtime="' + date(obj[key].created_at, "unix") + '" ' + if_notf + ' onclick="dmStatus()">' + '<div class="area-notice"><span class="gray sharesta">' + notice + home + "</span></div>" + '<div class="area-icon"><a onclick="udg(\'' + toot.account.id + "'," + acct_id + ');" user="' + toot.account.acct + '" class="udg">' + '<img src="' + avatar + '" width="40" class="prof-img" user="' + toot.account.acct + '"></a>' + noticeavatar + "</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.account.acct + locked + "</span></div>" + '<div class="flex-time"><span class="cbadge cbadge-hover pointer waves-effect" onclick="tootUriCopy(\'' + toot.url + '\');" title="' + date(toot.created_at, "absolute") + "(" + lang.lang_parse_clickcopyurl + ')"><i class="far fa-clock-o"></i>' + date(toot.created_at, datetype) + "</span>" + "</div></div>" + '<div class="area-toot">' + tickerdom + '<span class="' + api_spoil + " cw_text_" + toot.id + '"><span class="cw_text">' + spoil + "</span>" + spoiler_show + '</span><span class="toot ' + spoiler + '">' + content + "</span>" + "" + viewer + "" + "<br><a onclick=\"details('" + toot.id + "'," + acct_id + ",'" + tlid + "','dm')\" class=\"pointer waves-effect\">" + lang.lang_parse_thread + "</a></div>" + '<div class="area-vis"></div>' + "</div></div>";
|
||||
});
|
||||
return templete;
|
||||
}
|
||||
|
||||
@@ -1,381 +1,448 @@
|
||||
'use strict'
|
||||
/*メディアフィルター機能*/
|
||||
//各TL上方のMedia[On/Off]
|
||||
function mediaToggle(tlid) {
|
||||
var media = localStorage.getItem("media_" + tlid);
|
||||
var media = localStorage.getItem('media_' + tlid)
|
||||
if (media) {
|
||||
localStorage.removeItem("media_" + tlid);
|
||||
$("#sta-media-" + tlid).text("Off");
|
||||
$("#sta-media-" + tlid).css("color", 'red');
|
||||
$("#timeline_" + tlid).removeClass("media-filter")
|
||||
localStorage.removeItem('media_' + tlid)
|
||||
$('#sta-media-' + tlid).text('Off')
|
||||
$('#sta-media-' + tlid).css('color', 'red')
|
||||
$('#timeline_' + tlid).removeClass('media-filter')
|
||||
} else {
|
||||
localStorage.setItem("media_" + tlid, "true");
|
||||
$("#sta-media-" + tlid).text("On");
|
||||
$("#sta-media-" + tlid).css("color", '#009688');
|
||||
$("#timeline_" + tlid).addClass("media-filter")
|
||||
localStorage.setItem('media_' + tlid, 'true')
|
||||
$('#sta-media-' + tlid).text('On')
|
||||
$('#sta-media-' + tlid).css('color', '#009688')
|
||||
$('#timeline_' + tlid).addClass('media-filter')
|
||||
}
|
||||
}
|
||||
//各TL上方のBT[BTOnly/BTExc/Off]
|
||||
function ebtToggle(tlid) {
|
||||
var ebt = localStorage.getItem("ebt_" + tlid);
|
||||
if (ebt == "true") {
|
||||
localStorage.setItem("ebt_" + tlid, "but");
|
||||
$("#sta-bt-" + tlid).text("BT Only");
|
||||
$("#sta-bt-" + tlid).css("color", '#ff9800');
|
||||
$("#timeline_" + tlid).addClass("except-bt-filter")
|
||||
$("#timeline_" + tlid).removeClass("bt-filter")
|
||||
} else if (ebt == "but") {
|
||||
localStorage.removeItem("ebt_" + tlid);
|
||||
$("#sta-bt-" + tlid).text("Off");
|
||||
$("#sta-bt-" + tlid).css("color", 'red');
|
||||
$("#timeline_" + tlid).removeClass("bt-filter")
|
||||
$("#timeline_" + tlid).removeClass("except-bt-filter")
|
||||
var ebt = localStorage.getItem('ebt_' + tlid)
|
||||
if (ebt == 'true') {
|
||||
localStorage.setItem('ebt_' + tlid, 'but')
|
||||
$('#sta-bt-' + tlid).text('BT Only')
|
||||
$('#sta-bt-' + tlid).css('color', '#ff9800')
|
||||
$('#timeline_' + tlid).addClass('except-bt-filter')
|
||||
$('#timeline_' + tlid).removeClass('bt-filter')
|
||||
} else if (ebt == 'but') {
|
||||
localStorage.removeItem('ebt_' + tlid)
|
||||
$('#sta-bt-' + tlid).text('Off')
|
||||
$('#sta-bt-' + tlid).css('color', 'red')
|
||||
$('#timeline_' + tlid).removeClass('bt-filter')
|
||||
$('#timeline_' + tlid).removeClass('except-bt-filter')
|
||||
} else {
|
||||
localStorage.setItem("ebt_" + tlid, "true");
|
||||
$("#sta-bt-" + tlid).text("BT Ex");
|
||||
$("#sta-bt-" + tlid).css("color", '#009688');
|
||||
$("#timeline_" + tlid).addClass("bt-filter")
|
||||
$("#timeline_" + tlid).removeClass("except-bt-filter")
|
||||
localStorage.setItem('ebt_' + tlid, 'true')
|
||||
$('#sta-bt-' + tlid).text('BT Ex')
|
||||
$('#sta-bt-' + tlid).css('color', '#009688')
|
||||
$('#timeline_' + tlid).addClass('bt-filter')
|
||||
$('#timeline_' + tlid).removeClass('except-bt-filter')
|
||||
}
|
||||
}
|
||||
//各TL上方のMedia[On/Off]をチェック
|
||||
function mediaCheck(tlid) {
|
||||
var media = localStorage.getItem("media_" + tlid);
|
||||
var media = localStorage.getItem('media_' + tlid)
|
||||
if (media) {
|
||||
$("#sta-media-" + tlid).text("On");
|
||||
$("#sta-media-" + tlid).css("color", '#009688');
|
||||
$("#timeline_" + tlid).addClass("media-filter")
|
||||
$('#sta-media-' + tlid).text('On')
|
||||
$('#sta-media-' + tlid).css('color', '#009688')
|
||||
$('#timeline_' + tlid).addClass('media-filter')
|
||||
} else {
|
||||
$("#sta-media-" + tlid).text("Off");
|
||||
$("#sta-media-" + tlid).css("color", 'red');
|
||||
$("#timeline_" + tlid).removeClass("media-filter")
|
||||
$('#sta-media-' + tlid).text('Off')
|
||||
$('#sta-media-' + tlid).css('color', 'red')
|
||||
$('#timeline_' + tlid).removeClass('media-filter')
|
||||
}
|
||||
}
|
||||
//各TL上方のBT[On/Off]をチェック
|
||||
function ebtCheck(tlid) {
|
||||
var ebt = localStorage.getItem("ebt_" + tlid);
|
||||
if (ebt == "true") {
|
||||
$("#sta-bt-" + tlid).text("BT Ex");
|
||||
$("#sta-bt-" + tlid).css("color", '#009688');
|
||||
$("#timeline_" + tlid).addClass("bt-filter")
|
||||
$("#timeline_" + tlid).removeClass("except-bt-filter")
|
||||
} else if (ebt == "but") {
|
||||
$("#sta-bt-" + tlid).text("BT Only");
|
||||
$("#sta-bt-" + tlid).css("color", '#ff9800');
|
||||
$("#timeline_" + tlid).addClass("except-bt-filter")
|
||||
$("#timeline_" + tlid).removeClass("bt-filter")
|
||||
var ebt = localStorage.getItem('ebt_' + tlid)
|
||||
if (ebt == 'true') {
|
||||
$('#sta-bt-' + tlid).text('BT Ex')
|
||||
$('#sta-bt-' + tlid).css('color', '#009688')
|
||||
$('#timeline_' + tlid).addClass('bt-filter')
|
||||
$('#timeline_' + tlid).removeClass('except-bt-filter')
|
||||
} else if (ebt == 'but') {
|
||||
$('#sta-bt-' + tlid).text('BT Only')
|
||||
$('#sta-bt-' + tlid).css('color', '#ff9800')
|
||||
$('#timeline_' + tlid).addClass('except-bt-filter')
|
||||
$('#timeline_' + tlid).removeClass('bt-filter')
|
||||
} else {
|
||||
$("#sta-bt-" + tlid).text("Off");
|
||||
$("#sta-bt-" + tlid).css("color", 'red');
|
||||
$("#timeline_" + tlid).removeClass("bt-filter")
|
||||
$("#timeline_" + tlid).removeClass("except-bt-filter")
|
||||
$('#sta-bt-' + tlid).text('Off')
|
||||
$('#sta-bt-' + tlid).css('color', 'red')
|
||||
$('#timeline_' + tlid).removeClass('bt-filter')
|
||||
$('#timeline_' + tlid).removeClass('except-bt-filter')
|
||||
}
|
||||
}
|
||||
/* 削除追跡*/
|
||||
function catchToggle(tlid) {
|
||||
var catchck = localStorage.getItem("catch_" + tlid);
|
||||
var catchck = localStorage.getItem('catch_' + tlid)
|
||||
if (catchck) {
|
||||
localStorage.removeItem("catch_" + tlid);
|
||||
$("#sta-del-" + tlid).text("Off");
|
||||
$("#sta-del-" + tlid).css("color", 'red');
|
||||
parseColumn(tlid);
|
||||
localStorage.removeItem('catch_' + tlid)
|
||||
$('#sta-del-' + tlid).text('Off')
|
||||
$('#sta-del-' + tlid).css('color', 'red')
|
||||
parseColumn(tlid)
|
||||
} else {
|
||||
localStorage.setItem("catch_" + tlid, "true");
|
||||
$("#sta-del-" + tlid).text("On");
|
||||
$("#sta-del-" + tlid).css("color", '#009688');
|
||||
parseColumn(tlid);
|
||||
localStorage.setItem('catch_' + tlid, 'true')
|
||||
$('#sta-del-' + tlid).text('On')
|
||||
$('#sta-del-' + tlid).css('color', '#009688')
|
||||
parseColumn(tlid)
|
||||
}
|
||||
}
|
||||
function catchCheck(tlid) {
|
||||
var catchck = localStorage.getItem("catch_" + tlid);
|
||||
var catchck = localStorage.getItem('catch_' + tlid)
|
||||
if (catchck) {
|
||||
$("#sta-del-" + tlid).text("On");
|
||||
$("#sta-del-" + tlid).css("color", '#009688');
|
||||
$('#sta-del-' + tlid).text('On')
|
||||
$('#sta-del-' + tlid).css('color', '#009688')
|
||||
} else {
|
||||
$("#sta-del-" + tlid).text("Off");
|
||||
$("#sta-del-" + tlid).css("color", 'red');
|
||||
$('#sta-del-' + tlid).text('Off')
|
||||
$('#sta-del-' + tlid).css('color', 'red')
|
||||
}
|
||||
}
|
||||
function delreset(tlid) {
|
||||
$("[tlid=" + tlid + "] .by_delcatch").hide();
|
||||
$("[tlid=" + tlid + "] .by_delcatch").remove();
|
||||
|
||||
$('[tlid=' + tlid + '] .by_delcatch').hide()
|
||||
$('[tlid=' + tlid + '] .by_delcatch').remove()
|
||||
}
|
||||
/*ワードフィルター機能*/
|
||||
function filterMenu() {
|
||||
$("#left-menu div").removeClass("active");
|
||||
$("#filterMenu").addClass("active");
|
||||
$(".menu-content").addClass("hide");
|
||||
$("#filter-box").removeClass("hide");
|
||||
$('#left-menu div').removeClass('active')
|
||||
$('#filterMenu').addClass('active')
|
||||
$('.menu-content').addClass('hide')
|
||||
$('#filter-box').removeClass('hide')
|
||||
}
|
||||
function filter() {
|
||||
$("#filtered-words").html("");
|
||||
$("#filter-edit-id").val("")
|
||||
var acct_id = $("#filter-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/filters"
|
||||
$('#filtered-words').html('')
|
||||
$('#filter-edit-id').val('')
|
||||
var acct_id = $('#filter-acct-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/filters'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var filters = "";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var filterword = json[key];
|
||||
var context = filterword.context.join(',');
|
||||
filters = filters + escapeHTML(filterword.phrase) + '<span class="sml">(for ' + context + ')</span>:<a onclick="filterEdit(\'' + filterword.id + '\',\'' + acct_id +
|
||||
'\')" class="pointer">' + lang.lang_edit + '</a>/<a onclick="filterDel(' + filterword.id + ',' + acct_id +
|
||||
')" class="pointer">' + lang.lang_del + '</a><br> ';
|
||||
});
|
||||
if (filters == "") {
|
||||
filters = lang.lang_filter_nodata + "<br>";
|
||||
}
|
||||
$("#filtered-words").html(filters);
|
||||
} else {
|
||||
$("#filtered-words").html(lang_filter_nodata);
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var filters = ''
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var filterword = json[key]
|
||||
var context = filterword.context.join(',')
|
||||
filters =
|
||||
filters +
|
||||
escapeHTML(filterword.phrase) +
|
||||
`<span class="sml">(for ${context})</span>:
|
||||
<a onclick="filterEdit('${filterword.id}','${acct_id}')" class="pointer">
|
||||
${lang.lang_edit}
|
||||
</a>/
|
||||
<a onclick="filterDel('${filterword.id}','${acct_id}')" class="pointer">
|
||||
${lang.lang_del}
|
||||
</a><br> `
|
||||
})
|
||||
if (filters == '') {
|
||||
filters = lang.lang_filter_nodata + '<br>'
|
||||
}
|
||||
$('#filtered-words').html(filters)
|
||||
} else {
|
||||
$('#filtered-words').html(lang_filter_nodata)
|
||||
}
|
||||
})
|
||||
}
|
||||
function filterTime(day, hour, min) {
|
||||
$("#days_filter").val(day)
|
||||
$("#hours_filter").val(hour)
|
||||
$("#mins_filter").val(min)
|
||||
$('#days_filter').val(day)
|
||||
$('#hours_filter').val(hour)
|
||||
$('#mins_filter').val(min)
|
||||
}
|
||||
function makeNewFilter() {
|
||||
var acct_id = $("#filter-acct-sel").val();
|
||||
var phr = $("#filter-add-word").val();
|
||||
var cont = [];
|
||||
if ($("#home_filter:checked").val()) {
|
||||
cont.push("home");
|
||||
var acct_id = $('#filter-acct-sel').val()
|
||||
var phr = $('#filter-add-word').val()
|
||||
var cont = []
|
||||
if ($('#home_filter:checked').val()) {
|
||||
cont.push('home')
|
||||
}
|
||||
if ($("#local_filter:checked").val()) {
|
||||
cont.push("public");
|
||||
if ($('#local_filter:checked').val()) {
|
||||
cont.push('public')
|
||||
}
|
||||
if ($("#notf_filter:checked").val()) {
|
||||
cont.push("notifications");
|
||||
if ($('#notf_filter:checked').val()) {
|
||||
cont.push('notifications')
|
||||
}
|
||||
if ($("#conv_filter:checked").val()) {
|
||||
cont.push("thread");
|
||||
if ($('#conv_filter:checked').val()) {
|
||||
cont.push('thread')
|
||||
}
|
||||
if (!cont.length) {
|
||||
$("#filtered-words").html('Error:' + lang.lang_filter_errordegree);
|
||||
$('#filtered-words').html('Error:' + lang.lang_filter_errordegree)
|
||||
}
|
||||
var exc = $("#except_filter:checked").val();
|
||||
var who = $("#wholeword_filter:checked").val();
|
||||
var exc = $('#except_filter:checked').val()
|
||||
var who = $('#wholeword_filter:checked').val()
|
||||
if (!who) {
|
||||
who = false;
|
||||
who = false
|
||||
}
|
||||
var time = $("#days_filter").val() * 24 * 60 * 60 + $("#hours_filter").val() * 60 * 60 + $("#mins_filter").val() * 60;
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if ($("#filter-edit-id").val()) {
|
||||
var start = "https://" + domain + "/api/v1/filters/" + $("#filter-edit-id").val();
|
||||
var method = "PUT"
|
||||
var time =
|
||||
$('#days_filter').val() * 24 * 60 * 60 +
|
||||
$('#hours_filter').val() * 60 * 60 +
|
||||
$('#mins_filter').val() * 60
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if ($('#filter-edit-id').val()) {
|
||||
var start = 'https://' + domain + '/api/v1/filters/' + $('#filter-edit-id').val()
|
||||
var method = 'PUT'
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/filters"
|
||||
var method = "POST"
|
||||
var start = 'https://' + domain + '/api/v1/filters'
|
||||
var method = 'POST'
|
||||
}
|
||||
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open(method, start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({
|
||||
phrase: phr,
|
||||
context: cont,
|
||||
irreversible: exc,
|
||||
whole_word: who,
|
||||
expires_in: time
|
||||
}));
|
||||
httpreq.onreadystatechange = function () {
|
||||
var httpreq = new XMLHttpRequest()
|
||||
httpreq.open(method, start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.send(
|
||||
JSON.stringify({
|
||||
phrase: phr,
|
||||
context: cont,
|
||||
irreversible: exc,
|
||||
whole_word: who,
|
||||
expires_in: time
|
||||
})
|
||||
)
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
filter();
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
filter()
|
||||
filterUpdate(acct_id)
|
||||
$("#filter-add-word").val("");
|
||||
$("#home_filter").prop("checked", false);
|
||||
$("#local_filter").prop("checked", false);
|
||||
$("#notf_filter").prop("checked", false);
|
||||
$("#conv_filter").prop("checked", false);
|
||||
$("#except_filter").prop("checked", false);
|
||||
$("#wholeword_filter").prop("checked", false);
|
||||
$("#days_filter").val("0");
|
||||
$("#hours_filter").val("0");
|
||||
$("#mins_filter").val("0");
|
||||
$("#add-filter-btn").text(lang.lang_add);
|
||||
$("#filter-edit-id").val("")
|
||||
$('#filter-add-word').val('')
|
||||
$('#home_filter').prop('checked', false)
|
||||
$('#local_filter').prop('checked', false)
|
||||
$('#notf_filter').prop('checked', false)
|
||||
$('#conv_filter').prop('checked', false)
|
||||
$('#except_filter').prop('checked', false)
|
||||
$('#wholeword_filter').prop('checked', false)
|
||||
$('#days_filter').val('0')
|
||||
$('#hours_filter').val('0')
|
||||
$('#mins_filter').val('0')
|
||||
$('#add-filter-btn').text(lang.lang_add)
|
||||
$('#filter-edit-id').val('')
|
||||
}
|
||||
}
|
||||
}
|
||||
function filterEdit(id, acct_id) {
|
||||
$("#filter-add-word").val("");
|
||||
$("#home_filter").prop("checked", false);
|
||||
$("#local_filter").prop("checked", false);
|
||||
$("#notf_filter").prop("checked", false);
|
||||
$("#conv_filter").prop("checked", false);
|
||||
$("#except_filter").prop("checked", false);
|
||||
$("#wholeword_filter").prop("checked", false);
|
||||
$("#days_filter").val("0");
|
||||
$("#hours_filter").val("0");
|
||||
$("#mins_filter").val("0");
|
||||
$("#add-filter-btn").text(lang.lang_edit);
|
||||
$("#filter-edit-id").val(id);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/filters/" + id
|
||||
$('#filter-add-word').val('')
|
||||
$('#home_filter').prop('checked', false)
|
||||
$('#local_filter').prop('checked', false)
|
||||
$('#notf_filter').prop('checked', false)
|
||||
$('#conv_filter').prop('checked', false)
|
||||
$('#except_filter').prop('checked', false)
|
||||
$('#wholeword_filter').prop('checked', false)
|
||||
$('#days_filter').val('0')
|
||||
$('#hours_filter').val('0')
|
||||
$('#mins_filter').val('0')
|
||||
$('#add-filter-btn').text(lang.lang_edit)
|
||||
$('#filter-edit-id').val(id)
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/filters/' + 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) {
|
||||
if (json) {
|
||||
var now = new Date();
|
||||
now = now.getTime();
|
||||
var now = Math.floor(now / 1000);
|
||||
$("#filter-add-word").val(json.phrase);
|
||||
Object.keys(json.context).forEach(function (key) {
|
||||
var context = json.context[key];
|
||||
$("[value=" + context + "]").prop("checked", true);
|
||||
});
|
||||
if (json.irreversible) {
|
||||
$("#except_filter").prop("checked", true);
|
||||
}
|
||||
if (json.whole_word) {
|
||||
$("#wholeword_filter").prop("checked", true);
|
||||
}
|
||||
var expires = date(json.expires_at, 'unix') - now;
|
||||
var mins = Math.floor(expires / 60) % 60;
|
||||
var hours = Math.floor(expires / 3600) % 24;
|
||||
var days = Math.floor(expires / 3600 / 24);
|
||||
$("#days_filter").val(days);
|
||||
$("#hours_filter").val(hours);
|
||||
$("#mins_filter").val(mins);
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var now = new Date()
|
||||
now = now.getTime()
|
||||
var now = Math.floor(now / 1000)
|
||||
$('#filter-add-word').val(json.phrase)
|
||||
Object.keys(json.context).forEach(function(key) {
|
||||
var context = json.context[key]
|
||||
$('[value=' + context + ']').prop('checked', true)
|
||||
})
|
||||
if (json.irreversible) {
|
||||
$('#except_filter').prop('checked', true)
|
||||
}
|
||||
if (json.whole_word) {
|
||||
$('#wholeword_filter').prop('checked', true)
|
||||
}
|
||||
var expires = date(json.expires_at, 'unix') - now
|
||||
var mins = Math.floor(expires / 60) % 60
|
||||
var hours = Math.floor(expires / 3600) % 24
|
||||
var days = Math.floor(expires / 3600 / 24)
|
||||
$('#days_filter').val(days)
|
||||
$('#hours_filter').val(hours)
|
||||
$('#mins_filter').val(mins)
|
||||
}
|
||||
})
|
||||
}
|
||||
function filterDel(id, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/filters/" + 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 () {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/filters/' + 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) {
|
||||
var json = httpreq.response;
|
||||
filter();
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
filter()
|
||||
filterUpdate(acct_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
function getFilter(acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
var start = "https://" + domain + "/api/v1/filters"
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
var start = 'https://' + domain + '/api/v1/filters'
|
||||
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) {
|
||||
localStorage.setItem("filter_" + acct_id, JSON.stringify(json));
|
||||
});
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
localStorage.setItem('filter_' + acct_id, JSON.stringify(json))
|
||||
})
|
||||
} else {
|
||||
localStorage.setItem("filter_" + acct_id, JSON.stringify({}));
|
||||
localStorage.setItem('filter_' + acct_id, JSON.stringify({}))
|
||||
}
|
||||
}
|
||||
function getFilterType(json, type) {
|
||||
if (!json) {
|
||||
return [];
|
||||
return []
|
||||
}
|
||||
if (type == "local") {
|
||||
type = "public";
|
||||
} else if (type == "list") {
|
||||
type = "home";
|
||||
} else if (type == "notf") {
|
||||
type = "notifi";
|
||||
if (type == 'local') {
|
||||
type = 'public'
|
||||
} else if (type == 'list') {
|
||||
type = 'home'
|
||||
} else if (type == 'notf') {
|
||||
type = 'notifi'
|
||||
}
|
||||
var mutedfilters = [];
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var filterword = json[key];
|
||||
var phrases = filterword.phrase;
|
||||
if (filterword.context.join(",").indexOf(type) !== -1) {
|
||||
mutedfilters.push(phrases);
|
||||
var mutedfilters = []
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var filterword = json[key]
|
||||
var phrases = filterword.phrase
|
||||
var arr = filterword.context
|
||||
if (arr.join(',').indexOf(type) !== -1) {
|
||||
mutedfilters.push(phrases)
|
||||
} else if (type == 'mix'){
|
||||
if (arr.indexOf('home') !== -1 || arr.indexOf('public') !== -1) {
|
||||
mutedfilters.push(phrases)
|
||||
}
|
||||
}
|
||||
});
|
||||
return mutedfilters;
|
||||
})
|
||||
return mutedfilters
|
||||
}
|
||||
function getFilterTypeByAcct(acct_id, type) {
|
||||
if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
|
||||
var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
|
||||
} else {
|
||||
var mute = []
|
||||
}
|
||||
return mute
|
||||
}
|
||||
function filterUpdate(acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/filters"
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/filters'
|
||||
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) {
|
||||
localStorage.setItem("filter_" + acct_id, JSON.stringify(json));
|
||||
filterUpdateInternal(json, "home");
|
||||
filterUpdateInternal(json, "local");
|
||||
filterUpdateInternal(json, "notf");
|
||||
filterUpdateInternal(json, "pub");
|
||||
});
|
||||
|
||||
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
localStorage.setItem('filter_' + acct_id, JSON.stringify(json))
|
||||
filterUpdateInternal(json, 'home')
|
||||
filterUpdateInternal(json, 'local')
|
||||
filterUpdateInternal(json, 'notf')
|
||||
filterUpdateInternal(json, 'pub')
|
||||
})
|
||||
}
|
||||
function filterUpdateInternal(json, type) {
|
||||
var home = getFilterType(json, type);
|
||||
var wordmute = localStorage.getItem("word_mute");
|
||||
var home = getFilterType(json, type)
|
||||
var wordmute = localStorage.getItem('word_mute')
|
||||
if (wordmute) {
|
||||
var wordmute = JSON.parse(wordmute);
|
||||
home = home.concat(wordmute);
|
||||
var wordmute = JSON.parse(wordmute)
|
||||
home = home.concat(wordmute)
|
||||
}
|
||||
if (home) {
|
||||
$("[data-acct=" + acct_id + "] [data-type=" + type + "] .cvo").each(function (i, elem) {
|
||||
var id = $(elem).attr("toot-id");
|
||||
$("[toot-id=" + id + "]").removeClass("hide");
|
||||
var text = $(elem).find('.toot').html();
|
||||
Object.keys(home).forEach(function (key8) {
|
||||
var word = home[key8];
|
||||
var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
|
||||
$('[data-acct=' + acct_id + '] [data-type=' + type + '] .cvo').each(function(i, elem) {
|
||||
var id = $(elem).attr('toot-id')
|
||||
$('[toot-id=' + id + ']').removeClass('hide')
|
||||
var text = $(elem)
|
||||
.find('.toot')
|
||||
.html()
|
||||
Object.keys(home).forEach(function(key8) {
|
||||
var word = home[key8]
|
||||
var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
|
||||
if ($.strip_tags(text).match(regExp)) {
|
||||
$("[toot-id=" + id + "]").addClass("hide");
|
||||
$('[toot-id=' + id + ']').addClass('hide')
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -386,73 +453,73 @@ function filterUpdateInternal(json, type) {
|
||||
*/
|
||||
//通知フィルター
|
||||
function exclude(key) {
|
||||
localStorage.setItem("exclude-" + key, "")
|
||||
var excludetxt = localStorage.getItem("exclude-" + key);
|
||||
localStorage.setItem('exclude-' + key, '')
|
||||
var excludetxt = localStorage.getItem('exclude-' + key)
|
||||
if ($('#exc-reply-' + key + ':checked').val()) {
|
||||
excludetxt = "?exclude_types[]=mention"
|
||||
excludetxt = '?exclude_types[]=mention'
|
||||
}
|
||||
if ($('#exc-fav-' + key + ':checked').val()) {
|
||||
if (excludetxt || excludetxt !="") {
|
||||
excludetxt = excludetxt + "&exclude_types[]=favourite"
|
||||
if (excludetxt || excludetxt != '') {
|
||||
excludetxt = excludetxt + '&exclude_types[]=favourite'
|
||||
} else {
|
||||
excludetxt = "?exclude_types[]=favourite"
|
||||
excludetxt = '?exclude_types[]=favourite'
|
||||
}
|
||||
}
|
||||
if ($('#exc-bt-' + key + ':checked').val()) {
|
||||
if (excludetxt || excludetxt !="") {
|
||||
excludetxt = excludetxt + "&exclude_types[]=reblog"
|
||||
if (excludetxt || excludetxt != '') {
|
||||
excludetxt = excludetxt + '&exclude_types[]=reblog'
|
||||
} else {
|
||||
excludetxt = "?exclude_types[]=reblog"
|
||||
excludetxt = '?exclude_types[]=reblog'
|
||||
}
|
||||
}
|
||||
if ($('#exc-follow-' + key + ':checked').val()) {
|
||||
if (excludetxt || excludetxt !="") {
|
||||
excludetxt = excludetxt + "&exclude_types[]=follow"
|
||||
if (excludetxt || excludetxt != '') {
|
||||
excludetxt = excludetxt + '&exclude_types[]=follow'
|
||||
} else {
|
||||
excludetxt = "?exclude_types[]=follow"
|
||||
excludetxt = '?exclude_types[]=follow'
|
||||
}
|
||||
}
|
||||
if ($('#exc-poll-' + key + ':checked').val()) {
|
||||
if (excludetxt || excludetxt !="") {
|
||||
excludetxt = excludetxt + "&exclude_types[]=poll"
|
||||
if (excludetxt || excludetxt != '') {
|
||||
excludetxt = excludetxt + '&exclude_types[]=poll'
|
||||
} else {
|
||||
excludetxt = "?exclude_types[]=poll"
|
||||
excludetxt = '?exclude_types[]=poll'
|
||||
}
|
||||
} else {
|
||||
}
|
||||
localStorage.setItem("exclude-" + key, excludetxt)
|
||||
parseColumn(key);
|
||||
localStorage.setItem('exclude-' + key, excludetxt)
|
||||
parseColumn(key)
|
||||
}
|
||||
function excludeCk(key, target) {
|
||||
var exc = localStorage.getItem("exclude-" + key);
|
||||
var exc = localStorage.getItem('exclude-' + key)
|
||||
if (!exc) {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
if (~exc.indexOf(target)) {
|
||||
return "checked"
|
||||
return 'checked'
|
||||
} else {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
}
|
||||
function checkNotfFilter(tlid){
|
||||
var excludetxt = localStorage.getItem("exclude-" + tlid);
|
||||
if(!excludetxt || excludetxt != ""){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function resetNotfFilter(tlid){
|
||||
localStorage.setItem("exclude-" + tlid, "")
|
||||
parseColumn(tlid);
|
||||
}
|
||||
function notfFilter(id,tlid,acct_id){
|
||||
var excludetxt = localStorage.getItem("exclude-" + tlid);
|
||||
if (excludetxt || excludetxt !="") {
|
||||
excludetxt = excludetxt + "&account_id="+id
|
||||
function checkNotfFilter(tlid) {
|
||||
var excludetxt = localStorage.getItem('exclude-' + tlid)
|
||||
if (!excludetxt || excludetxt != '') {
|
||||
return true
|
||||
} else {
|
||||
excludetxt = "?account_id="+id
|
||||
return false
|
||||
}
|
||||
localStorage.setItem("exclude-" + tlid, excludetxt)
|
||||
parseColumn(tlid);
|
||||
}
|
||||
}
|
||||
function resetNotfFilter(tlid) {
|
||||
localStorage.setItem('exclude-' + tlid, '')
|
||||
parseColumn(tlid)
|
||||
}
|
||||
function notfFilter(id, tlid, acct_id) {
|
||||
var excludetxt = localStorage.getItem('exclude-' + tlid)
|
||||
if (excludetxt || excludetxt != '') {
|
||||
excludetxt = excludetxt + '&account_id=' + id
|
||||
} else {
|
||||
excludetxt = '?account_id=' + id
|
||||
}
|
||||
localStorage.setItem('exclude-' + tlid, excludetxt)
|
||||
parseColumn(tlid)
|
||||
}
|
||||
|
||||
@@ -1,262 +1,359 @@
|
||||
'use strict'
|
||||
function listMenu() {
|
||||
$("#left-menu div").removeClass("active");
|
||||
$("#listMenu").addClass("active");
|
||||
$(".menu-content").addClass("hide");
|
||||
$("#list-box").removeClass("hide");
|
||||
$('ul.tabs').tabs('select_tab', 'src-sta');
|
||||
$("#src-contents").html("");
|
||||
$('#left-menu div').removeClass('active')
|
||||
$('#listMenu').addClass('active')
|
||||
$('.menu-content').addClass('hide')
|
||||
$('#list-box').removeClass('hide')
|
||||
$('ul.tabs').tabs('select_tab', 'src-sta')
|
||||
$('#src-contents').html('')
|
||||
}
|
||||
|
||||
|
||||
function list() {
|
||||
$("#lists-user").html("");
|
||||
var acct_id = $("#list-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/users/lists/list"
|
||||
$('#lists-user').html('')
|
||||
var acct_id = $('#list-acct-sel').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var start = 'https://' + domain + '/api/users/lists/list'
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
i: at
|
||||
}),
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var lists = "";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var list = json[key];
|
||||
lists = lists + escapeHTML(list.title) + ':<a onclick="listShow(\'' + list.id + '\',\'' + escapeHTML(list.title) + '\',\'' + acct_id +
|
||||
'\')" class="pointer">' + lang.lang_list_show + '</a><br>';
|
||||
});
|
||||
$("#lists").html(lists);
|
||||
} else {
|
||||
$("#lists").html(lang.lang_list_nodata);
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var lists = ''
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var list = json[key]
|
||||
lists =
|
||||
lists +
|
||||
escapeHTML(list.title) +
|
||||
`:<a onclick="listShow('${list.id}','${escapeHTML(
|
||||
list.title
|
||||
)}','${acct_id}')" class="pointer">
|
||||
${lang.lang_list_show}
|
||||
</a><br>`
|
||||
})
|
||||
$('#lists').html(lists)
|
||||
} else {
|
||||
$('#lists').html(lang.lang_list_nodata)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/lists"
|
||||
var start = 'https://' + domain + '/api/v1/lists'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var lists = "";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var list = json[key];
|
||||
lists = lists + escapeHTML(list.title) + ':<a onclick="listShow(\'' + list.id + '\',\'' + escapeHTML(list.title) + '\',\'' + acct_id +
|
||||
'\')" class="pointer">' + lang.lang_list_show + '</a>/<a onclick="listUser(\'' + list.id + '\',' + acct_id +
|
||||
')" class="pointer">' + lang.lang_list_users + '</a><br>';
|
||||
});
|
||||
$("#lists").html(lists);
|
||||
} else {
|
||||
$("#lists").html(lang.lang_list_nodata);
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var lists = ''
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var list = json[key]
|
||||
lists =
|
||||
lists +
|
||||
escapeHTML(list.title) +
|
||||
`:<a onclick="listShow('${list.id}','${escapeHTML(
|
||||
list.title
|
||||
)}','${acct_id}')" class="pointer">
|
||||
${lang.lang_list_show}
|
||||
</a>/
|
||||
<a onclick="listUser('${list.id}','${acct_id}')" class="pointer">
|
||||
${lang.lang_list_users}
|
||||
'</a><br>`
|
||||
})
|
||||
$('#lists').html(lists)
|
||||
} else {
|
||||
$('#lists').html(lang.lang_list_nodata)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function makeNewList() {
|
||||
var acct_id = $("#list-acct-sel").val();
|
||||
var text = $("#list-add").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
var start = "https://" + domain + "/api/v1/lists"
|
||||
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(JSON.stringify({
|
||||
title: text
|
||||
}));
|
||||
httpreq.onreadystatechange = function () {
|
||||
var acct_id = $('#list-acct-sel').val()
|
||||
var text = $('#list-add').val()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
var start = 'https://' + domain + '/api/v1/lists'
|
||||
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(
|
||||
JSON.stringify({
|
||||
title: text
|
||||
})
|
||||
)
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
list();
|
||||
$("#list-add").val("")
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
list()
|
||||
$('#list-add').val('')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/users/lists/create"
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({
|
||||
i: at,
|
||||
title: text
|
||||
}));
|
||||
httpreq.onreadystatechange = function () {
|
||||
var start = 'https://' + domain + '/api/users/lists/create'
|
||||
var httpreq = new XMLHttpRequest()
|
||||
httpreq.open('POST', start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.send(
|
||||
JSON.stringify({
|
||||
i: at,
|
||||
title: text
|
||||
})
|
||||
)
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
list();
|
||||
$("#list-add").val("")
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
list()
|
||||
$('#list-add').val('')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function listShow(id, title, acct_id) {
|
||||
localStorage.setItem("list_" + id + "_" + acct_id, title);
|
||||
tl('list', id, acct_id, 'add');
|
||||
localStorage.setItem('list_' + id + '_' + acct_id, title)
|
||||
tl('list', id, acct_id, 'add')
|
||||
}
|
||||
function listUser(id, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts"
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/lists/' + id + '/accounts'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var lists = "";
|
||||
var templete = userparse(json, '', acct_id);
|
||||
if (!json[0]) {
|
||||
templete = lang.lang_list_nouser;
|
||||
}
|
||||
$("#lists-user").html(templete);
|
||||
} else {
|
||||
$("#lists-user").html(lang.lang_list_nouser);
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var lists = ''
|
||||
var templete = userparse(json, '', acct_id)
|
||||
if (!json[0]) {
|
||||
templete = lang.lang_list_nouser
|
||||
}
|
||||
$('#lists-user').html(templete)
|
||||
jQuery('time.timeago').timeago()
|
||||
} else {
|
||||
$('#lists-user').html(lang.lang_list_nouser)
|
||||
}
|
||||
})
|
||||
}
|
||||
function hisList(user, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
var start = "https://" + domain + "/api/v1/lists"
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) != 'misskey') {
|
||||
var start = 'https://' + domain + '/api/v1/lists'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var lists = lang.lang_list_add + "<br>";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var list = json[key];
|
||||
lists = lists + '<a onclick="listAdd(\'' + list.id + '\',\'' + user + '\',\'' + acct_id +
|
||||
'\')" class="pointer">' + escapeHTML(list.title) + '</a><br> ';
|
||||
});
|
||||
$("#his-lists-a").html(lists);
|
||||
} else {
|
||||
$("#his-lists-a").html(lang.lang_list_nodata);
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
});
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user + "/lists"
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var lists = lang.lang_list_add + '<br>'
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var list = json[key]
|
||||
lists =
|
||||
lists +
|
||||
`<a onclick="listAdd('${list.id}','${user}','${acct_id}')" class="pointer">
|
||||
${escapeHTML(list.title)}
|
||||
</a><br> `
|
||||
})
|
||||
$('#his-lists-a').html(lists)
|
||||
} else {
|
||||
$('#his-lists-a').html(lang.lang_list_nodata)
|
||||
}
|
||||
})
|
||||
var start = 'https://' + domain + '/api/v1/accounts/' + user + '/lists'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var lists = lang.lang_list_remove + "<br>";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var list = json[key];
|
||||
lists = lists + '<a onclick="listRemove(\'' + list.id + '\',\'' + user + '\',\'' + acct_id +
|
||||
'\')" class="pointer">' + escapeHTML(list.title) + '</a><br> ';
|
||||
});
|
||||
$("#his-lists-b").html(lists);
|
||||
} else {
|
||||
$("#his-lists-b").html(lang.lang_list_nodata);
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var lists = lang.lang_list_remove + '<br>'
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var list = json[key]
|
||||
lists =
|
||||
lists +
|
||||
`<a onclick="listRemove('${list.id}','${user}','${acct_id}')" class="pointer">
|
||||
${escapeHTML(list.title)}
|
||||
</a><br> `
|
||||
})
|
||||
$('#his-lists-b').html(lists)
|
||||
} else {
|
||||
$('#his-lists-b').html(lang.lang_list_nodata)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/users/lists/list"
|
||||
var start = 'https://' + domain + '/api/users/lists/list'
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
i: at
|
||||
}),
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var lists = "";
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var list = json[key];
|
||||
lists = lists + list.title + ':<a onclick="listShow(\'' + list.id + '\',\'' + escapeHTML(list.title) + '\',\'' + acct_id +
|
||||
'\')" class="pointer">' + lang.lang_list_show + '</a>/<a onclick="listAdd(\'' + list.id + '\',\'' + user + '\',\'' + acct_id +
|
||||
'\')" class="pointer">' + lang.lang_list_add + lang.lang_list_add_misskey + '</a><br>';
|
||||
});
|
||||
$("#his-lists-a").html(lists);
|
||||
} else {
|
||||
$("#his-lists-a").html(lang.lang_list_nodata);
|
||||
}
|
||||
});
|
||||
$("#his-lists-b").html("");
|
||||
})
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var lists = ''
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var list = json[key]
|
||||
lists =
|
||||
lists +
|
||||
list.title +
|
||||
`:<a onclick="listShow('${list.id}','${escapeHTML(
|
||||
list.title
|
||||
)}','${acct_id}')" class="pointer">
|
||||
${lang.lang_list_show}
|
||||
</a>/
|
||||
<a onclick="listAdd('${list.id}','${user}','${acct_id}')" class="pointer">
|
||||
${lang.lang_list_add}
|
||||
${lang.lang_list_add_misskey}
|
||||
'</a><br>`
|
||||
})
|
||||
$('#his-lists-a').html(lists)
|
||||
} else {
|
||||
$('#his-lists-a').html(lang.lang_list_nodata)
|
||||
}
|
||||
})
|
||||
$('#his-lists-b').html('')
|
||||
}
|
||||
}
|
||||
function listAdd(id, user, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/users/lists/push"
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var start = 'https://' + domain + '/api/users/lists/push'
|
||||
var i = {
|
||||
i: at,
|
||||
listId: id,
|
||||
userId: user
|
||||
}
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts"
|
||||
var start = 'https://' + domain + '/api/v1/lists/' + id + '/accounts'
|
||||
var i = {
|
||||
account_ids: [user]
|
||||
}
|
||||
}
|
||||
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(JSON.stringify(i));
|
||||
httpreq.onreadystatechange = function () {
|
||||
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(JSON.stringify(i))
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
hisList(user, acct_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
function listRemove(id, user, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/users/lists/push"
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var start = 'https://' + domain + '/api/users/lists/push'
|
||||
var method = 'POST'
|
||||
var i = {
|
||||
i: at,
|
||||
@@ -264,22 +361,25 @@ function listRemove(id, user, acct_id) {
|
||||
userId: user
|
||||
}
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts"
|
||||
var start = 'https://' + domain + '/api/v1/lists/' + id + '/accounts'
|
||||
var method = 'DELETE'
|
||||
var i = {
|
||||
account_ids: [user]
|
||||
}
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open(method, start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify(i));
|
||||
httpreq.onreadystatechange = function () {
|
||||
var httpreq = new XMLHttpRequest()
|
||||
httpreq.open(method, start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.send(JSON.stringify(i))
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
hisList(user, acct_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
function escapeHTMLtemp(str) {
|
||||
if (!str) {
|
||||
return "";
|
||||
@@ -268,19 +269,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
body: toot.user.name + "(" + toot.user.username + ")" + what + "\n\n" + $.strip_tagstemp(toot.note.text),
|
||||
icon: toot.user.avatarUrl
|
||||
};
|
||||
if (os == "darwin") {
|
||||
var n = new Notification('TheDesk:' + domain, options);
|
||||
} else {
|
||||
var nativeNotfOpt = [
|
||||
'TheDesk:' + domain,
|
||||
toot.user.name + "(" + toot.user.username + ")" + what + "\n\n" + $.strip_tagstemp(toot.note.text),
|
||||
toot.user.avatarUrl,
|
||||
"toot",
|
||||
acct_id,
|
||||
toot.note.id
|
||||
]
|
||||
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||
}
|
||||
var n = new Notification('TheDesk:' + domain, options);
|
||||
}
|
||||
if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
|
||||
$(".notf-icon_" + acct_id).addClass("red-text");
|
||||
@@ -532,7 +521,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
|
||||
if (tagck) {
|
||||
Object.keys(toot.tags).forEach(function (key4) {
|
||||
var tag = toot.tags[key4];
|
||||
var tags = '<a onclick="tagShow(\'' + tag + '\')" class="pointer parsed">#' + tag + '</a><span class="hide" data-tag="' + tag + '">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id +
|
||||
var tags = '<a onclick="tagShow(\'' + tag + '\')" class="pointer parsed">#' + tag + '</a><span class="hide" data-tag="' + tag + '" data-regTag="'+tag.toLowerCase()+'">#' + tag + ':<a onclick="tl(\'tag\',\'' + tag + '\',' + acct_id +
|
||||
',\'add\')" class="pointer parsed" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag) + '">TL</a> <a onclick="brInsert(\'#' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag) + '">Toot</a> ' +
|
||||
'<a onclick="tagPin(\'' + tag + '\')" class="pointer parsed" title="' + lang.lang_parse_tagpin.replace("{{tag}}", '#' + tag) + '">Pin</a></span> ';
|
||||
content = content.replace("#" + tag, tags);
|
||||
@@ -917,19 +906,7 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) {
|
||||
icon: toot.avatar
|
||||
};
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (os == "darwin") {
|
||||
var n = new Notification('TheDesk:' + domain, options);
|
||||
} else {
|
||||
var nativeNotfOpt = [
|
||||
'TheDesk:' + domain,
|
||||
toot.display_name + "(" + toot.acct + ")" + ftxt,
|
||||
toot.avatar,
|
||||
"userdata",
|
||||
acct_id,
|
||||
toot.id
|
||||
]
|
||||
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||
}
|
||||
var n = new Notification('TheDesk:' + domain, options);
|
||||
}
|
||||
}
|
||||
if (toot.name) {
|
||||
|
||||
461
app/js/tl/mix.js
461
app/js/tl/mix.js
@@ -1,327 +1,202 @@
|
||||
'use strict'
|
||||
//Integrated TL
|
||||
function mixtl(acct_id, tlid, type, delc, voice) {
|
||||
localStorage.removeItem("morelock")
|
||||
localStorage.setItem("now", type);
|
||||
todo("Integrated TL Loading...(Local)");
|
||||
//まずLocal
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/timelines/public?local=true";
|
||||
fetch(start, {
|
||||
async function mixtl(acct_id, tlid, type, delc, voice) {
|
||||
localStorage.setItem('now', type)
|
||||
todo('Integrated TL Loading...(Local)')
|
||||
const domain = localStorage.getItem('domain_' + acct_id)
|
||||
let startLocal = 'https://' + domain + '/api/v1/timelines/public?local=true'
|
||||
let local = await getTL(startLocal, acct_id)
|
||||
let startHome = 'https://' + domain + '/api/v1/timelines/home'
|
||||
let home = await getTL(startHome, acct_id)
|
||||
let concated = _.concat(local, home)
|
||||
let uniqued = _.uniqBy(concated, 'id')
|
||||
let sorted = _.orderBy(uniqued, ['id'], ['desc'])
|
||||
let integrated = _.slice(sorted, 0, 19)
|
||||
$('#landing_' + tlid).hide()
|
||||
let mute = getFilterTypeByAcct(acct_id, 'mix')
|
||||
let templete = parse(integrated, type, acct_id, tlid, '', mute, type)
|
||||
localStorage.setItem('lastobj_' + tlid, integrated[0].id)
|
||||
$('#timeline_' + tlid).html(templete)
|
||||
additional(acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
todc()
|
||||
mixre(acct_id, tlid, 'mix', mute, voice, '')
|
||||
$(window).scrollTop(0)
|
||||
lastId = integrated[0].id
|
||||
beforeLastId = integrated[1].id
|
||||
}
|
||||
async function getTL(start, acct_id) {
|
||||
const at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
let promise = await 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 (jsonL) {
|
||||
var start = "https://" + domain + "/api/v1/timelines/home";
|
||||
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 (jsonH) {
|
||||
var homearr = [];
|
||||
var timeline = jsonL.concat(jsonH);
|
||||
timeline.sort(function (a, b) {
|
||||
if (date(a.created_at, "unix") >= date(b.created_at, "unix")) return -1;
|
||||
if (date(a.created_at, "unix") < date(b.created_at, "unix")) return 1;
|
||||
return 0;
|
||||
});
|
||||
if (type == "integrated") {
|
||||
timeline.splice(20);
|
||||
}
|
||||
var templete = "";
|
||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "mix");
|
||||
} else {
|
||||
var mute = [];
|
||||
}
|
||||
Object.keys(timeline).forEach(function (key) {
|
||||
var pkey = key * 1 + 1;
|
||||
if (pkey < timeline.length) {
|
||||
if (date(timeline[key].created_at, "unix") != date(timeline[pkey].created_at, "unix")) {
|
||||
if (type == "integrated") {
|
||||
templete = templete + parse([timeline[key]], '', acct_id, tlid, "", mute, "mix");
|
||||
} else if (type == "plus") {
|
||||
if (timeline[key].account.acct == timeline[key].account.username) {
|
||||
templete = templete + parse([timeline[key]], '', acct_id, tlid, "", mute, "plus");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
$("#landing_" + tlid).hide();
|
||||
$("#timeline_" + tlid).html(templete);
|
||||
mixre(acct_id, tlid, type, mute, delc, voice);
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
todc();
|
||||
});
|
||||
});
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
if (!promise.ok) {
|
||||
promise.text().then(function(text) {
|
||||
setLog(promise.url, promise.status, text)
|
||||
})
|
||||
}
|
||||
return await promise.json()
|
||||
}
|
||||
|
||||
|
||||
//Streamingに接続
|
||||
function mixre(acct_id, tlid, TLtype, mute, delc, voice, mode) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("streaming_" + acct_id)) {
|
||||
var wss = localStorage.getItem("streaming_" + acct_id)
|
||||
function mixre(acct_id, tlid, TLtype, mute, voice, mode) {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('streaming_' + acct_id)) {
|
||||
var wss = localStorage.getItem('streaming_' + acct_id)
|
||||
} else {
|
||||
var wss = "wss://" + domain
|
||||
var wss = 'wss://' + domain
|
||||
}
|
||||
var startHome = wss +
|
||||
"/api/v1/streaming/?stream=user&access_token=" + at;
|
||||
var startLocal = wss +
|
||||
"/api/v1/streaming/?stream=public:local&access_token=" + at;
|
||||
var wshid = websocketHome.length;
|
||||
var wslid = websocketLocal.length;
|
||||
websocketHome[wshid] = new WebSocket(startHome);
|
||||
websocketLocal[wslid] = new WebSocket(startLocal);
|
||||
websocketHome[wshid].onopen = function (mess) {
|
||||
localStorage.setItem("wssH_" + tlid, wshid);
|
||||
console.table({ "tlid": tlid, "type": "Connect Streaming API(Integrated:Home)", "domain": domain, "message": mess })
|
||||
$("#notice_icon_" + tlid).removeClass("red-text");
|
||||
var startHome = wss + '/api/v1/streaming/?stream=user&access_token=' + at
|
||||
var startLocal = wss + '/api/v1/streaming/?stream=public:local&access_token=' + at
|
||||
var wshid = wsHome.length
|
||||
var wslid = wsLocal.length
|
||||
wsHome[wshid] = new WebSocket(startHome)
|
||||
wsLocal[wslid] = new WebSocket(startLocal)
|
||||
wsHome[wshid].onopen = function(mess) {
|
||||
localStorage.setItem('wssH_' + tlid, wshid)
|
||||
console.table({
|
||||
tlid: tlid,
|
||||
type: 'Connect Streaming API(Integrated:Home)',
|
||||
domain: domain,
|
||||
message: mess
|
||||
})
|
||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||
}
|
||||
websocketLocal[wslid].onopen = function (mess) {
|
||||
localStorage.setItem("wssL_" + tlid, wslid);
|
||||
console.table({ "tlid": tlid, "type": "Connect Streaming API(Integrated:Local)", "domain": domain, "message": mess })
|
||||
$("#notice_icon_" + tlid).removeClass("red-text");
|
||||
wsLocal[wslid].onopen = function(mess) {
|
||||
localStorage.setItem('wssL_' + tlid, wslid)
|
||||
console.table({
|
||||
tlid: tlid,
|
||||
type: 'Connect Streaming API(Integrated:Local)',
|
||||
domain: domain,
|
||||
message: mess
|
||||
})
|
||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||
}
|
||||
websocketLocal[wslid].onmessage = function (mess) {
|
||||
console.log(["Receive Streaming API:(Integrated:Local)", obj]);
|
||||
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||
var type = JSON.parse(mess.data).event;
|
||||
if (type == "delete") {
|
||||
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 (type == "update") {
|
||||
var templete = parse([obj], '', acct_id, tlid, "", mute);
|
||||
if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) {
|
||||
if (voice) {
|
||||
say(obj.content)
|
||||
}
|
||||
var templete = parse([obj], type, acct_id, tlid, "", mute, "mix");
|
||||
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("二重取得発生中");
|
||||
}
|
||||
|
||||
}
|
||||
wsLocal[wslid].onmessage = function(mess) {
|
||||
console.log('Receive Streaming API:(Integrated:Local)', mess)
|
||||
integratedMessage(mess, acct_id, tlid, mute, voice)
|
||||
}
|
||||
websocketHome[wshid].onmessage = function (mess) {
|
||||
console.log(["Receive Streaming API:(Integrated:Home)", obj]);
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||
var type = JSON.parse(mess.data).event;
|
||||
if (type == "delete") {
|
||||
if (del > 10) {
|
||||
reconnector(tlid, type, acct_id, data)
|
||||
} else {
|
||||
localStorage.setItem("delete", del * 1 + 1)
|
||||
}
|
||||
if (delc == "true") {
|
||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
|
||||
$("[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 (type == "update") {
|
||||
localStorage.removeItem("delete");
|
||||
if (TLtype == "integrated") {
|
||||
var templete = parse([obj], '', acct_id, tlid);
|
||||
} else if (TLtype == "plus") {
|
||||
if (obj.account.acct == obj.account.username) {
|
||||
var templete = parse([obj], '', acct_id, tlid, "", mute, "mix");
|
||||
} else {
|
||||
var templete = "";
|
||||
}
|
||||
}
|
||||
if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) {
|
||||
if (voice) {
|
||||
say(obj.content)
|
||||
}
|
||||
var templete = parse([obj], type, acct_id, tlid, "", mute, "mix");
|
||||
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("二重取得発生中");
|
||||
}
|
||||
}
|
||||
wsHome[wshid].onmessage = function(mess) {
|
||||
console.log(['Receive Streaming API:(Integrated:Home)', mess])
|
||||
integratedMessage(mess, acct_id, tlid, mute, voice)
|
||||
}
|
||||
websocketLocal[wslid].onerror = function (error) {
|
||||
wsLocal[wslid].onerror = function(error) {
|
||||
console.error('WebSocketLocal Error')
|
||||
console.error(error);
|
||||
if (mode == "error") {
|
||||
$("#notice_icon_" + tlid).addClass("red-text");
|
||||
todo('WebSocket Error ' + error);
|
||||
console.error(error)
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
if (mode == 'error') {
|
||||
todo('WebSocket Error ' + error)
|
||||
} else {
|
||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||
localStorage.setItem("wserror_" + tlid, errorct);
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, "", "error");
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
};
|
||||
websocketLocal[wslid].onclose = function () {
|
||||
console.warn('WebSocketLocal Closing:' + tlid);
|
||||
if (mode == "error") {
|
||||
$("#notice_icon_" + tlid).addClass("red-text");
|
||||
todo('WebSocket Closed');
|
||||
}
|
||||
wsLocal[wslid].onclose = function() {
|
||||
console.warn('WebSocketLocal Closing:' + tlid)
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
if (mode == 'error') {
|
||||
todo('WebSocket Closed')
|
||||
} else {
|
||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||
localStorage.setItem("wserror_" + tlid, errorct);
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, "", "error");
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
};
|
||||
websocketHome[wshid].onerror = function (error) {
|
||||
}
|
||||
wsHome[wshid].onerror = function(error) {
|
||||
console.error(['WebSocketHome Error', error])
|
||||
if (mode == "error") {
|
||||
$("#notice_icon_" + tlid).addClass("red-text");
|
||||
todo('WebSocket Error ' + error);
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
if (mode == 'error') {
|
||||
todo('WebSocket Error ' + error)
|
||||
} else {
|
||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||
localStorage.setItem("wserror_" + tlid, errorct);
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, "", "error");
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
};
|
||||
websocketHome[wshid].onclose = function () {
|
||||
console.warn('WebSocketHome Closing:' + tlid);
|
||||
if (mode == "error") {
|
||||
$("#notice_icon_" + tlid).addClass("red-text");
|
||||
todo('WebSocket Closed');
|
||||
}
|
||||
wsHome[wshid].onclose = function() {
|
||||
console.warn('WebSocketHome Closing:' + tlid)
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
if (mode == 'error') {
|
||||
todo('WebSocket Closed')
|
||||
} else {
|
||||
var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
|
||||
localStorage.setItem("wserror_" + tlid, errorct);
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, "", "error");
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//ある程度のスクロールで発火
|
||||
function mixmore(tlid, type) {
|
||||
var multi = localStorage.getItem("column");
|
||||
var obj = JSON.parse(multi);
|
||||
var acct_id = obj[tlid].domain;
|
||||
moreloading = true;
|
||||
todo("Integrated TL MoreLoading...(Local)");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var sid = $("#timeline_" + tlid + " .cvo").last().attr("unique-id");
|
||||
|
||||
|
||||
var start = "https://" + domain + "/api/v1/timelines/public?local=true&max_id=" + sid;
|
||||
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 (jsonL) {
|
||||
var start = "https://" + domain + "/api/v1/timelines/home?max_id=" + sid;
|
||||
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 (jsonH) {
|
||||
var homearr = [];
|
||||
var timeline = jsonL.concat(jsonH);
|
||||
timeline.sort(function (a, b) {
|
||||
if (date(a.created_at, "unix") > date(b.created_at, "unix")) return -1;
|
||||
if (date(a.created_at, "unix") < date(b.created_at, "unix")) return 1;
|
||||
return 0;
|
||||
});
|
||||
timeline.splice(20);
|
||||
var templete = "";
|
||||
Object.keys(timeline).forEach(function (key) {
|
||||
var pkey = key * 1 + 1;
|
||||
if (pkey < 20) {
|
||||
if (date(timeline[key].created_at, "unix") != date(timeline[pkey].created_at, "unix")) {
|
||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "mix");
|
||||
} else {
|
||||
var mute = [];
|
||||
}
|
||||
if (type == "integrated") {
|
||||
templete = templete + parse([timeline[key]], '', acct_id, tlid, "", mute, "mix");
|
||||
} else if (type == "plus") {
|
||||
if (timeline[key].account.acct == timeline[key].account.username) {
|
||||
templete = templete + parse([timeline[key]], '', acct_id, tlid, "", mute, "mix");
|
||||
}
|
||||
}
|
||||
}
|
||||
function integratedMessage(mess, acct_id, tlid, mute, voice) {
|
||||
let data = JSON.parse(mess.data)
|
||||
let type = data.event
|
||||
let payload = data.payload
|
||||
if (type == 'delete') {
|
||||
$('[unique-id=' + payload + ']').hide()
|
||||
$('[unique-id=' + payload + ']').remove()
|
||||
} else if (type == 'update') {
|
||||
let obj = JSON.parse(payload)
|
||||
|
||||
if (obj.id != lastId && obj.id != beforeLastId) {
|
||||
lastId = obj.id
|
||||
beforeLastId = obj.id
|
||||
let dom = parse([obj], '', acct_id, tlid, '', mute)
|
||||
if (voice) say(obj.content)
|
||||
if ($('timeline_box_' + tlid + '_box .tl-box').scrollTop() === 0) {
|
||||
$('#timeline_' + tlid).prepend(dom)
|
||||
} else {
|
||||
let pool = localStorage.getItem('pool_' + tlid)
|
||||
if (pool) {
|
||||
pool = dom + pool
|
||||
} else {
|
||||
pool = dom
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#timeline_" + tlid).append(templete);
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
moreloading = false;
|
||||
todc();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
localStorage.setItem('pool_' + tlid, pool)
|
||||
}
|
||||
scrollck()
|
||||
additional(acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
}
|
||||
}
|
||||
}
|
||||
//ある程度のスクロールで発火
|
||||
async function mixmore(tlid, type) {
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
var acct_id = obj[tlid].domain
|
||||
moreloading = true
|
||||
todo('Integrated TL MoreLoading...(Local)')
|
||||
const domain = localStorage.getItem('domain_' + acct_id)
|
||||
const sid = $('#timeline_' + tlid + ' .cvo')
|
||||
.last()
|
||||
.attr('unique-id')
|
||||
let startLocal = 'https://' + domain + '/api/v1/timelines/public?local=true&max_id=' + sid
|
||||
let local = await getTL(startLocal, acct_id)
|
||||
let startHome = 'https://' + domain + '/api/v1/timelines/home?max_id=' + sid
|
||||
let home = await getTL(startHome, acct_id)
|
||||
let concated = _.concat(local, home)
|
||||
let uniqued = _.uniqBy(concated, 'id')
|
||||
let sorted = _.orderBy(uniqued, ['id'], ['desc'])
|
||||
let integrated = _.slice(sorted, 0, 19)
|
||||
$('#landing_' + tlid).hide()
|
||||
let mute = getFilterTypeByAcct(acct_id, 'mix')
|
||||
let templete = parse(integrated, type, acct_id, tlid, '', mute, type)
|
||||
localStorage.setItem('lastobj_' + tlid, integrated[0].id)
|
||||
$('#timeline_' + tlid).append(templete)
|
||||
additional(acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
moreloading = false
|
||||
todc()
|
||||
}
|
||||
|
||||
@@ -1,341 +1,356 @@
|
||||
'use strict'
|
||||
//通知
|
||||
//取得+Streaming接続
|
||||
function notf(acct_id, tlid, sys) {
|
||||
if (sys == "direct") {
|
||||
if (sys == 'direct') {
|
||||
notfColumn(acct_id, tlid, sys)
|
||||
} else {
|
||||
notfCommon(acct_id, tlid, sys)
|
||||
}
|
||||
}
|
||||
function notfColumn(acct_id, tlid, sys) {
|
||||
todo("Notifications Loading...");
|
||||
var native = localStorage.getItem("nativenotf");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
todo('Notifications Loading...')
|
||||
var native = localStorage.getItem('nativenotf')
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (!native) {
|
||||
native = "yes";
|
||||
native = 'yes'
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var httpreq = new XMLHttpRequest();
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var misskey = true;
|
||||
var start = "https://" + domain + "/api/i/notifications";
|
||||
httpreq.open("POST", start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var httpreq = new XMLHttpRequest()
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var misskey = true
|
||||
var start = 'https://' + domain + '/api/i/notifications'
|
||||
httpreq.open('POST', start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
var body = JSON.stringify({
|
||||
i: at
|
||||
});
|
||||
})
|
||||
} else {
|
||||
var misskey = false;
|
||||
if (localStorage.getItem("exclude-" + tlid)) {
|
||||
var exc = localStorage.getItem("exclude-" + tlid);
|
||||
var misskey = false
|
||||
if (localStorage.getItem('exclude-' + tlid)) {
|
||||
var exc = localStorage.getItem('exclude-' + tlid)
|
||||
} else {
|
||||
var exc = "";
|
||||
var exc = ''
|
||||
}
|
||||
var start = "https://" + domain + "/api/v1/notifications" + exc;
|
||||
httpreq.open("GET", start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
var body = "";
|
||||
var start = 'https://' + domain + '/api/v1/notifications' + exc
|
||||
httpreq.open('GET', start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
var body = ''
|
||||
}
|
||||
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(body);
|
||||
httpreq.onreadystatechange = function () {
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.send(body)
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var max_id = httpreq.getResponseHeader("link");
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
var max_id = httpreq.getResponseHeader('link')
|
||||
if (max_id) {
|
||||
max_id = max_id.match(/[?&]{1}max_id=([0-9]+)/)[1]
|
||||
}
|
||||
if (json[0]) {
|
||||
var templete = "";
|
||||
var lastnotf = localStorage.getItem("lastnotf_" + acct_id);
|
||||
localStorage.setItem("lastnotf_" + acct_id, json[0].id);
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var obj = json[key];
|
||||
if (lastnotf == obj.id && key > 0 && native == "yes") {
|
||||
var ct = key;
|
||||
var templete = ''
|
||||
var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
|
||||
localStorage.setItem('lastnotf_' + acct_id, json[0].id)
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var obj = json[key]
|
||||
if (lastnotf == obj.id && key > 0 && native == 'yes') {
|
||||
var ct = key
|
||||
if (key > 14) {
|
||||
ct = "15+";
|
||||
ct = '15+'
|
||||
}
|
||||
var os = localStorage.getItem("platform");
|
||||
var os = localStorage.getItem('platform')
|
||||
var options = {
|
||||
body: ct + lang.lang_notf_new,
|
||||
icon: localStorage.getItem("prof_" + acct_id)
|
||||
};
|
||||
if (os == "darwin") {
|
||||
var n = new Notification('TheDesk:' + domain, options);
|
||||
} else {
|
||||
var nativeNotfOpt=['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
|
||||
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||
icon: localStorage.getItem('prof_' + acct_id)
|
||||
}
|
||||
|
||||
var n = new Notification('TheDesk:' + domain, options)
|
||||
}
|
||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif");
|
||||
} else {
|
||||
var mute = [];
|
||||
}
|
||||
if (obj.type != "follow") {
|
||||
var mute = getFilterTypeByAcct(acct_id, 'notif')
|
||||
if (obj.type != 'follow') {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyParse([obj], 'notf', acct_id, tlid, -1, mute);
|
||||
templete = templete + misskeyParse([obj], 'notf', acct_id, tlid, -1, mute)
|
||||
} else {
|
||||
templete = templete + parse([obj], 'notf', acct_id, tlid, -1, mute);
|
||||
templete = templete + parse([obj], 'notf', acct_id, tlid, -1, mute)
|
||||
}
|
||||
} else {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyUserparse([obj], 'notf', acct_id, tlid, -1, mute);
|
||||
templete = templete + misskeyUserparse([obj], 'notf', acct_id, tlid, -1, mute)
|
||||
} else {
|
||||
templete = templete + userparse([obj.account], 'notf', acct_id, tlid, -1);
|
||||
templete = templete + userparse([obj.account], 'notf', acct_id, tlid, -1)
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>';
|
||||
$("#timeline_" + tlid).html(templete);
|
||||
$("#landing_" + tlid).hide();
|
||||
jQuery("time.timeago").timeago();
|
||||
})
|
||||
templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>'
|
||||
$('#timeline_' + tlid).html(templete)
|
||||
$('#landing_' + tlid).hide()
|
||||
jQuery('time.timeago').timeago()
|
||||
}
|
||||
$('#notf-box').addClass('fetched')
|
||||
todc()
|
||||
//Markers
|
||||
var markers = localStorage.getItem('markers')
|
||||
if (markers == 'yes') {
|
||||
markers = true
|
||||
} else {
|
||||
markers = false
|
||||
}
|
||||
if (markers) {
|
||||
getMarker(tlid, 'notf', acct_id)
|
||||
}
|
||||
$("#notf-box").addClass("fetched");
|
||||
todc();
|
||||
}
|
||||
}
|
||||
if (!misskey) {
|
||||
if (localStorage.getItem("streaming_" + acct_id)) {
|
||||
var wss = localStorage.getItem("streaming_" + acct_id)
|
||||
if (localStorage.getItem('streaming_' + acct_id)) {
|
||||
var wss = localStorage.getItem('streaming_' + acct_id)
|
||||
} else {
|
||||
var wss = "wss://" + domain
|
||||
var wss = 'wss://' + domain
|
||||
}
|
||||
var start = wss + "/api/v1/streaming/?stream=user&access_token=" +
|
||||
at;
|
||||
var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
|
||||
} else {
|
||||
var start = "wss://" + domain + "/?i=" +
|
||||
at;
|
||||
var start = 'wss://' + domain + '/?i=' + at
|
||||
}
|
||||
|
||||
}
|
||||
function notfCommon(acct_id, tlid, sys) {
|
||||
todo("Notifications Loading...");
|
||||
var native = localStorage.getItem("nativenotf");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
todo('Notifications Loading...')
|
||||
var native = localStorage.getItem('nativenotf')
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (!native) {
|
||||
native = "yes";
|
||||
native = 'yes'
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var misskey = true;
|
||||
var start = "https://" + domain + "/api/i/notifications";
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var misskey = true
|
||||
var start = 'https://' + domain + '/api/i/notifications'
|
||||
var i = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
i: at
|
||||
})
|
||||
}
|
||||
} else {
|
||||
var misskey = false;
|
||||
var start = "https://" + domain + "/api/v1/notifications";
|
||||
var misskey = false
|
||||
var start = 'https://' + domain + '/api/v1/notifications'
|
||||
var i = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
}
|
||||
}
|
||||
fetch(start, i).then(function (response) {
|
||||
console.log("header to get param:" + response.headers.get('link'));
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json[0]) {
|
||||
var templete = "";
|
||||
var lastnotf = localStorage.getItem("lastnotf_" + acct_id);
|
||||
localStorage.setItem("lastnotf_" + acct_id, json[0].id);
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var obj = json[key];
|
||||
if (lastnotf == obj.id && key > 0 && native == "yes") {
|
||||
var ct = key;
|
||||
if (key > 14) {
|
||||
ct = "15+";
|
||||
fetch(start, i)
|
||||
.then(function(response) {
|
||||
console.log('header to get param:' + response.headers.get('link'))
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json[0]) {
|
||||
var templete = ''
|
||||
var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
|
||||
localStorage.setItem('lastnotf_' + acct_id, json[0].id)
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var obj = json[key]
|
||||
if (lastnotf == obj.id && key > 0 && native == 'yes') {
|
||||
var ct = key
|
||||
if (key > 14) {
|
||||
ct = '15+'
|
||||
}
|
||||
var os = localStorage.getItem('platform')
|
||||
var options = {
|
||||
body: ct + lang.lang_notf_new,
|
||||
icon: localStorage.getItem('prof_' + acct_id)
|
||||
}
|
||||
var n = new Notification('TheDesk:' + domain, options)
|
||||
}
|
||||
var os = localStorage.getItem("platform");
|
||||
var options = {
|
||||
body: ct + lang.lang_notf_new,
|
||||
icon: localStorage.getItem("prof_" + acct_id)
|
||||
};
|
||||
if (os == "darwin") {
|
||||
var n = new Notification('TheDesk:' + domain, options);
|
||||
var mute = getFilterTypeByAcct(acct_id, 'notif')
|
||||
if (obj.type != 'follow') {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
|
||||
} else {
|
||||
templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute)
|
||||
}
|
||||
} else {
|
||||
var nativeNotfOpt=['TheDesk:' + domain, ct + lang.lang_notf_new, localStorage.getItem("prof_" + acct_id)]
|
||||
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||
if (misskey) {
|
||||
templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute)
|
||||
} else {
|
||||
templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif");
|
||||
} else {
|
||||
var mute = [];
|
||||
}
|
||||
if (obj.type != "follow") {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute);
|
||||
} else {
|
||||
templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute);
|
||||
}
|
||||
} else {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute);
|
||||
} else {
|
||||
templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
$("div[data-notf=" + acct_id + "]").html(templete);
|
||||
$("#landing_" + tlid).hide();
|
||||
jQuery("time.timeago").timeago();
|
||||
}
|
||||
$("#notf-box").addClass("fetched");
|
||||
todc();
|
||||
notfWS(misskey, acct_id, tlid, domain, at)
|
||||
});
|
||||
|
||||
})
|
||||
$('div[data-notf=' + acct_id + ']').html(templete)
|
||||
$('#landing_' + tlid).hide()
|
||||
jQuery('time.timeago').timeago()
|
||||
}
|
||||
$('#notf-box').addClass('fetched')
|
||||
todc()
|
||||
notfWS(misskey, acct_id, tlid, domain, at)
|
||||
})
|
||||
}
|
||||
function notfWS(misskey, acct_id, tlid, domain, at) {
|
||||
if (!misskey) {
|
||||
if (localStorage.getItem("streaming_" + acct_id)) {
|
||||
var wss = localStorage.getItem("streaming_" + acct_id)
|
||||
if (localStorage.getItem('streaming_' + acct_id)) {
|
||||
var wss = localStorage.getItem('streaming_' + acct_id)
|
||||
} else {
|
||||
var wss = "wss://" + domain
|
||||
var wss = 'wss://' + domain
|
||||
}
|
||||
var start = wss + "/api/v1/streaming/?stream=user&access_token=" +
|
||||
at;
|
||||
|
||||
var wsid = websocketNotf.length;
|
||||
websocketNotf[acct_id] = new WebSocket(start);
|
||||
websocketNotf[acct_id].onopen = function (mess) {
|
||||
console.table({ "acct_id": acct_id, "type": "Connect Streaming API(Notf)", "domain": domain, "message": [mess] })
|
||||
$("i[data-notf=" + acct_id + "]").removeClass("red-text");
|
||||
var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
|
||||
|
||||
var wsid = websocketNotf.length
|
||||
websocketNotf[acct_id] = new WebSocket(start)
|
||||
websocketNotf[acct_id].onopen = function(mess) {
|
||||
console.table({
|
||||
acct_id: acct_id,
|
||||
type: 'Connect Streaming API(Notf)',
|
||||
domain: domain,
|
||||
message: [mess]
|
||||
})
|
||||
$('i[data-notf=' + acct_id + ']').removeClass('red-text')
|
||||
}
|
||||
websocketNotf[acct_id].onmessage = function (mess) {
|
||||
websocketNotf[acct_id].onmessage = function(mess) {
|
||||
//console.log(["Receive Streaming API(Notf):" + acct_id + "(" + domain + ")", JSON.parse(JSON.parse(mess.data).payload)]);
|
||||
var popup = localStorage.getItem("popup");
|
||||
var popup = localStorage.getItem('popup')
|
||||
if (!popup) {
|
||||
popup = 0;
|
||||
popup = 0
|
||||
}
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||
var type = JSON.parse(mess.data).event;
|
||||
if (type == "notification") {
|
||||
var templete = "";
|
||||
localStorage.setItem("lastnotf_" + acct_id, obj.id);
|
||||
if (obj.type != "follow") {
|
||||
templete = parse([obj], 'notf', acct_id, 'notf', popup);
|
||||
} else {
|
||||
templete = userparse([obj], 'notf', acct_id, 'notf', popup);
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||
var type = JSON.parse(mess.data).event
|
||||
if (type == 'notification') {
|
||||
var templete = ''
|
||||
localStorage.setItem('lastnotf_' + acct_id, obj.id)
|
||||
if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
|
||||
//markers show中はダメ
|
||||
if (obj.type != 'follow') {
|
||||
templete = parse([obj], 'notf', acct_id, 'notf', popup)
|
||||
} else {
|
||||
templete = userparse([obj], 'notf', acct_id, 'notf', popup)
|
||||
}
|
||||
if (!$('div[data-notfIndv=' + acct_id + '_' + obj.id + ']').length) {
|
||||
$('div[data-notf=' + acct_id + ']').prepend(templete)
|
||||
$('div[data-const=notf_' + acct_id + ']').prepend(templete)
|
||||
}
|
||||
jQuery('time.timeago').timeago()
|
||||
}
|
||||
if (!$("div[data-notfIndv=" + acct_id + "_" + obj.id + "]").length) {
|
||||
$("div[data-notf=" + acct_id + "]").prepend(templete);
|
||||
$("div[data-const=notf_" + acct_id + "]").prepend(templete);
|
||||
}
|
||||
jQuery("time.timeago").timeago();
|
||||
} else if (type == "delete") {
|
||||
$("[toot-id=" + obj + "]").hide();
|
||||
$("[toot-id=" + obj + "]").remove();
|
||||
} else if (type == 'delete') {
|
||||
$('[toot-id=' + obj + ']').hide()
|
||||
$('[toot-id=' + obj + ']').remove()
|
||||
}
|
||||
}
|
||||
websocketNotf[acct_id].onerror = function(error) {
|
||||
console.error('WebSocket Error ' + error)
|
||||
errorct++
|
||||
console.log(errorct)
|
||||
if (errorct < 3) {
|
||||
notfWS(misskey, acct_id, tlid, domain, at)
|
||||
}
|
||||
}
|
||||
websocketNotf[acct_id].onclose = function(error) {
|
||||
console.error('WebSocket Close ' + error)
|
||||
errorct++
|
||||
console.log(errorct)
|
||||
if (errorct < 3) {
|
||||
notfWS(misskey, acct_id, tlid, domain, at)
|
||||
}
|
||||
}
|
||||
websocketNotf[acct_id].onerror = function (error) {
|
||||
console.error('WebSocket Error ' + error);
|
||||
notfWS(misskey, acct_id, tlid, domain, at)
|
||||
};
|
||||
}
|
||||
}
|
||||
//一定のスクロールで発火
|
||||
function notfmore(tlid) {
|
||||
console.log({ "status": "kicked", "status": moreloading });
|
||||
var multi = localStorage.getItem("column");
|
||||
var obj = JSON.parse(multi);
|
||||
var acct_id = obj[tlid].domain;
|
||||
console.log({ status: 'kicked', status: moreloading })
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
var acct_id = obj[tlid].domain
|
||||
if (!type) {
|
||||
var type = obj[tlid].type;
|
||||
var type = obj[tlid].type
|
||||
} else {
|
||||
var data;
|
||||
var data
|
||||
}
|
||||
var sid = $("#timeline_" + tlid + " .notif-marker").last().attr("data-maxid");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var sid = $('#timeline_' + tlid + ' .notif-marker')
|
||||
.last()
|
||||
.attr('data-maxid')
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
if (sid && !moreloading) {
|
||||
moreloading = true;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var misskey = true;
|
||||
var start = "https://" + domain + "/api/i/notifications";
|
||||
httpreq.open(POST, start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
moreloading = true
|
||||
var httpreq = new XMLHttpRequest()
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
var misskey = true
|
||||
var start = 'https://' + domain + '/api/i/notifications'
|
||||
httpreq.open(POST, start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
var body = JSON.stringify({
|
||||
i: at,
|
||||
untilID: sid
|
||||
});
|
||||
})
|
||||
} else {
|
||||
var misskey = false;
|
||||
if (localStorage.getItem("exclude-" + tlid)) {
|
||||
var exc = localStorage.getItem("exclude-" + tlid) + "&max_id=" + sid;
|
||||
var misskey = false
|
||||
if (localStorage.getItem('exclude-' + tlid)) {
|
||||
var exc = localStorage.getItem('exclude-' + tlid) + '&max_id=' + sid
|
||||
} else {
|
||||
var exc = "?max_id=" + sid;
|
||||
var exc = '?max_id=' + sid
|
||||
}
|
||||
var start = "https://" + domain + "/api/v1/notifications" + exc;
|
||||
httpreq.open("GET", start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
var body = "";
|
||||
var start = 'https://' + domain + '/api/v1/notifications' + exc
|
||||
httpreq.open('GET', start, true)
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
var body = ''
|
||||
}
|
||||
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(body);
|
||||
httpreq.onreadystatechange = function () {
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.send(body)
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["More notifications on " + tlid, json]);
|
||||
var max_id = httpreq.getResponseHeader("link").match(/[?&]{1}max_id=([0-9]+)/)[1];
|
||||
if (json[0]) {
|
||||
var templete = "";
|
||||
var lastnotf = localStorage.getItem("lastnotf_" + acct_id);
|
||||
localStorage.setItem("lastnotf_" + acct_id, json[0].id);
|
||||
Object.keys(json).forEach(function (key) {
|
||||
var obj = json[key];
|
||||
if (localStorage.getItem("filter_" + acct_id) != "undefined") {
|
||||
var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif");
|
||||
} else {
|
||||
var mute = [];
|
||||
}
|
||||
if (obj.type != "follow") {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute);
|
||||
} else {
|
||||
templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute);
|
||||
}
|
||||
} else {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute);
|
||||
} else {
|
||||
templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
moreloading = false;
|
||||
templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>';
|
||||
$("#timeline_" + tlid).append(templete);
|
||||
$("#landing_" + tlid).hide();
|
||||
jQuery("time.timeago").timeago();
|
||||
var json = httpreq.response
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
$("#notf-box").addClass("fetched");
|
||||
todc();
|
||||
console.log(['More notifications on ' + tlid, json])
|
||||
var max_id = httpreq.getResponseHeader('link').match(/[?&]{1}max_id=([0-9]+)/)[1]
|
||||
if (json[0]) {
|
||||
var templete = ''
|
||||
var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
|
||||
localStorage.setItem('lastnotf_' + acct_id, json[0].id)
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var obj = json[key]
|
||||
var mute = getFilterTypeByAcct(acct_id, 'notif')
|
||||
if (obj.type != 'follow') {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
|
||||
} else {
|
||||
templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute)
|
||||
}
|
||||
} else {
|
||||
if (misskey) {
|
||||
templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute)
|
||||
} else {
|
||||
templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1)
|
||||
}
|
||||
}
|
||||
})
|
||||
moreloading = false
|
||||
templete = templete + '<div class="hide notif-marker" data-maxid="' + max_id + '"></div>'
|
||||
$('#timeline_' + tlid).append(templete)
|
||||
$('#landing_' + tlid).hide()
|
||||
jQuery('time.timeago').timeago()
|
||||
}
|
||||
$('#notf-box').addClass('fetched')
|
||||
todc()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,53 +358,59 @@ function notfmore(tlid) {
|
||||
|
||||
//通知トグルボタン
|
||||
function notfToggle(acct, tlid) {
|
||||
if ($("#notf-box_" + tlid).hasClass("column-hide")) {
|
||||
$("#notf-box_" + tlid).css("display", "block")
|
||||
$("#notf-box_" + tlid).animate({
|
||||
'height': '400px'
|
||||
}, {
|
||||
'duration': 300,
|
||||
'complete': function () {
|
||||
$("#notf-box_" + tlid).css("overflow-y", "scroll")
|
||||
$("#notf-box_" + tlid).removeClass("column-hide")
|
||||
if ($('#notf-box_' + tlid).hasClass('column-hide')) {
|
||||
$('#notf-box_' + tlid).css('display', 'block')
|
||||
$('#notf-box_' + tlid).animate(
|
||||
{
|
||||
height: '400px'
|
||||
},
|
||||
{
|
||||
duration: 300,
|
||||
complete: function() {
|
||||
$('#notf-box_' + tlid).css('overflow-y', 'scroll')
|
||||
$('#notf-box_' + tlid).removeClass('column-hide')
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
} else {
|
||||
$("#notf-box_" + tlid).css("overflow-y", "hidden")
|
||||
$("#notf-box_" + tlid).animate({
|
||||
'height': '0'
|
||||
}, {
|
||||
'duration': 300,
|
||||
'complete': function () {
|
||||
$("#notf-box_" + tlid).addClass("column-hide")
|
||||
$("#notf-box_" + tlid).css("display", "none")
|
||||
$('#notf-box_' + tlid).css('overflow-y', 'hidden')
|
||||
$('#notf-box_' + tlid).animate(
|
||||
{
|
||||
height: '0'
|
||||
},
|
||||
{
|
||||
duration: 300,
|
||||
complete: function() {
|
||||
$('#notf-box_' + tlid).addClass('column-hide')
|
||||
$('#notf-box_' + tlid).css('display', 'none')
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
}
|
||||
notfCanceler(acct)
|
||||
}
|
||||
function notfCanceler(acct) {
|
||||
$(".notf-reply_" + acct).text(0);
|
||||
localStorage.removeItem("notf-reply_" + acct)
|
||||
$(".notf-reply_" + acct).addClass("hide");
|
||||
$(".notf-fav_" + acct).text(0);
|
||||
localStorage.removeItem("notf-fav_" + acct)
|
||||
$(".notf-fav_" + acct).addClass("hide");
|
||||
$(".notf-bt_" + acct).text(0);
|
||||
localStorage.removeItem("notf-bt_" + acct)
|
||||
$(".notf-bt_" + acct).addClass("hide");
|
||||
$(".notf-follow_" + acct).text(0);
|
||||
localStorage.removeItem("notf-follow_" + acct)
|
||||
$(".notf-follow_" + acct).addClass("hide");
|
||||
$(".notf-icon_" + acct).removeClass("red-text");
|
||||
$('.notf-reply_' + acct).text(0)
|
||||
localStorage.removeItem('notf-reply_' + acct)
|
||||
$('.notf-reply_' + acct).addClass('hide')
|
||||
$('.notf-fav_' + acct).text(0)
|
||||
localStorage.removeItem('notf-fav_' + acct)
|
||||
$('.notf-fav_' + acct).addClass('hide')
|
||||
$('.notf-bt_' + acct).text(0)
|
||||
localStorage.removeItem('notf-bt_' + acct)
|
||||
$('.notf-bt_' + acct).addClass('hide')
|
||||
$('.notf-follow_' + acct).text(0)
|
||||
localStorage.removeItem('notf-follow_' + acct)
|
||||
$('.notf-follow_' + acct).addClass('hide')
|
||||
$('.notf-icon_' + acct).removeClass('red-text')
|
||||
}
|
||||
function allNotfRead() {
|
||||
var multi = localStorage.getItem("multi");
|
||||
var multi = localStorage.getItem('multi')
|
||||
if (multi) {
|
||||
var obj = JSON.parse(multi);
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var obj = JSON.parse(multi)
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
notfCanceler(key)
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
allNotfRead()
|
||||
allNotfRead()
|
||||
|
||||
@@ -1,249 +1,376 @@
|
||||
'use strict'
|
||||
//Integrated TL
|
||||
function mixtl(acct_id, tlid) {
|
||||
var type = "mix";
|
||||
localStorage.removeItem("morelock")
|
||||
localStorage.setItem("now", type);
|
||||
todo("Integrated TL Loading...(Local)");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
function mixtl(acct_id, tlid, type, delc, voice) {
|
||||
localStorage.removeItem('morelock')
|
||||
localStorage.setItem('now', type)
|
||||
todo('Integrated TL Loading...(Local)')
|
||||
//まずLocal
|
||||
var start = "https://" + domain + "/api/v1/timelines/public?local=true";
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/timelines/public?local=true'
|
||||
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, 'mix', acct_id, tlid);
|
||||
$("#timeline_" + tlid).html(templete[0]);
|
||||
|
||||
jQuery("time.timeago").timeago();
|
||||
$(window).scrollTop(0);
|
||||
var locals = templete[1];
|
||||
var times = templete[2];
|
||||
todo("Integrated TL Loading...(Home)");
|
||||
//Home
|
||||
var start = "https://" + domain + "/api/v1/timelines/home";
|
||||
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(obj) {
|
||||
//ホームのオブジェクトをUnix時間で走査
|
||||
if (!$("[toot-id=" + obj[0].id + "]").length) {
|
||||
$("#timeline_" + tlid + " .cvo").first().before(parse([obj[0]], 'home',
|
||||
acct_id));
|
||||
//delete obj[0];
|
||||
}
|
||||
//Localが遅すぎてHomeの全てより過去の場合
|
||||
var unixL=date(json[0].created_at,"unix");
|
||||
var unixH=date(obj[obj.length-1].created_at,"unix");
|
||||
//console.log(unixH+"vs"+unixL)
|
||||
if(unixH < unixL){
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var skey = obj.length - key - 1;
|
||||
var toot = obj[key];
|
||||
console.log(toot);
|
||||
var id = toot.id;
|
||||
if ($("#timeline_" + tlid + " [toot-id=" + toot.id + "]").length < 1) {
|
||||
//console.log(toot.id);
|
||||
var tarunix = date(toot.created_at, 'unix');
|
||||
var beforekey2;
|
||||
var key2;
|
||||
//console.log(locals)
|
||||
//ホームのオブジェクトに対してLocalのオブジェクトを時間走査
|
||||
Object.keys(times).forEach(function(key2) {
|
||||
if (times[key2] < tarunix) {
|
||||
var local = json[key2].id;
|
||||
//console.log($.strip_tags(toot.content));
|
||||
html = parse(
|
||||
[toot], 'home', acct_id, tlid);
|
||||
$("#timeline_" + tlid + " [toot-id=" + local + "]").before(html);
|
||||
//console.log("#timeline_" + tlid + " [toot-id=" + local + "]");
|
||||
tarunix = 0;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
html = parse(
|
||||
obj, 'home', acct_id, tlid);
|
||||
$("#timeline_" + tlid).html(html);
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
todc();
|
||||
mixre(acct_id, tlid);
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(jsonL) {
|
||||
var start = 'https://' + domain + '/api/v1/timelines/home'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(jsonH) {
|
||||
var homearr = []
|
||||
var timeline = jsonL.concat(jsonH)
|
||||
timeline.sort(function(a, b) {
|
||||
if (date(a.created_at, 'unix') >= date(b.created_at, 'unix')) return -1
|
||||
if (date(a.created_at, 'unix') < date(b.created_at, 'unix')) return 1
|
||||
return 0
|
||||
})
|
||||
if (type == 'integrated') {
|
||||
timeline.splice(20)
|
||||
}
|
||||
var templete = ''
|
||||
if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
|
||||
var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), 'mix')
|
||||
} else {
|
||||
var mute = []
|
||||
}
|
||||
Object.keys(timeline).forEach(function(key) {
|
||||
var pkey = key * 1 + 1
|
||||
if (pkey < timeline.length) {
|
||||
if (
|
||||
date(timeline[key].created_at, 'unix') != date(timeline[pkey].created_at, 'unix')
|
||||
) {
|
||||
if (type == 'integrated') {
|
||||
templete = templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'mix')
|
||||
} else if (type == 'plus') {
|
||||
if (timeline[key].account.acct == timeline[key].account.username) {
|
||||
templete =
|
||||
templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'plus')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
$('#landing_' + tlid).hide()
|
||||
$('#timeline_' + tlid).html(templete)
|
||||
mixre(acct_id, tlid, type, mute, delc, voice)
|
||||
additional(acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
todc()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//Streamingに接続
|
||||
function mixre(acct_id, tlid) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var type = "mix";
|
||||
localStorage.setItem("now", type);
|
||||
var startHome = "wss://" + domain +
|
||||
"/api/v1/streaming/?stream=user&access_token=" + at;
|
||||
|
||||
var startLocal = "wss://" + domain +
|
||||
"/api/v1/streaming/?stream=public:local&access_token=" + at;
|
||||
var wshid = websocketHome.length;
|
||||
var wslid = websocketLocal.length;
|
||||
websocketHome[wshid] = new WebSocket(startHome);
|
||||
websocketLocal[wslid] = new WebSocket(startLocal);
|
||||
function mixre(acct_id, tlid, TLtype, mute, delc, voice, mode) {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
if (localStorage.getItem('streaming_' + acct_id)) {
|
||||
var wss = localStorage.getItem('streaming_' + acct_id)
|
||||
} else {
|
||||
var wss = 'wss://' + domain
|
||||
}
|
||||
var startHome = wss + '/api/v1/streaming/?stream=user&access_token=' + at
|
||||
var startLocal = wss + '/api/v1/streaming/?stream=public:local&access_token=' + at
|
||||
var wshid = websocketHome.length
|
||||
var wslid = websocketLocal.length
|
||||
websocketHome[wshid] = new WebSocket(startHome)
|
||||
websocketLocal[wslid] = new WebSocket(startLocal)
|
||||
websocketHome[wshid].onopen = function(mess) {
|
||||
console.log("Connect Streaming API(Home)");
|
||||
$("#notice_icon_" + tlid).removeClass("red-text");
|
||||
localStorage.setItem('wssH_' + tlid, wshid)
|
||||
console.table({
|
||||
tlid: tlid,
|
||||
type: 'Connect Streaming API(Integrated:Home)',
|
||||
domain: domain,
|
||||
message: mess
|
||||
})
|
||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||
}
|
||||
websocketLocal[wslid].onopen = function(mess) {
|
||||
console.log("Connect Streaming API(Local)");
|
||||
$("#notice_icon_" + tlid).removeClass("red-text");
|
||||
localStorage.setItem('wssL_' + tlid, wslid)
|
||||
console.table({
|
||||
tlid: tlid,
|
||||
type: 'Connect Streaming API(Integrated:Local)',
|
||||
domain: domain,
|
||||
message: mess
|
||||
})
|
||||
$('#notice_icon_' + tlid).removeClass('red-text')
|
||||
}
|
||||
websocketLocal[wslid].onmessage = function(mess) {
|
||||
console.log("Receive Streaming API:");
|
||||
console.log(['Receive Streaming API:(Integrated:Local)', obj])
|
||||
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||
console.log(obj);
|
||||
var type = JSON.parse(mess.data).event;
|
||||
if (type == "delete") {
|
||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
|
||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
|
||||
} else if (type == "update") {
|
||||
var templete = parse([obj], '', acct_id, tlid);
|
||||
var pool = localStorage.getItem("pool_" + tlid);
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||
var type = JSON.parse(mess.data).event
|
||||
if (type == 'delete') {
|
||||
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 (type == 'update') {
|
||||
var templete = parse([obj], '', acct_id, tlid, '', mute)
|
||||
if ($('#timeline_' + tlid + ' [toot-id=' + obj.id + ']').length < 1) {
|
||||
if (voice) {
|
||||
say(obj.content)
|
||||
}
|
||||
var templete = parse([obj], type, acct_id, tlid, '', mute, 'mix')
|
||||
var pool = localStorage.getItem('pool_' + tlid)
|
||||
if (pool) {
|
||||
pool = templete + pool;
|
||||
pool = templete + pool
|
||||
} else {
|
||||
pool = templete
|
||||
}
|
||||
localStorage.setItem("pool_" + tlid, pool);
|
||||
scrollck();
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
todc();
|
||||
localStorage.setItem('pool_' + tlid, pool)
|
||||
|
||||
scrollck()
|
||||
|
||||
additional(acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
} else {
|
||||
todo('二重取得発生中')
|
||||
}
|
||||
}
|
||||
}
|
||||
websocketHome[wshid].onmessage = function(mess) {
|
||||
console.log("Receive Streaming API:(Home)");
|
||||
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload);
|
||||
console.log(obj);
|
||||
var type = JSON.parse(mess.data).event;
|
||||
if (type == "delete") {
|
||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
|
||||
$("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
|
||||
} else if (type == "update") {
|
||||
var templete = parse([obj], '', acct_id, tlid);
|
||||
if (obj.visibility != "public" || obj.account.acct != obj.account.username) {
|
||||
var pool = localStorage.getItem("pool_" + tlid);
|
||||
console.log(['Receive Streaming API:(Integrated:Home)', obj])
|
||||
var obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||
var type = JSON.parse(mess.data).event
|
||||
if (type == 'delete') {
|
||||
if (del > 10) {
|
||||
reconnector(tlid, type, acct_id, data)
|
||||
} else {
|
||||
localStorage.setItem('delete', del * 1 + 1)
|
||||
}
|
||||
if (delc == 'true') {
|
||||
$('[toot-id=' + JSON.parse(mess.data).payload + ']').addClass('emphasized')
|
||||
$('[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 (type == 'update') {
|
||||
localStorage.removeItem('delete')
|
||||
if (TLtype == 'integrated') {
|
||||
var templete = parse([obj], '', acct_id, tlid)
|
||||
} else if (TLtype == 'plus') {
|
||||
if (obj.account.acct == obj.account.username) {
|
||||
var templete = parse([obj], '', acct_id, tlid, '', mute, 'mix')
|
||||
} else {
|
||||
var templete = ''
|
||||
}
|
||||
}
|
||||
if ($('#timeline_' + tlid + ' [toot-id=' + obj.id + ']').length < 1) {
|
||||
if (voice) {
|
||||
say(obj.content)
|
||||
}
|
||||
var templete = parse([obj], type, acct_id, tlid, '', mute, 'mix')
|
||||
var pool = localStorage.getItem('pool_' + tlid)
|
||||
if (pool) {
|
||||
pool = templete + pool;
|
||||
pool = templete + pool
|
||||
} else {
|
||||
pool = templete
|
||||
}
|
||||
localStorage.setItem("pool_" + tlid, pool);
|
||||
scrollck();
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
localStorage.setItem('pool_' + tlid, pool)
|
||||
|
||||
scrollck()
|
||||
|
||||
additional(acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
} else {
|
||||
todo('二重取得発生中')
|
||||
}
|
||||
}
|
||||
}
|
||||
websocketLocal[wslid].onerror = function(error) {
|
||||
console.error('WebSocket Error ' + error);
|
||||
};
|
||||
console.error('WebSocketLocal Error')
|
||||
console.error(error)
|
||||
if (mode == 'error') {
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
todo('WebSocket Error ' + error)
|
||||
} else {
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
}
|
||||
websocketLocal[wslid].onclose = function() {
|
||||
console.warn('WebSocketLocal Closing:' + tlid)
|
||||
if (mode == 'error') {
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
todo('WebSocket Closed')
|
||||
} else {
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
}
|
||||
websocketHome[wshid].onerror = function(error) {
|
||||
console.error('WebSocket Error ' + error);
|
||||
};
|
||||
console.error(['WebSocketHome Error', error])
|
||||
if (mode == 'error') {
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
todo('WebSocket Error ' + error)
|
||||
} else {
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
}
|
||||
websocketHome[wshid].onclose = function() {
|
||||
console.warn('WebSocketHome Closing:' + tlid)
|
||||
if (mode == 'error') {
|
||||
$('#notice_icon_' + tlid).addClass('red-text')
|
||||
todo('WebSocket Closed')
|
||||
} else {
|
||||
var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
|
||||
localStorage.setItem('wserror_' + tlid, errorct)
|
||||
if (errorct < 3) {
|
||||
reconnector(tlid, TLtype, acct_id, '', 'error')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ある程度のスクロールで発火
|
||||
function mixmore(tlid) {
|
||||
var multi = localStorage.getItem("column");
|
||||
var obj = JSON.parse(multi);
|
||||
var acct_id = obj[tlid].domain;
|
||||
todo("Integrated TL MoreLoading...(Local)");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var sid = $("#timeline_" + tlid + " .cvo").last().attr("toot-id");
|
||||
var len = $("#timeline_" + tlid + " .cvo").length
|
||||
var start = "https://" + domain +
|
||||
"/api/v1/timelines/public?local=true&max_id=" + sid;
|
||||
console.log(start);
|
||||
function mixmore(tlid, type) {
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
var acct_id = obj[tlid].domain
|
||||
moreloading = true
|
||||
todo('Integrated TL MoreLoading...(Local)')
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var sid = $('#timeline_' + tlid + ' .cvo')
|
||||
.last()
|
||||
.attr('unique-id')
|
||||
|
||||
var start = 'https://' + domain + '/api/v1/timelines/public?local=true&max_id=' + sid
|
||||
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, 'mix', acct_id, tlid);
|
||||
$("#timeline_" + tlid).append(templete[0]);
|
||||
var locals = templete[1];
|
||||
todo("Integrated TL MoreLoading...(Home)");
|
||||
console.log(sid);
|
||||
var start = "https://" + domain + "/api/v1/timelines/home?max_id=" + sid;
|
||||
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(obj) {
|
||||
if ($("[toot-id=" + obj[0].id + "]").length < 1) {
|
||||
$("#timeline_" + tlid + " .cvo").eq(len).before(parse([obj[0]], 'home',
|
||||
acct_id)+'<div class="divider"></div>');
|
||||
//delete obj[0];
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var skey = obj.length - key - 1;
|
||||
var toot = obj[skey];
|
||||
var id = toot.id;
|
||||
var tarunix = date(toot.created_at, 'unix');
|
||||
var beforekey2;
|
||||
var key2;
|
||||
Object.keys(locals).forEach(function(key2) {
|
||||
if ($("[toot-id=" + toot.id + "]").length <1) {
|
||||
if (key2 > tarunix) {
|
||||
var local = locals[key2];
|
||||
$("#timeline_" + tlid + " [toot-id=" + local + "]").after(parse([toot], 'home',
|
||||
acct_id, tlid));
|
||||
tarunix = 2147483647;
|
||||
}
|
||||
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(jsonL) {
|
||||
var start = 'https://' + domain + '/api/v1/timelines/home?max_id=' + sid
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
additional(acct_id, tlid);
|
||||
jQuery("time.timeago").timeago();
|
||||
todc();
|
||||
});
|
||||
});
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(jsonH) {
|
||||
var homearr = []
|
||||
var timeline = jsonL.concat(jsonH)
|
||||
timeline.sort(function(a, b) {
|
||||
if (date(a.created_at, 'unix') > date(b.created_at, 'unix')) return -1
|
||||
if (date(a.created_at, 'unix') < date(b.created_at, 'unix')) return 1
|
||||
return 0
|
||||
})
|
||||
timeline.splice(20)
|
||||
var templete = ''
|
||||
Object.keys(timeline).forEach(function(key) {
|
||||
var pkey = key * 1 + 1
|
||||
if (pkey < 20) {
|
||||
if (
|
||||
date(timeline[key].created_at, 'unix') != date(timeline[pkey].created_at, 'unix')
|
||||
) {
|
||||
if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
|
||||
var mute = getFilterType(
|
||||
JSON.parse(localStorage.getItem('filter_' + acct_id)),
|
||||
'mix'
|
||||
)
|
||||
} else {
|
||||
var mute = []
|
||||
}
|
||||
if (type == 'integrated') {
|
||||
templete = templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'mix')
|
||||
} else if (type == 'plus') {
|
||||
if (timeline[key].account.acct == timeline[key].account.username) {
|
||||
templete = templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'mix')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
$('#timeline_' + tlid).append(templete)
|
||||
additional(acct_id, tlid)
|
||||
jQuery('time.timeago').timeago()
|
||||
moreloading = false
|
||||
todc()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
2064
app/js/tl/parse.js
2064
app/js/tl/parse.js
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,38 @@
|
||||
'use strict'
|
||||
//アンケートのトグル
|
||||
function pollToggle() {
|
||||
if ($("#poll").hasClass("hide")) {
|
||||
$("#right-side").show()
|
||||
$("#poll").removeClass("hide")
|
||||
} else {
|
||||
$("#right-side").hide()
|
||||
$("#emoji").addClass("hide")
|
||||
$("#poll").addClass("hide")
|
||||
}
|
||||
if ($('#poll').hasClass('hide')) {
|
||||
$('#right-side').show()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', 'calc(100% - 300px)')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1 + 300
|
||||
} else {
|
||||
width = 600
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
$('#poll').removeClass('hide')
|
||||
$('#pollsta').text(lang.lang_yesno)
|
||||
} else {
|
||||
$('#right-side').hide()
|
||||
$('#left-side').css('width', '100%')
|
||||
$('#right-side').css('width', '300px')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1
|
||||
} else {
|
||||
width = 300
|
||||
}
|
||||
$('#post-box').css('width', width + 'px')
|
||||
$('#emoji').addClass('hide')
|
||||
$('#poll').addClass('hide')
|
||||
$('#pollsta').text(lang.lang_no)
|
||||
}
|
||||
}
|
||||
function pollProviderCk() {
|
||||
$(".poll-provider").addClass("hide");
|
||||
$("#" + $("#poll-sel").val()).removeClass("hide");
|
||||
$('.poll-provider').addClass('hide')
|
||||
$('#' + $('#poll-sel').val()).removeClass('hide')
|
||||
}
|
||||
/*
|
||||
function pollAddtime(num){
|
||||
@@ -22,98 +43,86 @@ function pollAddtime(num){
|
||||
}
|
||||
*/
|
||||
function pollCalc() {
|
||||
var days = $("#days_poll").val();
|
||||
var hrs = $("#hours_poll").val();
|
||||
var mins = $("#mins_poll").val();
|
||||
console.log("Poll calc:" + days * 86400 + hrs * 3600 + mins * 60)
|
||||
return days * 86400 + hrs * 3600 + mins * 60;
|
||||
|
||||
var days = $('#days_poll').val()
|
||||
var hrs = $('#hours_poll').val()
|
||||
var mins = $('#mins_poll').val()
|
||||
console.log('Poll calc:' + days * 86400 + hrs * 3600 + mins * 60)
|
||||
return days * 86400 + hrs * 3600 + mins * 60
|
||||
}
|
||||
//Vote
|
||||
function voteSelMastodon(acct_id, id, to, mul) {
|
||||
if ($('.vote_' + acct_id + '_' + id + '_' + to).hasClass("sel")) {
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).css("background-color", "transparent")
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).removeClass("sel");
|
||||
} else {
|
||||
if (!mul) {
|
||||
$('.vote_' + acct_id + '_' + id + ' div').each(function (i, elem) {
|
||||
if (i == to) {
|
||||
$(this).css("background-color", "var(--emphasized)");
|
||||
$(this).addClass("sel");
|
||||
} else {
|
||||
$(this).css("background-color", "transparent")
|
||||
$(this).removeClass("sel");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).css("background-color", "var(--emphasized)")
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).addClass("sel");
|
||||
}
|
||||
}
|
||||
|
||||
if ($('.vote_' + acct_id + '_' + id + '_' + to).hasClass('sel')) {
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).css('background-color', 'transparent')
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).removeClass('sel')
|
||||
} else {
|
||||
if (!mul) {
|
||||
$('.vote_' + acct_id + '_' + id + ' div').each(function(i, elem) {
|
||||
if (i == to) {
|
||||
$(this).css('background-color', 'var(--emphasized)')
|
||||
$(this).addClass('sel')
|
||||
} else {
|
||||
$(this).css('background-color', 'transparent')
|
||||
$(this).removeClass('sel')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).css('background-color', 'var(--emphasized)')
|
||||
$('.vote_' + acct_id + '_' + id + '_' + to).addClass('sel')
|
||||
}
|
||||
}
|
||||
}
|
||||
function voteMastodon(acct_id, id) {
|
||||
var choice = [];
|
||||
$('.vote_' + acct_id + '_' + id + ' div').each(function (i, elem) {
|
||||
if ($(this).hasClass("sel")) {
|
||||
choice.push(i + "");
|
||||
}
|
||||
});
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/polls/" + id + "/votes";
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
return false;
|
||||
}
|
||||
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(JSON.stringify({ choices: choice }));
|
||||
httpreq.onreadystatechange = function () {
|
||||
voteMastodonrefresh(acct_id, id)
|
||||
}
|
||||
var choice = []
|
||||
$('.vote_' + acct_id + '_' + id + ' div').each(function(i, elem) {
|
||||
if ($(this).hasClass('sel')) {
|
||||
choice.push(i + '')
|
||||
}
|
||||
})
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/polls/' + id + '/votes'
|
||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||
return false
|
||||
}
|
||||
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(JSON.stringify({ choices: choice }))
|
||||
httpreq.onreadystatechange = function() {
|
||||
voteMastodonrefresh(acct_id, id)
|
||||
}
|
||||
}
|
||||
function showResult(acct_id, id) {
|
||||
$('.vote_' + acct_id + '_' + id + '_result').toggleClass("hide")
|
||||
$('.vote_' + acct_id + '_' + id + '_result').toggleClass('hide')
|
||||
}
|
||||
function voteMastodonrefresh(acct_id, id) {
|
||||
var datetype = localStorage.getItem("datetype");
|
||||
if (!datetype) {
|
||||
datetype = "absolute";
|
||||
}
|
||||
var httpreqd = new XMLHttpRequest();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/polls/" + id;
|
||||
httpreqd.open('GET', start, true);
|
||||
httpreqd.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreqd.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreqd.responseType = 'json';
|
||||
httpreqd.send();
|
||||
httpreqd.onreadystatechange = function () {
|
||||
if (httpreqd.readyState == 4) {
|
||||
var json = httpreqd.response;
|
||||
console.log(["Refresh vote", json]);
|
||||
if (!json) {
|
||||
return false;
|
||||
}
|
||||
var poll = "";
|
||||
var choices = json.options;
|
||||
var myvote = lang.lang_parse_voted;
|
||||
var result_hide = "";
|
||||
Object.keys(choices).forEach(function (keyc) {
|
||||
var choice = choices[keyc];
|
||||
if (!json.voted) {
|
||||
votesel = 'voteSelMastodon(\'' + acct_id + '\',\'' + json.id + '\',' + keyc + ',' + json.multiple + ')';
|
||||
}
|
||||
poll = poll + '<div class="pointer vote vote_' + acct_id + '_' + json.id + '_' + keyc + '" onclick="' + votesel + '">' + escapeHTML(choice.title) + '<span class="vote_' + acct_id + '_' + json.id + '_result ' + result_hide + '">(' + choice.votes_count + ')</span></div>';
|
||||
});
|
||||
poll = poll + myvote + '<a onclick="voteMastodonrefresh(\'' + acct_id + '\',\'' + json.id + '\')" class="pointer">' + lang.lang_manager_refresh + '</a><span class="cbadge cbadge-hover" title="' + date(json.expires_at, 'absolute') +
|
||||
'"><i class="far fa-calendar-times"></i>' +
|
||||
date(json.expires_at, datetype) + '</span>';
|
||||
$('.vote_' + acct_id + '_' + json.id).html(poll)
|
||||
}
|
||||
}
|
||||
}
|
||||
var datetype = localStorage.getItem('datetype')
|
||||
if (!datetype) {
|
||||
datetype = 'absolute'
|
||||
}
|
||||
var httpreqd = new XMLHttpRequest()
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/polls/' + id
|
||||
httpreqd.open('GET', start, true)
|
||||
httpreqd.setRequestHeader('Content-Type', 'application/json')
|
||||
httpreqd.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
httpreqd.responseType = 'json'
|
||||
httpreqd.send()
|
||||
httpreqd.onreadystatechange = function() {
|
||||
if (httpreqd.readyState == 4) {
|
||||
if (this.status !== 200) {
|
||||
setLog(start, this.status, this.response)
|
||||
}
|
||||
var json = httpreqd.response
|
||||
console.log(['Refresh vote', json])
|
||||
if (!json) {
|
||||
return false
|
||||
}
|
||||
var poll = pollParse(json, acct_id)
|
||||
$('.vote_' + acct_id + '_' + json.id).html(poll)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,108 +1,184 @@
|
||||
$voise = null;
|
||||
$voiseName = lang.lang_speech;
|
||||
$voices = speechSynthesis.getVoices();
|
||||
$synthes = new SpeechSynthesisUtterance();
|
||||
$voise = $.grep($voices, function (n, i) { return n.name == $voiseName })[0];
|
||||
$synthes.voice = $voise; // 音声の設定
|
||||
localStorage.removeItem("voicebank");
|
||||
'use strict'
|
||||
var $voise = null
|
||||
var isBouyomi = localStorage.getItem('voice_bouyomi')
|
||||
var $voiseName = lang.lang_speech
|
||||
var $voices = speechSynthesis.getVoices()
|
||||
var $synthes = new SpeechSynthesisUtterance()
|
||||
$voise = $.grep($voices, function(n, i) {
|
||||
return n.name == $voiseName
|
||||
})[0]
|
||||
$synthes.voice = $voise // 音声の設定
|
||||
localStorage.removeItem('voicebank')
|
||||
speechSynthesis.cancel()
|
||||
if (!localStorage.getItem("voice_vol")) {
|
||||
localStorage.setItem("voice_vol", 1)
|
||||
if (!localStorage.getItem('voice_vol')) {
|
||||
localStorage.setItem('voice_vol', 1)
|
||||
}
|
||||
$synthes.rate = localStorage.getItem("voice_speed");
|
||||
$synthes.pitch = localStorage.getItem("voice_pitch");
|
||||
$synthes.volume = localStorage.getItem("voice_vol");
|
||||
var voiceRate = localStorage.getItem('voice_speed')
|
||||
$synthes.rate = voiceRate
|
||||
var voicePitch = localStorage.getItem('voice_pitch')
|
||||
$synthes.pitch = voicePitch
|
||||
var voiceVol = localStorage.getItem('voice_vol')
|
||||
$synthes.volume = voiceVol
|
||||
function say(msgr) {
|
||||
msg = voiceParse(msgr);
|
||||
var voice = localStorage.getItem("voicebank");
|
||||
var obj = JSON.parse(voice);
|
||||
if (!obj) {
|
||||
var json = JSON.stringify([msg]);
|
||||
localStorage.setItem("voicebank", json);
|
||||
} else {
|
||||
obj.push([msg]);
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("voicebank", json);
|
||||
}
|
||||
|
||||
var msg = voiceParse(msgr)
|
||||
var voice = localStorage.getItem('voicebank')
|
||||
var obj = JSON.parse(voice)
|
||||
if (!obj) {
|
||||
var json = JSON.stringify([msg])
|
||||
localStorage.setItem('voicebank', json)
|
||||
} else {
|
||||
obj.push([msg])
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('voicebank', json)
|
||||
}
|
||||
}
|
||||
$repeat = setInterval(function () {
|
||||
if (!speechSynthesis.speaking) {
|
||||
var voice = localStorage.getItem("voicebank");
|
||||
if (voice) {
|
||||
var obj = JSON.parse(voice);
|
||||
if (obj[0]) {
|
||||
$synthes.text = obj[0];
|
||||
speechSynthesis.speak($synthes);
|
||||
obj.splice(0, 1);
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("voicebank", json);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 300);
|
||||
var $repeat = setInterval(function() {
|
||||
if (!speechSynthesis.speaking) {
|
||||
var voice = localStorage.getItem('voicebank')
|
||||
if (voice) {
|
||||
var obj = JSON.parse(voice)
|
||||
if (obj[0]) {
|
||||
if (localStorage.getItem('voice_bouyomi')) {
|
||||
var delim = '<bouyomi>'
|
||||
var thisVoiceRate = voiceRate * 10 + 70
|
||||
var thisVoicePitch = voicePitch * 50 + 70
|
||||
var thisVoiceVol = voiceVol * 100
|
||||
console.log(thisVoiceRate, thisVoicePitch, thisVoiceVol)
|
||||
var command = 0x0001
|
||||
var type = 0
|
||||
var sends =
|
||||
'' +
|
||||
command +
|
||||
delim +
|
||||
thisVoiceRate +
|
||||
delim +
|
||||
thisVoicePitch +
|
||||
delim +
|
||||
thisVoiceVol +
|
||||
delim +
|
||||
type +
|
||||
delim +
|
||||
obj[0]
|
||||
bouyomiConnect(sends)
|
||||
} else {
|
||||
$synthes.text = obj[0]
|
||||
speechSynthesis.speak($synthes)
|
||||
}
|
||||
|
||||
obj.splice(0, 1)
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('voicebank', json)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 300)
|
||||
function voiceParse(msg) {
|
||||
msg = $.strip_tags(msg);
|
||||
msg = msg.replace(/#/g, "");
|
||||
msg = msg.replace(/'/g, "");
|
||||
msg = msg.replace(/"/g, "");
|
||||
msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?%&-]+/g, "");
|
||||
return msg;
|
||||
var msg = $.strip_tags(msg)
|
||||
msg = msg.replace(/#/g, '')
|
||||
msg = msg.replace(/'/g, '')
|
||||
msg = msg.replace(/"/g, '')
|
||||
msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?%&-]+/g, '')
|
||||
return msg
|
||||
}
|
||||
function voiceToggle(tlid) {
|
||||
var voiceck = localStorage.getItem("voice_" + tlid);
|
||||
if (voiceck) {
|
||||
localStorage.removeItem("voice_" + tlid);
|
||||
speechSynthesis.cancel()
|
||||
$("#sta-voice-" + tlid).text("Off");
|
||||
$("#sta-voice-" + tlid).css("color", 'red');
|
||||
parseColumn(tlid);
|
||||
} else {
|
||||
localStorage.setItem("voice_" + tlid, "true");
|
||||
$("#sta-voice-" + tlid).text("On");
|
||||
$("#sta-voice-" + tlid).css("color", '#009688');
|
||||
parseColumn(tlid);
|
||||
}
|
||||
var voiceck = localStorage.getItem('voice_' + tlid)
|
||||
if (voiceck) {
|
||||
localStorage.removeItem('voice_' + tlid)
|
||||
speechSynthesis.cancel()
|
||||
if (localStorage.getItem('voice_bouyomi')) {
|
||||
var command = 0x0010
|
||||
var sends = '' + command
|
||||
bouyomiConnect(sends)
|
||||
}
|
||||
$('#sta-voice-' + tlid).text('Off')
|
||||
$('#sta-voice-' + tlid).css('color', 'red')
|
||||
parseColumn(tlid)
|
||||
} else {
|
||||
localStorage.setItem('voice_' + tlid, 'true')
|
||||
$('#sta-voice-' + tlid).text('On')
|
||||
$('#sta-voice-' + tlid).css('color', '#009688')
|
||||
parseColumn(tlid)
|
||||
}
|
||||
}
|
||||
function voiceCheck(tlid) {
|
||||
var voiceck = localStorage.getItem("voice_" + tlid);
|
||||
if (voiceck) {
|
||||
$("#sta-voice-" + tlid).text("On");
|
||||
$("#sta-voice-" + tlid).css("color", '#009688');
|
||||
} else {
|
||||
$("#sta-voice-" + tlid).text("Off");
|
||||
$("#sta-voice-" + tlid).css("color", 'red');
|
||||
}
|
||||
var voiceck = localStorage.getItem('voice_' + tlid)
|
||||
if (voiceck) {
|
||||
$('#sta-voice-' + tlid).text('On')
|
||||
$('#sta-voice-' + tlid).css('color', '#009688')
|
||||
} else {
|
||||
$('#sta-voice-' + tlid).text('Off')
|
||||
$('#sta-voice-' + tlid).css('color', 'red')
|
||||
}
|
||||
}
|
||||
function voicePlay() {
|
||||
if (speechSynthesis.speaking) {
|
||||
speechSynthesis.cancel()
|
||||
} else {
|
||||
$synthes.text = $("#voicetxt").val();
|
||||
$synthes.rate = $("#voicespeed").val() / 10;
|
||||
$synthes.pitch = $("#voicepitch").val() / 50;
|
||||
$synthes.volume = $("#voicevol").val() / 100;
|
||||
speechSynthesis.speak($synthes);
|
||||
}
|
||||
if (speechSynthesis.speaking) {
|
||||
speechSynthesis.cancel()
|
||||
} else {
|
||||
var text = $('#voicetxt').val()
|
||||
var rate = $('#voicespeed').val()
|
||||
var pitch = $('#voicepitch').val()
|
||||
var vol = $('#voicevol').val()
|
||||
if (localStorage.getItem('voice_bouyomi')) {
|
||||
var delim = '<bouyomi>'
|
||||
rate = rate * 1 + 70
|
||||
pitch = pitch * 1 + 70
|
||||
var command = 0x0001 // コマンドです。0x0001.読み上げ/0x0010.ポーズ/0x0020.再開/0x0030.スキップ
|
||||
/*var speed = 100; // 速度50-200。-1を指定すると本体設定
|
||||
var pitch = 100; // ピッチ50-200。-1を指定すると本体設定
|
||||
var volume = 100; // ボリューム0-100。-1を指定すると本体設定*/
|
||||
var type = 0 // 声質(0.本体設定/1.女性1/2.女性2/3.男性1/4.男性2/5.中性/6.ロボット/7.機械1/8.機械2)
|
||||
var sends =
|
||||
'' + command + delim + rate + delim + pitch + delim + vol + delim + type + delim + text
|
||||
bouyomiConnect(sends)
|
||||
} else {
|
||||
$synthes.text = text
|
||||
$synthes.rate = rate / 10
|
||||
$synthes.pitch = pitch / 50
|
||||
$synthes.volume = vol / 100
|
||||
speechSynthesis.speak($synthes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function voiceSettings() {
|
||||
localStorage.setItem("voice_speed", $("#voicespeed").val() / 10);
|
||||
localStorage.setItem("voice_pitch", $("#voicepitch").val() / 50);
|
||||
localStorage.setItem("voice_vol", $("#voicevol").val() / 100);
|
||||
M.toast({ html: lang.lang_speech_refresh, displayLength: 3000 })
|
||||
var awk = $('[name=bym]:checked').val()
|
||||
if (awk == 'yes') {
|
||||
localStorage.setItem('voice_bouyomi', 'yes')
|
||||
M.toast({ html: 'Bouyomi Chan connection requires WebSocket Plugin', displayLength: 3000 })
|
||||
} else {
|
||||
localStorage.removeItem('voice_bouyomi')
|
||||
}
|
||||
localStorage.setItem('voice_speed', $('#voicespeed').val() / 10)
|
||||
localStorage.setItem('voice_pitch', $('#voicepitch').val() / 50)
|
||||
localStorage.setItem('voice_vol', $('#voicevol').val() / 100)
|
||||
M.toast({ html: lang.lang_speech_refresh, displayLength: 3000 })
|
||||
}
|
||||
function voiceSettingLoad() {
|
||||
var speed = localStorage.getItem("voice_speed");
|
||||
var pitch = localStorage.getItem("voice_pitch");
|
||||
var vol = localStorage.getItem("voice_vol");
|
||||
if (speed) {
|
||||
$("#voicespeed").val(speed * 10);
|
||||
}
|
||||
if (pitch) {
|
||||
$("#voicepitch").val(pitch * 50);
|
||||
}
|
||||
if (vol) {
|
||||
$("#voicevol").val(vol * 100);
|
||||
}
|
||||
}
|
||||
var flag = localStorage.getItem('voice_bouyomi')
|
||||
if (flag) {
|
||||
$('#bym_yes').prop('checked', true)
|
||||
} else {
|
||||
$('#bym_no').prop('checked', true)
|
||||
}
|
||||
var speed = localStorage.getItem('voice_speed')
|
||||
var pitch = localStorage.getItem('voice_pitch')
|
||||
var vol = localStorage.getItem('voice_vol')
|
||||
if (speed) {
|
||||
$('#voicespeed').val(speed * 10)
|
||||
$('#voicespeedVal').text(speed * 10)
|
||||
}
|
||||
if (pitch) {
|
||||
$('#voicepitch').val(pitch * 50)
|
||||
$('#voicepitchVal').text(pitch * 50)
|
||||
}
|
||||
if (vol) {
|
||||
$('#voicevol').val(vol * 100)
|
||||
$('#voicevolVal').text(vol * 100)
|
||||
}
|
||||
}
|
||||
function bouyomiConnect(sends) {
|
||||
var socket = new WebSocket('ws://localhost:50002/')
|
||||
socket.onopen = function() {
|
||||
socket.send(sends)
|
||||
}
|
||||
}
|
||||
|
||||
466
app/js/tl/src.js
466
app/js/tl/src.js
@@ -1,241 +1,343 @@
|
||||
'use strict'
|
||||
//検索
|
||||
//検索ボックストグル
|
||||
function searchMenu() {
|
||||
$("#src-contents").html("");
|
||||
trend();
|
||||
$("#left-menu div").removeClass("active");
|
||||
$("#searchMenu").addClass("active");
|
||||
$(".menu-content").addClass("hide");
|
||||
$("#src-box").removeClass("hide");
|
||||
$('#src-contents').html('')
|
||||
trend()
|
||||
$('#left-menu div').removeClass('active')
|
||||
$('#searchMenu').addClass('active')
|
||||
$('.menu-content').addClass('hide')
|
||||
$('#src-box').removeClass('hide')
|
||||
//$('ul.tabs').tabs('select_tab', 'src-sta');
|
||||
}
|
||||
|
||||
//検索取得
|
||||
function src(mode) {
|
||||
$("#src-contents").html("");
|
||||
var q = $("#src").val();
|
||||
var acct_id = $("#src-acct-sel").val();
|
||||
if (acct_id == "tootsearch") {
|
||||
tsAdd(q)
|
||||
return false;
|
||||
function src(mode, offset) {
|
||||
if (!offset) {
|
||||
$('#src-contents').html('')
|
||||
var add = ''
|
||||
} else {
|
||||
var add = '&type=accounts&offset=' + $('#src-accts .cvo').length
|
||||
}
|
||||
localStorage.setItem("last-use", acct_id);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var m = q.match(/^#(.+)$/);
|
||||
if (m) { q = m[1]; }
|
||||
if (user == "--now") {
|
||||
var user = $('#his-data').attr("user-id");
|
||||
|
||||
var q = $('#src').val()
|
||||
var acct_id = $('#src-acct-sel').val()
|
||||
if (acct_id == 'tootsearch') {
|
||||
tsAdd(q)
|
||||
return false
|
||||
}
|
||||
localStorage.setItem('last-use', acct_id)
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var m = q.match(/^#(.+)$/)
|
||||
if (m) {
|
||||
q = m[1]
|
||||
}
|
||||
if (user == '--now') {
|
||||
var user = $('#his-data').attr('user-id')
|
||||
}
|
||||
if (!mode) {
|
||||
var start = "https://" + domain + "/api/v2/search?q=" + q
|
||||
var start = 'https://' + domain + '/api/v2/search?q=' + q + add
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/search?q=" + q
|
||||
var start = 'https://' + domain + '/api/v1/search?q=' + q
|
||||
}
|
||||
console.log("Try to search at " + start)
|
||||
console.log('Try to search at ' + start)
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
src("v1")
|
||||
return false;
|
||||
}).then(function (json) {
|
||||
console.log(["Search", json]);
|
||||
//ハッシュタグ
|
||||
if (json.hashtags[0]) {
|
||||
var tags = "";
|
||||
Object.keys(json.hashtags).forEach(function (key4) {
|
||||
var tag = json.hashtags[key4];
|
||||
if (mode) {
|
||||
tags = tags + '<a onclick="tl(\'tag\',\'' + tag + '\',\'' + acct_id +
|
||||
'\',\'add\')" class="pointer">#' + escapeHTML(tag) + '</a><br> ';
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
src('v1')
|
||||
return false
|
||||
})
|
||||
.then(function(json) {
|
||||
console.log(['Search', json])
|
||||
//ハッシュタグ
|
||||
if (json.hashtags[0]) {
|
||||
var tags = ''
|
||||
Object.keys(json.hashtags).forEach(function(key4) {
|
||||
var tag = json.hashtags[key4]
|
||||
if (mode) {
|
||||
tags =
|
||||
tags +
|
||||
`<a onclick="tl('tag','${tag}','${acct_id}','add')" class="pointer">
|
||||
#${escapeHTML(tag)}
|
||||
</a>
|
||||
<br> `
|
||||
} else {
|
||||
tags = tags + graphDraw(tag, acct_id)
|
||||
}
|
||||
})
|
||||
$('#src-contents').append('Tags<br>' + tags)
|
||||
}
|
||||
//トゥート
|
||||
if (json.statuses[0]) {
|
||||
var templete = parse(json.statuses, '', acct_id)
|
||||
$('#src-contents').append('<br>Mentions<br>' + templete)
|
||||
}
|
||||
//アカウント
|
||||
if (json.accounts[0]) {
|
||||
var templete = userparse(json.accounts, '', acct_id)
|
||||
if (!offset) {
|
||||
$('#src-contents').append(
|
||||
`<br>Accounts<div id="src-accts">
|
||||
${templete}
|
||||
</div><a onclick="src(false,'more')" class="pointer">more...</a>`
|
||||
)
|
||||
} else {
|
||||
tags = tags + graphDraw(tag, acct_id);
|
||||
$('#src-accts').append(templete)
|
||||
}
|
||||
|
||||
});
|
||||
$("#src-contents").append("Tags<br>" + tags);
|
||||
}
|
||||
//トゥート
|
||||
if (json.statuses[0]) {
|
||||
var templete = parse(json.statuses, '', acct_id);
|
||||
$("#src-contents").append("<br>Mentions<br>" + templete);
|
||||
}
|
||||
//アカウント
|
||||
if (json.accounts[0]) {
|
||||
var templete = userparse(json.accounts, '', acct_id);
|
||||
$("#src-contents").append("<br>Accounts<br>" + templete);
|
||||
}
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
}
|
||||
jQuery('time.timeago').timeago()
|
||||
})
|
||||
}
|
||||
function tsAdd(q) {
|
||||
var add = {
|
||||
domain: acct_id,
|
||||
type: "tootsearch",
|
||||
type: 'tootsearch',
|
||||
data: q
|
||||
};
|
||||
var multi = localStorage.getItem("column");
|
||||
var obj = JSON.parse(multi);
|
||||
localStorage.setItem("card_" + obj.length, "true");
|
||||
obj.push(add);
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("column", json);
|
||||
parseColumn('add');
|
||||
}
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
localStorage.setItem('card_' + obj.length, 'true')
|
||||
obj.push(add)
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('column', json)
|
||||
parseColumn('add')
|
||||
}
|
||||
function tootsearch(tlid, q) {
|
||||
var start = "https://tootsearch.chotto.moe/api/v1/search?from=0&sort=created_at%3Adesc&q=" + q
|
||||
console.log("Toot srrach at " + start)
|
||||
$("#notice_" + tlid).text("tootsearch(" + q + ")");
|
||||
$("#notice_icon_" + tlid).text("search");
|
||||
var start = 'https://tootsearch.chotto.moe/api/v1/search?from=0&sort=created_at%3Adesc&q=' + q
|
||||
console.log('Toot srrach at ' + start)
|
||||
$('#notice_' + tlid).text('tootsearch(' + q + ')')
|
||||
$('#notice_icon_' + tlid).text('search')
|
||||
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 (raw) {
|
||||
var templete = "";
|
||||
var json = raw.hits.hits;
|
||||
var max_id = raw["hits"].length;
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
var toot = json[i]["_source"];
|
||||
if (lastid != toot.uri) {
|
||||
if (toot && toot.account) {
|
||||
templete = templete + parse([toot], "noauth", null, tlid, 0, [], "tootsearch")
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
var lastid = toot.uri;
|
||||
}
|
||||
if (!templete) {
|
||||
templete = lang.lang_details_nodata;
|
||||
} else {
|
||||
templete = templete + '<div class="hide ts-marker" data-maxid="' + max_id + '"></div>';
|
||||
}
|
||||
$("#timeline_" + tlid).html(templete);
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(raw) {
|
||||
var templete = ''
|
||||
var json = raw.hits.hits
|
||||
var max_id = raw['hits'].length
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
var toot = json[i]['_source']
|
||||
if (lastid != toot.uri) {
|
||||
if (toot && toot.account) {
|
||||
templete = templete + parse([toot], 'noauth', null, tlid, 0, [], 'tootsearch')
|
||||
}
|
||||
}
|
||||
var lastid = toot.uri
|
||||
}
|
||||
if (!templete) {
|
||||
templete = lang.lang_details_nodata
|
||||
} else {
|
||||
templete = templete + `<div class="hide ts-marker" data-maxid="${max_id}"></div>`
|
||||
}
|
||||
$('#timeline_' + tlid).html(templete)
|
||||
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
jQuery('time.timeago').timeago()
|
||||
})
|
||||
}
|
||||
function moreTs(tlid, q) {
|
||||
var sid = $("#timeline_" + tlid + " .ts-marker").last().attr("data-maxid");
|
||||
moreloading = true;
|
||||
var start = "https://tootsearch.chotto.moe/api/v1/search?from=" + sid + "&sort=created_at%3Adesc&q=" + q
|
||||
$("#notice_" + tlid).text("tootsearch(" + q + ")");
|
||||
$("#notice_icon_" + tlid).text("search");
|
||||
var sid = $('#timeline_' + tlid + ' .ts-marker')
|
||||
.last()
|
||||
.attr('data-maxid')
|
||||
moreloading = true
|
||||
var start =
|
||||
'https://tootsearch.chotto.moe/api/v1/search?from=' + sid + '&sort=created_at%3Adesc&q=' + q
|
||||
$('#notice_' + tlid).text('tootsearch(' + q + ')')
|
||||
$('#notice_icon_' + tlid).text('search')
|
||||
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 (raw) {
|
||||
var templete = "";
|
||||
var json = raw.hits.hits;
|
||||
var max_id = raw["hits"].length;
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
var toot = json[i]["_source"];
|
||||
if (lastid != toot.uri) {
|
||||
if (toot && toot.account) {
|
||||
templete = templete + parse([toot], "noauth", null, tlid, 0, [], "tootsearch")
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
var lastid = toot.uri;
|
||||
}
|
||||
if (!templete) {
|
||||
templete = lang.lang_details_nodata;
|
||||
} else {
|
||||
templete = templete + '<div class="hide ts-marker" data-maxid="' + max_id + '"></div>';
|
||||
}
|
||||
$("#timeline_" + tlid).append(templete);
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(raw) {
|
||||
var templete = ''
|
||||
var json = raw.hits.hits
|
||||
var max_id = raw['hits'].length
|
||||
for (var i = 0; i < json.length; i++) {
|
||||
var toot = json[i]['_source']
|
||||
if (lastid != toot.uri) {
|
||||
if (toot && toot.account) {
|
||||
templete = templete + parse([toot], 'noauth', null, tlid, 0, [], 'tootsearch')
|
||||
}
|
||||
}
|
||||
var lastid = toot.uri
|
||||
}
|
||||
if (!templete) {
|
||||
templete = lang.lang_details_nodata
|
||||
} else {
|
||||
templete = templete + `<div class="hide ts-marker" data-maxid="${max_id}"></div>`
|
||||
}
|
||||
$('#timeline_' + tlid).append(templete)
|
||||
|
||||
jQuery("time.timeago").timeago();
|
||||
});
|
||||
jQuery('time.timeago').timeago()
|
||||
})
|
||||
}
|
||||
function graphDraw(tag, acct_id) {
|
||||
var tags = "";
|
||||
var his = tag.history;
|
||||
var max = Math.max.apply(null, [his[0].uses, his[1].uses, his[2].uses, his[3].uses, his[4].uses, his[5].uses, his[6].uses]);
|
||||
var six = 50 - (his[6].uses / max * 50);
|
||||
var five = 50 - (his[5].uses / max * 50);
|
||||
var four = 50 - (his[4].uses / max * 50);
|
||||
var three = 50 - (his[3].uses / max * 50);
|
||||
var two = 50 - (his[2].uses / max * 50);
|
||||
var one = 50 - (his[1].uses / max * 50);
|
||||
var zero = 50 - (his[0].uses / max * 50);
|
||||
var tags = ''
|
||||
var his = tag.history
|
||||
var max = Math.max.apply(null, [
|
||||
his[0].uses,
|
||||
his[1].uses,
|
||||
his[2].uses,
|
||||
his[3].uses,
|
||||
his[4].uses,
|
||||
his[5].uses,
|
||||
his[6].uses
|
||||
])
|
||||
var six = 50 - (his[6].uses / max) * 50
|
||||
var five = 50 - (his[5].uses / max) * 50
|
||||
var four = 50 - (his[4].uses / max) * 50
|
||||
var three = 50 - (his[3].uses / max) * 50
|
||||
var two = 50 - (his[2].uses / max) * 50
|
||||
var one = 50 - (his[1].uses / max) * 50
|
||||
var zero = 50 - (his[0].uses / max) * 50
|
||||
if (max === 0) {
|
||||
tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' +
|
||||
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toot(s) <a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
|
||||
'\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a> ' + his[0].accounts + lang.lang_src_people;
|
||||
tags =
|
||||
`<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50"></svg>
|
||||
<span style="font-size:200%">${his[0].uses}</span>
|
||||
toot(s)
|
||||
<a onclick=\"tl('tag','${escapeHTML(tag.name)}','${acct_id}','add')" class="pointer">
|
||||
#${escapeHTML(tag.name)}
|
||||
</a> ` +
|
||||
his[0].accounts +
|
||||
lang.lang_src_people
|
||||
} else {
|
||||
tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' +
|
||||
'<g><path d="M0,' + six + ' L10,' + five + ' 20,' + four + ' 30,' + three + ' 40,' + two + ' 50,' + one + ' 60,' + zero + '" style="stroke: #9e9e9e; stroke-width: 1;fill: none;"></path></g>' +
|
||||
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toot <a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
|
||||
'\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a> ' + his[0].accounts + lang.lang_src_people;
|
||||
tags =
|
||||
`<br><br>
|
||||
<svg version="1.1" viewbox="0 0 60 50" width="60" height="50">
|
||||
<g>
|
||||
<path d="M0,${six} L10,${five} 20,${four} 30,${three} 40,${two} 50,${one} 60,${zero}"
|
||||
style="stroke: #0f8c0c;fill: rgba(13,113,19,.25); stroke-width: 1;">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
<span style="font-size:200%">${his[0].uses}</span>
|
||||
toot
|
||||
<a onclick="tl('tag','${escapeHTML(tag.name)}','${acct_id}','add')" class="pointer">
|
||||
#${escapeHTML(tag.name)}
|
||||
</a> ` +
|
||||
his[0].accounts +
|
||||
lang.lang_src_people
|
||||
}
|
||||
|
||||
return tags;
|
||||
return tags
|
||||
}
|
||||
/*
|
||||
<svg version="1.1" viewbox="0 0 50 300" width="100%" height="50">
|
||||
<path d="M0,0 L10,0 20,10 20,50" fill="#3F51B5"></path>
|
||||
</svg>
|
||||
*/
|
||||
function trend(){
|
||||
console.log("get trend")
|
||||
$("#src-contents").html("");
|
||||
var acct_id = $("#src-acct-sel").val();
|
||||
if(acct_id=="tootsearch"){
|
||||
return false;
|
||||
function trend() {
|
||||
console.log('get trend')
|
||||
$('#src-contents').html('')
|
||||
var acct_id = $('#src-acct-sel').val()
|
||||
if (acct_id == 'tootsearch') {
|
||||
return false
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/trends"
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/trends'
|
||||
console.log(start)
|
||||
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 tags = "";
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
var tags = ''
|
||||
Object.keys(json).forEach(function(keye) {
|
||||
var tag = json[keye];
|
||||
var his=tag.history;
|
||||
var max=Math.max.apply(null, [his[0].uses,his[1].uses,his[2].uses,his[3].uses,his[4].uses,his[5].uses,his[6].uses]);
|
||||
var six=50-(his[6].uses/max*50);
|
||||
var five=50-(his[5].uses/max*50);
|
||||
var four=50-(his[4].uses/max*50);
|
||||
var three=50-(his[3].uses/max*50);
|
||||
var two=50-(his[2].uses/max*50);
|
||||
var one=50-(his[1].uses/max*50);
|
||||
var zero=50-(his[0].uses/max*50);
|
||||
tags = '<svg version="1.1" viewbox="0 0 60 50" width="60" height="50">'+
|
||||
'<g><path d="M0,'+six+' L10,'+five+' 20,'+four+' 30,'+three+' 40,'+two+' 50,'+one+' 60,'+zero+'" style="stroke: #9e9e9e; stroke-width: 1;fill: none;"></path></g>'+
|
||||
'</svg><span style="font-size:200%">'+his[0].uses+'</span>toots <a onclick="tl(\'tag\',\'' + tag.name + '\',\'' + acct_id +
|
||||
'\',\'add\')" class="pointer">#' + tag.name + '</a> '+his[0].accounts+lang.lang_src_people+"<br><br>";
|
||||
var tag = json[keye]
|
||||
var his = tag.history
|
||||
var max = Math.max.apply(null, [
|
||||
his[0].uses,
|
||||
his[1].uses,
|
||||
his[2].uses,
|
||||
his[3].uses,
|
||||
his[4].uses,
|
||||
his[5].uses,
|
||||
his[6].uses
|
||||
])
|
||||
var six = 50 - (his[6].uses / max) * 50
|
||||
var five = 50 - (his[5].uses / max) * 50
|
||||
var four = 50 - (his[4].uses / max) * 50
|
||||
var three = 50 - (his[3].uses / max) * 50
|
||||
var two = 50 - (his[2].uses / max) * 50
|
||||
var one = 50 - (his[1].uses / max) * 50
|
||||
var zero = 50 - (his[0].uses / max) * 50
|
||||
tags =
|
||||
`<svg version="1.1" viewbox="0 0 60 50" width="60" height="50">
|
||||
<g>
|
||||
<path d="M0,${six} L10,${five} 20,${four} 30,${three} 40,${two} 50,${one} 60,${zero}"
|
||||
style="stroke: #0f8c0c;fill: rgba(13,113,19,.25); stroke-width: 1;">
|
||||
</path>
|
||||
</g>
|
||||
</svg>
|
||||
<span style="font-size:200%">${his[0].uses}</span>
|
||||
toot
|
||||
<a onclick="tl('tag','${escapeHTML(tag.name)}','${acct_id}','add')" class="pointer">
|
||||
#${escapeHTML(tag.name)}
|
||||
</a> ` +
|
||||
his[0].accounts +
|
||||
lang.lang_src_people +
|
||||
'<br><br>'
|
||||
|
||||
$("#src-contents").append(tags);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
$('#src-contents').append(tags)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
287
app/js/tl/tag.js
287
app/js/tl/tag.js
@@ -1,130 +1,201 @@
|
||||
'use strict'
|
||||
//タグ表示
|
||||
if (location.search) {
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
|
||||
var mode = m[1];
|
||||
var codex = m[2];
|
||||
if (mode == "tag") {
|
||||
var acct_id = localStorage.getItem("main");
|
||||
tl('tag', decodeURI(codex), acct_id, 'add');
|
||||
}
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
|
||||
var mode = m[1]
|
||||
var codex = m[2]
|
||||
if (mode == 'tag') {
|
||||
var acct_id = localStorage.getItem('main')
|
||||
tl('tag', decodeURI(codex), acct_id, 'add')
|
||||
}
|
||||
}
|
||||
//よく使うタグ
|
||||
function tagShow(tag) {
|
||||
$("[data-tag=" + decodeURI(tag).toLowerCase() + "]").toggleClass("hide");
|
||||
console.log('[data-regTag=' + decodeURI(tag).toLowerCase() + ']')
|
||||
$('[data-regTag=' + decodeURI(tag).toLowerCase() + ']').toggleClass('hide')
|
||||
}
|
||||
//タグ追加
|
||||
function tagPin(tag) {
|
||||
var tags = localStorage.getItem("tag");
|
||||
if (!tags) {
|
||||
var obj = [];
|
||||
} else {
|
||||
var obj = JSON.parse(tags);
|
||||
}
|
||||
var can;
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var tagT = obj[key];
|
||||
if (tagT == tag) {
|
||||
can = true;
|
||||
} else {
|
||||
can = false;
|
||||
}
|
||||
});
|
||||
if (!can) {
|
||||
obj.push(tag);
|
||||
}
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("tag", json);
|
||||
favTag();
|
||||
var tags = localStorage.getItem('tag')
|
||||
if (!tags) {
|
||||
var obj = []
|
||||
} else {
|
||||
var obj = JSON.parse(tags)
|
||||
}
|
||||
var can
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var tagT = obj[key]
|
||||
if (tagT == tag) {
|
||||
can = true
|
||||
} else {
|
||||
can = false
|
||||
}
|
||||
})
|
||||
if (!can) {
|
||||
obj.push(tag)
|
||||
}
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('tag', json)
|
||||
favTag()
|
||||
}
|
||||
//タグ削除
|
||||
function tagRemove(key) {
|
||||
var tags = localStorage.getItem("tag");
|
||||
var obj = JSON.parse(tags);
|
||||
obj.splice(key, 1);
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("tag", json);
|
||||
favTag();
|
||||
var tags = localStorage.getItem('tag')
|
||||
var obj = JSON.parse(tags)
|
||||
obj.splice(key, 1)
|
||||
var json = JSON.stringify(obj)
|
||||
localStorage.setItem('tag', json)
|
||||
favTag()
|
||||
}
|
||||
function favTag() {
|
||||
$("#taglist").html("");
|
||||
var tagarr = localStorage.getItem("tag");
|
||||
if (!tagarr) {
|
||||
var obj = [];
|
||||
} else {
|
||||
var obj = JSON.parse(tagarr);
|
||||
}
|
||||
var tags = "";
|
||||
var nowPT = localStorage.getItem("stable")
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var tag = obj[key];
|
||||
if (nowPT != tag) {
|
||||
console.log("stable tags:" + nowPT + "/" + tag);
|
||||
var ptt = lang.lang_tags_realtime;
|
||||
var nowon = "";
|
||||
} else {
|
||||
var ptt = lang.lang_tags_unrealtime;
|
||||
var nowon = "(" + lang.lang_tags_realtime + ")";
|
||||
}
|
||||
tag = escapeHTML(tag);
|
||||
tags = tags + '<a onclick="tagShow(\'' + tag + '\')" class="pointer">#' + tag + '</a>' + nowon + '<span class="hide" data-tag="' + tag + '"> <a onclick="tagTL(\'tag\',\'' + tag + '\',false,\'add\')" class="pointer" title="' + lang.lang_parse_tagTL.replace("{{tag}}", '#' + tag) + '">TL</a> <a onclick="brInsert(\'#' + tag + '\')" class="pointer" title="' + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag) + '">Toot</a> ' +
|
||||
'<a onclick="autoToot(\'' + tag + '\');" class="pointer" title="' + lang.lang_tags_always + lang.lang_parse_tagtoot.replace("{{tag}}", '#' + tag) + '">' + ptt + '</a> <a onclick="tagRemove(\'' + key + '\')" class="pointer" title="' + lang.lang_tags_tagunpin.replace("{{tag}}", '#' + tag) + '">' + lang.lang_del + '</a></span> ';
|
||||
});
|
||||
if (obj.length > 0) {
|
||||
$("#taglist").append("My Tags:" + tags);
|
||||
} else {
|
||||
$("#taglist").append("");
|
||||
}
|
||||
$('#taglist').html('')
|
||||
var tagarr = localStorage.getItem('tag')
|
||||
if (!tagarr) {
|
||||
var obj = []
|
||||
} else {
|
||||
var obj = JSON.parse(tagarr)
|
||||
}
|
||||
var tags = ''
|
||||
var nowPT = localStorage.getItem('stable')
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var tag = obj[key]
|
||||
if (nowPT != tag) {
|
||||
console.log('stable tags:' + nowPT + '/' + tag)
|
||||
var ptt = lang.lang_tags_realtime
|
||||
var nowon = ''
|
||||
} else {
|
||||
var ptt = lang.lang_tags_unrealtime
|
||||
var nowon = '(' + lang.lang_tags_realtime + ')'
|
||||
}
|
||||
tag = escapeHTML(tag)
|
||||
tags =
|
||||
tags +
|
||||
`<a onclick="tagShow('${tag}')" class="pointer">#${tag}</a>
|
||||
${nowon}<span class="hide" data-tag="${tag}" data-regTag="${tag.toLowerCase()}">
|
||||
<a onclick=\"tagTL('tag','${tag}',false,'add')" class="pointer" title="${lang.lang_parse_tagTL.replace('{{tag}}', '#' + tag)}">
|
||||
TL
|
||||
</a>
|
||||
<a onclick="brInsert('#${tag}')" class="pointer" title="${lang.lang_parse_tagtoot.replace('{{tag}}', '#' + tag)}">
|
||||
Toot
|
||||
</a>
|
||||
<a onclick="autoToot('${tag}');" class="pointer" title="${lang.lang_tags_always}${lang.lang_parse_tagtoot.replace('{{tag}}', '#' + tag)}">
|
||||
${ptt}
|
||||
</a>
|
||||
<a onclick="tagRemove('${key}')" class="pointer" title="${lang.lang_tags_tagunpin.replace('{{tag}}', '#' + tag)}">
|
||||
${lang.lang_del}
|
||||
</a>
|
||||
</span> `
|
||||
})
|
||||
if (obj.length > 0) {
|
||||
$('#taglist').append('My Tags:' + tags)
|
||||
} else {
|
||||
$('#taglist').append('')
|
||||
}
|
||||
}
|
||||
function trendTag() {
|
||||
$(".trendtag").remove();
|
||||
var domain = "imastodon.net"
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/trend_tags"
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var tags = "";
|
||||
json = json.score;
|
||||
Object.keys(json).forEach(function (tag) {
|
||||
tag = escapeHTML(tag);
|
||||
tags = tags + '<a onclick="tagShow(\'' + tag + '\')" class="pointer">#' + tag + '</a><span class="hide" data-tag="' + tag + '"> <a onclick="tagTL(\'tag\',\'' + tag + '\',false,\'add\')" class="pointer" title="#' + tag + 'のタイムライン">TL</a> <a onclick="show();brInsert(\'#' + tag + '\')" class="pointer" title="#' + tag + 'でトゥート">Toot</a></span> ';
|
||||
});
|
||||
$("#taglist").append('<div class="trendtag">アイマストドントレンドタグ<i class="material-icons pointer" onclick="trendTag()" style="font-size:12px">refresh</i>:' + tags + '</div>');
|
||||
trendintervalset()
|
||||
} else {
|
||||
$("#taglist").html("");
|
||||
}
|
||||
});
|
||||
|
||||
$('.trendtag').remove()
|
||||
var domain = 'imastodon.net'
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/trend_tags'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var tags = ''
|
||||
json = json.score
|
||||
Object.keys(json).forEach(function(tag) {
|
||||
tag = escapeHTML(tag)
|
||||
tags =
|
||||
tags +
|
||||
`<a onclick="tagShow('${tag}')" class="pointer">#${tag}</a>
|
||||
<span class="hide" data-tag="${tag}" data-regTag="${tag.toLowerCase()}">
|
||||
<a onclick=\"tagTL('tag','${tag}',false,'add')" class="pointer" title="#${tag}のタイムライン">TL</a>
|
||||
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">
|
||||
Toot
|
||||
</a>
|
||||
</span> `
|
||||
})
|
||||
$('#taglist').append(
|
||||
'<div class="trendtag">アイマストドントレンドタグ<i class="material-icons pointer" onclick="trendTag()" style="font-size:12px">refresh</i>:' +
|
||||
tags +
|
||||
'</div>'
|
||||
)
|
||||
trendintervalset()
|
||||
} else {
|
||||
$('#taglist').html('')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function trendintervalset() {
|
||||
setTimeout(trendTag, 6000000);
|
||||
setTimeout(trendTag, 6000000)
|
||||
}
|
||||
function tagTL(a, b, c, d) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
tl(a, b, acct_id, d);
|
||||
var acct_id = $('#post-acct-sel').val()
|
||||
tl(a, b, acct_id, d)
|
||||
}
|
||||
function autoToot(tag) {
|
||||
tag = escapeHTML(tag)
|
||||
var nowPT = localStorage.getItem("stable")
|
||||
if (nowPT == tag) {
|
||||
localStorage.removeItem("stable");
|
||||
M.toast({ html: lang.lang_tags_unrealtime, displayLength: 3000 })
|
||||
} else {
|
||||
localStorage.setItem("stable", tag);
|
||||
M.toast({ html: lang.lang_tags_tagwarn.replace("{{tag}}", tag).replace("{{tag}}", tag), displayLength: 3000 })
|
||||
brInsert('#' + tag + " ")
|
||||
}
|
||||
favTag();
|
||||
}
|
||||
tag = escapeHTML(tag)
|
||||
var nowPT = localStorage.getItem('stable')
|
||||
if (nowPT == tag) {
|
||||
localStorage.removeItem('stable')
|
||||
M.toast({ html: lang.lang_tags_unrealtime, displayLength: 3000 })
|
||||
} else {
|
||||
localStorage.setItem('stable', tag)
|
||||
M.toast({
|
||||
html: lang.lang_tags_tagwarn.replace('{{tag}}', tag).replace('{{tag}}', tag),
|
||||
displayLength: 3000
|
||||
})
|
||||
brInsert('#' + tag + ' ')
|
||||
}
|
||||
favTag()
|
||||
}
|
||||
//タグをフィーチャー
|
||||
function tagFeature(name, acct_id) {
|
||||
var domain = localStorage.getItem('domain_' + acct_id)
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/featured_tags'
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
Authorization: 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({
|
||||
name: name
|
||||
})
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
return false
|
||||
})
|
||||
.then(function(json) {
|
||||
console.log(json)
|
||||
M.toast({ html: 'Complete: ' + escapeHTML(name), displayLength: 3000 })
|
||||
})
|
||||
}
|
||||
|
||||
1573
app/js/tl/tl.js
1573
app/js/tl/tl.js
File diff suppressed because it is too large
Load Diff
485
app/js/ui/img.js
485
app/js/ui/img.js
@@ -1,259 +1,250 @@
|
||||
'use strict'
|
||||
/*イメージビューワー*/
|
||||
//postのimg.jsとは異なります。
|
||||
function imgv(id, key, acct_id) {
|
||||
$("#imgprog").text(0);
|
||||
$('#imgmodal').hide();
|
||||
$('#imgmodal').attr('src', '../../img/loading.svg');
|
||||
var murl = $("#" + id + "-image-" + key).attr("data-url");
|
||||
var type = $("#" + id + "-image-" + key).attr("data-type");
|
||||
$("#imagemodal").attr("data-id", id);
|
||||
$("#imagemodal").attr("data-acct", acct_id);
|
||||
$(document).ready(function () {
|
||||
if (type == "image") {
|
||||
$('#imagemodal').modal('open');
|
||||
xhr = new XMLHttpRequest;
|
||||
xhr.open('GET', murl, true);
|
||||
xhr.addEventListener('progress', function (event) {
|
||||
if (event.lengthComputable) {
|
||||
var total = event.total;
|
||||
var now = event.loaded;
|
||||
var per = now / total * 100;
|
||||
$("#imgprog").text(Math.floor(per));
|
||||
}
|
||||
}, false);
|
||||
xhr.addEventListener('loadend', function (event) {
|
||||
var total = event.total;
|
||||
var now = event.loaded;
|
||||
var per = now / total * 100;
|
||||
$("#imgprog").text(Math.floor(per));
|
||||
}, false);
|
||||
xhr.send();
|
||||
$('#imgmodal').attr('src', murl);
|
||||
$('#imagewrap').dragScroll(); // ドラッグスクロール設定
|
||||
$('#imgmodal').show();
|
||||
$('#imagemodal').attr('data-key', key);
|
||||
$('#imagemodal').attr('data-id', id);
|
||||
} else if (type == "video" || type == "gifv") {
|
||||
$('#video').attr('src', murl);
|
||||
$('#videomodal').modal('open');
|
||||
$('#imgmodal').show();
|
||||
$('#imgprog').text(0)
|
||||
$('#imgsec').text(0)
|
||||
$('#imgmodal').hide()
|
||||
$('#imgmodal').attr('src', '../../img/loading.svg')
|
||||
var murl = $('#' + id + '-image-' + key).attr('data-url')
|
||||
var ourl = $('#' + id + '-image-' + key).attr('data-original')
|
||||
if (!ourl || ourl == 'null') {
|
||||
ourl = murl
|
||||
}
|
||||
var type = $('#' + id + '-image-' + key).attr('data-type')
|
||||
$('#imagemodal').attr('data-id', id)
|
||||
$('#imagemodal').attr('data-acct', acct_id)
|
||||
$('#imagemodal').attr('data-original', ourl)
|
||||
$('#imagemodal').attr('data-image', murl)
|
||||
//表示はリモートを使うか(どちらにしろコピーはオリジナル)
|
||||
var remote_img = localStorage.getItem('remote_img')
|
||||
if (remote_img == 'yes') {
|
||||
murl = ourl
|
||||
}
|
||||
$(document).ready(function() {
|
||||
if (type == 'image') {
|
||||
$('#imagemodal').modal('open')
|
||||
imageXhr(id, key, murl)
|
||||
$('#imagewrap').dragScroll() // ドラッグスクロール設定
|
||||
$('#imgmodal').show()
|
||||
$('#imagemodal').attr('data-key', key)
|
||||
$('#imagemodal').attr('data-id', id)
|
||||
} else if (type == 'video' || type == 'gifv') {
|
||||
$('#video').attr('src', murl)
|
||||
$('#videomodal').modal('open')
|
||||
$('#imgmodal').show()
|
||||
}
|
||||
var element = new Image();
|
||||
var width;
|
||||
element.onload = function () {
|
||||
var width = element.naturalWidth;
|
||||
var height = element.naturalHeight;
|
||||
var windowH = $(window).height();
|
||||
var windowW = $(window).width();
|
||||
$("#imagemodal").css("bottom", "0")
|
||||
$("#imagemodal img").css("width", "auto")
|
||||
if (height < windowH) {
|
||||
$("#imagemodal").css("height", height + 60 + "px")
|
||||
$("#imagemodal img").css("height", "100%")
|
||||
if (width > windowW * 0.8) {
|
||||
$("#imagemodal").css("width", "80vw")
|
||||
$("#imagemodal img").css("width", "100%")
|
||||
var heightS = windowW * 0.8 / width * height;
|
||||
$("#imagemodal").css("height", heightS + 60 + "px")
|
||||
} else {
|
||||
$("#imagemodal").css("width", width + "px")
|
||||
}
|
||||
} else {
|
||||
$("#imagemodal img").css("width", "auto")
|
||||
var widthS = windowH / height * width;
|
||||
if (widthS < windowW) {
|
||||
$("#imagemodal").css("width", widthS + "px")
|
||||
} else {
|
||||
$("#imagemodal").css("width", "100vw")
|
||||
}
|
||||
|
||||
$("#imagemodal").css("height", "100vh")
|
||||
$("#imagemodal img").css("height", "calc(100vh - 60px)")
|
||||
}
|
||||
|
||||
}
|
||||
if ($("#" + id + "-image-" + (key * 1 + 1)).length == 0) {
|
||||
$("#image-next").prop("disabled", true);
|
||||
} else {
|
||||
$("#image-next").prop("disabled", false);
|
||||
}
|
||||
if ($("#" + id + "-image-" + (key * 1 - 1)).length == 0) {
|
||||
$("#image-prev").prop("disabled", true);
|
||||
} else {
|
||||
$("#image-prev").prop("disabled", false);
|
||||
}
|
||||
element.src = murl;
|
||||
});
|
||||
})
|
||||
}
|
||||
//イメージビューワーの送り
|
||||
function imgCont(type) {
|
||||
$("#imgprog").text(0);
|
||||
var key = $('#imagemodal').attr('data-key');
|
||||
var id = $('#imagemodal').attr('data-id');
|
||||
if (type == "next") {
|
||||
key++;
|
||||
} else if (type == "prev") {
|
||||
key = key * 1 - 1;
|
||||
var key = $('#imagemodal').attr('data-key')
|
||||
var id = $('#imagemodal').attr('data-id')
|
||||
if (type == 'next') {
|
||||
key++
|
||||
} else if (type == 'prev') {
|
||||
key = key * 1 - 1
|
||||
}
|
||||
var murl = $('#' + id + '-image-' + key).attr('data-url')
|
||||
var ourl = $('#' + id + '-image-' + key).attr('data-original')
|
||||
var type = $('#' + id + '-image-' + key).attr('data-type')
|
||||
$('#imagemodal').attr('data-id', id)
|
||||
$('#imagemodal').attr('data-acct', acct_id)
|
||||
$('#imagemodal').attr('data-original', ourl)
|
||||
$('#imagemodal').attr('data-image', murl)
|
||||
//表示はリモートを使うか(どちらにしろコピーはオリジナル)
|
||||
var remote_img = localStorage.getItem('remote_img')
|
||||
if (remote_img == 'yes') {
|
||||
murl = ourl
|
||||
}
|
||||
var murl = $("#" + id + "-image-" + key).attr("data-url");
|
||||
if (murl) {
|
||||
$('#imgmodal').attr('src', '../../img/loading.svg');
|
||||
var type = $("#" + id + "-image-" + key).attr("data-type");
|
||||
$(document).ready(function () {
|
||||
if (type == "image") {
|
||||
xhr = new XMLHttpRequest;
|
||||
xhr.open('GET', murl, true);
|
||||
xhr.responseType = "arraybuffer";
|
||||
xhr.addEventListener('progress', function (event) {
|
||||
if (event.lengthComputable) {
|
||||
var total = event.total;
|
||||
var now = event.loaded;
|
||||
var per = now / total * 100;
|
||||
$("#imgprog").text(Math.floor(per));
|
||||
}
|
||||
}, false);
|
||||
xhr.addEventListener('loadend', function (event) {
|
||||
var total = event.total;
|
||||
var now = event.loaded;
|
||||
var per = now / total * 100;
|
||||
$("#imgprog").text(Math.floor(per));
|
||||
}, false);
|
||||
xhr.send();
|
||||
$('#imgmodal').attr('src', murl);
|
||||
$('#imagewrap').dragScroll(); // ドラッグスクロール設定
|
||||
$('#imagemodal').attr('data-key', key);
|
||||
$('#imagemodal').attr('data-id', id);
|
||||
} else if (type == "video" || type == "gifv") {
|
||||
$('#video').attr('src', murl);
|
||||
$('#videomodal').modal('open');
|
||||
$('#imgprog').text(0)
|
||||
$('#imgsec').text(0)
|
||||
$('#imgmodal').attr('src', '../../img/loading.svg')
|
||||
var type = $('#' + id + '-image-' + key).attr('data-type')
|
||||
$(document).ready(function() {
|
||||
if (type == 'image') {
|
||||
imageXhr(id, key, murl)
|
||||
$('#imagewrap').dragScroll() // ドラッグスクロール設定
|
||||
$('#imagemodal').attr('data-key', key)
|
||||
$('#imagemodal').attr('data-id', id)
|
||||
} else if (type == 'video' || type == 'gifv') {
|
||||
$('#video').attr('src', murl)
|
||||
$('#videomodal').modal('open')
|
||||
}
|
||||
var element = new Image();
|
||||
var width;
|
||||
element.onload = function () {
|
||||
var width = element.naturalWidth;
|
||||
var height = element.naturalHeight;
|
||||
var windowH = $(window).height();
|
||||
var windowW = $(window).width();
|
||||
$("#imagemodal").css("bottom", "0")
|
||||
$("#imagemodal img").css("width", "auto")
|
||||
if (height < windowH) {
|
||||
$("#imagemodal").css("height", height + 60 + "px")
|
||||
$("#imagemodal img").css("height", "100%")
|
||||
if (width > windowW * 0.8) {
|
||||
$("#imagemodal").css("width", "80vw")
|
||||
$("#imagemodal img").css("width", "100%")
|
||||
var heightS = windowW * 0.8 / width * height;
|
||||
$("#imagemodal").css("height", heightS + 60 + "px")
|
||||
} else {
|
||||
$("#imagemodal").css("width", width + "px")
|
||||
}
|
||||
} else {
|
||||
$("#imagemodal img").css("width", "auto")
|
||||
var widthS = windowH / height * width;
|
||||
if (widthS < windowW) {
|
||||
$("#imagemodal").css("width", widthS + "px")
|
||||
} else {
|
||||
$("#imagemodal").css("width", "100vw")
|
||||
}
|
||||
|
||||
$("#imagemodal").css("height", "100vh")
|
||||
$("#imagemodal img").css("height", "calc(100vh - 60px)")
|
||||
}
|
||||
}
|
||||
if ($("#" + id + "-image-" + (key * 1 + 1)).length === 0) {
|
||||
$("#image-next").prop("disabled", true);
|
||||
} else {
|
||||
$("#image-next").prop("disabled", false);
|
||||
}
|
||||
if ($("#" + id + "-image-" + (key * 1 - 1)).length === 0) {
|
||||
$("#image-prev").prop("disabled", true);
|
||||
} else {
|
||||
$("#image-prev").prop("disabled", false);
|
||||
}
|
||||
element.src = murl;
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
function imageXhr(id, key, murl) {
|
||||
var startTime = new Date()
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', murl, true)
|
||||
xhr.responseType = 'arraybuffer'
|
||||
xhr.addEventListener(
|
||||
'progress',
|
||||
function(event) {
|
||||
if (event.lengthComputable) {
|
||||
var total = event.total
|
||||
var now = event.loaded
|
||||
var per = (now / total) * 100
|
||||
$('#imgprog').text(Math.floor(per))
|
||||
}
|
||||
},
|
||||
false
|
||||
)
|
||||
xhr.addEventListener(
|
||||
'loadend',
|
||||
function(event) {
|
||||
var total = event.total
|
||||
$('#imgbyte').text(Math.floor(total/1024))
|
||||
var now = event.loaded
|
||||
var per = (now / total) * 100
|
||||
$('#imgprog').text(Math.floor(per))
|
||||
},
|
||||
false
|
||||
)
|
||||
xhr.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var r = new FileReader()
|
||||
r.readAsDataURL(this.response)
|
||||
r.onload = function() {
|
||||
var b64 = r.result
|
||||
var element = new Image()
|
||||
var width
|
||||
element.onload = function() {
|
||||
var width = element.naturalWidth
|
||||
var height = element.naturalHeight
|
||||
var windowH = $(window).height()
|
||||
var windowW = $(window).width()
|
||||
$('#imagemodal').css('bottom', '0')
|
||||
$('#imagemodal img').css('width', 'auto')
|
||||
if (height < windowH) {
|
||||
$('#imagemodal').css('height', height + 60 + 'px')
|
||||
$('#imagemodal img').css('height', '100%')
|
||||
if (width > windowW * 0.8) {
|
||||
$('#imagemodal').css('width', '80vw')
|
||||
$('#imagemodal img').css('width', '100%')
|
||||
var heightS = ((windowW * 0.8) / width) * height
|
||||
$('#imagemodal').css('height', heightS + 60 + 'px')
|
||||
} else {
|
||||
$('#imagemodal').css('width', width + 'px')
|
||||
}
|
||||
} else {
|
||||
$('#imagemodal img').css('width', 'auto')
|
||||
var widthS = (windowH / height) * width
|
||||
if (widthS < windowW) {
|
||||
$('#imagemodal').css('width', widthS + 'px')
|
||||
} else {
|
||||
$('#imagemodal').css('width', '100vw')
|
||||
}
|
||||
|
||||
$('#imagemodal').css('height', '100vh')
|
||||
$('#imagemodal img').css('height', 'calc(100vh - 60px)')
|
||||
}
|
||||
}
|
||||
if ($('#' + id + '-image-' + (key * 1 + 1)).length == 0) {
|
||||
$('#image-next').prop('disabled', true)
|
||||
} else {
|
||||
$('#image-next').prop('disabled', false)
|
||||
}
|
||||
if ($('#' + id + '-image-' + (key * 1 - 1)).length == 0) {
|
||||
$('#image-prev').prop('disabled', true)
|
||||
} else {
|
||||
$('#image-prev').prop('disabled', false)
|
||||
}
|
||||
element.src = b64
|
||||
var endTime = new Date()
|
||||
var proctime = endTime.getTime() - startTime.getTime()
|
||||
$('#imgsec').text(proctime)
|
||||
$('#imgmodal').attr('src', b64)
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.responseType = 'blob'
|
||||
xhr.send()
|
||||
}
|
||||
//ズームボタン(z:倍率)
|
||||
function zoom(z) {
|
||||
var wdth = $('#imagewrap img').width();
|
||||
var wdth = wdth * z;
|
||||
$('#imagewrap img').css("width", wdth + "px");
|
||||
var hgt = $('#imagewrap img').height();
|
||||
var hgt = hgt * z;
|
||||
$('#imagewrap img').css("height", hgt + "px");
|
||||
var wdth = $('#imagewrap img').width()
|
||||
var wdth = wdth * z
|
||||
$('#imagewrap img').css('width', wdth + 'px')
|
||||
var hgt = $('#imagewrap img').height()
|
||||
var hgt = hgt * z
|
||||
$('#imagewrap img').css('height', hgt + 'px')
|
||||
}
|
||||
//スマホ対応ドラッグ移動システム
|
||||
(function () {
|
||||
$.fn.dragScroll = function () {
|
||||
var target = this;
|
||||
$(this).mousedown(function (event) {
|
||||
$(this)
|
||||
.data('down', true)
|
||||
.data('x', event.clientX)
|
||||
.data('y', event.clientY)
|
||||
.data('scrollLeft', this.scrollLeft)
|
||||
.data('scrollTop', this.scrollTop);
|
||||
return false;
|
||||
}).css({
|
||||
'overflow': 'hidden', // スクロールバー非表示
|
||||
'cursor': 'move'
|
||||
});
|
||||
;(function() {
|
||||
$.fn.dragScroll = function() {
|
||||
var target = this
|
||||
$(this)
|
||||
.mousedown(function(event) {
|
||||
$(this)
|
||||
.data('down', true)
|
||||
.data('x', event.clientX)
|
||||
.data('y', event.clientY)
|
||||
.data('scrollLeft', this.scrollLeft)
|
||||
.data('scrollTop', this.scrollTop)
|
||||
return false
|
||||
})
|
||||
.css({
|
||||
overflow: 'hidden', // スクロールバー非表示
|
||||
cursor: 'move'
|
||||
})
|
||||
// ウィンドウから外れてもイベント実行
|
||||
$(document).mousemove(function (event) {
|
||||
if ($(target).data('down') == true) {
|
||||
// スクロール
|
||||
target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') -
|
||||
event.clientX);
|
||||
target.scrollTop($(target).data('scrollTop') + $(target).data('y') -
|
||||
event.clientY);
|
||||
return false; // 文字列選択を抑止
|
||||
}
|
||||
}).mouseup(function (event) {
|
||||
$(target).data('down', false);
|
||||
});
|
||||
$(this).on('touchstart', function (event) {
|
||||
$(this)
|
||||
.data('down', true)
|
||||
.data('x', getX(event))
|
||||
.data('y', getY(event))
|
||||
.data('scrollLeft', this.scrollLeft)
|
||||
.data('scrollTop', this.scrollTop);
|
||||
return false;
|
||||
}).css({
|
||||
'overflow': 'hidden', // スクロールバー非表示
|
||||
'cursor': 'move'
|
||||
}); //指が触れたか検知
|
||||
$(this).on('touchmove', function (event) {
|
||||
$(document)
|
||||
.mousemove(function(event) {
|
||||
if ($(target).data('down') == true) {
|
||||
// スクロール
|
||||
target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') - event.clientX)
|
||||
target.scrollTop($(target).data('scrollTop') + $(target).data('y') - event.clientY)
|
||||
return false // 文字列選択を抑止
|
||||
}
|
||||
})
|
||||
.mouseup(function(event) {
|
||||
$(target).data('down', false)
|
||||
})
|
||||
$(this)
|
||||
.on('touchstart', function(event) {
|
||||
$(this)
|
||||
.data('down', true)
|
||||
.data('x', getX(event))
|
||||
.data('y', getY(event))
|
||||
.data('scrollLeft', this.scrollLeft)
|
||||
.data('scrollTop', this.scrollTop)
|
||||
return false
|
||||
})
|
||||
.css({
|
||||
overflow: 'hidden', // スクロールバー非表示
|
||||
cursor: 'move'
|
||||
}) //指が触れたか検知
|
||||
$(this).on('touchmove', function(event) {
|
||||
if ($(target).data('down') === true) {
|
||||
// スクロール
|
||||
target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') -
|
||||
getX(event));
|
||||
target.scrollTop($(target).data('scrollTop') + $(target).data('y') -
|
||||
getY(event));
|
||||
return false; // 文字列選択を抑止
|
||||
} else { }
|
||||
}); //指が動いたか検知
|
||||
$(this).on('touchend', function (event) {
|
||||
$(target).data('down', false);
|
||||
});
|
||||
target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') - getX(event))
|
||||
target.scrollTop($(target).data('scrollTop') + $(target).data('y') - getY(event))
|
||||
return false // 文字列選択を抑止
|
||||
} else {
|
||||
}
|
||||
}) //指が動いたか検知
|
||||
$(this).on('touchend', function(event) {
|
||||
$(target).data('down', false)
|
||||
})
|
||||
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
})(jQuery);
|
||||
})(jQuery)
|
||||
|
||||
function getX(event) {
|
||||
return event.originalEvent.touches[0].pageX;
|
||||
return event.originalEvent.touches[0].pageX
|
||||
}
|
||||
|
||||
function getY(event) {
|
||||
return event.originalEvent.touches[0].pageY;
|
||||
return event.originalEvent.touches[0].pageY
|
||||
}
|
||||
//マウスホイールで拡大
|
||||
var element = document.getElementById("imagemodal");
|
||||
element.onmousewheel = function (e) {
|
||||
var delta = e.wheelDelta;
|
||||
var element = document.getElementById('imagemodal')
|
||||
element.onmousewheel = function(e) {
|
||||
var delta = e.wheelDelta
|
||||
if (delta > 0) {
|
||||
zoom(1.1)
|
||||
} else {
|
||||
@@ -263,22 +254,34 @@ element.onmousewheel = function (e) {
|
||||
|
||||
//当該トゥート
|
||||
function detFromImg() {
|
||||
var id = $("#imagemodal").attr("data-id");
|
||||
var acct_id = $("#imagemodal").attr("data-acct");
|
||||
$('#imagemodal').modal('close');
|
||||
details(id, acct_id);
|
||||
var id = $('#imagemodal').attr('data-id')
|
||||
var acct_id = $('#imagemodal').attr('data-acct')
|
||||
$('#imagemodal').modal('close')
|
||||
details(id, acct_id)
|
||||
}
|
||||
//画像保存
|
||||
function dlImg() {
|
||||
var url = $("#imgmodal").attr("src");
|
||||
if (localStorage.getItem("savefolder")) {
|
||||
var save = localStorage.getItem("savefolder");
|
||||
} else {
|
||||
var save = "";
|
||||
var ourl = $('#imagemodal').attr('data-original')
|
||||
var murl = $('#imagemodal').attr('data-image')
|
||||
var remote_img = localStorage.getItem('remote_img')
|
||||
if (remote_img == 'yes') {
|
||||
murl = ourl
|
||||
}
|
||||
postMessage(["generalDL", [url, save, false]], "*")
|
||||
|
||||
if (localStorage.getItem('savefolder')) {
|
||||
var save = localStorage.getItem('savefolder')
|
||||
} else {
|
||||
var save = ''
|
||||
}
|
||||
postMessage(['generalDL', [murl, save, false]], '*')
|
||||
}
|
||||
function openFinder(dir) {
|
||||
postMessage(["openFinder", dir], "*")
|
||||
}
|
||||
postMessage(['openFinder', dir], '*')
|
||||
}
|
||||
function stopVideo() {
|
||||
document.getElementById('video').pause()
|
||||
}
|
||||
function copyImgUrl() {
|
||||
var murl = $('#imagemodal').attr('data-original')
|
||||
execCopy(murl)
|
||||
M.toast({ html: lang.lang_img_copyDone, displayLength: 1500 })
|
||||
}
|
||||
|
||||
13
app/js/ui/jquery-ui.min.js
vendored
13
app/js/ui/jquery-ui.min.js
vendored
File diff suppressed because one or more lines are too long
1096
app/js/ui/layout.js
1096
app/js/ui/layout.js
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
function menu() {
|
||||
localStorage.setItem("menu-done", true);
|
||||
$("#fukidashi").addClass("hide")
|
||||
@@ -17,6 +18,16 @@ function menu() {
|
||||
}
|
||||
$('#menu').css("left", left + "px")
|
||||
$('#menu').css("top", top + "px")
|
||||
var height = localStorage.getItem("menu-height");
|
||||
var width = localStorage.getItem("menu-width");
|
||||
if(height){
|
||||
$('#menu').css("height", height + "px")
|
||||
}else{
|
||||
$('#menu').css("height", "460px")
|
||||
}
|
||||
if(width){
|
||||
$('#menu').css("width", width + "px")
|
||||
}
|
||||
$('#menu').fadeIn();
|
||||
$("#menu-bar").html("TheDesk " + localStorage.getItem("ver"));
|
||||
$(".menu-content").addClass("hide");
|
||||
@@ -49,7 +60,19 @@ $(function () {
|
||||
localStorage.setItem("menu-top", top);
|
||||
}
|
||||
});
|
||||
$("#menu").resizable({
|
||||
minHeight: 150,
|
||||
minWidth: 200,
|
||||
stop: function (event, ui) {
|
||||
localStorage.setItem("menu-height", ui.size.height);
|
||||
localStorage.setItem("menu-width", ui.size.width);
|
||||
}
|
||||
});
|
||||
});
|
||||
function help() {
|
||||
postMessage(["openUrl", "https://docs.thedesk.top"], "*")
|
||||
$("#left-menu div").removeClass("active");
|
||||
$("#helpMenu").addClass("active");
|
||||
$(".menu-content").addClass("hide");
|
||||
$("#help-box").removeClass("hide");
|
||||
postMessage(["sendSinmpleIpc", "getLogs"], "*")
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
function pip(id) {
|
||||
$("#pip-content").html($("[toot-id=" + id + "] .additional").html());
|
||||
$("#pip").removeClass("hide");
|
||||
|
||||
@@ -1,111 +1,141 @@
|
||||
'use strict'
|
||||
/*ささやきボックス(Cr民並感)*/
|
||||
//✕隠す
|
||||
function hide() {
|
||||
$("#right-side").hide()
|
||||
$('#right-side').hide()
|
||||
$('#right-side').css('width', '300px')
|
||||
$('#left-side').css('width', '100%')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
width = width.replace('px', '') * 1
|
||||
} else {
|
||||
width = 300
|
||||
}
|
||||
$('#post-box').css('width', width)
|
||||
$('#post-box').fadeOut()
|
||||
$("#post-box").removeClass("appear")
|
||||
$("#emoji").addClass("hide")
|
||||
$("#left-side").show();
|
||||
$("#default-emoji").show();
|
||||
$("#unreact").show();
|
||||
$("#addreact").addClass("hide");
|
||||
$('#post-box').removeClass('appear')
|
||||
$('#emoji').addClass('hide')
|
||||
$('#left-side').show()
|
||||
$('#default-emoji').show()
|
||||
$('#unreact').show()
|
||||
$('#addreact').addClass('hide')
|
||||
}
|
||||
//最小化
|
||||
function mini() {
|
||||
$("body").toggleClass("mini-post");
|
||||
if ($("body").hasClass("mini-post")) {
|
||||
$(".mini-btn").text("expand_less");
|
||||
$('body').toggleClass('mini-post')
|
||||
if ($('body').hasClass('mini-post')) {
|
||||
$('.mini-btn').text('expand_less')
|
||||
} else {
|
||||
$(".mini-btn").text("expand_more");
|
||||
$('.mini-btn').text('expand_more')
|
||||
}
|
||||
}
|
||||
//最小化時に展開
|
||||
function show() {
|
||||
$("#post-box").addClass("appear")
|
||||
$("#textarea").focus();
|
||||
console.log("show" + localStorage.getItem("postbox-left"));
|
||||
var left = localStorage.getItem("postbox-left");
|
||||
$('#post-box').addClass('appear')
|
||||
$('#textarea').focus()
|
||||
console.log('show' + localStorage.getItem('postbox-left'))
|
||||
var left = localStorage.getItem('postbox-left')
|
||||
if (left > $('body').width() - $('#post-box').width()) {
|
||||
left = $('body').width() - $('#post-box').width();
|
||||
left = $('body').width() - $('#post-box').width()
|
||||
} else if (left < 0) {
|
||||
left = 0;
|
||||
left = 0
|
||||
}
|
||||
var top = localStorage.getItem("postbox-top");
|
||||
var top = localStorage.getItem('postbox-top')
|
||||
if (top > $('body').height() - $('#post-box').height()) {
|
||||
top = $('body').height() - $('#post-box').height();
|
||||
top = $('body').height() - $('#post-box').height()
|
||||
} else if (top < 0) {
|
||||
top = 0;
|
||||
top = 0
|
||||
}
|
||||
$('#post-box').css("left", left + "px")
|
||||
$('#post-box').css("top", top + "px")
|
||||
$('#post-box').fadeIn();
|
||||
$('#textarea').characterCounter();
|
||||
$('#post-box').css('left', left + 'px')
|
||||
$('#post-box').css('top', top + 'px')
|
||||
var width = localStorage.getItem('postbox-width')
|
||||
if (width) {
|
||||
$('#post-box').css('width', width + 'px')
|
||||
} else {
|
||||
$('#post-box').css('width', '300px')
|
||||
}
|
||||
$('#post-box').fadeIn()
|
||||
$('#textarea').characterCounter()
|
||||
mdCheck()
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$("#post-box").draggable({
|
||||
handle: "#post-bar",
|
||||
stop: function () {
|
||||
var left = $('#post-box').offset().left;
|
||||
$(function() {
|
||||
$('#post-box').draggable({
|
||||
handle: '#post-bar',
|
||||
stop: function() {
|
||||
var left = $('#post-box').offset().left
|
||||
if (left > $('body').width() - $('#post-box').width()) {
|
||||
left = $('body').width() - $('#post-box').width();
|
||||
left = $('body').width() - $('#post-box').width()
|
||||
} else if (left < 0) {
|
||||
left = 0;
|
||||
left = 0
|
||||
}
|
||||
var top = $('#post-box').offset().top;
|
||||
var top = $('#post-box').offset().top
|
||||
if (top > $('body').height() - $('#post-box').height()) {
|
||||
top = $('body').height() - $('#post-box').height();
|
||||
top = $('body').height() - $('#post-box').height()
|
||||
} else if (top < 0) {
|
||||
top = 0;
|
||||
top = 0
|
||||
}
|
||||
localStorage.setItem("postbox-left", left);
|
||||
localStorage.setItem("postbox-top", top);
|
||||
localStorage.setItem('postbox-left', left)
|
||||
localStorage.setItem('postbox-top', top)
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
$('#post-box').resizable({
|
||||
minHeight: 150,
|
||||
minWidth: 100,
|
||||
stop: function(event, ui) {
|
||||
$('#textarea').blur()
|
||||
localStorage.setItem('postbox-width', ui.size.width)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
//コード受信
|
||||
if (location.search) {
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
|
||||
var mode = m[1];
|
||||
var codex = m[2];
|
||||
if (mode == "share") {
|
||||
$('textarea').focus();
|
||||
$("#textarea").val(decodeURI(codex));
|
||||
show();
|
||||
$("body").removeClass("mini-post");
|
||||
$(".mini-btn").text("expand_less");
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
|
||||
var mode = m[1]
|
||||
var codex = m[2]
|
||||
if (mode == 'share') {
|
||||
$('textarea').focus()
|
||||
$('#textarea').val(decodeURI(codex))
|
||||
show()
|
||||
$('body').removeClass('mini-post')
|
||||
$('.mini-btn').text('expand_less')
|
||||
}
|
||||
}
|
||||
$('#posttgl').click(function (e) {
|
||||
if (!$('#post-box').hasClass("appear")) {
|
||||
show();
|
||||
$('#posttgl').click(function(e) {
|
||||
if (!$('#post-box').hasClass('appear')) {
|
||||
show()
|
||||
} else {
|
||||
hide();
|
||||
hide()
|
||||
}
|
||||
$('.cvo').removeClass("selectedToot")
|
||||
$('.cvo').removeClass('selectedToot')
|
||||
selectedColumn = 0
|
||||
selectedToot = 0
|
||||
});
|
||||
})
|
||||
|
||||
$("#timeline-container,#group").click(function (e) {
|
||||
if (localStorage.getItem("box") != "absolute") {
|
||||
if ($('#post-box').hasClass("appear") && !localStorage.getItem("nohide")) {
|
||||
hide();
|
||||
$('#timeline-container,#group').click(function(e) {
|
||||
if (localStorage.getItem('box') != 'absolute') {
|
||||
if ($('#post-box').hasClass('appear') && !localStorage.getItem('nohide')) {
|
||||
hide()
|
||||
}
|
||||
}
|
||||
$('.cvo').removeClass("selectedToot")
|
||||
$('.cvo').removeClass('selectedToot')
|
||||
selectedColumn = 0
|
||||
selectedToot = 0
|
||||
localStorage.removeItem("nohide")
|
||||
});
|
||||
$('#textarea,#cw-text').focusout(function (e) {
|
||||
localStorage.setItem("nohide", true)
|
||||
var countup = function () {
|
||||
localStorage.removeItem("nohide")
|
||||
localStorage.removeItem('nohide')
|
||||
})
|
||||
$('#contextWrap').click(function(e) {
|
||||
$('#contextWrap').addClass('hide')
|
||||
$('.contextMenu').addClass('hide')
|
||||
$('.act-icon').text('expand_more')
|
||||
})
|
||||
$('#textarea,#cw-text').focusout(function(e) {
|
||||
localStorage.setItem('nohide', true)
|
||||
var countup = function() {
|
||||
localStorage.removeItem('nohide')
|
||||
}
|
||||
//setTimeout(remove, 100);
|
||||
$('.cvo').removeClass("selectedToot")
|
||||
$('.cvo').removeClass('selectedToot')
|
||||
selectedColumn = 0
|
||||
selectedToot = 0
|
||||
});
|
||||
})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
var r = document.getElementById("radio");
|
||||
function Rtoggle() {
|
||||
if ($("#radio").hasClass("play")) {
|
||||
|
||||
@@ -1,49 +1,71 @@
|
||||
'use strict'
|
||||
//スクロールで続きを読む
|
||||
function scrollevent() {
|
||||
$(".tl-box").scroll(function () {
|
||||
scrollck();
|
||||
});
|
||||
$('.tl-box').scroll(function() {
|
||||
scrollck()
|
||||
})
|
||||
}
|
||||
scrollevent();
|
||||
scrollevent()
|
||||
|
||||
function scrollck() {
|
||||
$(".tl-box").each(function (i, elem) {
|
||||
var tlid = $(this).attr('tlid');
|
||||
//一番上ならためていた新しいトゥートを表示
|
||||
$('.tl-box').each(function(i, elem) {
|
||||
var tlid = $(this).attr('tlid')
|
||||
var len = $('#timeline_' + tlid + ' .cvo').length
|
||||
//一番上ならためていた新しいトゥートを表示ないしtealなら未読管理モード
|
||||
if ($(this).scrollTop() === 0) {
|
||||
var pool = localStorage.getItem("pool_" + tlid);
|
||||
if (pool) {
|
||||
$("#timeline_" + tlid).prepend(pool);
|
||||
jQuery("time.timeago").timeago();
|
||||
localStorage.removeItem("pool_" + tlid);
|
||||
if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
|
||||
var pool = localStorage.getItem('pool_' + tlid)
|
||||
if (pool) {
|
||||
$('#timeline_' + tlid).prepend(pool)
|
||||
jQuery('time.timeago').timeago()
|
||||
localStorage.removeItem('pool_' + tlid)
|
||||
}
|
||||
} else {
|
||||
ueload(tlid)
|
||||
}
|
||||
//自動リフレッシュ
|
||||
if ($("#timeline_" + tlid + " .cvo").length > 30) {
|
||||
for (var i = 30; i < $("#timeline_" + tlid + " .cvo").length; i++) {
|
||||
$("#timeline_" + tlid + " .cvo").eq(i).remove();
|
||||
if (len > 30) {
|
||||
for (var i = 30; i < $('#timeline_' + tlid + ' .cvo').length; i++) {
|
||||
$('#timeline_' + tlid + ' .cvo')
|
||||
.eq(i)
|
||||
.remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
//続きを読むトリガー
|
||||
var scrt = $(this).find(".tl").height() - $(window).height();
|
||||
var scr = $(this).scrollTop();
|
||||
if (scr > scrt) {
|
||||
console.log("kicked more loading:" + tlid);
|
||||
moreload('', tlid);
|
||||
var scrt =
|
||||
$(this)
|
||||
.find('.tl')
|
||||
.height() - $(window).height()
|
||||
var scr = $(this).scrollTop()
|
||||
if (scr > scrt && scrt > 0) {
|
||||
console.log('kicked more loading:' + tlid)
|
||||
moreload('', tlid)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function goTop(id) {
|
||||
if ($("#timeline_box_" + id + "_box .tl-box").scrollTop() > 500) {
|
||||
$("#timeline_box_" + id + "_box .tl-box").scrollTop(500)
|
||||
if ($('#unread_' + id + ' .material-icons').hasClass('teal-text')) {
|
||||
$('#unread_' + id + ' .material-icons').removeClass('teal-text')
|
||||
var multi = localStorage.getItem('column')
|
||||
var obj = JSON.parse(multi)
|
||||
var acct_id = obj[id * 1].domain
|
||||
var type = obj[id * 1].type
|
||||
console.log(id, type)
|
||||
columnReload(id, type)
|
||||
}
|
||||
$("#timeline_box_" + id + "_box .tl-box").animate({ scrollTop: 0 });
|
||||
if ($('#timeline_box_' + id + '_box .tl-box').scrollTop() > 500) {
|
||||
$('#timeline_box_' + id + '_box .tl-box').scrollTop(500)
|
||||
}
|
||||
$('#timeline_box_' + id + '_box .tl-box').animate({ scrollTop: 0 })
|
||||
}
|
||||
function goColumn(key) {
|
||||
$("#sort-box").addClass("hide");
|
||||
$("#sort-box").removeClass("show");
|
||||
$('#sort-box').addClass('hide')
|
||||
$('#sort-box').removeClass('show')
|
||||
if ($('[tlid=' + key + ']').length) {
|
||||
$("#timeline-container").animate({ scrollLeft: $("#timeline-container").scrollLeft() + $('[tlid=' + key + ']').offset().left });
|
||||
$('#timeline-container').animate({
|
||||
scrollLeft: $('#timeline-container').scrollLeft() + $('[tlid=' + key + ']').offset().left
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,77 +1,81 @@
|
||||
'use strict'
|
||||
//設定(setting.html)で読む
|
||||
var envView = new Vue({
|
||||
el: '#envView',
|
||||
el: "#envView",
|
||||
data: { config: envConstruction },
|
||||
methods: {
|
||||
complete: function (i, val) {
|
||||
complete: function(i, val) {
|
||||
var ls = envView.config[i].storage;
|
||||
M.toast({ html: 'Complete', displayLength: 3000 })
|
||||
M.toast({ html: "Complete", displayLength: 3000 });
|
||||
if (!val) {
|
||||
var id = envView.config[i].id;
|
||||
var val = $("#" + id).val()
|
||||
var val = $("#" + id).val();
|
||||
}
|
||||
localStorage.setItem(ls, val)
|
||||
localStorage.setItem(ls, val);
|
||||
if (ls == "ha") {
|
||||
hardwareAcceleration(val)
|
||||
hardwareAcceleration(val);
|
||||
}
|
||||
return true
|
||||
if (ls == "ua_setting") {
|
||||
useragent(val);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
var tlView = new Vue({
|
||||
el: '#tlView',
|
||||
el: "#tlView",
|
||||
data: { config: tlConstruction },
|
||||
methods: {
|
||||
complete: function (i, val) {
|
||||
complete: function(i, val) {
|
||||
var ls = tlView.config[i];
|
||||
if (val) {
|
||||
localStorage.setItem(ls.storage, val)
|
||||
localStorage.setItem(ls.storage, val);
|
||||
} else {
|
||||
if (!ls.data) {
|
||||
ls = [ls]
|
||||
ls = [ls];
|
||||
} else {
|
||||
ls = ls.data
|
||||
ls = ls.data;
|
||||
}
|
||||
for (var j = 0; j < ls.length; j++) {
|
||||
M.toast({ html: 'Complete', displayLength: 3000 })
|
||||
M.toast({ html: "Complete", displayLength: 3000 });
|
||||
var id = ls[j].id;
|
||||
var val = $("#" + id).val()
|
||||
localStorage.setItem(ls[j].storage, val)
|
||||
var val = $("#" + id).val();
|
||||
localStorage.setItem(ls[j].storage, val);
|
||||
}
|
||||
}
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
var postView = new Vue({
|
||||
el: '#postView',
|
||||
data: { config: postConstruction, kirishima: localStorage.getItem('kirishima') },
|
||||
el: "#postView",
|
||||
data: { config: postConstruction, kirishima: localStorage.getItem("kirishima"), quoters: localStorage.getItem("quoters") },
|
||||
methods: {
|
||||
complete: function (i, val) {
|
||||
complete: function(i, val) {
|
||||
var ls = postView.config[i];
|
||||
if (val) {
|
||||
localStorage.setItem(ls.storage, val)
|
||||
localStorage.setItem(ls.storage, val);
|
||||
} else {
|
||||
if (!ls.data) {
|
||||
ls = [ls]
|
||||
ls = [ls];
|
||||
} else {
|
||||
ls = ls.data
|
||||
ls = ls.data;
|
||||
}
|
||||
for (var j = 0; j < ls.length; j++) {
|
||||
M.toast({ html: 'Complete', displayLength: 3000 })
|
||||
M.toast({ html: "Complete", displayLength: 3000 });
|
||||
var id = ls[j].id;
|
||||
var val = $("#" + id).val()
|
||||
localStorage.setItem(ls[j].storage, val)
|
||||
var val = $("#" + id).val();
|
||||
localStorage.setItem(ls[j].storage, val);
|
||||
}
|
||||
}
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
//設定ボタン押した。
|
||||
function settings() {
|
||||
var cd = $("[name=theme]:checked").val();
|
||||
var ct = $("[for=" + cd + "]").html();
|
||||
var ct = $("[data-ct=" + cd + "]").html();
|
||||
if (cd == "custom" && !$("#custom-sel-sel").val()) {
|
||||
var theme = localStorage.getItem("theme");
|
||||
if (!theme) {
|
||||
@@ -80,7 +84,7 @@ function settings() {
|
||||
$("#" + theme).prop("checked", true);
|
||||
} else {
|
||||
if (cd != localStorage.getItem("theme")) {
|
||||
M.toast({ html: lang.lang_setting_theme.replace("{{set}}", ct), displayLength: 3000 })
|
||||
M.toast({ html: lang.lang_setting_theme.replace("{{set}}", ct), displayLength: 3000 });
|
||||
}
|
||||
//テーマはこの場で設定
|
||||
themes(cd);
|
||||
@@ -89,14 +93,14 @@ function settings() {
|
||||
var fontd = $("#font").val();
|
||||
if (fontd) {
|
||||
if (fontd != localStorage.getItem("font")) {
|
||||
M.toast({ html: lang.lang_setting_font.replace("{{set}}", ct), displayLength: 3000 })
|
||||
M.toast({ html: lang.lang_setting_font.replace("{{set}}", ct), displayLength: 3000 });
|
||||
}
|
||||
localStorage.setItem("font", fontd);
|
||||
themes();
|
||||
} else {
|
||||
if (localStorage.getItem("font")) {
|
||||
localStorage.removeItem("font");
|
||||
M.toast({ html: lang.lang_setting_font.replace("{{set}}", ct), displayLength: 3000 })
|
||||
M.toast({ html: lang.lang_setting_font.replace("{{set}}", ct), displayLength: 3000 });
|
||||
themes();
|
||||
}
|
||||
}
|
||||
@@ -108,7 +112,7 @@ function load() {
|
||||
for (var i = 0; i < max; i++) {
|
||||
var ls = envView.config[i].storage;
|
||||
if (localStorage.getItem(ls)) {
|
||||
envView.config[i].setValue = localStorage.getItem(ls)
|
||||
envView.config[i].setValue = localStorage.getItem(ls);
|
||||
}
|
||||
}
|
||||
var max = tlView.config.length;
|
||||
@@ -116,14 +120,14 @@ function load() {
|
||||
var ls = tlView.config[i].storage;
|
||||
if (ls) {
|
||||
if (localStorage.getItem(ls)) {
|
||||
tlView.config[i].setValue = localStorage.getItem(ls)
|
||||
tlView.config[i].setValue = localStorage.getItem(ls);
|
||||
}
|
||||
} else {
|
||||
ls = tlView.config[i].data
|
||||
ls = tlView.config[i].data;
|
||||
for (var j = 0; j < ls.length; j++) {
|
||||
if(localStorage.getItem(tlView.config[i].data[j].storage)){
|
||||
tlView.config[i].data[j].setValue = localStorage.getItem(tlView.config[i].data[j].storage)
|
||||
}
|
||||
if (localStorage.getItem(tlView.config[i].data[j].storage)) {
|
||||
tlView.config[i].data[j].setValue = localStorage.getItem(tlView.config[i].data[j].storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,12 +136,12 @@ function load() {
|
||||
var ls = postView.config[i].storage;
|
||||
if (ls) {
|
||||
if (localStorage.getItem(ls)) {
|
||||
postView.config[i].setValue = localStorage.getItem(ls)
|
||||
postView.config[i].setValue = localStorage.getItem(ls);
|
||||
}
|
||||
} else {
|
||||
ls = postView.config[i].data
|
||||
ls = postView.config[i].data;
|
||||
for (var j = 0; j < ls.length; j++) {
|
||||
postView.config[i].data[j].setValue = localStorage.getItem(ls[j].storage)
|
||||
postView.config[i].data[j].setValue = localStorage.getItem(ls[j].storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,12 +161,41 @@ function load() {
|
||||
var font = "";
|
||||
}
|
||||
$("#font").val(font);
|
||||
$("#c1-file").text(localStorage.getItem("custom1"))
|
||||
$("#c1-file").text(localStorage.getItem("custom1"));
|
||||
$("#c2-file").text(localStorage.getItem("custom2"));
|
||||
$("#c3-file").text(localStorage.getItem("custom3"));
|
||||
$("#c4-file").text(localStorage.getItem("custom4"));
|
||||
var cvol = localStorage.getItem("customVol");
|
||||
if (cvol) {
|
||||
$("#soundvol").val(cvol * 100);
|
||||
$("#soundVolVal").text(cvol * 100);
|
||||
}
|
||||
//$("#log").val(localStorage.getItem("errors"))
|
||||
}
|
||||
function customVol() {
|
||||
var cvol = $("#soundvol").val();
|
||||
$("#soundVolVal").text(cvol);
|
||||
localStorage.setItem("customVol", cvol / 100);
|
||||
var sound = localStorage.getItem("favSound");
|
||||
if (sound == "default") {
|
||||
var file = "../../source/notif.wav";
|
||||
} else {
|
||||
if (sound == "c1") {
|
||||
var file = localStorage.getItem("custom1");
|
||||
} else if (sound == "c2") {
|
||||
var file = localStorage.getItem("custom2");
|
||||
} else if (sound == "c3") {
|
||||
var file = localStorage.getItem("custom3");
|
||||
} else if (sound == "c4") {
|
||||
var file = localStorage.getItem("custom4");
|
||||
}
|
||||
}
|
||||
request = new XMLHttpRequest();
|
||||
request.open("GET", file, true);
|
||||
request.responseType = "arraybuffer";
|
||||
request.onload = playSound;
|
||||
request.send();
|
||||
}
|
||||
|
||||
function climute() {
|
||||
//クライアントミュート
|
||||
@@ -176,13 +209,10 @@ function climute() {
|
||||
return;
|
||||
}
|
||||
var templete;
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var cli = obj[key];
|
||||
var list = key * 1 + 1;
|
||||
templete = '<div class="acct" id="acct_' + key + '">' + list +
|
||||
'.' +
|
||||
escapeHTML(cli) + '<button class="btn waves-effect red disTar" onclick="cliMuteDel(' +
|
||||
key + ')">' + lang.lang_del + '</button><br></div>';
|
||||
templete = '<div class="acct" id="acct_' + key + '">' + list + "." + escapeHTML(cli) + '<button class="btn waves-effect red disTar" onclick="cliMuteDel(' + key + ')">' + lang.lang_del + "</button><br></div>";
|
||||
$("#mute-cli").append(templete);
|
||||
});
|
||||
}
|
||||
@@ -199,9 +229,11 @@ function cliMuteDel(key) {
|
||||
function wordmute() {
|
||||
var word = localStorage.getItem("word_mute");
|
||||
var obj = JSON.parse(word);
|
||||
if (!obj) { obj = [] }
|
||||
$('#wordmute').chips({
|
||||
data: obj,
|
||||
if (!obj) {
|
||||
obj = [];
|
||||
}
|
||||
$("#wordmute").chips({
|
||||
data: obj
|
||||
});
|
||||
}
|
||||
function wordmuteSave() {
|
||||
@@ -213,9 +245,11 @@ function wordmuteSave() {
|
||||
function wordemp() {
|
||||
var word = localStorage.getItem("word_emp");
|
||||
var obj = JSON.parse(word);
|
||||
if (!obj) { obj = [] }
|
||||
$('#wordemp').chips({
|
||||
data: obj,
|
||||
if (!obj) {
|
||||
obj = [];
|
||||
}
|
||||
$("#wordemp").chips({
|
||||
data: obj
|
||||
});
|
||||
}
|
||||
function wordempSave() {
|
||||
@@ -226,44 +260,44 @@ function wordempSave() {
|
||||
function notftest() {
|
||||
var os = localStorage.getItem("platform");
|
||||
var options = {
|
||||
body: lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')',
|
||||
body: lang.lang_setting_notftest + "(" + lang.lang_setting_notftestprof + ")",
|
||||
icon: localStorage.getItem("prof_0")
|
||||
};
|
||||
if (os == "darwin") {
|
||||
var n = new Notification('TheDesk' + lang.lang_setting_notftest, options);
|
||||
} else {
|
||||
var nativeNotfOpt = ['TheDesk' + lang.lang_setting_notftest, lang.lang_setting_notftest + '(' + lang.lang_setting_notftestprof + ')', localStorage.getItem('prof_0'), "", ""]
|
||||
postMessage(["nativeNotf", nativeNotfOpt], "*")
|
||||
}
|
||||
|
||||
var n = new Notification("TheDesk" + lang.lang_setting_notftest, options);
|
||||
}
|
||||
function oks(no) {
|
||||
var txt = $("#oks-" + no).val();
|
||||
localStorage.setItem("oks-" + no, txt);
|
||||
M.toast({ html: lang.lang_setting_ksref, displayLength: 3000 })
|
||||
M.toast({ html: lang.lang_setting_ksref, displayLength: 3000 });
|
||||
}
|
||||
function oksload() {
|
||||
if (localStorage.getItem("oks-1")) { $("#oks-1").val(localStorage.getItem("oks-1")) }
|
||||
if (localStorage.getItem("oks-2")) { $("#oks-2").val(localStorage.getItem("oks-2")) }
|
||||
if (localStorage.getItem("oks-3")) { $("#oks-3").val(localStorage.getItem("oks-3")) }
|
||||
if (localStorage.getItem("oks-1")) {
|
||||
$("#oks-1").val(localStorage.getItem("oks-1"));
|
||||
}
|
||||
if (localStorage.getItem("oks-2")) {
|
||||
$("#oks-2").val(localStorage.getItem("oks-2"));
|
||||
}
|
||||
if (localStorage.getItem("oks-3")) {
|
||||
$("#oks-3").val(localStorage.getItem("oks-3"));
|
||||
}
|
||||
}
|
||||
function changelang(lang) {
|
||||
postMessage(["lang", lang], "*")
|
||||
postMessage(["lang", lang], "*");
|
||||
}
|
||||
function exportSettings() {
|
||||
Swal.fire({
|
||||
title: lang.lang_setting_exportwarn,
|
||||
type: 'warning',
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: lang.lang_yesno,
|
||||
cancelButtonText: lang.lang_no
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
postMessage(["exportSettings", ""], "*")
|
||||
postMessage(["exportSettings", ""], "*");
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
function exportSettingsCore() {
|
||||
var exp = {};
|
||||
@@ -282,27 +316,23 @@ function exportSettingsCore() {
|
||||
var max = envView.config.length;
|
||||
for (var i = 0; i < max; i++) {
|
||||
var ls = envView.config[i].storage;
|
||||
config[ls] = localStorage.getItem(ls)
|
||||
config[ls] = localStorage.getItem(ls);
|
||||
}
|
||||
var max = tlView.config.length;
|
||||
for (var i = 0; i < max; i++) {
|
||||
var ls = tlView.config[i].storage;
|
||||
config[ls] = localStorage.getItem(ls)
|
||||
config[ls] = localStorage.getItem(ls);
|
||||
}
|
||||
var max = postView.config.length;
|
||||
for (var i = 0; i < max; i++) {
|
||||
var ls = postView.config[i].storage;
|
||||
config[ls] = localStorage.getItem(ls)
|
||||
config[ls] = localStorage.getItem(ls);
|
||||
}
|
||||
//Font
|
||||
config.font = localStorage.getItem("font");
|
||||
exp.config = config;
|
||||
//keysc
|
||||
exp.ksc = [
|
||||
localStorage.getItem("oks-1"),
|
||||
localStorage.getItem("oks-2"),
|
||||
localStorage.getItem("oks-3")
|
||||
];
|
||||
exp.ksc = [localStorage.getItem("oks-1"), localStorage.getItem("oks-2"), localStorage.getItem("oks-3")];
|
||||
//climu
|
||||
var cli = localStorage.getItem("client_mute");
|
||||
var climu = JSON.parse(cli);
|
||||
@@ -312,7 +342,7 @@ function exportSettingsCore() {
|
||||
var wordmu = JSON.parse(wdm);
|
||||
exp.wordMute = wordmu;
|
||||
//spotify
|
||||
exp.spotifyArtwork = localStorage.getItem("artwork")
|
||||
exp.spotifyArtwork = localStorage.getItem("artwork");
|
||||
var content = localStorage.getItem("np-temp");
|
||||
if (content || content == "" || content == "null") {
|
||||
exp.spotifyTemplete = content;
|
||||
@@ -323,25 +353,29 @@ function exportSettingsCore() {
|
||||
var tagarr = localStorage.getItem("tag");
|
||||
var favtag = JSON.parse(tagarr);
|
||||
exp.favoriteTags = favtag;
|
||||
exp.revisons = 2.1;
|
||||
exp.meta = {};
|
||||
exp.meta.date = new Date();
|
||||
exp.meta.thedesk = localStorage.getItem("ver");
|
||||
exp.meta.platform = localStorage.getItem("platform");
|
||||
return exp;
|
||||
}
|
||||
function importSettings() {
|
||||
Swal.fire({
|
||||
title: lang.lang_setting_importwarn,
|
||||
type: 'warning',
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: lang.lang_yesno,
|
||||
cancelButtonText: lang.lang_no
|
||||
}).then((result) => {
|
||||
}).then(result => {
|
||||
if (result.value) {
|
||||
postMessage(["importSettings", ""], "*")
|
||||
postMessage(["importSettings", ""], "*");
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
function importSettingsCore(arg) {
|
||||
var obj = JSON.parse(arg);
|
||||
function importSettingsCore(obj) {
|
||||
if (obj) {
|
||||
localStorage.clear();
|
||||
localStorage.setItem("multi", JSON.stringify(obj.accts));
|
||||
@@ -356,26 +390,26 @@ function importSettingsCore(arg) {
|
||||
}
|
||||
localStorage.setItem("column", JSON.stringify(obj.columns));
|
||||
if (obj.config) {
|
||||
//Version 2
|
||||
//Version 2~
|
||||
var max = envView.config.length;
|
||||
for (var i = 0; i < max; i++) {
|
||||
var ls = envView.config[i].storage;
|
||||
if (obj.config[ls]) {
|
||||
localStorage.setItem(ls, obj.config[ls])
|
||||
localStorage.setItem(ls, obj.config[ls]);
|
||||
}
|
||||
}
|
||||
var max = tlView.config.length;
|
||||
for (var i = 0; i < max; i++) {
|
||||
var ls = tlView.config[i].storage;
|
||||
if (obj.config[ls]) {
|
||||
localStorage.setItem(ls, obj.config[ls])
|
||||
localStorage.setItem(ls, obj.config[ls]);
|
||||
}
|
||||
}
|
||||
var max = postView.config.length;
|
||||
for (var i = 0; i < max; i++) {
|
||||
var ls = postView.config[i].storage;
|
||||
if (obj.config[ls]) {
|
||||
localStorage.setItem(ls, obj.config[ls])
|
||||
localStorage.setItem(ls, obj.config[ls]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -428,110 +462,146 @@ function importSettingsCore(arg) {
|
||||
location.href = "index.html";
|
||||
} else {
|
||||
Swal.fire({
|
||||
type: 'error',
|
||||
title: 'Error'
|
||||
})
|
||||
type: "error",
|
||||
title: "Error"
|
||||
});
|
||||
}
|
||||
}
|
||||
function savefolder() {
|
||||
postMessage(["sendSinmpleIpc", "savefolder"], "*")
|
||||
postMessage(["sendSinmpleIpc", "savefolder"], "*");
|
||||
}
|
||||
|
||||
function font() {
|
||||
postMessage(["sendSinmpleIpc", "fonts"], "*")
|
||||
postMessage(["sendSinmpleIpc", "fonts"], "*");
|
||||
}
|
||||
function fontList(arg) {
|
||||
$("#fonts").removeClass("hide");
|
||||
for (var i = 0; i < arg.length; i++) {
|
||||
var font = arg[i];
|
||||
$("#fonts").append('<div class="font pointer" style="font-family:' + font.family + '" onclick="insertFont(\'' + font.family + '\')">' + font.family + "</div>")
|
||||
$("#fonts").append('<div class="font pointer" style="font-family:' + font.family + '" onclick="insertFont(\'' + font.family + "')\">" + font.family + "</div>");
|
||||
}
|
||||
}
|
||||
function insertFont(name) {
|
||||
$("#font").val(name);
|
||||
}
|
||||
$(".color-picker").each(function (i, elem) {
|
||||
$(".color-picker").each(function(i, elem) {
|
||||
pickerDefine(i, "fff");
|
||||
});
|
||||
function pickerDefine(i, color) {
|
||||
var pickr = new Pickr({
|
||||
el: '#color-picker' + i,
|
||||
el: "#color-picker" + i,
|
||||
default: color,
|
||||
showAlways: true,
|
||||
appendToBody: true,
|
||||
closeWithKey: 'Escape',
|
||||
closeWithKey: "Escape",
|
||||
comparison: false,
|
||||
components: {
|
||||
preview: true, // Left side color comparison
|
||||
opacity: false, // Opacity slider
|
||||
hue: true, // Hue slider
|
||||
hue: true, // Hue slider
|
||||
interaction: {
|
||||
rgba: false, // rgba option (red green blue and alpha)
|
||||
input: true, // input / output element
|
||||
input: true // input / output element
|
||||
}
|
||||
},
|
||||
strings: {
|
||||
save: 'Save', // Default for save button
|
||||
clear: 'Clear' // Default for clear button
|
||||
save: "Save", // Default for save button
|
||||
clear: "Clear" // Default for clear button
|
||||
}
|
||||
});
|
||||
pickr.on('change', (...args) => {
|
||||
var rgb = 'rgb(' + args[0].toRGBA()[0] + ',' + args[0].toRGBA()[1] + ',' + args[0].toRGBA()[2] + ')';
|
||||
$("#color-picker" + i + "_value").val(rgb)
|
||||
pickr.on("change", (...args) => {
|
||||
var rgb = "rgb(" + args[0].toRGBA()[0] + "," + args[0].toRGBA()[1] + "," + args[0].toRGBA()[2] + ")";
|
||||
$("#color-picker" + i + "_value").val(rgb);
|
||||
});
|
||||
}
|
||||
function customComp() {
|
||||
var nameC = $("#custom_name").val();
|
||||
if (!nameC) { return false; }
|
||||
if (!nameC) {
|
||||
return false;
|
||||
}
|
||||
var descC = $("#custom_desc").val();
|
||||
var primaryC = $("#color-picker0_value").val();
|
||||
if (!primaryC) { primaryC = "rgb(255,255,255)" }
|
||||
if (!primaryC) {
|
||||
primaryC = "rgb(255,255,255)";
|
||||
}
|
||||
var secondaryC = $("#color-picker1_value").val();
|
||||
if (!secondaryC) { secondaryC = "rgb(255,255,255)" }
|
||||
if (!secondaryC) {
|
||||
secondaryC = "rgb(255,255,255)";
|
||||
}
|
||||
var textC = $("#color-picker2_value").val();
|
||||
if (!textC) { textC = "rgb(255,255,255)" }
|
||||
var accentC = $("#color-picker3_value").val();
|
||||
if (!accentC) { accentC = "rgb(255,255,255)" }
|
||||
if (!textC) {
|
||||
textC = "rgb(255,255,255)";
|
||||
}
|
||||
var multi = localStorage.getItem("multi");
|
||||
if ($("#pickers").hasClass("advanceTheme")) {
|
||||
var accentC = $("#color-picker3_value").val();
|
||||
if (!accentC) {
|
||||
accentC = null;
|
||||
}
|
||||
var activeC = $("#color-picker4_value").val();
|
||||
if (!activeC) {
|
||||
activeC = null;
|
||||
}
|
||||
var modalC = $("#color-picker5_value").val();
|
||||
if (!modalC) {
|
||||
modalC = null;
|
||||
}
|
||||
var bottomC = $("#color-picker6_value").val();
|
||||
if (!bottomC) {
|
||||
bottomC = null;
|
||||
}
|
||||
var postboxC = $("#color-picker7_value").val();
|
||||
if (!postboxC) {
|
||||
postboxC = null;
|
||||
}
|
||||
var subcolorC = $("#color-picker8_value").val();
|
||||
if (!subcolorC) {
|
||||
subcolorC = null;
|
||||
}
|
||||
var advanceTheme = {
|
||||
TheDeskAccent: accentC,
|
||||
TheDeskActive: activeC,
|
||||
TheDeskModal: modalC,
|
||||
TheDeskBottom: bottomC,
|
||||
TheDeskPostbox: postboxC,
|
||||
TheDeskSubcolor: subcolorC
|
||||
};
|
||||
} else {
|
||||
var advanceTheme = {};
|
||||
}
|
||||
|
||||
var my = JSON.parse(multi)[0].name;
|
||||
var id = $("#custom-edit-sel").val();
|
||||
if (id == "add_new") {
|
||||
id = makeCID();
|
||||
}
|
||||
localStorage.setItem("customtheme-id", id);
|
||||
var json = {
|
||||
"name": nameC,
|
||||
"author": my,
|
||||
"desc": descC,
|
||||
"base": $("[name=direction]:checked").val(),
|
||||
"vars": {
|
||||
"primary": primaryC,
|
||||
"secondary": secondaryC,
|
||||
"text": textC
|
||||
name: nameC,
|
||||
author: my,
|
||||
desc: descC,
|
||||
base: $("[name=direction]:checked").val(),
|
||||
vars: {
|
||||
primary: primaryC,
|
||||
secondary: secondaryC,
|
||||
text: textC
|
||||
},
|
||||
"props": {
|
||||
"TheDeskAccent": accentC
|
||||
},
|
||||
"id": id
|
||||
}
|
||||
props: advanceTheme,
|
||||
id: id
|
||||
};
|
||||
$("#custom_json").val(JSON.stringify(json));
|
||||
themes();
|
||||
themes("custom");
|
||||
$("#custom").prop("checked", true);
|
||||
$("#custom_name").val("");
|
||||
$("#custom_desc").val("");
|
||||
$("#dark").prop("checked", true);
|
||||
$("#custom_json").val("");
|
||||
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>')
|
||||
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>')
|
||||
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>')
|
||||
$("#color-picker3-wrap").html('<div class="color-picker" id="color-picker3"></div>')
|
||||
$("#color-picker0_value").val("");
|
||||
$("#color-picker1_value").val("");
|
||||
$("#color-picker2_value").val("");
|
||||
$("#color-picker3_value").val("");
|
||||
pickerDefine(0, "fff");
|
||||
pickerDefine(1, "fff");
|
||||
pickerDefine(2, "fff");
|
||||
pickerDefine(3, "fff");
|
||||
postMessage(["themeJsonCreate", JSON.stringify(json)], "*")
|
||||
for (var i = 0; i <= 8; i++) {
|
||||
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
||||
$("#color-picker" + i + "_value").val("");
|
||||
pickerDefine(i, "fff");
|
||||
}
|
||||
postMessage(["themeJsonCreate", JSON.stringify(json)], "*");
|
||||
}
|
||||
function deleteIt() {
|
||||
var id = $("#custom-sel-sel").val();
|
||||
@@ -539,41 +609,34 @@ function deleteIt() {
|
||||
$("#custom_desc").val("");
|
||||
$("#dark").prop("checked", true);
|
||||
$("#custom_json").val("");
|
||||
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>')
|
||||
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>')
|
||||
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>')
|
||||
$("#color-picker3-wrap").html('<div class="color-picker" id="color-picker3"></div>')
|
||||
$("#color-picker0_value").val("");
|
||||
$("#color-picker1_value").val("");
|
||||
$("#color-picker2_value").val("");
|
||||
$("#color-picker3_value").val("");
|
||||
pickerDefine(0, "fff");
|
||||
pickerDefine(1, "fff");
|
||||
pickerDefine(2, "fff");
|
||||
pickerDefine(3, "fff");
|
||||
postMessage(["themeJsonDelete", id], "*")
|
||||
for (var i = 0; i <= 8; i++) {
|
||||
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
||||
$("#color-picker" + i + "_value").val("");
|
||||
pickerDefine(i, "fff");
|
||||
}
|
||||
postMessage(["themeJsonDelete", id], "*");
|
||||
}
|
||||
function ctLoad() {
|
||||
postMessage(["sendSinmpleIpc", "theme-json-list"], "*")
|
||||
postMessage(["sendSinmpleIpc", "theme-json-list"], "*");
|
||||
}
|
||||
function ctLoadCore(args) {
|
||||
var templete = "";
|
||||
Object.keys(args).forEach(function (key) {
|
||||
Object.keys(args).forEach(function(key) {
|
||||
var theme = args[key];
|
||||
var themeid = theme.id
|
||||
templete = templete + '<option value="' + themeid + '">' + theme.name + '</option>';
|
||||
var themeid = theme.id;
|
||||
templete = templete + '<option value="' + themeid + '">' + theme.name + "</option>";
|
||||
});
|
||||
if (args[0]) {
|
||||
localStorage.setItem("customtheme-id", args[0].id)
|
||||
localStorage.setItem("customtheme-id", args[0].id);
|
||||
}
|
||||
$("#custom-sel-sel").html(templete);
|
||||
templete = '<option value="add_new">' + $("#edit-selector").attr("data-add") + '</option>' + templete;
|
||||
templete = '<option value="add_new">' + $("#edit-selector").attr("data-add") + "</option>" + templete;
|
||||
$("#custom-edit-sel").html(templete);
|
||||
$('select').formSelect();
|
||||
$("select").formSelect();
|
||||
}
|
||||
function customSel() {
|
||||
var id = $("#custom-sel-sel").val();
|
||||
localStorage.setItem("customtheme-id", id)
|
||||
localStorage.setItem("customtheme-id", id);
|
||||
}
|
||||
function custom() {
|
||||
var id = $("#custom-edit-sel").val();
|
||||
@@ -582,75 +645,91 @@ function custom() {
|
||||
$("#custom_desc").val("");
|
||||
$("#dark").prop("checked", true);
|
||||
$("#custom_json").val("");
|
||||
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>')
|
||||
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>')
|
||||
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>')
|
||||
$("#color-picker3-wrap").html('<div class="color-picker" id="color-picker3"></div>')
|
||||
$("#color-picker0_value").val("");
|
||||
$("#color-picker1_value").val("");
|
||||
$("#color-picker2_value").val("");
|
||||
$("#color-picker3_value").val("");
|
||||
pickerDefine(0, "fff");
|
||||
pickerDefine(1, "fff");
|
||||
pickerDefine(2, "fff");
|
||||
pickerDefine(3, "fff");
|
||||
$("#delTheme").addClass("disabled")
|
||||
for (var i = 0; i <= 8; i++) {
|
||||
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
||||
$("#color-picker" + i + "_value").val("");
|
||||
pickerDefine(i, "fff");
|
||||
}
|
||||
$("#delTheme").addClass("disabled");
|
||||
} else {
|
||||
$("#delTheme").removeClass("disabled")
|
||||
postMessage(["themeJsonRequest", id], "*")
|
||||
$("#delTheme").removeClass("disabled");
|
||||
postMessage(["themeJsonRequest", id], "*");
|
||||
}
|
||||
}
|
||||
function customConnect(args) {
|
||||
function customConnect(raw) {
|
||||
var args = raw[0];
|
||||
$("#custom_name").val(args.name);
|
||||
$("#custom_desc").val(args.desc);
|
||||
$("#" + args.base).prop("checked", true);
|
||||
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>')
|
||||
pickerDefine(0, rgbToHex(args.vars.primary))
|
||||
//Primary
|
||||
$("#color-picker0-wrap").html('<div class="color-picker" id="color-picker0"></div>');
|
||||
pickerDefine(0, rgbToHex(args.vars.primary));
|
||||
$("#color-picker0_value").val(args.vars.primary);
|
||||
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>')
|
||||
pickerDefine(1, rgbToHex(args.vars.secondary))
|
||||
//Secondary
|
||||
$("#color-picker1-wrap").html('<div class="color-picker" id="color-picker1"></div>');
|
||||
pickerDefine(1, rgbToHex(args.vars.secondary));
|
||||
$("#color-picker1_value").val(args.vars.secondary);
|
||||
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>')
|
||||
//Text
|
||||
$("#color-picker2-wrap").html('<div class="color-picker" id="color-picker2"></div>');
|
||||
$("#color-picker2_value").val(args.vars.text);
|
||||
pickerDefine(2, rgbToHex(args.vars.text))
|
||||
pickerDefine(2, rgbToHex(args.vars.text));
|
||||
//TheDesk Only
|
||||
advancedConncet(args, "TheDeskAccent", "secondary", 3);
|
||||
advancedConncet(args, "TheDeskActive", "primary", 4);
|
||||
advancedConncet(args, "TheDeskModal", "secondary", 5);
|
||||
advancedConncet(args, "TheDeskBottom", "primary", 6);
|
||||
advancedConncet(args, "TheDeskPostbox", "primary", 7);
|
||||
advancedConncet(args, "TheDeskSubcolor", "primary", 8);
|
||||
$("#custom_json").val(raw[1]);
|
||||
}
|
||||
function advancedConncet(args, tar, sub, i) {
|
||||
if (args.props) {
|
||||
if (args.props.TheDeskAccent) {
|
||||
var accent = args.props.TheDeskAccent;
|
||||
if (args.props[tar]) {
|
||||
var color = args.props[tar];
|
||||
$("#pickers").addClass("advanceTheme");
|
||||
$(".advanced").removeClass("hide");
|
||||
} else {
|
||||
var accent = args.vars.secondary;
|
||||
var color = args.vars[sub];
|
||||
}
|
||||
} else {
|
||||
var accent = args.vars.secondary;
|
||||
var color = args.vars[sub];
|
||||
}
|
||||
$("#color-picker3-wrap").html('<div class="color-picker" id="color-picker3"></div>')
|
||||
pickerDefine(3, rgbToHex(accent))
|
||||
$("#custom_json").val(JSON.stringify(args));
|
||||
$("#color-picker" + i + "-wrap").html('<div class="color-picker" id="color-picker' + i + '"></div>');
|
||||
$("#color-picker" + i + "_value").val(color);
|
||||
pickerDefine(i, rgbToHex(color));
|
||||
}
|
||||
function customImp() {
|
||||
var json = $("#custom_import").val();
|
||||
if (JSON5.parse(json)) {
|
||||
postMessage(["themeJsonCreate", json], "*")
|
||||
postMessage(["themeJsonCreate", json], "*");
|
||||
} else {
|
||||
Swal.fire({
|
||||
type: 'error',
|
||||
title: 'Error'
|
||||
})
|
||||
type: "error",
|
||||
title: "Error"
|
||||
});
|
||||
}
|
||||
}
|
||||
function advanced() {
|
||||
$(".advanced").toggleClass("hide");
|
||||
$("#pickers").toggleClass("advanceTheme");
|
||||
}
|
||||
function clearCustomImport() {
|
||||
$("#custom_import").val("");
|
||||
}
|
||||
function hardwareAcceleration(had) {
|
||||
postMessage(["ha", had], "*")
|
||||
postMessage(["ha", had], "*");
|
||||
}
|
||||
function useragent(val) {
|
||||
postMessage(["ua", val], "*");
|
||||
}
|
||||
function customSound(key) {
|
||||
postMessage(["customSound", key], "*")
|
||||
postMessage(["customSound", key], "*");
|
||||
}
|
||||
function customSoundSave(key, file) {
|
||||
localStorage.setItem("custom" + key, file);
|
||||
$("#c1-file").text(file)
|
||||
$("#c1-file").text(file);
|
||||
}
|
||||
window.onload = function () {
|
||||
window.onload = function() {
|
||||
//最初に読む
|
||||
load();
|
||||
climute();
|
||||
@@ -659,6 +738,56 @@ window.onload = function () {
|
||||
checkSpotify();
|
||||
voiceSettingLoad();
|
||||
oksload();
|
||||
ctLoad()
|
||||
ctLoad();
|
||||
};
|
||||
|
||||
//設定画面で未読マーカーは要らない
|
||||
function asReadEnd() {
|
||||
postMessage(["asReadComp", ""], "*");
|
||||
}
|
||||
function checkupd() {
|
||||
var ver = localStorage.getItem("ver");
|
||||
var start = "https://thedesk.top/ver.json";
|
||||
fetch(start, {
|
||||
method: "GET"
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(mess) {
|
||||
console.table(mess);
|
||||
if (mess) {
|
||||
var platform = localStorage.getItem("platform");
|
||||
if (platform == "darwin") {
|
||||
var newest = mess.desk_mac;
|
||||
} else {
|
||||
var newest = mess.desk;
|
||||
}
|
||||
if (newest == ver) {
|
||||
Swal.fire({
|
||||
type: "info",
|
||||
title: lang.lang_setting_noupd,
|
||||
html: ver
|
||||
});
|
||||
} else if (ver.indexOf("beta") != -1 || winstore) {
|
||||
Swal.fire({
|
||||
type: "info",
|
||||
title: lang.lang_setting_thisisbeta,
|
||||
html: ver
|
||||
});
|
||||
} else {
|
||||
localStorage.removeItem("new-ver-skip");
|
||||
location.href = "index.html";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//ソートデータ読み込み
|
||||
function sortLoad () {
|
||||
$("#sort").html("");
|
||||
|
||||
@@ -1,180 +1,190 @@
|
||||
'use strict'
|
||||
function spotifyConnect() {
|
||||
var auth = "https://accounts.spotify.com/authorize?client_id=0f18e54abe0b4aedb4591e353d3aff69&redirect_uri=https://thedesk.top/spotify-connect&response_type=code&scope=user-read-currently-playing";
|
||||
var platform = localStorage.getItem("platform");
|
||||
if (platform == "win32") {
|
||||
postMessage(["openUrl", auth], "*")
|
||||
postMessage(["sendSinmpleIpc", "quit"], "*")
|
||||
} else {
|
||||
auth = auth + "&state=code";
|
||||
$("#spotify-code-show").removeClass("hide");
|
||||
postMessage(["openUrl", auth], "*")
|
||||
}
|
||||
|
||||
|
||||
var auth = "https://accounts.spotify.com/authorize?client_id=0f18e54abe0b4aedb4591e353d3aff69&redirect_uri=https://thedesk.top/spotify-connect&response_type=code&scope=user-read-currently-playing";
|
||||
var platform = localStorage.getItem("platform");
|
||||
if (platform == "win32") {
|
||||
postMessage(["openUrl", auth], "*");
|
||||
postMessage(["sendSinmpleIpc", "quit"], "*");
|
||||
} else {
|
||||
auth = auth + "&state=code";
|
||||
$("#spotify-code-show").removeClass("hide");
|
||||
postMessage(["openUrl", auth], "*");
|
||||
}
|
||||
}
|
||||
function spotifyAuth() {
|
||||
var code = $("#spotify-code").val();
|
||||
localStorage.setItem("spotify", "code");
|
||||
localStorage.setItem("spotify-refresh", code);
|
||||
$("#spotify-code-show").addClass("hide");
|
||||
$("#spotify-enable").addClass("disabled");
|
||||
$("#spotify-disable").removeClass("disabled");
|
||||
var code = $("#spotify-code").val();
|
||||
localStorage.setItem("spotify", "code");
|
||||
localStorage.setItem("spotify-refresh", code);
|
||||
$("#spotify-code-show").addClass("hide");
|
||||
$("#spotify-enable").addClass("disabled");
|
||||
$("#spotify-disable").removeClass("disabled");
|
||||
}
|
||||
function spotifyDisconnect() {
|
||||
localStorage.removeItem("spotify");
|
||||
localStorage.removeItem("spotify-refresh");
|
||||
checkSpotify();
|
||||
localStorage.removeItem("spotify");
|
||||
localStorage.removeItem("spotify-refresh");
|
||||
checkSpotify();
|
||||
}
|
||||
function checkSpotify() {
|
||||
if (localStorage.getItem("spotify")) {
|
||||
$("#spotify-enable").addClass("disabled");
|
||||
$("#spotify-disable").removeClass("disabled");
|
||||
} else {
|
||||
$("#spotify-enable").removeClass("disabled");
|
||||
$("#spotify-disable").addClass("disabled");
|
||||
}
|
||||
var content = localStorage.getItem("np-temp");
|
||||
if (!content || content == "" || content == "null") {
|
||||
var content = "#NowPlaying {song} / {album} / {artist}\n{url} #SpotifyWithTheDesk";
|
||||
}
|
||||
$("#np-temp").val(content);
|
||||
var flag = localStorage.getItem("artwork");
|
||||
if (flag) {
|
||||
$("#awk_yes").prop("checked", true);
|
||||
} else {
|
||||
$("#awk_no").prop("checked", true);
|
||||
}
|
||||
if (localStorage.getItem("spotify")) {
|
||||
$("#spotify-enable").addClass("disabled");
|
||||
$("#spotify-disable").removeClass("disabled");
|
||||
} else {
|
||||
$("#spotify-enable").removeClass("disabled");
|
||||
$("#spotify-disable").addClass("disabled");
|
||||
}
|
||||
var content = localStorage.getItem("np-temp");
|
||||
if (!content || content == "" || content == "null") {
|
||||
var content = "#NowPlaying {song} / {album} / {artist}\n{url} #SpotifyWithTheDesk";
|
||||
}
|
||||
$("#np-temp").val(content);
|
||||
var flag = localStorage.getItem("artwork");
|
||||
if (flag) {
|
||||
$("#awk_yes").prop("checked", true);
|
||||
} else {
|
||||
$("#awk_no").prop("checked", true);
|
||||
}
|
||||
}
|
||||
function spotifyFlagSave() {
|
||||
var awk = $("[name=awk]:checked").val();
|
||||
if (awk == "yes") {
|
||||
localStorage.setItem("artwork", "yes");
|
||||
M.toast({ html: lang.lang_spotify_img, displayLength: 3000 })
|
||||
} else {
|
||||
localStorage.removeItem("artwork");
|
||||
M.toast({ html: lang.lang_spotify_imgno, displayLength: 3000 })
|
||||
}
|
||||
var awk = $("[name=awk]:checked").val();
|
||||
if (awk == "yes") {
|
||||
localStorage.setItem("artwork", "yes");
|
||||
M.toast({ html: lang.lang_spotify_img, displayLength: 3000 });
|
||||
} else {
|
||||
localStorage.removeItem("artwork");
|
||||
M.toast({ html: lang.lang_spotify_imgno, displayLength: 3000 });
|
||||
}
|
||||
}
|
||||
function nowplaying(mode) {
|
||||
if (mode == "spotify") {
|
||||
var start = "https://thedesk.top/now-playing?at=" + localStorage.getItem("spotify") + "&rt=" + localStorage.getItem("spotify-refresh");
|
||||
var at = localStorage.getItem("spotify");
|
||||
if (at) {
|
||||
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.table(json);
|
||||
if (json.length < 1) {
|
||||
return false;
|
||||
}
|
||||
var item = json.item;
|
||||
var img = item.album.images[0].url;
|
||||
var flag = localStorage.getItem("artwork");
|
||||
if (flag) {
|
||||
postMessage(["bmpImage", [img, 0]], "*")
|
||||
}
|
||||
var content = localStorage.getItem("np-temp");
|
||||
if (!content || content == "" || content == "null") {
|
||||
var content = "#NowPlaying {song} / {album} / {artist}\n{url}";
|
||||
}
|
||||
var regExp = new RegExp("{song}", "g");
|
||||
content = content.replace(regExp, item.name);
|
||||
var regExp = new RegExp("{album}", "g");
|
||||
content = content.replace(regExp, item.album.name);
|
||||
var regExp = new RegExp("{artist}", "g");
|
||||
content = content.replace(regExp, item.artists[0].name);
|
||||
var regExp = new RegExp("{url}", "g");
|
||||
content = content.replace(regExp, item.external_urls.spotify);
|
||||
var regExp = new RegExp("{composer}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{hz}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bitRate}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{lyricist}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bpm}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{genre}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
$("#textarea").val(content);
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
type: 'info',
|
||||
title: lang.lang_spotify_acct
|
||||
})
|
||||
}
|
||||
} else if (mode == "itunes") {
|
||||
postMessage(["itunes", ""], "*")
|
||||
}
|
||||
if (mode == "spotify") {
|
||||
var start = "https://thedesk.top/now-playing?at=" + localStorage.getItem("spotify") + "&rt=" + localStorage.getItem("spotify-refresh");
|
||||
var at = localStorage.getItem("spotify");
|
||||
if (at) {
|
||||
fetch(start, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
}
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
console.table(json);
|
||||
if (json.length < 1) {
|
||||
return false;
|
||||
}
|
||||
var item = json.item;
|
||||
var img = item.album.images[0].url;
|
||||
var flag = localStorage.getItem("artwork");
|
||||
if (flag) {
|
||||
postMessage(["bmpImage", [img, 0]], "*");
|
||||
}
|
||||
var content = localStorage.getItem("np-temp");
|
||||
if (!content || content == "" || content == "null") {
|
||||
var content = "#NowPlaying {song} / {album} / {artist}\n{url}";
|
||||
}
|
||||
var regExp = new RegExp("{song}", "g");
|
||||
content = content.replace(regExp, item.name);
|
||||
var regExp = new RegExp("{album}", "g");
|
||||
content = content.replace(regExp, item.album.name);
|
||||
var regExp = new RegExp("{artist}", "g");
|
||||
content = content.replace(regExp, item.artists[0].name);
|
||||
var regExp = new RegExp("{url}", "g");
|
||||
content = content.replace(regExp, item.external_urls.spotify);
|
||||
var regExp = new RegExp("{composer}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{hz}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bitRate}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{lyricist}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bpm}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{genre}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
$("#textarea").val(content);
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
type: "info",
|
||||
title: lang.lang_spotify_acct
|
||||
});
|
||||
}
|
||||
} else if (mode == "itunes") {
|
||||
postMessage(["itunes", ""], "*");
|
||||
}
|
||||
}
|
||||
function npCore(arg) {
|
||||
if (arg.cmd) {
|
||||
console.error(arg);
|
||||
return;
|
||||
}
|
||||
console.table(arg);
|
||||
var content = localStorage.getItem("np-temp");
|
||||
if (!content || content == "" || content == "null") {
|
||||
var content = "#NowPlaying {song} / {album} / {artist}\n{url}";
|
||||
}
|
||||
var flag = localStorage.getItem("artwork");
|
||||
var platform = localStorage.getItem("platform");
|
||||
if (platform == "win32") {
|
||||
if (flag && arg.path) {
|
||||
media(arg.path, "image/png", "new");
|
||||
}
|
||||
} else if (platform == "darwin") {
|
||||
if (flag && arg.existsArtwork) {
|
||||
media(arg.artworks[0].data, "image/png", "new");
|
||||
}
|
||||
}
|
||||
var regExp = new RegExp("{song}", "g");
|
||||
content = content.replace(regExp, arg.name);
|
||||
var regExp = new RegExp("{album}", "g");
|
||||
content = content.replace(regExp, arg.album);
|
||||
var regExp = new RegExp("{artist}", "g");
|
||||
content = content.replace(regExp, arg.artist);
|
||||
var regExp = new RegExp("{url}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{composer}", "g");
|
||||
content = content.replace(regExp, arg.composer);
|
||||
var regExp = new RegExp("{hz}", "g");
|
||||
content = content.replace(regExp, arg.sampleRate / 1000 + "kHz");
|
||||
var regExp = new RegExp("{lyricist}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bpm}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bitRate}", "g");
|
||||
content = content.replace(regExp, arg.bitRate + "kbps");
|
||||
var regExp = new RegExp("{genre}", "g");
|
||||
content = content.replace(regExp, arg.genre);
|
||||
$("#textarea").val(content);
|
||||
if (arg.cmd) {
|
||||
console.error(arg);
|
||||
return;
|
||||
}
|
||||
console.table(arg);
|
||||
var content = localStorage.getItem("np-temp");
|
||||
if (!content || content == "" || content == "null") {
|
||||
var content = "#NowPlaying {song} / {album} / {artist}\n{url}";
|
||||
}
|
||||
var flag = localStorage.getItem("artwork");
|
||||
var platform = localStorage.getItem("platform");
|
||||
if (platform == "win32") {
|
||||
if (flag && arg.path) {
|
||||
media(arg.path, "image/png", "new");
|
||||
}
|
||||
} else if (platform == "darwin") {
|
||||
if (flag && arg.artwork) {
|
||||
media(arg.artwork, "image/png", "new");
|
||||
}
|
||||
}
|
||||
var regExp = new RegExp("{song}", "g");
|
||||
content = content.replace(regExp, arg.name);
|
||||
var regExp = new RegExp("{album}", "g");
|
||||
if (arg.album) {
|
||||
if (arg.album.name) {
|
||||
content = content.replace(regExp, arg.album.name);
|
||||
}
|
||||
}
|
||||
var regExp = new RegExp("{artist}", "g");
|
||||
content = content.replace(regExp, arg.artist);
|
||||
var regExp = new RegExp("{url}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{composer}", "g");
|
||||
content = content.replace(regExp, arg.composer);
|
||||
var regExp = new RegExp("{hz}", "g");
|
||||
content = content.replace(regExp, arg.sampleRate / 1000 + "kHz");
|
||||
var regExp = new RegExp("{lyricist}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bpm}", "g");
|
||||
content = content.replace(regExp, "");
|
||||
var regExp = new RegExp("{bitRate}", "g");
|
||||
content = content.replace(regExp, arg.bitRate + "kbps");
|
||||
var regExp = new RegExp("{genre}", "g");
|
||||
content = content.replace(regExp, arg.genre);
|
||||
$("#textarea").val(content);
|
||||
}
|
||||
function spotifySave() {
|
||||
var temp = $("#np-temp").val();
|
||||
localStorage.setItem("np-temp", temp);
|
||||
M.toast({ html: lang.lang_spotify_np, displayLength: 3000 })
|
||||
var temp = $("#np-temp").val();
|
||||
localStorage.setItem("np-temp", temp);
|
||||
M.toast({ html: lang.lang_spotify_np, displayLength: 3000 });
|
||||
}
|
||||
if (location.search) {
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
|
||||
var mode = m[1];
|
||||
var codex = m[2];
|
||||
if (mode == "spotify") {
|
||||
var coder = codex.split(":");
|
||||
localStorage.setItem("spotify", coder[0]);
|
||||
localStorage.setItem("spotify-refresh", coder[1]);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
|
||||
var mode = m[1];
|
||||
var codex = m[2];
|
||||
if (mode == "spotify") {
|
||||
var coder = codex.split(":");
|
||||
localStorage.setItem("spotify", coder[0]);
|
||||
localStorage.setItem("spotify-refresh", coder[1]);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//テーマ適用
|
||||
function themes(theme) {
|
||||
if (!theme) {
|
||||
|
||||
@@ -1,137 +1,219 @@
|
||||
'use strict'
|
||||
//左下のメッセージ
|
||||
var todcTrigger = null;
|
||||
var todcTrigger = null
|
||||
function todo(mes) {
|
||||
clearInterval(todcTrigger);
|
||||
$('#message').text(mes);
|
||||
$('#message').fadeIn();
|
||||
todcTrigger = setTimeout(todc, 4000);
|
||||
clearInterval(todcTrigger)
|
||||
$('#message').text(mes)
|
||||
$('#message').fadeIn()
|
||||
todcTrigger = setTimeout(todc, 4000)
|
||||
}
|
||||
function todc() {
|
||||
$('#message').fadeOut();
|
||||
$('#message').fadeOut()
|
||||
}
|
||||
//reverse
|
||||
function bottomReverse() {
|
||||
$("#bottom").toggleClass("reverse");
|
||||
$(".leftside").toggleClass("reverse");
|
||||
if ($("#bottom").hasClass("reverse")) {
|
||||
localStorage.removeItem("reverse")
|
||||
$('#bottom').toggleClass('reverse')
|
||||
$('.leftside').toggleClass('reverse')
|
||||
if ($('#bottom').hasClass('reverse')) {
|
||||
localStorage.removeItem('reverse')
|
||||
} else {
|
||||
localStorage.setItem("reverse", "true")
|
||||
localStorage.setItem('reverse', 'true')
|
||||
}
|
||||
}
|
||||
function tips(mode) {
|
||||
postMessage(["sendSinmpleIpc", "endmem"], "*")
|
||||
clearInterval(clockint);
|
||||
clearInterval(spotStart);
|
||||
if (mode == "ver") {
|
||||
postMessage(['sendSinmpleIpc', 'endmem'], '*')
|
||||
clearInterval(clockint)
|
||||
clearInterval(spotStart)
|
||||
if (mode == 'ver') {
|
||||
tipsToggle()
|
||||
$("#tips-text").html('<img src="../../img/desk.png" width="20" onclick="todo(\'!TheDesk! It\\\'s a nice client!\')"><span style="font-size:20px">TheDesk</span> ' + localStorage.getItem("ver") + '[<i class="material-icons" style="font-size:1.2rem;top: 3px;position: relative;">supervisor_account</i><span id="persons">1+</span>]')
|
||||
localStorage.setItem("tips", "ver")
|
||||
} else if (mode == "clock") {
|
||||
$('#tips-text').html(
|
||||
'<img src="../../img/desk.png" width="20" onclick="todo(\'TheDesk is a nice client!: TheDesk ' +
|
||||
localStorage.getItem('ver') +
|
||||
' git: ' +
|
||||
gitHash +
|
||||
'\')">TheDesk ' +
|
||||
localStorage.getItem('ver') +
|
||||
' {' +
|
||||
gitHash.slice(0, 7) +
|
||||
'} [<i class="material-icons" style="font-size:1.2rem;top: 3px;position: relative;">supervisor_account</i><span id="persons">1+</span>]'
|
||||
)
|
||||
localStorage.setItem('tips', 'ver')
|
||||
} else if (mode == 'clock') {
|
||||
tipsToggle()
|
||||
localStorage.setItem("tips", "clock")
|
||||
localStorage.setItem('tips', 'clock')
|
||||
clock()
|
||||
} else if (mode == "memory") {
|
||||
} else if (mode == 'memory') {
|
||||
tipsToggle()
|
||||
localStorage.setItem("tips", "memory")
|
||||
startmem();
|
||||
} else if (mode == "trend") {
|
||||
localStorage.setItem('tips', 'memory')
|
||||
startmem()
|
||||
} else if (mode == 'trend') {
|
||||
tipsToggle()
|
||||
localStorage.setItem("tips", "trend")
|
||||
localStorage.setItem('tips', 'trend')
|
||||
trendTagonTip()
|
||||
} else if (mode == "spotify") {
|
||||
} else if (mode == 'spotify') {
|
||||
tipsToggle()
|
||||
localStorage.setItem("tips", "spotify")
|
||||
var json = nowplaying("spotifytips")
|
||||
spotifytips(json)
|
||||
localStorage.setItem('tips', 'spotify')
|
||||
spotifytips()
|
||||
} else if (mode == 'itunes') {
|
||||
tipsToggle()
|
||||
localStorage.setItem('tips', 'itunes')
|
||||
itunestips()
|
||||
}
|
||||
}
|
||||
//メモリ
|
||||
function startmem() {
|
||||
postMessage(["sendSinmpleIpc", "startmem"], "*")
|
||||
postMessage(['sendSinmpleIpc', 'startmem'], '*')
|
||||
}
|
||||
function renderMem(use, cpu, total){
|
||||
$("#tips-text").html(escapeHTML(cpu) + "<br>Memory:" + Math.floor(use / 1024 / 1024 / 102.4) / 10 + "/" + Math.floor(total / 1024 / 1024 / 102.4) / 10 + "GB(" + Math.floor(use / total * 100) + "%)")
|
||||
function renderMem(use, cpu, total) {
|
||||
$('#tips-text').html(
|
||||
escapeHTML(cpu) +
|
||||
'<br>Memory:' +
|
||||
Math.floor(use / 1024 / 1024 / 102.4) / 10 +
|
||||
'/' +
|
||||
Math.floor(total / 1024 / 1024 / 102.4) / 10 +
|
||||
'GB(' +
|
||||
Math.floor((use / total) * 100) +
|
||||
'%)'
|
||||
)
|
||||
}
|
||||
//トレンドタグ
|
||||
function trendTagonTip() {
|
||||
$(".trendtag").remove();
|
||||
var domain = "imastodon.net"
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/trend_tags"
|
||||
$('.trendtag').remove()
|
||||
var domain = 'imastodon.net'
|
||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||
var start = 'https://' + domain + '/api/v1/trend_tags'
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json) {
|
||||
var tags = "";
|
||||
json = json.score;
|
||||
Object.keys(json).forEach(function (tag) {
|
||||
tags = tags + '<a onclick="tagShow(\'' + tag + '\')" class="pointer">#' + escapeHTML(tag) + '</a><span class="hide" data-tag="' + tag + '"> <a onclick="tagTL(\'tag\',\'' + tag + '\',false,\'add\')" class="pointer" title="#' + tag + 'のタイムライン">TL</a> <a onclick="show();brInsert(\'#' + tag + '\')" class="pointer" title="#' + tag + 'でトゥート">Toot</a></span><br>';
|
||||
});
|
||||
$("#tips-text").html('<div class="trendtag">トレンドタグ<i class="material-icons pointer" onclick="trendTagonTip()" style="font-size:12px">refresh</i>:<br>' + tags + '</div>');
|
||||
trendTagonTipInterval()
|
||||
} else {
|
||||
$("#tips-text").html("");
|
||||
Authorization: 'Bearer ' + at
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json) {
|
||||
var tags = ''
|
||||
json = json.score
|
||||
Object.keys(json).forEach(function(tag) {
|
||||
tags =
|
||||
tags +
|
||||
`<a onclick="tagShow('${tag}')" class="pointer">
|
||||
#${escapeHTML(tag)}
|
||||
</a>
|
||||
<span class="hide" data-tag="${tag}" data-regTag="${tag.toLowerCase()}">
|
||||
<a onclick="tagTL('tag','${tag}',false,'add')" class="pointer" title="#${tag}のタイムライン">TL</a>
|
||||
<a onclick="show();brInsert('#${tag}')" class="pointer" title="#${tag}でトゥート">Toot</a>
|
||||
</span><br>`
|
||||
})
|
||||
$('#tips-text').html(
|
||||
'<div class="trendtag">トレンドタグ<i class="material-icons pointer" onclick="trendTagonTip()" style="font-size:12px">refresh</i>:<br>' +
|
||||
tags +
|
||||
'</div>'
|
||||
)
|
||||
trendTagonTipInterval()
|
||||
} else {
|
||||
$('#tips-text').html('')
|
||||
}
|
||||
})
|
||||
}
|
||||
//Spotify
|
||||
var spotint = null
|
||||
function spotifytips() {
|
||||
var start = "https://thedesk.top/now-playing?at=" + localStorage.getItem("spotify") + "&rt=" + localStorage.getItem("spotify-refresh");
|
||||
var at = localStorage.getItem("spotify");
|
||||
if (spotint) clearInterval(spotint)
|
||||
var start =
|
||||
'https://thedesk.top/now-playing?at=' +
|
||||
localStorage.getItem('spotify') +
|
||||
'&rt=' +
|
||||
localStorage.getItem('spotify-refresh')
|
||||
var at = localStorage.getItem('spotify')
|
||||
if (at) {
|
||||
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 ms = json.progress_ms;
|
||||
var last = 1000 - ms % 1000;
|
||||
var item = json.item;
|
||||
var img = item.album.images[0].url;
|
||||
var artisttxt = "";
|
||||
for (i = 0; i < item.artists.length; i++) {
|
||||
if (i > 0) {
|
||||
artisttxt = artisttxt + "," + item.artists[i].name;
|
||||
} else {
|
||||
artisttxt = item.artists[0].name;
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text)
|
||||
})
|
||||
}
|
||||
}
|
||||
artisttxt = escapeHTML(artisttxt);
|
||||
sleep(last);
|
||||
var tms = item.duration_ms;
|
||||
var per = ms / item.duration_ms * 100;
|
||||
ms = ms / 1000;
|
||||
tms = tms / 1000;
|
||||
var s = Math.round(ms) % 60;
|
||||
if (s < 10) {
|
||||
s = "0" + s;
|
||||
}
|
||||
var m = (Math.round(ms) - Math.round(ms) % 60) / 60;
|
||||
var ts = Math.round(tms) % 60;
|
||||
if (ts < 10) {
|
||||
ts = "0" + ts;
|
||||
}
|
||||
var tm = (Math.round(tms) - Math.round(tms) % 60) / 60;
|
||||
$("#tips-text").html('<div id="spot-box"><i class="material-icons pointer" onclick="spotifytips()" style="font-size:12px">refresh</i><img src="' + img + '" width="20" id="spot-img">' + escapeHTML(item.name) + '<span class="gray sml" id="spot-art">' + artisttxt + '</span><span id="spot-m">' + m + '</span>:<span id="spot-s">' + s + '</span>/' + tm + ":" + ts + '</span></div><div class="progress grey"><div class="determinate spotify-prog grey lighten-2" style="width: ' + per + '%" data-s="' + Math.round(ms) + '" data-total="' + item.duration_ms + '"></div></div>');
|
||||
spotint = setInterval(spotStart, 1000);
|
||||
});
|
||||
return response.json()
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error)
|
||||
setLog(start, 'JSON', error)
|
||||
console.error(error)
|
||||
})
|
||||
.then(function(json) {
|
||||
var ms = json.progress_ms
|
||||
var last = 1000 - (ms % 1000)
|
||||
var item = json.item
|
||||
var img = item.album.images[0].url
|
||||
var artisttxt = ''
|
||||
for (i = 0; i < item.artists.length; i++) {
|
||||
if (i > 0) {
|
||||
artisttxt = artisttxt + ',' + item.artists[i].name
|
||||
} else {
|
||||
artisttxt = item.artists[0].name
|
||||
}
|
||||
}
|
||||
artisttxt = escapeHTML(artisttxt)
|
||||
sleep(last)
|
||||
var tms = item.duration_ms
|
||||
var per = (ms / item.duration_ms) * 100
|
||||
ms = ms / 1000
|
||||
tms = tms / 1000
|
||||
var s = Math.round(ms) % 60
|
||||
if (s < 10) {
|
||||
s = '0' + s
|
||||
}
|
||||
var m = (Math.round(ms) - (Math.round(ms) % 60)) / 60
|
||||
var ts = Math.round(tms) % 60
|
||||
if (ts < 10) {
|
||||
ts = '0' + ts
|
||||
}
|
||||
var tm = (Math.round(tms) - (Math.round(tms) % 60)) / 60
|
||||
var html = `
|
||||
<div id="spot-box">
|
||||
<div id="spot-refresh">
|
||||
<i class="material-icons pointer" onclick="spotifytips()" style="font-size:20px">refresh</i>
|
||||
<i class="material-icons pointer" onclick="nowplaying('spotify');show()" style="font-size:20px">send</i>
|
||||
</div>
|
||||
<div id="spot-cover">
|
||||
<img src="${img}" id="spot-img">
|
||||
</div>
|
||||
<div id="spot-name">
|
||||
${escapeHTML(item.name)}
|
||||
</div>
|
||||
<div id="spot-artist">
|
||||
<span class="gray sml" id="spot-art">${artisttxt}</span>
|
||||
</div>
|
||||
<div id="spot-time">
|
||||
<span id="spot-m">${m}</span>:<span id="spot-s">${s}</span>/${tm}:${ts}</span>
|
||||
</div>
|
||||
<div class="progress grey">
|
||||
<div class="determinate spotify-prog grey lighten-2"
|
||||
style="width:${per}%" data-s="${Math.round(ms)}" data-total="${item.duration_ms}">
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
$('#tips-text').html(html)
|
||||
spotint = setInterval(spotStart, 1000)
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
type: 'info',
|
||||
@@ -140,57 +222,73 @@ function spotifytips() {
|
||||
}
|
||||
}
|
||||
function spotStart() {
|
||||
var total = $(".spotify-prog").attr("data-total");
|
||||
var s = $(".spotify-prog").attr("data-s");
|
||||
var news = s * 1 + 1;
|
||||
var per = news * 100000 / total;
|
||||
var ns = news % 60;
|
||||
var nm = (news - ns) / 60;
|
||||
var total = $('.spotify-prog').attr('data-total')
|
||||
var s = $('.spotify-prog').attr('data-s')
|
||||
var news = s * 1 + 1
|
||||
var per = (news * 100000) / total
|
||||
var ns = news % 60
|
||||
var nm = (news - ns) / 60
|
||||
if (ns < 10) {
|
||||
ns = "0" + ns;
|
||||
ns = '0' + ns
|
||||
}
|
||||
if (per >= 100) {
|
||||
clearInterval(spotStart);
|
||||
clearInterval(spotStart)
|
||||
spotifytips()
|
||||
} else {
|
||||
$("#spot-m").text(nm);
|
||||
$("#spot-s").text(ns);
|
||||
$('#spot-m').text(nm)
|
||||
$('#spot-s').text(ns)
|
||||
}
|
||||
$(".spotify-prog").attr("data-s", news);
|
||||
$(".spotify-prog").css("width", per + "%");
|
||||
$('.spotify-prog').attr('data-s', news)
|
||||
$('.spotify-prog').css('width', per + '%')
|
||||
}
|
||||
|
||||
|
||||
function trendTagonTipInterval() {
|
||||
setTimeout(trendTagonTip, 6000000);
|
||||
setTimeout(trendTagonTip, 6000000)
|
||||
}
|
||||
//時計
|
||||
var clockint;
|
||||
var clockint
|
||||
function clock() {
|
||||
var now = new Date();
|
||||
var last = 1000 - now.getTime() % 1000;
|
||||
sleep(last);
|
||||
clockint = setInterval(clockStart, 1000);
|
||||
var now = new Date()
|
||||
var last = 1000 - (now.getTime() % 1000)
|
||||
sleep(last)
|
||||
clockint = setInterval(clockStart, 1000)
|
||||
}
|
||||
function clockStart() {
|
||||
var nowTime = new Date(); // 現在日時を得る
|
||||
var nowHour = nowTime.getHours(); // 時を抜き出す
|
||||
if (nowHour < 10) { nowHour = "0" + nowHour }
|
||||
var nowMin = nowTime.getMinutes(); // 分を抜き出す
|
||||
if (nowMin < 10) { nowMin = "0" + nowMin }
|
||||
var nowSec = nowTime.getSeconds(); // 秒を抜き出す
|
||||
if (nowSec < 10) { nowSec = "0" + nowSec }
|
||||
var msg = nowTime.getFullYear() + "/" + (nowTime.getMonth() + 1) + "/" + nowTime.getDate() + '<span style="font-size:20px; font-family:Open Sans">' + nowHour + ":" + nowMin + ":" + nowSec + "</span>";
|
||||
$("#tips-text").html(msg);
|
||||
var nowTime = new Date() // 現在日時を得る
|
||||
var nowHour = nowTime.getHours() // 時を抜き出す
|
||||
if (nowHour < 10) {
|
||||
nowHour = '0' + nowHour
|
||||
}
|
||||
var nowMin = nowTime.getMinutes() // 分を抜き出す
|
||||
if (nowMin < 10) {
|
||||
nowMin = '0' + nowMin
|
||||
}
|
||||
var nowSec = nowTime.getSeconds() // 秒を抜き出す
|
||||
if (nowSec < 10) {
|
||||
nowSec = '0' + nowSec
|
||||
}
|
||||
var msg =
|
||||
nowTime.getFullYear() +
|
||||
'/' +
|
||||
(nowTime.getMonth() + 1) +
|
||||
'/' +
|
||||
nowTime.getDate() +
|
||||
'<span style="font-size:20px; font-family:Open Sans">' +
|
||||
nowHour +
|
||||
':' +
|
||||
nowMin +
|
||||
':' +
|
||||
nowSec +
|
||||
'</span>'
|
||||
$('#tips-text').html(msg)
|
||||
}
|
||||
function sleep(waitMsec) {
|
||||
var startMsec = new Date();
|
||||
var startMsec = new Date()
|
||||
while (new Date() - startMsec < waitMsec);
|
||||
}
|
||||
function tipsToggle() {
|
||||
$("#tips").toggleClass("hide");
|
||||
$("#tips-menu").toggleClass("hide");
|
||||
$('#tips').toggleClass('hide')
|
||||
$('#tips-menu').toggleClass('hide')
|
||||
}
|
||||
if (localStorage.getItem("tips")) {
|
||||
tips(localStorage.getItem("tips"));
|
||||
if (localStorage.getItem('tips')) {
|
||||
tips(localStorage.getItem('tips'))
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//プロフ編集
|
||||
//文字系
|
||||
function profedit() {
|
||||
@@ -52,6 +53,7 @@ function imgChange(imgfile, target) {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(this.status!==200){ setLog(start, this.status, this.response); }
|
||||
$('#his-data').modal('close');
|
||||
todc();
|
||||
localStorage.removeItem("image");
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
//ユーザーデータ表示
|
||||
localStorage.removeItem("history");
|
||||
//コード受信
|
||||
@@ -6,12 +7,12 @@ if (location.search) {
|
||||
var mode = m[1];
|
||||
var codex = m[2];
|
||||
if (mode == "user") {
|
||||
udgEx(codex, 'main');
|
||||
udgEx(codex, "main");
|
||||
}
|
||||
}
|
||||
function udgEx(user, acct_id) {
|
||||
if (user == "selector") {
|
||||
user = $("#his-acct").attr('fullname');
|
||||
user = $("#his-acct").attr("fullname");
|
||||
}
|
||||
if (acct_id == "selector") {
|
||||
acct_id = $("#user-acct-sel").val();
|
||||
@@ -21,28 +22,39 @@ function udgEx(user, acct_id) {
|
||||
}
|
||||
console.log("Get user data of " + user);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") { return false; }
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
return false;
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/search?resolve=true&q=" + user
|
||||
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + encodeURIComponent(user);
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json.accounts) {
|
||||
var id = json.accounts[0].id;
|
||||
udg(id, acct_id);
|
||||
} else {
|
||||
postMessage(["openUrl", url], "*")
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
if (json.accounts[0]) {
|
||||
var id = json.accounts[0].id;
|
||||
udg(id, acct_id);
|
||||
} else {
|
||||
postMessage(["openUrl", user], "*");
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
function udg(user, acct_id) {
|
||||
@@ -53,160 +65,184 @@ function udg(user, acct_id) {
|
||||
todo("User Data Loading...");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
misskeyUdg(user, acct_id)
|
||||
misskeyUdg(user, acct_id);
|
||||
return;
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + user;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
method: "GET",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
//一つ前のユーザーデータ
|
||||
if (!localStorage.getItem("history")) {
|
||||
$("#his-history-btn").prop("disabled", true);
|
||||
} else {
|
||||
$("#his-history-btn").prop("disabled", false);
|
||||
$('#his-data').attr("history", localStorage.getItem("history"));
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
//moved設定時
|
||||
if (json.moved) {
|
||||
M.toast({
|
||||
html: lang.lang_showontl_movetxt + '<button class="btn-flat toast-action" onclick="udg(\'' +
|
||||
json.moved.id + '\',\'' + acct_id + '\')">' + lang.lang_showontl_movebtn + '</button>', displayLength: 4000
|
||||
})
|
||||
}
|
||||
$('#his-data').modal('open');
|
||||
$('#his-data').attr("user-id", user);
|
||||
$('#his-data').attr("use-acct", acct_id);
|
||||
if (json.username != json.acct) {
|
||||
//Remote
|
||||
$('#his-data').attr("remote", "true");
|
||||
var fullname = json.acct;
|
||||
} 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);
|
||||
var dis_name = escapeHTML(json.display_name);
|
||||
dis_name = twemoji.parse(dis_name);
|
||||
|
||||
var note = json.note;
|
||||
if (json.emojis) {
|
||||
var actemojick = json.emojis[0];
|
||||
} else {
|
||||
var actemojick = false;
|
||||
}
|
||||
//絵文字があれば
|
||||
if (actemojick) {
|
||||
Object.keys(json.emojis).forEach(function (key5) {
|
||||
var emoji = json.emojis[key5];
|
||||
var shortcode = emoji.shortcode;
|
||||
var emoji_url = '<img src="' + emoji.url +
|
||||
'" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">';
|
||||
var regExp = new RegExp(":" + shortcode + ":", "g");
|
||||
dis_name = dis_name.replace(regExp, emoji_url);
|
||||
note = note.replace(regExp, emoji_url);
|
||||
});
|
||||
}
|
||||
//noteの解析
|
||||
//var tags = '<a onclick="tl(\'tag\',\'$1\',' + acct_id +',\'add\')" class="pointer parsed">#$1</a>';
|
||||
//var mens = '<a onclick="udgEx(\'$1\',' + acct_id +')" class="pointer parsed">@$1</a>';
|
||||
//note=note.replace(/#(\S+)/gi, tags)
|
||||
//note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens)
|
||||
$("#his-name").html(dis_name);
|
||||
$("#his-acct").text(json.acct);
|
||||
$("#his-acct").attr("fullname", fullname);
|
||||
$("#his-prof").attr("src", json.avatar);
|
||||
$('#his-data').css('background-image', 'url(' + json.header + ')');
|
||||
$("#his-sta").text(json.statuses_count);
|
||||
$("#his-follow").text(json.following_count);
|
||||
var flerc = json.followers_count;
|
||||
if (flerc < 0) {
|
||||
flerc = "-";
|
||||
}
|
||||
$("#his-follower").text(flerc);
|
||||
$("#his-since").text(crat(json.created_at));
|
||||
$("#his-openin").attr("data-href", json.url);
|
||||
if (json.fields) {
|
||||
if (json.fields.length > 0) {
|
||||
note = note + '<table id="his-field">'
|
||||
for (var i = 0; i < json.fields.length; i++) {
|
||||
var fname = json.fields[i].name;
|
||||
var fval = json.fields[i].value;
|
||||
if (json.fields[i].verified_at) {
|
||||
var when = lang.lang_showontl_verified + ":" + crat(json.fields[i].verified_at);
|
||||
var color = "rgba(121,189,154,.25);"
|
||||
} else {
|
||||
var when = "";
|
||||
var color = "inherit"
|
||||
}
|
||||
note = note + '<tr><td class="his-field-title">' + twemoji.parse(escapeHTML(fname)) + '</td><td class="his-field-content" title="' + when + '" style="background-color:' + color + '">' + twemoji.parse(fval) + '</td></tr>';
|
||||
}
|
||||
note = note + '</table>'
|
||||
$("#his-des").html(twemoji.parse(note));
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
//一つ前のユーザーデータ
|
||||
if (!localStorage.getItem("history")) {
|
||||
$("#his-history-btn").prop("disabled", true);
|
||||
} else {
|
||||
$("#his-des").html(twemoji.parse(note));
|
||||
$("#his-history-btn").prop("disabled", false);
|
||||
$("#his-data").attr("history", localStorage.getItem("history"));
|
||||
}
|
||||
//moved設定時
|
||||
if (json.moved) {
|
||||
M.toast({
|
||||
html: lang.lang_showontl_movetxt + '<button class="btn-flat toast-action" onclick="udg(\'' + json.moved.id + "','" + acct_id + "')\">" + lang.lang_showontl_movebtn + "</button>",
|
||||
displayLength: 4000
|
||||
});
|
||||
}
|
||||
$("#his-data").modal("open");
|
||||
$("#his-data").attr("user-id", user);
|
||||
$("#his-data").attr("use-acct", acct_id);
|
||||
if (json.username != json.acct) {
|
||||
//Remote
|
||||
$("#his-data").attr("remote", "true");
|
||||
var fullname = json.acct;
|
||||
} 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);
|
||||
var dis_name = escapeHTML(json.display_name);
|
||||
dis_name = twemoji.parse(dis_name);
|
||||
|
||||
var note = json.note;
|
||||
if (json.emojis) {
|
||||
var actemojick = json.emojis[0];
|
||||
} else {
|
||||
var actemojick = false;
|
||||
}
|
||||
//絵文字があれば
|
||||
if (actemojick) {
|
||||
Object.keys(json.emojis).forEach(function(key5) {
|
||||
var emoji = json.emojis[key5];
|
||||
var shortcode = emoji.shortcode;
|
||||
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">';
|
||||
var regExp = new RegExp(":" + shortcode + ":", "g");
|
||||
dis_name = dis_name.replace(regExp, emoji_url);
|
||||
note = note.replace(regExp, emoji_url);
|
||||
});
|
||||
}
|
||||
//noteの解析
|
||||
//var tags = '<a onclick="tl(\'tag\',\'$1\',' + acct_id +',\'add\')" class="pointer parsed">#$1</a>';
|
||||
//var mens = '<a onclick="udgEx(\'$1\',' + acct_id +')" class="pointer parsed">@$1</a>';
|
||||
//note=note.replace(/#(\S+)/gi, tags)
|
||||
//note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens)
|
||||
$("#his-name").html(dis_name);
|
||||
$("#his-acct").text(json.acct);
|
||||
$("#his-acct").attr("fullname", fullname);
|
||||
$("#his-prof").attr("src", json.avatar);
|
||||
$("#his-data").css("background-image", "url(" + json.header + ")");
|
||||
$("#his-sta").text(json.statuses_count);
|
||||
$("#his-follow").text(json.following_count);
|
||||
var flerc = json.followers_count;
|
||||
if (flerc < 0) {
|
||||
flerc = "-";
|
||||
}
|
||||
$("#his-follower").text(flerc);
|
||||
$("#his-since").text(crat(json.created_at));
|
||||
$("#his-openin").attr("data-href", json.url);
|
||||
if (json.fields) {
|
||||
var table = "";
|
||||
if (json.fields.length > 0) {
|
||||
$("#his-des").css("max-height", "250px");
|
||||
table = '<table id="his-field">';
|
||||
for (var i = 0; i < json.fields.length; i++) {
|
||||
var fname = json.fields[i].name;
|
||||
var fval = json.fields[i].value;
|
||||
if (json.fields[i].verified_at) {
|
||||
var when = lang.lang_showontl_verified + ":" + crat(json.fields[i].verified_at);
|
||||
var color = "rgba(121,189,154,.25);";
|
||||
} else {
|
||||
var when = "";
|
||||
var color = "inherit";
|
||||
}
|
||||
table = table + '<tr><td class="his-field-title">' + escapeHTML(fname) + '</td><td class="his-field-content" title="' + when + '" style="background-color:' + color + '">' + fval + "</td></tr>";
|
||||
}
|
||||
table = table + "</table>";
|
||||
$("#his-des").html(twemoji.parse(note));
|
||||
} else {
|
||||
$("#his-des").css("max-height", "400px");
|
||||
}
|
||||
$("#his-table").html(twemoji.parse(table));
|
||||
} else {
|
||||
$("#his-des").css("max-height", "400px");
|
||||
}
|
||||
} else {
|
||||
$("#his-des").html(twemoji.parse(note));
|
||||
}
|
||||
if (json.bot) {
|
||||
$("#his-bot").html(lang.lang_showontl_botacct);
|
||||
}
|
||||
$("#his-des").attr("data-acct", acct_id);
|
||||
$('#his-data').css('background-size', 'cover');
|
||||
$("#his-float-timeline").css("height", $("#his-data-show").height() + "px")
|
||||
localStorage.setItem("history", user);
|
||||
//自分の時
|
||||
if (json.acct == localStorage.getItem("user_" + acct_id)) {
|
||||
showFav('', acct_id);
|
||||
showBlo('', acct_id);
|
||||
showMut('', acct_id);
|
||||
showDom('', acct_id);
|
||||
showReq('', acct_id);
|
||||
showFrl('', acct_id);
|
||||
$("#his-name-val").val(json.display_name);
|
||||
if (json.fields.length > 0) {
|
||||
if (json.fields[0]) { $("#his-f1-name").val(json.fields[0].name); $("#his-f1-val").val($.strip_tags(json.fields[0].value)); }
|
||||
if (json.fields[1]) { $("#his-f2-name").val(json.fields[1].name); $("#his-f2-val").val($.strip_tags(json.fields[1].value)); }
|
||||
if (json.fields[2]) { $("#his-f3-name").val(json.fields[2].name); $("#his-f3-val").val($.strip_tags(json.fields[2].value)); }
|
||||
if (json.fields[3]) { $("#his-f4-name").val(json.fields[3].name); $("#his-f4-val").val($.strip_tags(json.fields[3].value)); }
|
||||
if (json.bot) {
|
||||
$("#his-bot").html(lang.lang_showontl_botacct);
|
||||
}
|
||||
var des = json.note;
|
||||
des = des.replace(/<br \/>/g, "\n")
|
||||
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();
|
||||
if (localStorage.getItem("main") == acct_id) {
|
||||
$("#his-main-acct").hide();
|
||||
$("#his-des").attr("data-acct", acct_id);
|
||||
$("#his-data").css("background-size", "cover");
|
||||
$("#his-float-timeline").css("height", $("#his-data-show").height() + "px");
|
||||
localStorage.setItem("history", user);
|
||||
//自分の時
|
||||
if (json.acct == localStorage.getItem("user_" + acct_id)) {
|
||||
showFav("", acct_id);
|
||||
showBlo("", acct_id);
|
||||
showMut("", acct_id);
|
||||
showDom("", acct_id);
|
||||
showReq("", acct_id);
|
||||
showFrl("", acct_id);
|
||||
$("#his-name-val").val(json.display_name);
|
||||
if (json.fields.length > 0) {
|
||||
if (json.fields[0]) {
|
||||
$("#his-f1-name").val(json.fields[0].name);
|
||||
$("#his-f1-val").val($.strip_tags(json.fields[0].value));
|
||||
}
|
||||
if (json.fields[1]) {
|
||||
$("#his-f2-name").val(json.fields[1].name);
|
||||
$("#his-f2-val").val($.strip_tags(json.fields[1].value));
|
||||
}
|
||||
if (json.fields[2]) {
|
||||
$("#his-f3-name").val(json.fields[2].name);
|
||||
$("#his-f3-val").val($.strip_tags(json.fields[2].value));
|
||||
}
|
||||
if (json.fields[3]) {
|
||||
$("#his-f4-name").val(json.fields[3].name);
|
||||
$("#his-f4-val").val($.strip_tags(json.fields[3].value));
|
||||
}
|
||||
}
|
||||
var des = json.note;
|
||||
des = des.replace(/<br \/>/g, "\n");
|
||||
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();
|
||||
if (localStorage.getItem("main") == acct_id) {
|
||||
$("#his-main-acct").hide();
|
||||
}
|
||||
} else {
|
||||
relations(user, acct_id);
|
||||
$(".only-my-data").hide();
|
||||
$(".only-his-data").show();
|
||||
}
|
||||
} else {
|
||||
relations(user, acct_id);
|
||||
$(".only-my-data").hide();
|
||||
$(".only-his-data").show();
|
||||
}
|
||||
todc();
|
||||
//外部データ取得(死かもしれないので)
|
||||
udAdd(json.url);
|
||||
});
|
||||
todc();
|
||||
//外部データ取得(死かもしれないので)
|
||||
udAdd(acct_id, user, json.url);
|
||||
});
|
||||
}
|
||||
function misskeyUdg(user, acct_id) {
|
||||
reset();
|
||||
@@ -216,128 +252,137 @@ function misskeyUdg(user, acct_id) {
|
||||
todo("User Data Loading...");
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
udg(user, acct_id)
|
||||
udg(user, acct_id);
|
||||
return;
|
||||
}
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/users/show";
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
"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) {
|
||||
//一つ前のユーザーデータ
|
||||
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 = escapeHTML(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();
|
||||
if (localStorage.getItem("main") == acct_id) {
|
||||
$("#his-main-acct").hide();
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (json.isFollowing) {
|
||||
//自分がフォローしている
|
||||
$("#his-data").addClass("following");
|
||||
$("#his-follow-btn").text(lang.lang_status_unfollow);
|
||||
hisList(user, acct_id);
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
//一つ前のユーザーデータ
|
||||
if (!localStorage.getItem("history")) {
|
||||
$("#his-history-btn").prop("disabled", true);
|
||||
} else {
|
||||
$("#his-follow-btn").text(lang.lang_status_follow);
|
||||
$("#his-history-btn").prop("disabled", false);
|
||||
$("#his-data").attr("history", localStorage.getItem("history"));
|
||||
}
|
||||
if (json.isFollowed) {
|
||||
//フォローされてる
|
||||
$("#his-relation").text(lang.lang_showontl_followed);
|
||||
}
|
||||
$("#his-block-btn").hide();
|
||||
if (json.isMuted) {
|
||||
$("#his-data").addClass("muting");
|
||||
$("#his-mute-btn").text(lang.lang_status_unmute);
|
||||
$("#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-mute-btn").text(lang.lang_status_mute);
|
||||
$("#his-data").attr("remote", "false");
|
||||
var fullname = json.acct + "@" + domain;
|
||||
}
|
||||
$(".only-my-data").hide();
|
||||
$(".only-his-data").show();
|
||||
}
|
||||
todc();
|
||||
});
|
||||
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 = escapeHTML(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();
|
||||
if (localStorage.getItem("main") == acct_id) {
|
||||
$("#his-main-acct").hide();
|
||||
}
|
||||
} else {
|
||||
if (json.isFollowing) {
|
||||
//自分がフォローしている
|
||||
$("#his-data").addClass("following");
|
||||
$("#his-follow-btn-text").text(lang.lang_status_unfollow);
|
||||
hisList(user, acct_id);
|
||||
} else {
|
||||
$("#his-follow-btn-text").text(lang.lang_status_follow);
|
||||
}
|
||||
if (json.isFollowed) {
|
||||
//フォローされてる
|
||||
$("#his-relation").text(lang.lang_showontl_followed);
|
||||
}
|
||||
$("#his-block-btn").hide();
|
||||
if (json.isMuted) {
|
||||
$("#his-data").addClass("muting");
|
||||
$("#his-mute-btn-text").text(lang.lang_status_unmute);
|
||||
} else {
|
||||
$("#his-mute-btn-text").text(lang.lang_status_mute);
|
||||
}
|
||||
$(".only-my-data").hide();
|
||||
$(".only-his-data").show();
|
||||
}
|
||||
todc();
|
||||
});
|
||||
}
|
||||
//一つ前のユーザーデータ表示
|
||||
function historyShow() {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
var user = $('#his-data').attr("history");
|
||||
udg(user, acct_id, "true")
|
||||
var acct_id = $("#his-data").attr("use-acct");
|
||||
var user = $("#his-data").attr("history");
|
||||
udg(user, acct_id, "true");
|
||||
}
|
||||
//選択アカウントのプロフ
|
||||
function profShow() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var user = localStorage.getItem("user-id_" + acct_id);
|
||||
udg(user, acct_id)
|
||||
udg(user, acct_id);
|
||||
hide();
|
||||
}
|
||||
|
||||
@@ -347,104 +392,112 @@ function relations(user, acct_id) {
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
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 json = json[0];
|
||||
if (json.following) {
|
||||
//自分がフォローしている
|
||||
$("#his-data").addClass("following");
|
||||
$("#his-follow-btn").text(lang.lang_status_unfollow);
|
||||
hisList(user, acct_id);
|
||||
} else {
|
||||
$("#his-follow-btn").text(lang.lang_status_follow);
|
||||
"content-type": "application/json",
|
||||
Authorization: "Bearer " + at
|
||||
}
|
||||
if (json.followed_by) {
|
||||
//フォローされてる
|
||||
$("#his-relation").text(lang.lang_showontl_followed);
|
||||
}
|
||||
if (json.blocking) {
|
||||
$("#his-data").addClass("blocking");
|
||||
$("#his-block-btn").text(lang.lang_status_unblock);
|
||||
} else {
|
||||
$("#his-block-btn").text(lang.lang_status_block);
|
||||
}
|
||||
if (json.muting) {
|
||||
$("#his-data").addClass("muting");
|
||||
$("#his-mute-btn").text(lang.lang_status_unmute);
|
||||
} else {
|
||||
$("#his-mute-btn").text(lang.lang_status_mute);
|
||||
}
|
||||
if (json.muting_notifications) {
|
||||
$("#his-data").addClass("mutingNotf");
|
||||
$("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_unmute);
|
||||
} else {
|
||||
$("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_mute);
|
||||
}
|
||||
if (json.domain_blocking) {
|
||||
$("#his-data").addClass("blockingDom");
|
||||
$("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_unblock);
|
||||
} else {
|
||||
$("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_block);
|
||||
}
|
||||
//Endorsed
|
||||
if (json.endorsed) {
|
||||
$("#his-end-btn").addClass("endorsed");
|
||||
$("#his-end-btn").text(lang.lang_status_unendorse)
|
||||
} else {
|
||||
$("#his-end-btn").removeClass("endorsed");
|
||||
$("#his-end-btn").text(lang.lang_status_endorse)
|
||||
}
|
||||
//Blocked
|
||||
if (json.blocked_by) {
|
||||
$("#my-data-nav .btn").addClass("disabled")
|
||||
$(".his-var-content").hide();
|
||||
$("#his-float-blocked").show()
|
||||
$("#his-follow-btn").hide()
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
response.text().then(function(text) {
|
||||
setLog(response.url, response.status, text);
|
||||
});
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.catch(function(error) {
|
||||
todo(error);
|
||||
setLog(start, "JSON", error);
|
||||
console.error(error);
|
||||
})
|
||||
.then(function(json) {
|
||||
var json = json[0];
|
||||
if (json.following) {
|
||||
//自分がフォローしている
|
||||
$("#his-data").addClass("following");
|
||||
$("#his-follow-btn-text").text(lang.lang_status_unfollow);
|
||||
hisList(user, acct_id);
|
||||
} else {
|
||||
$("#his-follow-btn-text").text(lang.lang_status_follow);
|
||||
}
|
||||
if (json.followed_by) {
|
||||
//フォローされてる
|
||||
$("#his-relation").text(lang.lang_showontl_followed);
|
||||
}
|
||||
if (json.blocking) {
|
||||
$("#his-data").addClass("blocking");
|
||||
$("#his-block-btn-text").text(lang.lang_status_unblock);
|
||||
} else {
|
||||
$("#his-block-btn-text").text(lang.lang_status_block);
|
||||
}
|
||||
if (json.muting) {
|
||||
$("#his-data").addClass("muting");
|
||||
$("#his-mute-btn-text").text(lang.lang_status_unmute);
|
||||
} else {
|
||||
$("#his-mute-btn-text").text(lang.lang_status_mute);
|
||||
}
|
||||
if (json.muting_notifications) {
|
||||
$("#his-data").addClass("mutingNotf");
|
||||
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_unmute);
|
||||
} else {
|
||||
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_mute);
|
||||
}
|
||||
if (json.domain_blocking) {
|
||||
$("#his-data").addClass("blockingDom");
|
||||
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_unblock);
|
||||
} else {
|
||||
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_block);
|
||||
}
|
||||
//Endorsed
|
||||
if (json.endorsed) {
|
||||
$("#his-end-btn").addClass("endorsed");
|
||||
$("#his-end-btn-text").text(lang.lang_status_unendorse);
|
||||
} else {
|
||||
$("#his-end-btn").removeClass("endorsed");
|
||||
$("#his-end-btn-text").text(lang.lang_status_endorse);
|
||||
}
|
||||
//Blocked
|
||||
if (json.blocked_by) {
|
||||
$("#my-data-nav .btn").addClass("disabled");
|
||||
$(".his-var-content").hide();
|
||||
$("#his-float-blocked").show();
|
||||
$("#his-follow-btn").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
function profbrws() {
|
||||
var url = $("#his-openin").attr("data-href")
|
||||
postMessage(["openUrl", url], "*")
|
||||
var url = $("#his-openin").attr("data-href");
|
||||
postMessage(["openUrl", url], "*");
|
||||
}
|
||||
function setMain() {
|
||||
var acct_id = $("#his-data").attr("use-acct")
|
||||
var acct_id = $("#his-data").attr("use-acct");
|
||||
localStorage.setItem("main", acct_id);
|
||||
multiSelector(true)
|
||||
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 })
|
||||
multiSelector(true);
|
||||
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 });
|
||||
}
|
||||
//オールリセット
|
||||
function hisclose() {
|
||||
$('#his-data').modal('close');
|
||||
$("#his-data").modal("close");
|
||||
reset();
|
||||
$('#his-data').attr("history", "");
|
||||
$("#his-data").attr("history", "");
|
||||
localStorage.removeItem("history");
|
||||
}
|
||||
function reset() {
|
||||
$(".his-var-content:eq(0)").show();
|
||||
$(".his-var-content:gt(0)").hide();
|
||||
$("#my-data-nav .btn").removeClass("disabled")
|
||||
$("#my-data-nav .btn").removeClass("disabled");
|
||||
$(".active-back").removeClass("active-back");
|
||||
$(".column-first").addClass("active-back");
|
||||
$("#his-name").text("Loading");
|
||||
$("#his-acct").text("");
|
||||
$("#his-prof").attr("src", "../../img/loading.svg");
|
||||
$('#his-data').css('background-image', 'url(../../img/loading.svg)');
|
||||
$("#his-data").css("background-image", "url(../../img/loading.svg)");
|
||||
$("#his-sta").text("");
|
||||
$("#his-follow").text("");
|
||||
$("#his-follower").text("");
|
||||
$("#his-des").html("");
|
||||
$('#his-data').css('background-size', 'cover');
|
||||
$("#his-data").css("background-size", "cover");
|
||||
$("#his-since").text("");
|
||||
$("#his-data").removeClass("following");
|
||||
$("#his-data").removeClass("muting");
|
||||
@@ -452,6 +505,7 @@ function reset() {
|
||||
$("#his-data").removeClass("mutingNotf");
|
||||
$("#his-data").removeClass("blockingDom");
|
||||
$("#his-end-btn").removeClass("endorsed");
|
||||
$("#his-des").css("max-height", "250px");
|
||||
$("#his-bot").html("");
|
||||
$("#his-follow-btn").show();
|
||||
$("#his-block-btn").show();
|
||||
@@ -459,30 +513,34 @@ function reset() {
|
||||
$("#his-notf-btn").show();
|
||||
$("#his-domain-btn").show();
|
||||
$("#his-emp-btn").show();
|
||||
$("#his-follow-btn").text(lang.lang_status_follow);
|
||||
$("#his-mute-btn").text(lang.lang_status_mute);
|
||||
$("#his-block-btn").text(lang.lang_status_block);
|
||||
$("#his-follow-btn-text").text(lang.lang_status_follow);
|
||||
$("#his-mute-btn-text").text(lang.lang_status_mute);
|
||||
$("#his-block-btn-text").text(lang.lang_status_block);
|
||||
$("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_mute);
|
||||
$("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_block);
|
||||
$("#his-relation").text("");
|
||||
$(".cont-series").html("");
|
||||
$("#domainblock").val("");
|
||||
$("#his-lists-a").html(lang.lang_showontl_listwarn);
|
||||
$("#his-lists-b").html('');
|
||||
$("#his-lists-b").html("");
|
||||
$("#his-name-val").val("");
|
||||
$("#his-des-val").val("");
|
||||
$("#his-f1-name").val(""); $("#his-f1-val").val("");
|
||||
$("#his-f2-name").val(""); $("#his-f2-val").val("");
|
||||
$("#his-f3-name").val(""); $("#his-f3-val").val("");
|
||||
$("#his-f4-name").val(""); $("#his-f4-val").val("");
|
||||
$("#his-f1-name").val("");
|
||||
$("#his-f1-val").val("");
|
||||
$("#his-f2-name").val("");
|
||||
$("#his-f2-val").val("");
|
||||
$("#his-f3-name").val("");
|
||||
$("#his-f3-val").val("");
|
||||
$("#his-f4-name").val("");
|
||||
$("#his-f4-val").val("");
|
||||
$("#his-endorse").html("");
|
||||
$("#his-openin").attr("data-href", "");
|
||||
$("#his-float-timeline").show();
|
||||
$("#his-float-blocked").hide();
|
||||
$("#his-main-acct").show();
|
||||
$("#his-proof-prof").html("")
|
||||
$("#his-proof-prof").html("");
|
||||
}
|
||||
$('#my-data-nav .anc-link').on('click', function () {
|
||||
$("#my-data-nav .anc-link").on("click", function() {
|
||||
var target = $(this).attr("go");
|
||||
if (target) {
|
||||
$("#my-data-nav .anc-link").removeClass("active-back");
|
||||
@@ -490,5 +548,4 @@ $('#my-data-nav .anc-link').on('click', function () {
|
||||
$(target).show();
|
||||
$(".his-var-content:not(" + target + ")").hide();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
364
app/main.js
364
app/main.js
@@ -1,223 +1,327 @@
|
||||
var dirname = __dirname;
|
||||
var dir = 'file://' + __dirname;
|
||||
var base = dir + '/view/';
|
||||
var dirname = __dirname
|
||||
var dir = 'file://' + __dirname
|
||||
var base = dir + '/view/'
|
||||
// Electronのモジュール
|
||||
const electron = require("electron");
|
||||
const fs = require("fs");
|
||||
const language = require('./main/language.js');
|
||||
const css = require('./main/css.js');
|
||||
const dl = require('./main/dl.js');
|
||||
const img = require('./main/img.js');
|
||||
const np = require('./main/np.js');
|
||||
const systemFunc = require('./main/system.js');
|
||||
const electron = require('electron')
|
||||
const fs = require('fs')
|
||||
const language = require('./main/language.js')
|
||||
const css = require('./main/css.js')
|
||||
const dl = require('./main/dl.js')
|
||||
const img = require('./main/img.js')
|
||||
const np = require('./main/np.js')
|
||||
const systemFunc = require('./main/system.js')
|
||||
const Menu = electron.Menu
|
||||
const join = require('path').join;
|
||||
const join = require('path').join
|
||||
|
||||
// アプリケーションをコントロールするモジュール
|
||||
const app = electron.app;
|
||||
const app = electron.app
|
||||
// ウィンドウを作成するモジュール
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
// メインウィンドウはGCされないようにグローバル宣言
|
||||
let mainWindow;
|
||||
if (process.argv.indexOf("--dev") === -1) {
|
||||
var packaged = true;
|
||||
let mainWindow
|
||||
|
||||
// アプリが多重起動しないようにする
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
|
||||
if (!gotTheLock) {
|
||||
app.quit()
|
||||
} else {
|
||||
var packaged = false;
|
||||
app.on('second-instance', () => {
|
||||
// 多重起動を試みた場合、既に存在するウィンドウにフォーカスを移す
|
||||
// Someone tried to run a second instance, we should focus our window.
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore()
|
||||
mainWindow.focus()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('--dev') === -1) {
|
||||
var packaged = true
|
||||
} else {
|
||||
var packaged = false
|
||||
console.log(
|
||||
"||\\\\\\ \n"+
|
||||
"|||| \\\\\\\\ \n"+
|
||||
"|||| \\\\\\\\ \n"+
|
||||
"|||| Am I a \\\\\\\\ \n"+
|
||||
"|||| cat? ^ ^ \\\\\\\\\\ _____ _ ____ _ \n"+
|
||||
"|||| (.-.) \\\\\\\\\\ |_ _| |__ ___| _ \\ ___ ___| | __\n"+
|
||||
"|||| ___> ) ||||| | | | '_ \\ / _ \\ | | |/ _ \\/ __| |/ /\n"+
|
||||
"|||| < _ _) ////// | | | | | | __/ |_| | __/\__ \\ < \n"+
|
||||
"|||| |_||_| ///// |_| |_| |_|\\___|____/ \\___||___/_|\\_\\ \n"+
|
||||
"|||| ///// \n"+
|
||||
"|||| /////\n"+
|
||||
"|||| /////\n"+
|
||||
"||||//////"
|
||||
'||\\\\\\ \n' +
|
||||
'|||| \\\\\\\\ \n' +
|
||||
'|||| \\\\\\\\ \n' +
|
||||
'|||| Am I a \\\\\\\\ \n' +
|
||||
'|||| cat? ^ ^ \\\\\\\\\\ _____ _ ____ _ \n' +
|
||||
'|||| (.-.) \\\\\\\\\\ |_ _| |__ ___| _ \\ ___ ___| | __\n' +
|
||||
"|||| ___> ) ||||| | | | '_ \\ / _ \\ | | |/ _ \\/ __| |/ /\n" +
|
||||
'|||| < _ _) ////// | | | | | | __/ |_| | __/__ \\ < \n' +
|
||||
'|||| |_||_| ///// |_| |_| |_|\\___|____/ \\___||___/_|\\_\\ \n' +
|
||||
'|||| ///// \n' +
|
||||
'|||| /////\n' +
|
||||
'|||| /////\n' +
|
||||
'||||//////'
|
||||
)
|
||||
console.log("Welcome!")
|
||||
console.log('Welcome!')
|
||||
}
|
||||
var info_path = join(app.getPath("userData"), "window-size.json");
|
||||
var max_info_path = join(app.getPath("userData"), "max-window-size.json");
|
||||
var lang_path = join(app.getPath("userData"), "language");
|
||||
var ha_path = join(app.getPath("userData"), "hardwareAcceleration");
|
||||
var info_path = join(app.getPath('userData'), 'window-size.json')
|
||||
var max_info_path = join(app.getPath('userData'), 'max-window-size.json')
|
||||
var lang_path = join(app.getPath('userData'), 'language')
|
||||
var ha_path = join(app.getPath('userData'), 'hardwareAcceleration')
|
||||
var ua_path = join(app.getPath('userData'), 'useragent')
|
||||
try {
|
||||
fs.readFileSync(ha_path, 'utf8');
|
||||
fs.readFileSync(ha_path, 'utf8')
|
||||
app.disableHardwareAcceleration()
|
||||
if(!packaged) console.log("disabled: Hardware Acceleration");
|
||||
} catch{
|
||||
if(!packaged) console.log("enabled: Hardware Acceleration");
|
||||
if (!packaged) console.log('disabled: Hardware Acceleration')
|
||||
} catch {
|
||||
if (!packaged) console.log('enabled: Hardware Acceleration')
|
||||
}
|
||||
var window_size;
|
||||
var window_size
|
||||
try {
|
||||
window_size = JSON.parse(fs.readFileSync(info_path, 'utf8'));
|
||||
window_size = JSON.parse(fs.readFileSync(info_path, 'utf8'))
|
||||
} catch (e) {
|
||||
window_size = {
|
||||
width: 1000,
|
||||
height: 750
|
||||
}; // デフォルトバリュー
|
||||
} // デフォルトバリュー
|
||||
}
|
||||
var max_window_size;
|
||||
var max_window_size
|
||||
try {
|
||||
max_window_size = JSON.parse(fs.readFileSync(max_info_path, 'utf8'));
|
||||
max_window_size = JSON.parse(fs.readFileSync(max_info_path, 'utf8'))
|
||||
} catch (e) {
|
||||
max_window_size = {
|
||||
width: "string",
|
||||
height: "string",
|
||||
x: "string",
|
||||
y: "string"
|
||||
|
||||
}; // デフォルトバリュー
|
||||
width: 'string',
|
||||
height: 'string',
|
||||
x: 'string',
|
||||
y: 'string'
|
||||
} // デフォルトバリュー
|
||||
}
|
||||
function isFile(file) {
|
||||
try {
|
||||
fs.statSync(file);
|
||||
fs.statSync(file)
|
||||
return true
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') return false
|
||||
}
|
||||
}
|
||||
// 全てのウィンドウが閉じたら終了
|
||||
app.on('window-all-closed', function () {
|
||||
if (process.platform != 'darwin') {
|
||||
electron.session.defaultSession.clearCache(() => { })
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
// macOSでウィンドウを閉じた後に再度開けるようにする
|
||||
app.on('activate', function () {
|
||||
if (mainWindow == null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
|
||||
app.on('window-all-closed', function() {
|
||||
electron.session.defaultSession.clearCache(() => {})
|
||||
app.quit()
|
||||
})
|
||||
function createWindow() {
|
||||
if (isFile(lang_path)) {
|
||||
var lang = fs.readFileSync(lang_path, 'utf8');
|
||||
var lang = fs.readFileSync(lang_path, 'utf8')
|
||||
} else {
|
||||
var langs = app.getLocale();
|
||||
console.log(langs);
|
||||
if (~langs.indexOf("ja")) {
|
||||
lang = "ja";
|
||||
} else if (~langs.indexOf("de")) {
|
||||
lang = "de";
|
||||
} else if (~langs.indexOf("cs")) {
|
||||
lang = "cs";
|
||||
} else if (~langs.indexOf("bg")) {
|
||||
lang = "bg";
|
||||
var langs = app.getLocale()
|
||||
console.log(langs)
|
||||
if (~langs.indexOf('ja')) {
|
||||
lang = 'ja'
|
||||
} else if (~langs.indexOf('de')) {
|
||||
lang = 'de'
|
||||
} else if (~langs.indexOf('cs')) {
|
||||
lang = 'cs'
|
||||
} else if (~langs.indexOf('bg')) {
|
||||
lang = 'bg'
|
||||
} else {
|
||||
lang = "en";
|
||||
lang = 'en'
|
||||
}
|
||||
fs.mkdir(app.getPath("userData"), function (err) {
|
||||
fs.writeFileSync(lang_path, lang);
|
||||
});
|
||||
fs.mkdir(app.getPath('userData'), function(err) {
|
||||
fs.writeFileSync(lang_path, lang)
|
||||
})
|
||||
}
|
||||
if(!packaged) console.log("your lang:" + app.getLocale());
|
||||
if(!packaged) console.log("launch:" + lang);
|
||||
if (!packaged) console.log('your lang:' + app.getLocale())
|
||||
if (!packaged) console.log('launch:' + lang)
|
||||
// メイン画面の表示。ウィンドウの幅、高さを指定できる
|
||||
var platform = process.platform;
|
||||
var bit = process.arch;
|
||||
if (platform == "linux") {
|
||||
var platform = process.platform
|
||||
var bit = process.arch
|
||||
if (platform == 'linux') {
|
||||
var arg = {
|
||||
webPreferences: {
|
||||
webviewTag: true,
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
preload: join(__dirname, "js", "platform", "preload.js")
|
||||
preload: join(__dirname, 'js', 'platform', 'preload.js')
|
||||
},
|
||||
width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, icon: __dirname + '/desk.png', show: false
|
||||
width: window_size.width,
|
||||
height: window_size.height,
|
||||
x: window_size.x,
|
||||
y: window_size.y,
|
||||
icon: __dirname + '/desk.png',
|
||||
show: false
|
||||
}
|
||||
} else if (platform == "win32") {
|
||||
} else if (platform == 'win32') {
|
||||
var arg = {
|
||||
webPreferences: {
|
||||
webviewTag: true,
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
preload: join(__dirname, "js", "platform", "preload.js")
|
||||
preload: join(__dirname, 'js', 'platform', 'preload.js')
|
||||
},
|
||||
width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true, show: false
|
||||
width: window_size.width,
|
||||
height: window_size.height,
|
||||
x: window_size.x,
|
||||
y: window_size.y,
|
||||
simpleFullscreen: true,
|
||||
show: false
|
||||
}
|
||||
} else if (platform == "darwin") {
|
||||
} else if (platform == 'darwin') {
|
||||
var arg = {
|
||||
webPreferences: {
|
||||
webviewTag: true,
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
preload: join(__dirname, "js", "platform", "preload.js")
|
||||
preload: join(__dirname, 'js', 'platform', 'preload.js')
|
||||
},
|
||||
width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true, show: false
|
||||
width: window_size.width,
|
||||
height: window_size.height,
|
||||
x: window_size.x,
|
||||
y: window_size.y,
|
||||
simpleFullscreen: true,
|
||||
show: false
|
||||
}
|
||||
}
|
||||
mainWindow = new BrowserWindow(arg);
|
||||
mainWindow = new BrowserWindow(arg)
|
||||
mainWindow.once('page-title-updated', () => {
|
||||
mainWindow.show()
|
||||
if (window_size.max) {
|
||||
mainWindow.maximize();
|
||||
mainWindow.maximize()
|
||||
}
|
||||
})
|
||||
electron.session.defaultSession.clearCache(() => { })
|
||||
})
|
||||
if (!packaged) mainWindow.toggleDevTools()
|
||||
electron.session.defaultSession.clearCache(() => {})
|
||||
if (process.argv) {
|
||||
if (process.argv[1]) {
|
||||
var m = process.argv[1].match(/([a-zA-Z0-9]+)\/\?[a-zA-Z-0-9]+=(.+)/);
|
||||
var m = process.argv[1].match(/([a-zA-Z0-9]+)\/\?[a-zA-Z-0-9]+=(.+)/)
|
||||
if (m) {
|
||||
var mode = m[1];
|
||||
var code = m[2];
|
||||
var plus = '?mode=' + mode + '&code=' + code;
|
||||
var mode = m[1]
|
||||
var code = m[2]
|
||||
var plus = '?mode=' + mode + '&code=' + code
|
||||
} else {
|
||||
var plus = "";
|
||||
var plus = ''
|
||||
}
|
||||
} else {
|
||||
var plus = "";
|
||||
var plus = ''
|
||||
}
|
||||
} else {
|
||||
var plus = "";
|
||||
var plus = ''
|
||||
}
|
||||
mainWindow.loadURL(base + lang + '/index.html' + plus);
|
||||
var ua
|
||||
try {
|
||||
ua = fs.readFileSync(ua_path, 'utf8')
|
||||
} catch (e) {
|
||||
//default UA Example:
|
||||
// Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) thedesk/18.11.3 Chrome/76.0.3809.146 Electron/6.0.12 Safari/537.36
|
||||
const crypto = require('crypto')
|
||||
const N = 100
|
||||
var ua =
|
||||
'Mastodon client: ' +
|
||||
crypto
|
||||
.randomBytes(N)
|
||||
.toString('base64')
|
||||
.substring(0, N)
|
||||
}
|
||||
mainWindow.loadURL(base + lang + '/index.html' + plus, { userAgent: ua })
|
||||
if (!window_size.x && !window_size.y) {
|
||||
mainWindow.center();
|
||||
mainWindow.center()
|
||||
}
|
||||
// ウィンドウが閉じられたらアプリも終了
|
||||
mainWindow.on('closed', function () {
|
||||
electron.ipcMain.removeAllListeners();
|
||||
mainWindow = null;
|
||||
});
|
||||
mainWindow.on('close', function () {
|
||||
mainWindow.on('closed', function() {
|
||||
electron.ipcMain.removeAllListeners()
|
||||
mainWindow = null
|
||||
})
|
||||
closeArg = false
|
||||
mainWindow.on('close', function(e, arg) {
|
||||
writePos(mainWindow)
|
||||
if (!closeArg) {
|
||||
e.preventDefault()
|
||||
}
|
||||
const promise = new Promise(function(resolve) {
|
||||
mainWindow.webContents.send('asReadEnd', '')
|
||||
setTimeout(function() {
|
||||
resolve()
|
||||
}, 3000)
|
||||
})
|
||||
promise.then(function(response) {
|
||||
closeArg = true
|
||||
mainWindow.close()
|
||||
})
|
||||
})
|
||||
electron.ipcMain.on('sendMarkersComplete', function(e, arg) {
|
||||
closeArg = true
|
||||
mainWindow.close()
|
||||
})
|
||||
function writePos(mainWindow) {
|
||||
if (
|
||||
max_window_size.width == mainWindow.getBounds().width &&
|
||||
max_window_size.height == mainWindow.getBounds().height &&
|
||||
max_window_size.x == mainWindow.getBounds().x &&
|
||||
max_window_size.y == mainWindow.getBounds().y
|
||||
) {
|
||||
var size = { width: mainWindow.getBounds().width, height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, y: mainWindow.getBounds().y, max: true }
|
||||
var size = {
|
||||
width: mainWindow.getBounds().width,
|
||||
height: mainWindow.getBounds().height,
|
||||
x: mainWindow.getBounds().x,
|
||||
y: mainWindow.getBounds().y,
|
||||
max: true
|
||||
}
|
||||
} else {
|
||||
var size = { width: mainWindow.getBounds().width, height: mainWindow.getBounds().height, x: mainWindow.getBounds().x, y: mainWindow.getBounds().y }
|
||||
var size = {
|
||||
width: mainWindow.getBounds().width,
|
||||
height: mainWindow.getBounds().height,
|
||||
x: mainWindow.getBounds().x,
|
||||
y: mainWindow.getBounds().y
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(info_path, JSON.stringify(size));
|
||||
});
|
||||
mainWindow.on('maximize', function () {
|
||||
fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds()));
|
||||
});
|
||||
fs.writeFileSync(info_path, JSON.stringify(size))
|
||||
}
|
||||
mainWindow.on('maximize', function() {
|
||||
writePos(mainWindow)
|
||||
fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds()))
|
||||
})
|
||||
mainWindow.on('minimize', function() {
|
||||
writePos(mainWindow)
|
||||
mainWindow.webContents.send('asRead', '')
|
||||
})
|
||||
|
||||
var platform = process.platform;
|
||||
var bit = process.arch;
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(language.template(lang, mainWindow, packaged, dir)));
|
||||
var platform = process.platform
|
||||
var bit = process.arch
|
||||
Menu.setApplicationMenu(
|
||||
Menu.buildFromTemplate(language.template(lang, mainWindow, packaged, dir, dirname))
|
||||
)
|
||||
//CSS
|
||||
css.css(mainWindow);
|
||||
css.css(mainWindow)
|
||||
//アップデータとダウンロード
|
||||
dl.dl(mainWindow, lang_path, base, dirname);
|
||||
dl.dl(mainWindow, lang_path, base, dirname)
|
||||
//画像選択と画像処理
|
||||
img.img(mainWindow, dir);
|
||||
img.img(mainWindow, dir)
|
||||
//NowPlaying
|
||||
np.TheDeskNowPlaying(mainWindow);
|
||||
np.TheDeskNowPlaying(mainWindow)
|
||||
//その他system
|
||||
systemFunc.system(mainWindow, dir, lang, dirname);
|
||||
systemFunc.system(mainWindow, dir, lang, dirname)
|
||||
setInterval(function() {
|
||||
mouseTrack(mainWindow)
|
||||
}, 1000)
|
||||
}
|
||||
var x = 0
|
||||
var y = 0
|
||||
var unchanged = 0
|
||||
var locked = false
|
||||
function mouseTrack(mainWindow) {
|
||||
let mousePos = electron.screen.getCursorScreenPoint()
|
||||
let xNow = mousePos.x
|
||||
let yNow = mousePos.x
|
||||
if (x != xNow || y != yNow) {
|
||||
unchanged = 0
|
||||
locked = false
|
||||
} else {
|
||||
unchanged++
|
||||
if (unchanged > 60 && !locked) {
|
||||
unchanged = 0
|
||||
locked = true
|
||||
mainWindow.webContents.send('asRead', '')
|
||||
}
|
||||
}
|
||||
x = xNow
|
||||
y = yNow
|
||||
}
|
||||
// Electronの初期化完了後に実行
|
||||
app.on('ready', createWindow);
|
||||
var onError = function (err, response) {
|
||||
console.error(err, response);
|
||||
};
|
||||
app.on('ready', createWindow)
|
||||
var onError = function(err, response) {
|
||||
console.error(err, response)
|
||||
}
|
||||
|
||||
app.setAsDefaultProtocolClient('thedesk')
|
||||
|
||||
@@ -23,7 +23,7 @@ function css(mainWindow) {
|
||||
ipc.on('theme-json-create', function (e, arg) {
|
||||
var themecss = join(app.getPath("userData"), JSON5.parse(arg)["id"] +
|
||||
".thedesktheme");
|
||||
fs.writeFileSync(themecss, JSON.stringify(JSON5.parse(arg)));
|
||||
fs.writeFileSync(themecss, JSON5.stringify(JSON5.parse(arg)));
|
||||
if (JSON5.parse(arg)["id"]) {
|
||||
e.sender.webContents.send('theme-json-create-complete', "");
|
||||
} else {
|
||||
@@ -39,13 +39,14 @@ function css(mainWindow) {
|
||||
})
|
||||
ipc.on('theme-json-request', function (e, arg) {
|
||||
var themecss = join(app.getPath("userData"), arg + ".thedesktheme");
|
||||
var json = JSON.parse(fs.readFileSync(themecss, 'utf8'));
|
||||
e.sender.webContents.send('theme-json-response', json);
|
||||
var raw = fs.readFileSync(themecss, 'utf8')
|
||||
var json = JSON5.parse(raw);
|
||||
e.sender.webContents.send('theme-json-response', [json, raw]);
|
||||
})
|
||||
ipc.on('theme-css-request', function (e, arg) {
|
||||
var themecss = join(app.getPath("userData"), arg + ".thedesktheme");
|
||||
try {
|
||||
var json = JSON.parse(fs.readFileSync(themecss, 'utf8'));
|
||||
var json = JSON5.parse(fs.readFileSync(themecss, 'utf8'));
|
||||
|
||||
var primary = json.vars.primary;
|
||||
var secondary = json.vars.secondary;
|
||||
@@ -67,21 +68,52 @@ function css(mainWindow) {
|
||||
if (json.props.TheDeskAccent) {
|
||||
var emphasized = json.props.TheDeskAccent
|
||||
} else {
|
||||
var emphasized = secondary;
|
||||
var emphasized = secondary
|
||||
}
|
||||
if (json.props.TheDeskActive) {
|
||||
var active = json.props.TheDeskActive
|
||||
} else {
|
||||
var active = primary
|
||||
}
|
||||
if (json.props.TheDeskModal) {
|
||||
var modal = json.props.TheDeskModal
|
||||
} else {
|
||||
var modal = secondary
|
||||
}
|
||||
if (json.props.TheDeskBottom) {
|
||||
var bottom = json.props.TheDeskBottom
|
||||
} else {
|
||||
var bottom = primary
|
||||
}
|
||||
if (json.props.TheDeskPostbox) {
|
||||
var postbox = json.props.TheDeskPostbox
|
||||
} else {
|
||||
var postbox = primary
|
||||
}
|
||||
if (json.props.TheDeskSubcolor) {
|
||||
var subcolor = json.props.TheDeskSubcolor
|
||||
} else {
|
||||
var subcolor = primary
|
||||
}
|
||||
} else {
|
||||
var emphasized = primary;
|
||||
var emphasized = primary
|
||||
var acs = secondary
|
||||
var active = primary
|
||||
var modal = secondary
|
||||
var bottom = primary
|
||||
var postbox = primary
|
||||
var subcolor = primary
|
||||
}
|
||||
|
||||
var css = ".customtheme {--bg:" + secondary + ";--drag:" + drag + ";" +
|
||||
"--color:" + text + ";--beforehover:" + beforehover + ";--modal:" +
|
||||
secondary + ";--subcolor:" + primary + ";--box:" + primary +
|
||||
";--sidebar:" + primary + ";--shared:" + emphasized + ";" +
|
||||
"--notfbox:" + secondary + ";--emphasized:" + primary + ";--his-data:" +
|
||||
modal + ";--subcolor:" + subcolor + ";--box:" + subcolor +
|
||||
";--sidebar:" + bottom + ";--shared:" + emphasized + ";" +
|
||||
"--notfbox:" + secondary + ";--emphasized:" + active + ";--his-data:" +
|
||||
secondary +
|
||||
";--active:" + primary + ";--postbox:" + primary + ";--modalfooter:" +
|
||||
";--active:" + active + ";--postbox:" + postbox + ";--modalfooter:" +
|
||||
primary +
|
||||
";--accentbtn:" + primary + ";--selected:" + selected + ";--selectedWithShare:" + selectedWithShare + "}"+
|
||||
";--accentbtn:" + subcolor + ";--selected:" + selected + ";--selectedWithShare:" + selectedWithShare + "}"+
|
||||
"--gray:" + gray + ";"+
|
||||
".customtheme #imagemodal{background: url(\"../img/pixel.svg\");}";
|
||||
e.sender.webContents.send('theme-css-response', css);
|
||||
@@ -92,15 +124,19 @@ function css(mainWindow) {
|
||||
})
|
||||
ipc.on('theme-json-list', function (e, arg) {
|
||||
fs.readdir(app.getPath("userData"), function (err, files) {
|
||||
if (err) throw err;
|
||||
if (err || !files) throw err;
|
||||
var fileList = files.filter(function (file) {
|
||||
var tfile = join(app.getPath("userData"), file);
|
||||
return fs.statSync(tfile).isFile() && /.*\.thedesktheme$/.test(tfile); //絞り込み
|
||||
if(file.match(/\.thedesktheme$/)){
|
||||
var tfile = join(app.getPath("userData"), file)
|
||||
return fs.statSync(tfile).isFile() && /.*\.thedesktheme$/.test(tfile)
|
||||
}else{
|
||||
return null
|
||||
}
|
||||
})
|
||||
var themes = [];
|
||||
for (var i = 0; i < fileList.length; i++) {
|
||||
var themecss = join(app.getPath("userData"), fileList[i]);
|
||||
var json = JSON.parse(fs.readFileSync(themecss, 'utf8'));
|
||||
var json = JSON5.parse(fs.readFileSync(themecss, 'utf8'));
|
||||
themes.push({
|
||||
name: json.name,
|
||||
id: json.id
|
||||
|
||||
@@ -26,11 +26,9 @@ function dl(mainWindow, lang_path, base, dirname) {
|
||||
"transparent": false, // ウィンドウの背景を透過
|
||||
"frame": false, // 枠の無いウィンドウ
|
||||
"resizable": false
|
||||
});
|
||||
//updatewin.openDevTools()
|
||||
})
|
||||
var lang = fs.readFileSync(lang_path, 'utf8');
|
||||
updatewin.loadURL(base + lang + '/update.html');
|
||||
|
||||
return "true"
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// Create the Application's main menu
|
||||
function templete(lang, mainWindow, packaged, dir) {
|
||||
function templete(lang, mainWindow, packaged, dir, dirname) {
|
||||
if(lang !="ja" && lang != "en"){
|
||||
lang = "en"
|
||||
}
|
||||
const electron = require("electron");
|
||||
const app = electron.app;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const join = require('path').join;
|
||||
const dict = {
|
||||
"application": {
|
||||
"ja": "アプリケーション",
|
||||
@@ -101,9 +102,9 @@ function templete(lang, mainWindow, packaged, dir) {
|
||||
webviewTag: false,
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
preload: "../js/platform/preload.js"
|
||||
preload: join(dirname , "js", "platform", "preload.js")
|
||||
},
|
||||
width: 300, height: 460,
|
||||
width: 300, height: 500,
|
||||
"transparent": false, // ウィンドウの背景を透過
|
||||
"frame": false, // 枠の無いウィンドウ
|
||||
"resizable": false
|
||||
|
||||
@@ -15,7 +15,11 @@ function np(mainWindow) {
|
||||
if (platform == "darwin") {
|
||||
try {
|
||||
const nowplaying = require("itunes-nowplaying-mac");
|
||||
const value = await nowplaying.getRawData();
|
||||
let value = await nowplaying();
|
||||
|
||||
const artwork = await nowplaying.getThumbnailBuffer(value.databaseID);
|
||||
const base64 = artwork.toString('base64');
|
||||
value.artwork = base64
|
||||
e.sender.webContents.send('itunes-np', value);
|
||||
} catch (error) {
|
||||
// エラーを返す
|
||||
|
||||
@@ -1,148 +1,158 @@
|
||||
function system(mainWindow, dir, lang, dirname) {
|
||||
const electron = require("electron");
|
||||
const app = electron.app;
|
||||
const join = require('path').join;
|
||||
const join = require("path").join;
|
||||
var Jimp = require("jimp");
|
||||
const fs = require("fs");
|
||||
var JSON5 = require("json5");
|
||||
var ipc = electron.ipcMain;
|
||||
const clipboard = electron.clipboard;
|
||||
var tmp_img = join(app.getPath("userData"), "tmp.png");
|
||||
var ha_path = join(app.getPath("userData"), "hardwareAcceleration");
|
||||
var ua_path = join(app.getPath("userData"), "useragent");
|
||||
var lang_path = join(app.getPath("userData"), "language");
|
||||
var log_dir_path = join(app.getPath("userData"), "logs");
|
||||
//ログ
|
||||
var today = new Date();
|
||||
//今日のやつ
|
||||
var todayStr = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log";
|
||||
//昨日のやつ
|
||||
today.setDate(today.getDate() - 1);
|
||||
var yestStr = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log";
|
||||
//一昨日のやつ
|
||||
today.setDate(today.getDate() - 1);
|
||||
var yest2Str = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate() + ".log";
|
||||
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const dialog = electron.dialog;
|
||||
const os = require('os')
|
||||
const os = require("os");
|
||||
const language = require("../main/language.js");
|
||||
ipc.on('native-notf', function (e, args) {
|
||||
|
||||
var platform = process.platform;
|
||||
var bit = process.arch;
|
||||
if (platform == "win32") {
|
||||
const notifier = require('node-notifier')
|
||||
var tmp_imge = tmp_img;
|
||||
Jimp.read(args[2], function (err, lenna) {
|
||||
if (!err && lenna) {
|
||||
lenna.write(tmp_img);
|
||||
var tmp_imge = tmp_img;
|
||||
} else {
|
||||
var tmp_imge = "";
|
||||
}
|
||||
notifier.notify({
|
||||
appID: "top.thedesk",
|
||||
message: args[1],
|
||||
title: args[0],
|
||||
icon: tmp_imge,
|
||||
sound: false,
|
||||
wait: true,
|
||||
},
|
||||
function (err, response) {
|
||||
console.log(err, response)
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
//プラットフォーム
|
||||
ipc.on('getPlatform', function (e, arg) {
|
||||
e.sender.webContents.send('platform', [process.platform, process.arch, process.version, process.versions.chrome, process.versions.electron]);
|
||||
})
|
||||
ipc.on("getPlatform", function(e, arg) {
|
||||
try {
|
||||
var gitHash = fs.readFileSync("git", "utf8");
|
||||
} catch {
|
||||
var gitHash = null;
|
||||
}
|
||||
e.sender.webContents.send("platform", [process.platform, process.arch, process.version, process.versions.chrome, process.versions.electron, gitHash]);
|
||||
});
|
||||
//言語
|
||||
ipc.on('lang', function (e, arg) {
|
||||
|
||||
ipc.on("lang", function(e, arg) {
|
||||
console.log("set:" + arg);
|
||||
fs.writeFileSync(lang_path, arg);
|
||||
e.sender.webContents.send('langres', arg);
|
||||
})
|
||||
e.sender.webContents.send("langres", arg);
|
||||
});
|
||||
//エクスポートのダイアログ
|
||||
ipc.on('exportSettings', function (e, args) {
|
||||
dialog.showSaveDialog(null, {
|
||||
title: 'Export',
|
||||
properties: ['openFile', 'createDirectory'],
|
||||
defaultPath: "export.thedeskconfigv2"
|
||||
}, (savedFiles) => {
|
||||
if (!savedFiles) {
|
||||
return false;
|
||||
ipc.on("exportSettings", function(e, args) {
|
||||
dialog.showSaveDialog(
|
||||
null,
|
||||
{
|
||||
title: "Export",
|
||||
properties: ["openFile", "createDirectory"],
|
||||
defaultPath: "export.thedeskconfig.json5"
|
||||
},
|
||||
savedFiles => {
|
||||
if (!savedFiles) {
|
||||
return false;
|
||||
}
|
||||
e.sender.webContents.send("exportSettingsFile", savedFiles);
|
||||
}
|
||||
e.sender.webContents.send('exportSettingsFile', savedFiles);
|
||||
})
|
||||
})
|
||||
);
|
||||
});
|
||||
//インポートのダイアログ
|
||||
ipc.on('importSettings', function (e, args) {
|
||||
dialog.showOpenDialog(null, {
|
||||
title: 'Import',
|
||||
properties: ['openFile'],
|
||||
filters: [
|
||||
{ name: 'TheDesk Config', extensions: ['thedeskconfig', 'thedeskconfigv2'] },
|
||||
]
|
||||
}, (fileNames) => {
|
||||
if (!fileNames) {
|
||||
return false;
|
||||
ipc.on("importSettings", function(e, args) {
|
||||
dialog.showOpenDialog(
|
||||
null,
|
||||
{
|
||||
title: "Import",
|
||||
properties: ["openFile"],
|
||||
filters: [{ name: "TheDesk Config", extensions: ["thedeskconfig", "thedeskconfigv2", "json5"] }]
|
||||
},
|
||||
fileNames => {
|
||||
if (!fileNames) {
|
||||
return false;
|
||||
}
|
||||
e.sender.webContents.send("config", JSON5.parse(fs.readFileSync(fileNames[0], "utf8")));
|
||||
}
|
||||
e.sender.webContents.send('config', fs.readFileSync(arg, 'utf8'));
|
||||
})
|
||||
})
|
||||
);
|
||||
});
|
||||
//保存フォルダのダイアログ
|
||||
ipc.on('savefolder', function (e, args) {
|
||||
dialog.showOpenDialog(null, {
|
||||
title: 'Save folder',
|
||||
properties: ['openDirectory'],
|
||||
}, (fileNames) => {
|
||||
e.sender.webContents.send('savefolder', fileNames[0]);
|
||||
});
|
||||
})
|
||||
ipc.on("savefolder", function(e, args) {
|
||||
dialog.showOpenDialog(
|
||||
null,
|
||||
{
|
||||
title: "Save folder",
|
||||
properties: ["openDirectory"]
|
||||
},
|
||||
fileNames => {
|
||||
e.sender.webContents.send("savefolder", fileNames[0]);
|
||||
}
|
||||
);
|
||||
});
|
||||
//カスタムサウンドのダイアログ
|
||||
ipc.on('customSound', function (e, arg) {
|
||||
dialog.showOpenDialog(null, {
|
||||
title: 'Custom sound',
|
||||
properties: ['openFile'],
|
||||
filters: [
|
||||
{ name: 'Audio', extensions: ['mp3', 'aac', 'wav', 'flac', 'm4a'] },
|
||||
{ name: 'All', extensions: ['*'] },
|
||||
]
|
||||
}, (fileNames) => {
|
||||
e.sender.webContents.send('customSoundRender', [arg, fileNames[0]]);
|
||||
});
|
||||
})
|
||||
ipc.on("customSound", function(e, arg) {
|
||||
dialog.showOpenDialog(
|
||||
null,
|
||||
{
|
||||
title: "Custom sound",
|
||||
properties: ["openFile"],
|
||||
filters: [{ name: "Audio", extensions: ["mp3", "aac", "wav", "flac", "m4a"] }, { name: "All", extensions: ["*"] }]
|
||||
},
|
||||
fileNames => {
|
||||
e.sender.webContents.send("customSoundRender", [arg, fileNames[0]]);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
//ハードウェアアクセラレーションの無効化
|
||||
ipc.on('ha', function (e, arg) {
|
||||
|
||||
ipc.on("ha", function(e, arg) {
|
||||
if (arg == "true") {
|
||||
fs.writeFileSync(ha_path, arg);
|
||||
} else {
|
||||
fs.unlink(ha_path, function (err) { });
|
||||
fs.unlink(ha_path, function(err) {});
|
||||
}
|
||||
app.relaunch()
|
||||
app.exit()
|
||||
})
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
ipc.on("ua", function(e, arg) {
|
||||
if (arg == "") {
|
||||
fs.unlink(ua_path, function(err) {});
|
||||
} else {
|
||||
fs.writeFileSync(ua_path, arg);
|
||||
}
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
});
|
||||
|
||||
ipc.on('quit', (e, args) => {
|
||||
ipc.on("quit", (e, args) => {
|
||||
app.quit();
|
||||
});
|
||||
ipc.on('about', (e, args) => {
|
||||
ipc.on("about", (e, args) => {
|
||||
about();
|
||||
});
|
||||
function about() {
|
||||
var ver = app.getVersion()
|
||||
var ver = app.getVersion();
|
||||
var window = new BrowserWindow({
|
||||
webPreferences: {
|
||||
webviewTag: false,
|
||||
nodeIntegration: false
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
preload: join(dirname, "js", "platform", "preload.js")
|
||||
},
|
||||
width: 300,
|
||||
height: 480,
|
||||
"transparent": false, // ウィンドウの背景を透過
|
||||
"frame": false, // 枠の無いウィンドウ
|
||||
"resizable": false
|
||||
height: 500,
|
||||
transparent: false, // ウィンドウの背景を透過
|
||||
frame: false, // 枠の無いウィンドウ
|
||||
resizable: false
|
||||
});
|
||||
window.loadURL(dir + '/about.html?ver=' + ver);
|
||||
return "true"
|
||||
window.loadURL(dir + "/about.html?ver=" + ver);
|
||||
return "true";
|
||||
}
|
||||
ipc.on('nano', function (e, x, y) {
|
||||
|
||||
var nano_info_path = join(app.getPath("userData"),
|
||||
"nano-window-position.json");
|
||||
ipc.on("nano", function(e, x, y) {
|
||||
var nano_info_path = join(app.getPath("userData"), "nano-window-position.json");
|
||||
var window_pos;
|
||||
try {
|
||||
window_pos = JSON.parse(fs.readFileSync(nano_info_path, 'utf8'));
|
||||
window_pos = JSON.parse(fs.readFileSync(nano_info_path, "utf8"));
|
||||
} catch (e) {
|
||||
window_pos = [0, 0]; // デフォルトバリュー
|
||||
}
|
||||
@@ -151,43 +161,43 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
webviewTag: false,
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
preload: join(dirname,"js", "platform", "preload.js")
|
||||
preload: join(dirname, "js", "platform", "preload.js")
|
||||
},
|
||||
width: 350,
|
||||
height: 200,
|
||||
"transparent": false, // ウィンドウの背景を透過
|
||||
"frame": false, // 枠の無いウィンドウ
|
||||
"resizable": false
|
||||
height: 140,
|
||||
transparent: false, // ウィンドウの背景を透過
|
||||
frame: false, // 枠の無いウィンドウ
|
||||
resizable: false
|
||||
});
|
||||
nanowindow.loadURL(dir + '/nano.html');
|
||||
nanowindow.loadURL(dir + "/nano.html");
|
||||
nanowindow.setAlwaysOnTop(true);
|
||||
|
||||
//nanowindow.toggleDevTools()
|
||||
nanowindow.setPosition(window_pos[0], window_pos[1]);
|
||||
nanowindow.on('close', function () {
|
||||
nanowindow.on("close", function() {
|
||||
fs.writeFileSync(nano_info_path, JSON.stringify(nanowindow.getPosition()));
|
||||
});
|
||||
return true;
|
||||
})
|
||||
});
|
||||
var cbTimer1;
|
||||
ipc.on('startmem', (e, arg) => {
|
||||
event = e.sender
|
||||
ipc.on("startmem", (e, arg) => {
|
||||
event = e.sender;
|
||||
cbTimer1 = setInterval(mems, 1000);
|
||||
});
|
||||
function mems() {
|
||||
var mem = os.totalmem() - os.freemem();
|
||||
if (mainWindow) {
|
||||
event.webContents.send('memory', [mem, os.cpus()[0].model, os.totalmem()]);
|
||||
event.webContents.send("memory", [mem, os.cpus()[0].model, os.totalmem()]);
|
||||
}
|
||||
}
|
||||
ipc.on('endmem', (e, arg) => {
|
||||
ipc.on("endmem", (e, arg) => {
|
||||
if (cbTimer1) {
|
||||
clearInterval(cbTimer1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ipc.on('export', (e, args) => {
|
||||
fs.writeFileSync(args[0], args[1]);
|
||||
ipc.on("export", (e, args) => {
|
||||
fs.writeFileSync(args[0], JSON5.stringify(args[1]));
|
||||
e.sender.webContents.send("exportAllComplete", "");
|
||||
});
|
||||
//フォント
|
||||
function object_array_sort(data, key, order, fn) {
|
||||
@@ -195,12 +205,13 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
var num_a = -1;
|
||||
var num_b = 1;
|
||||
|
||||
if (order === 'asc') { //指定があれば昇順(ASC)
|
||||
if (order === "asc") {
|
||||
//指定があれば昇順(ASC)
|
||||
num_a = 1;
|
||||
num_b = -1;
|
||||
}
|
||||
|
||||
data = data.sort(function (a, b) {
|
||||
data = data.sort(function(a, b) {
|
||||
var x = a[key];
|
||||
var y = b[key];
|
||||
if (x > y) return num_a;
|
||||
@@ -211,7 +222,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
//重複排除
|
||||
var arrObj = {};
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
arrObj[data[i]['family']] = data[i];
|
||||
arrObj[data[i]["family"]] = data[i];
|
||||
}
|
||||
|
||||
data = [];
|
||||
@@ -221,12 +232,69 @@ function system(mainWindow, dir, lang, dirname) {
|
||||
|
||||
fn(data); // ソート後の配列を返す
|
||||
}
|
||||
ipc.on('fonts', (e, arg) => {
|
||||
const fm = require('font-manager');
|
||||
ipc.on("fonts", (e, arg) => {
|
||||
const fm = require("font-manager");
|
||||
var fonts = fm.getAvailableFontsSync();
|
||||
object_array_sort(fonts, 'family', 'asc', function (fonts_sorted) {
|
||||
e.sender.webContents.send('font-list', fonts_sorted);
|
||||
object_array_sort(fonts, "family", "asc", function(fonts_sorted) {
|
||||
e.sender.webContents.send("font-list", fonts_sorted);
|
||||
});
|
||||
});
|
||||
//コピー
|
||||
ipc.on("copy", (e, arg) => {
|
||||
clipboard.writeText(arg);
|
||||
});
|
||||
//ログ
|
||||
ipc.on("log", (e, arg) => {
|
||||
var today = new Date();
|
||||
var todayStr = today.getFullYear() + "" + (today.getMonth() + 1) + "" + today.getDate();
|
||||
var log_path = join(log_dir_path, todayStr + ".log");
|
||||
fs.appendFile(log_path, "\n" + arg, function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
});
|
||||
ipc.on("getLogs", (e, arg) => {
|
||||
var logs=""
|
||||
var todayLog=""
|
||||
var yestLog=""
|
||||
var yest2Log=""
|
||||
fs.readdir(log_dir_path, function(err, files) {
|
||||
if (err) throw err;
|
||||
files.filter(function(file) {
|
||||
if (file == todayStr) {
|
||||
todayLog=fs.readFileSync(join(log_dir_path, file), "utf8")
|
||||
}
|
||||
if (file == yestStr) {
|
||||
yestLog=logs+fs.readFileSync(join(log_dir_path, file), "utf8")
|
||||
}
|
||||
if (file == yest2Str) {
|
||||
yest2Log=fs.readFileSync(join(log_dir_path, file), "utf8")
|
||||
}
|
||||
logs = todayLog + yestLog + yest2Log;
|
||||
});
|
||||
logs = yest2Log + yestLog + todayLog;
|
||||
e.sender.webContents.send("logData", logs);
|
||||
});
|
||||
});
|
||||
//起動時ログディレクトリ存在確認と作成、古ログ削除
|
||||
fs.access(log_dir_path, fs.constants.R_OK | fs.constants.W_OK, error => {
|
||||
if (error) {
|
||||
if (error.code === "ENOENT") {
|
||||
fs.mkdirSync(log_dir_path);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
fs.readdir(log_dir_path, function(err, files) {
|
||||
if (err) throw err;
|
||||
files.filter(function(file) {
|
||||
if (file != todayStr && file != yestStr && file != yest2Str) {
|
||||
fs.unlinkSync(join(log_dir_path, file));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.system = system;
|
||||
exports.system = system;
|
||||
|
||||
377
app/nano.html
377
app/nano.html
@@ -1,240 +1,155 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link href="./css/themes.css" type="text/css" rel="stylesheet">
|
||||
<link href="./css/tl.css" type="text/css" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<title>TheDesk Nano</title>
|
||||
<style>
|
||||
html {
|
||||
-webkit-app-region: drag !important;
|
||||
cursor: move !important;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#timeline_nano {
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
-webkit-app-region: no-drag;
|
||||
max-height: 100px;
|
||||
}
|
||||
|
||||
.user {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
select {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
button {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
textarea {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.area-actions {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.area-date_via {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.area-side {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
::-webkit-scrollbar-thumb {
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.blacktheme body {
|
||||
color: white;
|
||||
background-color: #212121;
|
||||
}
|
||||
|
||||
.blacktheme button {
|
||||
background-color: black;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.blacktheme textarea,
|
||||
.blacktheme select {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.blacktheme select,
|
||||
.blacktheme option {
|
||||
background-color: black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script type="text/javascript" src="./node_modules/jquery/dist/jquery.js"></script>
|
||||
<script>
|
||||
$.strip_tags = function (str, allowed) {
|
||||
if (!str) {
|
||||
return "";
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link href="./css/themes.css" type="text/css" rel="stylesheet" />
|
||||
<link href="./css/tl.css" type="text/css" rel="stylesheet" />
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
||||
<link href="./node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" rel="stylesheet">
|
||||
<title>TheDesk Nano</title>
|
||||
<style>
|
||||
html {
|
||||
-webkit-app-region: drag !important;
|
||||
cursor: move !important;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
font-family: sans-serif;
|
||||
color: var(--color) !important;
|
||||
}
|
||||
allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || [])
|
||||
.join('');
|
||||
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
|
||||
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
|
||||
return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
|
||||
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
|
||||
});
|
||||
};
|
||||
function escapeHTML(str) {
|
||||
if (!str) {
|
||||
return "";
|
||||
}
|
||||
return str.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="./js/platform/first-not-view.js"></script>
|
||||
<select id="post-acct-sel" style="max-width:150px">
|
||||
</select>
|
||||
<select id="type-sel" style="max-width:60px">
|
||||
<option value="local">Local</option>
|
||||
<option value="home">Home</option>
|
||||
</select><button onclick="tl()">Show</button><button onclick="window.close()">x</button><br>
|
||||
<div id="timeline_nano">
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<textarea id="textarea" style="width:80%; background-color:transparent"></textarea>
|
||||
<button class="btn" onclick="post()">Post</button>
|
||||
<script>
|
||||
if (localStorage.getItem("lang")) {
|
||||
var lang = localStorage.getItem("lang");
|
||||
} else {
|
||||
var lang = "ja";
|
||||
}
|
||||
</script>
|
||||
<script src="https://twemoji.maxcdn.com/2/twemoji.min.js?2.7"></script>
|
||||
<script type="text/javascript" src="./js/post/post.js"></script>
|
||||
<script type="text/javascript" src="./js/post/use-txtbox.js"></script>
|
||||
<script type="text/javascript" src="./js/tl/parse.js"></script>
|
||||
<script type="text/javascript" src="./js/ui/theme.js"></script>
|
||||
<script type="text/javascript" src="./js/tl/date.js"></script>
|
||||
<script type="text/javascript" src="./js/common/time.js"></script>
|
||||
<script type="text/javascript" src="./js/platform/nano.js"></script>
|
||||
<script type="text/javascript" src="./js/platform/end.js"></script>
|
||||
<script>
|
||||
var multi = localStorage.getItem("multi");
|
||||
if (!multi) {
|
||||
var obj = [{
|
||||
at: localStorage.getItem(localStorage.getItem("domain_" + acct_id) + "_at"),
|
||||
name: localStorage.getItem("name_" + acct_id),
|
||||
domain: localStorage.getItem("domain_" + acct_id),
|
||||
user: localStorage.getItem("user_" + acct_id),
|
||||
prof: localStorage.getItem("prof_" + acct_id)
|
||||
}];
|
||||
var json = JSON.stringify(obj);
|
||||
localStorage.setItem("multi", json);
|
||||
} else {
|
||||
var obj = JSON.parse(multi);
|
||||
}
|
||||
var templete;
|
||||
var last = localStorage.getItem("last-use");
|
||||
var sel;
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var acct = obj[key];
|
||||
var list = key * 1 + 1;
|
||||
if (key == last) {
|
||||
sel = "selected";
|
||||
} else {
|
||||
sel = "";
|
||||
body {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
font-size: 11px;
|
||||
}
|
||||
templete = '<option value="' + key + '" ' + sel + '>' + acct.user + '@' + acct.domain +
|
||||
'</option>';
|
||||
$("#post-acct-sel").append(templete);
|
||||
});
|
||||
function mov() {
|
||||
return false;
|
||||
}
|
||||
function resetmv() {
|
||||
return false;
|
||||
}
|
||||
function post() {
|
||||
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/statuses";
|
||||
var str = $("#textarea").val();
|
||||
var toot = {
|
||||
status: str
|
||||
|
||||
#timeline_nano {
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
-webkit-app-region: no-drag;
|
||||
max-height: 100px;
|
||||
}
|
||||
var vis = loadVis(acct_id)
|
||||
toot.visibility = vis;
|
||||
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(JSON.stringify(toot));
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
$("#textarea").val("");
|
||||
|
||||
.user {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
select {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
button {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
textarea {
|
||||
-webkit-app-region: no-drag;
|
||||
color: var(--color) !important;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.area-date_via {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.area-side {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
::-webkit-scrollbar-thumb {
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.hide, .pin, .rep-btn, .tickers{
|
||||
display: none;
|
||||
}
|
||||
.fas {
|
||||
font-size: 1rem !important;
|
||||
}
|
||||
.cvo {
|
||||
grid-template-rows: auto 1rem 1fr auto 2rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script type="text/javascript" src="./node_modules/jquery/dist/jquery.js"></script>
|
||||
<script>
|
||||
$.strip_tags = function(str, allowed) {
|
||||
if (!str) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadVis(acct_id) {
|
||||
var vist = localStorage.getItem("vis");
|
||||
console.log(vist);
|
||||
if (!vist) {
|
||||
return "public";
|
||||
} else {
|
||||
if (vist == "memory") {
|
||||
var memory = localStorage.getItem("vis-memory-" + acct_id);
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
}
|
||||
return memory;
|
||||
} else if (vist == "server") {
|
||||
var multi = localStorage.getItem("multi");
|
||||
var obj = JSON.parse(multi);
|
||||
var memory = obj[acct_id]["vis"];
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
}
|
||||
return memory;
|
||||
} else {
|
||||
return vist;
|
||||
allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join("");
|
||||
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
|
||||
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
|
||||
return str.replace(commentsAndPhpTags, "").replace(tags, function($0, $1) {
|
||||
return allowed.indexOf("<" + $1.toLowerCase() + ">") > -1 ? $0 : "";
|
||||
});
|
||||
};
|
||||
function escapeHTML(str) {
|
||||
if (!str) {
|
||||
return "";
|
||||
}
|
||||
return str
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<script type="text/javascript" src="./js/platform/first-not-view.js"></script>
|
||||
<div id="menu" class="hide">
|
||||
TL and posting account<br>
|
||||
<select id="post-acct-sel" style="max-width:150px"> </select><br>
|
||||
TL type<br>
|
||||
<select id="type-sel" style="max-width:60px" onchange="loader()">
|
||||
<option value="local">Local</option>
|
||||
<option value="home">Home</option> </select
|
||||
><button onclick="tl()">Show</button><br>
|
||||
Visibility<br>
|
||||
<select id="vis-sel" style="max-width:60px">
|
||||
<option value="public">Public</option>
|
||||
<option value="unlisted">Unlisted</option>
|
||||
<option value="private">Private</option>
|
||||
</select>
|
||||
</div>
|
||||
<button onclick="set()" id="setting">Setting</button>
|
||||
<textarea id="textarea" style="width:55%; background-color:transparent" placeholder="Post someyhing new"></textarea>
|
||||
<button class="btn" onclick="post()">Post</button>
|
||||
<button onclick="window.close()">x</button><br />
|
||||
<div id="timeline_nano">Click "settings" to show TL</div>
|
||||
<br />
|
||||
<script>
|
||||
if (localStorage.getItem("lang")) {
|
||||
var lang = localStorage.getItem("lang");
|
||||
} else {
|
||||
var lang = "ja";
|
||||
}
|
||||
</script>
|
||||
<script src="https://twemoji.maxcdn.com/2/twemoji.min.js?2.7"></script>
|
||||
<script type="text/javascript" src="view/en/main.js"></script>
|
||||
<script type="text/javascript" src="./js/post/status.js"></script>
|
||||
<script type="text/javascript" src="./js/post/post.js"></script>
|
||||
<script type="text/javascript" src="./js/post/use-txtbox.js"></script>
|
||||
<script type="text/javascript" src="./js/tl/parse.js"></script>
|
||||
<script type="text/javascript" src="./js/ui/theme.js"></script>
|
||||
<script type="text/javascript" src="./js/tl/date.js"></script>
|
||||
<script type="text/javascript" src="./js/common/time.js"></script>
|
||||
<script type="text/javascript" src="./js/platform/nano.js"></script>
|
||||
<script type="text/javascript" src="./js/platform/end.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
{
|
||||
"name": "thedesk",
|
||||
"version": "18.8.3",
|
||||
"version": "20.0.4",
|
||||
"description": "TheDesk is a Mastodon client for PC.",
|
||||
"repository": "https://github.com/cutls/TheDesk",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"construct": "cd view/make && node make",
|
||||
"construct": "cd view/make && node make --automatic && cd ../../",
|
||||
"dev": "electron ./ --dev",
|
||||
"dist": "build --linux snap",
|
||||
"watchview": "node view/make/make.js --automatic --watch",
|
||||
"build:js": "node build.js",
|
||||
"build": "electron-builder",
|
||||
"build:all": "electron-builder --win --linux",
|
||||
@@ -49,24 +50,27 @@
|
||||
],
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.11.2",
|
||||
"electron-dl": "^1.14.0",
|
||||
"@fortawesome/fontawesome-free": "^5.10.1",
|
||||
"jimp": "^0.6.4",
|
||||
"jimp": "^0.8.4",
|
||||
"jquery": "^3.4.1",
|
||||
"json5": "^2.1.0",
|
||||
"materialize-css": "^1.0.0",
|
||||
"node-notifier": "^5.4.0",
|
||||
"jquery-ui-dist": "^1.12.1",
|
||||
"materialize-css": "git://github.com/cutls/materialize",
|
||||
"json5": "^2.1.1",
|
||||
"lodash": "^4.17.15",
|
||||
"sumchecker": "^3.0.0",
|
||||
"sweetalert2": "^8.13.0",
|
||||
"sweetalert2": "^9.3.16",
|
||||
"vue": "^2.6.10"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"itunes-nowplaying-mac": "kPherox/itunes-nowplaying-mac#get-artworks-base64",
|
||||
"font-manager": "^0.3.0"
|
||||
"font-manager": "0.3.0",
|
||||
"itunes-nowplaying-mac": "0.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^6.0.0",
|
||||
"electron-builder": "^21.1.5",
|
||||
"chokidar": "^3.3.0",
|
||||
"electron": "^7.1.1",
|
||||
"electron-builder": "^22.1.0",
|
||||
"electron-rebuild": "^1.8.8",
|
||||
"readline-sync": "1.4.10"
|
||||
},
|
||||
"build": {
|
||||
@@ -105,7 +109,8 @@
|
||||
"icon": "build/icons",
|
||||
"target": [
|
||||
"zip",
|
||||
"snap"
|
||||
"snap",
|
||||
"deb"
|
||||
],
|
||||
"category": "Network"
|
||||
},
|
||||
|
||||
94
app/source/version.json
Normal file
94
app/source/version.json
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"latest":[],
|
||||
"3.0.0": [
|
||||
"プロフィールディレクトリの表示",
|
||||
"ホワイトリスト式のトレンドタグ(3.0の機能)",
|
||||
"Featuredハッシュタグの追加",
|
||||
"ホームタイムラインと通知タイムラインの未読管理",
|
||||
"自分がどの選択肢に投票したかを表示"
|
||||
],
|
||||
"2.9.3": [],
|
||||
"2.9.2": [],
|
||||
"2.9.1": ["オーディオのアップロードと再生"],
|
||||
"2.9.0": ["ユーザーごとの通知のフィルター"],
|
||||
"2.8.4": [],
|
||||
"2.8.3": [],
|
||||
"2.8.2": [],
|
||||
"2.8.1": ["blurhashによる閲覧注意画像表示"],
|
||||
"2.8.0": [
|
||||
"アンケートの作成と投票",
|
||||
"keybase等のアカウント認証対応",
|
||||
"検索のオフセット等",
|
||||
"ブロックされているアカウントを表示したときに「ブロックされています」と表示",
|
||||
"公開範囲を指定してブースト"
|
||||
],
|
||||
"2.7.4": [],
|
||||
"2.7.3": [],
|
||||
"2.7.2": [],
|
||||
"2.7.1": [],
|
||||
"2.7.0": ["プロフィールディレクトリのユーザー追加", "時間指定投稿"],
|
||||
"2.6.5": [],
|
||||
"2.6.4": [],
|
||||
"2.6.3": [],
|
||||
"2.6.2": [],
|
||||
"2.6.1": [],
|
||||
"2.6.0": [
|
||||
"ダイレクトメールだけのタイムラインの表示",
|
||||
"詳細画面の「これより後のタイムライン」の利用",
|
||||
"タイムラインにおけるカードの表示"
|
||||
],
|
||||
"2.5.2": [],
|
||||
"2.5.1": [],
|
||||
"2.5.0": ["リプライ数のカウント", "プロフィールに紹介する"],
|
||||
"2.4.5": [],
|
||||
"2.4.4": [],
|
||||
"2.4.3": ["フィルター機能", "フォローレコメンデーション"],
|
||||
"2.4.2": [],
|
||||
"2.4.1": [
|
||||
"削除して再編集の画像を下書きに戻す",
|
||||
"検索時のトゥート数のグラフ等の表示(v2 search)",
|
||||
"トゥート内のURLからトゥートやアカウントの情報を開く",
|
||||
"設定ページから製作者のアカウント情報を開く",
|
||||
"TheDeskお知らせに添付されたトゥートを開く",
|
||||
"Glance TLやtootsearchのトゥートやアカウント情報を表示する"
|
||||
],
|
||||
"2.4.0": [
|
||||
"プロフィールのフィールド(4つの項目)を見る",
|
||||
"プロフィールにカスタム絵文字を使用する"
|
||||
],
|
||||
"2.3.3": [],
|
||||
"2.3.2": [],
|
||||
"2.3.1": [],
|
||||
"2.3.0": [
|
||||
"トゥートに埋め込まれたYouTubeやニコ動などをその場で再生する",
|
||||
"ローカル(メディア)と連合(メディア)タイムライン"
|
||||
],
|
||||
"2.2.0": [],
|
||||
"2.1.3": [],
|
||||
"2.1.2": [],
|
||||
"2.1.0": [
|
||||
"リスト機能",
|
||||
"アカウント移行機能(移行された通知)",
|
||||
"Glance TLのストリーミング"
|
||||
],
|
||||
"2.0.0": ["カスタム絵文字"],
|
||||
"1.6.1": [],
|
||||
"1.6.0": ["トゥートのピン留め"],
|
||||
"1.5.1": [],
|
||||
"1.5.0": [
|
||||
"Mastodonのサーバー規定値による投稿範囲の変更",
|
||||
"Mastodonのサーバー規定値による閲覧注意画像設定"
|
||||
],
|
||||
"1.4.7": [],
|
||||
"1.4.6": [],
|
||||
"1.4.5": [],
|
||||
"1.4.4": [],
|
||||
"1.4.3": [],
|
||||
"1.4.2": [],
|
||||
"1.4.1": ["ユーザーによるドメインブロック"],
|
||||
"1.3.3": [],
|
||||
"1.3.2": [],
|
||||
"1.3.1": [],
|
||||
"1.3.0": [],
|
||||
"oldest":[]
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="bg">
|
||||
|
||||
<head>
|
||||
<title>Account Manager - TheDesk</title>
|
||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||
<link href="../../node_modules/materialize-css/dist/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/tl.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../css/userdata.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" 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;
|
||||
}
|
||||
|
||||
.first {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center
|
||||
}
|
||||
|
||||
.first .hide-first {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<meta charset="utf-8">
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body id="mainView">
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<script type="text/javascript" src="../../js/lang/lang.bg.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
<script>
|
||||
var misskeytoken = false;
|
||||
</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>
|
||||
<div class="hide-first">
|
||||
<a href="index.html" class="btn waves-effect orange nex"
|
||||
style="width:100%; max-width:200px;">Назад</a><br>
|
||||
<h5>Списък на профилите</h5>
|
||||
<div id="acct-list"></div>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<div>
|
||||
<h5>Добавяне на профил</h5><br>
|
||||
<div id="add">
|
||||
<div class="row">
|
||||
<div class="col s8">
|
||||
<input type="text" id="url" style="width:70%" placeholder="ex)mstdn.jp">
|
||||
<div id="ins-suggest"></div>
|
||||
Премахнете отметката за да пропуснете влизането с код. (Вход в Mastodon от Windows или macOS) (Препоръчително: pcheck)<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="linux" />
|
||||
<span>Настройка на код</span>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="misskey" />
|
||||
<span>Влезте като Misskey</span>
|
||||
</label><br>
|
||||
<button class="btn waves-effect" onclick="instance()">Login</button><br>
|
||||
</div>
|
||||
<div class="col s4">
|
||||
<span style="font-family:Open Sans;">Supports</span>
|
||||
<div id="support" class="collection transparent"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="auth" style="display:none">
|
||||
Поставете кода и затворете браузъра.<br>
|
||||
<input type="text" id="code" placeholder="Код">
|
||||
<button class="btn waves-effect" onclick="code()">Auth</button><br>
|
||||
</div>
|
||||
<div id="misskeylogin" style="display:none">
|
||||
<h5>AppSecret</h5>
|
||||
Прочетете <a href=\"https://thedesk.top/how-to-misskey-login.html\">Документацията</a>, за да влезете в Misskey.<br>
|
||||
<input type="hidden" id="misskey-url">
|
||||
<input type="text" id="misskey-key" placeholder="Код">
|
||||
<button class="btn waves-effect" onclick="misskeyLogin()">Auth</button><br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-first">
|
||||
<h5>Основен профил</h5>
|
||||
<div class="input-field" style="width:300px"><span data-trans="your_acct">Изберете профил</span>
|
||||
<br>
|
||||
<select id="main-acct-sel" class="acct-sel" style="color:black" onchange="mainacct()"></select>
|
||||
<label></label>
|
||||
</div>
|
||||
Some instance data by <a href="https://instances.social" target="_blank">instances.social API</a><br>
|
||||
<h5 id="ins-title"></h5>
|
||||
Administered by:<a id="ins-admin"></a><br>
|
||||
<span id="ins-desc"></span><br>
|
||||
<img src="../../img/loading.svg" id="ins-prof" width="200"><br>
|
||||
<br>
|
||||
Домейн:<span id="ins-name"></span><br>
|
||||
Федерални сървъри:<span id="ins-connect"></span><br>
|
||||
Тоот:<span id="ins-toot"></span><br>
|
||||
Потребители:<span id="ins-user"></span>Потребители<br>
|
||||
Свързване:<span id="ins-per"></span>%<br>
|
||||
Mastodon версия:<span id="ins-ver"></span>@<span id="ins-upd"></span><br>
|
||||
</div>
|
||||
<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/tkn.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>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,476 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="bg" style="overflow:scroll">
|
||||
|
||||
<head>
|
||||
<title>Settings - TheDesk</title>
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||
<link href="../../node_modules/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/themes.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/pickr.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/master.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
input {
|
||||
max-height: 50px !important
|
||||
}
|
||||
|
||||
.pcr-result {
|
||||
height: 1rem !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body id="mainView" style="overflow-y:scroll">
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<script type="text/javascript" src="../../js/lang/lang.bg.js"></script>
|
||||
<script src="https://unpkg.com/json5@^2.0.0/dist/index.min.js"></script>
|
||||
<script src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="setting.vue.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
|
||||
<h4>Предпочитания</h4>
|
||||
<ul class="collapsible" data-collapsible="accordion">
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">desktop_windows</i>Системни предпочитания
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h5>Езици</h5>
|
||||
To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.<br>
|
||||
<a onclick="changelang('ja')" class="pointer" style="margin-right:5px;">日本語</a><a onclick="changelang('en')" class="pointer" style="margin-right:5px;">English</a><a onclick="changelang('ps')" class="pointer" style="margin-right:5px;">Crowdin translate system(beta)</a><a onclick="changelang('bg')" class="pointer" style="margin-right:5px;">български</a><a onclick="changelang('cs')" class="pointer" style="margin-right:5px;">Česky</a><a onclick="changelang('de')" class="pointer" style="margin-right:5px;">Deutsch</a>
|
||||
<h5>Внос и износ на предпочитания</h5>
|
||||
<button onclick="exportSettings()" class="btn waves-effect lime darken-3"
|
||||
style="width:100%; max-width:200px;">Износ</button>
|
||||
<button onclick="importSettings()" class="btn waves-effect cyan darken-3"
|
||||
style="width:100%; max-width:200px;">Внос</button>
|
||||
<div id="envView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.id=='notf'"><a onclick="notftest()"
|
||||
class="pointer">Тест за уведомяване</a><br></template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<label>
|
||||
<input class="with-gap" v-on:click="complete(i,check.value)" v-model="item.setValue"
|
||||
type="radio" v-bind:id="item.id+check.value" v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span>
|
||||
</label>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Промяна</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
<h5>Шрифт</h5>
|
||||
Изберете любимия си шрифт с „Избор“ (само за Windows / macOS)<br>
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="font()">Избери</button><br>
|
||||
<div id="fonts" class="hide" style="overflow-y:scroll; width:300px; height:500px;"></div>
|
||||
<br>
|
||||
<input type="text" style="width:150px" id="font">
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Запази</button>
|
||||
<br>
|
||||
<h5>Папка за запазване</h5>
|
||||
TheDesk ще използва това местоназначение, когато се опитва да запази снимки или да прави екранни снимки.<br>
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="savefolder()">Промяна</button>
|
||||
<br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">color_lens</i>Теми
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h4>Изберете тема</h4>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="black" value="black" />
|
||||
<span>Black</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="white" value="white" />
|
||||
<span>White</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="indigo"
|
||||
value="indigo" />
|
||||
<span>Indigo<span class="imas hide">(エンドレスナイト)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="brown" value="brown" />
|
||||
<span>Brown<span class="imas hide">(ビタースイート・タイム)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="green" value="green" />
|
||||
<span>Green<span class="imas hide">(ユースフルロマンス)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="blue" value="blue" />
|
||||
<span>Blue<span class="imas hide">(渚の花嫁)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="custom"
|
||||
value="custom" />
|
||||
<span>custom</span>
|
||||
</label>
|
||||
<div style="width:300px" id="sel-selector">
|
||||
<select id="custom-sel-sel" class="custom-sel" onchange="customSel()"></select>
|
||||
</div>
|
||||
<h4>Редактирайте и добавете персонализирани теми</h4>
|
||||
<div style="width:300px" id="edit-selector" data-add="Добавяне на нов">
|
||||
<select id="custom-edit-sel" class="custom-sel" onchange="custom()">
|
||||
<option value="add_new">Добавяне на нов</option>
|
||||
</select>
|
||||
</div>
|
||||
<h5>Име</h5>
|
||||
<input type="text" style="width:300px" id="custom_name" placeholder="Име...">
|
||||
<h5>Относно тази тема</h5>
|
||||
<div class="input-field"><textarea style="width:300px" id="custom_desc" class="materialize-textarea"
|
||||
placeholder="Относно тази тема..."></textarea></div>
|
||||
<h5>Цветова схема</h5>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="direction" type="radio" id="dark" value="dark"
|
||||
checked="true" />
|
||||
<span>Dark</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="direction" type="radio" id="light"
|
||||
value="light" />
|
||||
<span>Light</span>
|
||||
</label>
|
||||
<div id="pickers">
|
||||
<div>
|
||||
<h5>Primary</h5>Компоненти на фона
|
||||
<div id="color-picker0-wrap">
|
||||
<div class="color-picker" id="color-picker0"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker0_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Secondary</h5>Цвят на фона
|
||||
<div id="color-picker1-wrap">
|
||||
<div class="color-picker" id="color-picker1"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker1_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Texts</h5>Цвят на текста
|
||||
<div id="color-picker2-wrap">
|
||||
<div class="color-picker" id="color-picker2"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker2_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Accent</h5>Фон на подсилването
|
||||
<div id="color-picker3-wrap">
|
||||
<div class="color-picker" id="color-picker3"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker3_value">
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn-large waves-effect" onclick="customComp()">Промяна</button> <button
|
||||
class="btn waves-effect red disabled" id="delTheme" onclick="deleteIt()">Изтрий</button><br><br>
|
||||
<input type="text" style="width:300px;height:40px;" id="custom_json" class="materialize-textarea"
|
||||
placeholder="JSON style" readonly><br>
|
||||
Споделете този код с друг TheDesk. Не споделяйте този код с MiAS.
|
||||
<h4>Импортиране на персонализирани теми</h4>
|
||||
Вземете още теми от <a href=\"https://assets.msky.cafe/\" target=\"_blank\">MiAS</a><br>
|
||||
<input type="text" style="width:300px;height:40px;" id="custom_import" class="materialize-textarea"
|
||||
placeholder="JSON/JSON5 style">
|
||||
<button class="btn waves-effect" onclick="customImp()">Внос</button><br>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">reorder</i>Предпочитания за времевата линия
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<div id="tlView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<label>
|
||||
<input class="with-gap" v-on:click="complete(i,check.value)" v-model="item.setValue"
|
||||
type="radio" v-bind:id="item.id+check.value" v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span>
|
||||
</label>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Промяна</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
<h5>Персонализиран звук</h5>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(1)">Custom 1</button><span
|
||||
id="c1-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(2)">Custom 2</button><span
|
||||
id="c2-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(3)">Custom 3</button><span
|
||||
id="c3-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(4)">Custom 4</button><span
|
||||
id="c4-file"></span><br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">send</i>Предпочитания за публикуване
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<div id="postView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<template v-if="!check.kirishima || (check.kirishima && kirishima)">
|
||||
<label><input class="with-gap" v-on:click="complete(i,check.value)"
|
||||
v-model="item.setValue" type="radio" v-bind:id="item.id+check.value"
|
||||
v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span></label>
|
||||
<span v-if="check.kirishimaText">{{check.kirishimaText}}</span>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Промяна</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
</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>
|
||||
Можете да вмъкнете всякакви букви и емотикони само с 3 клавиша<br>
|
||||
Ctrl+Shift+1:<input type="text" style="width:150px" id="oks-1">
|
||||
<button onclick="oks(1)" class="btn waves-effect" style="width:100px;">Запази</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;">Запази</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;">Запази</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;">Запази</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;">Запази</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="fab fa-spotify"></i>Spotify and NowPlaying Preferences
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<br><br>
|
||||
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;">Запази</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>@@templateedit@@</h5>
|
||||
@@templateeditwarn@@<br>
|
||||
<textarea id="np-temp" class="materialize-textarea" data-length="500">#NowPlaying {song} / {album} / {artist}
|
||||
{url}</textarea><br>
|
||||
@@template1@@<br>
|
||||
@@template2@@<br>
|
||||
@@template3@@<br>
|
||||
<button onclick="spotifySave()" class="btn waves-effect" style="width:100px;">Запази</button>
|
||||
<h5>Attach an Artwork of Spotify</h5>
|
||||
<label>
|
||||
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_yes"
|
||||
value="yes" />
|
||||
<span>Да</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_no"
|
||||
value="no" />
|
||||
<span>Не</span>
|
||||
</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()">Запази</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+Enter+Shift:Post(secondary toot)</li>
|
||||
<li>Alt+Enter:Secondary Toot Button</li>
|
||||
<li>Ctrl+E:Make all notifications read</li>
|
||||
<li>Ctrl+U:@@keyselecttop@@</li>
|
||||
<li>Esc:Hide toot box</li>
|
||||
<li>F5:Super Reload</li>
|
||||
<li>Ctrl+Shift+C:Clear toot box</li>
|
||||
<li>Ctrl+Shift+S:Предпочитания</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>
|
||||
以下アスタルテにログインしている場合のみ
|
||||
<br>
|
||||
<li>Ctrl+R:
|
||||
<a href="https://astarte.thedesk.top">アスタルテ暇人ランキング</a>を開く
|
||||
</li><br>
|
||||
@@whenSelected@@
|
||||
<li>F:@@fav@@</li>
|
||||
<li>B:@@bt@@</li>
|
||||
<li>R:@@reply@@</li>
|
||||
</div>
|
||||
<button class="btn waves-effect red" style="width:100%; max-width:500px;"
|
||||
onclick="if(confirm('Изтриване на всички данни. Не можете да го отмените. Продължaвате?')){ 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://www.pixiv.net/fanbox/creator/28105985" class="btn waves-effect red lighten-2"
|
||||
style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>Поддръжка(Pixiv FANBOX)</a>
|
||||
<a href="https://www.patreon.com/cutls" class="btn waves-effect red darken-2"
|
||||
style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>Поддръжка(Patreon)</a>
|
||||
<a href="https://liberapay.com/cutls" class="btn waves-effect black-text"
|
||||
style="width:100%; max-width:500px; background-color: #f6c915"><i class="material-icons left">trending_up</i>Поддръжка(Liberapay)</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</a>
|
||||
<a href="https://github.com/cutls/TheDesk" class="btn waves-effect black lighten-2"
|
||||
style="width:100%; max-width:500px;"><i class="fab fa-github left"></i>GitHub</a>
|
||||
<a href="index.html?mode=user&code=Cutls@cutls.com" 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@cutls.com</a>
|
||||
<br>
|
||||
Kyash<br>
|
||||
<img src="../../img/kyash.png" width="100"><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 © TheDesk 2018
|
||||
Under <a href="https://github.com/cutls/TheDesk/blob/master/LICENSE">GNU General Public License v3.0</a> and <a
|
||||
href="https://thedesk.top/tos.html">Terms of Use</a>/<a href="https://thedesk.top/priv.html">Privacy
|
||||
Policy</a>
|
||||
<br>Developer: Cutls P(
|
||||
<a href="index.html?mode=user&code=Cutls@cutls.com">@Cutls@cutls.com</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/modal.js"></script>
|
||||
<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/platform/pickr.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>
|
||||
@@ -1,552 +0,0 @@
|
||||
var yesno = [
|
||||
{
|
||||
text: "Да",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Не",
|
||||
value: "no"
|
||||
}
|
||||
];
|
||||
var sound = [
|
||||
{
|
||||
text: "Няма",
|
||||
value: "none"
|
||||
}, {
|
||||
text: "По подразбиране",
|
||||
value: "default"
|
||||
}, {
|
||||
text: "Custom 1",
|
||||
value: "c1"
|
||||
}, {
|
||||
text: "Custom 2",
|
||||
value: "c2"
|
||||
}, {
|
||||
text: "Custom 3",
|
||||
value: "c3"
|
||||
}, {
|
||||
text: "Custom 4",
|
||||
value: "c4"
|
||||
}
|
||||
];
|
||||
var envConstruction = [
|
||||
{
|
||||
id: "popup",
|
||||
storage: "popup",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
setValue: 0,
|
||||
width: 50,
|
||||
text: {
|
||||
head: "Известие с изскачащ прозорец (за Windows)",
|
||||
desc: "Скрито ако е зададено на „0“",
|
||||
after: "сек"
|
||||
}
|
||||
}, {
|
||||
id: "notf",
|
||||
storage: "nativenotf",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Вътрешно уведомяване",
|
||||
desc: "Това не работи в Windows Portable вер.",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "width",
|
||||
storage: "width",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 50,
|
||||
setValue: 300,
|
||||
text: {
|
||||
head: "Минимална ширина на колоните",
|
||||
desc: "Лентата за превъртане ще се покаже, когато размерът на прозореца е по-голям от размера на колони.",
|
||||
after: "px над"
|
||||
}
|
||||
}, {
|
||||
id: "fixwidth",
|
||||
storage: "fixwidth",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
setValue: 300,
|
||||
width: 50,
|
||||
text: {
|
||||
head: "Минимална ширина на браузъра TweetDeck",
|
||||
desc: "",
|
||||
after: "px над"
|
||||
}
|
||||
}, {
|
||||
id: "size",
|
||||
storage: "size",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 50,
|
||||
setValue: 13,
|
||||
text: {
|
||||
head: "Размер на шрифта",
|
||||
desc: "<span style=\"font-size:13px\">13px(абсолютна стойност)</span>",
|
||||
after: "px"
|
||||
}
|
||||
}, {
|
||||
id: "ha",
|
||||
storage: "ha",
|
||||
checkbox: true,
|
||||
setValue: false,
|
||||
text: {
|
||||
head: "Деактивиране на хардуерното ускорение",
|
||||
desc: "Автоматичното рестартиране",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Да",
|
||||
value: "true"
|
||||
}, {
|
||||
text: "Не",
|
||||
value: "false"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
var tlConstruction = [
|
||||
{
|
||||
id: "time",
|
||||
storage: "datetype",
|
||||
checkbox: true,
|
||||
setValue: "absolute",
|
||||
text: {
|
||||
head: "Времеви формат",
|
||||
desc: "Относителен формат: „преди 1 минута“, „преди 3 дни“<br>Абсолютен формат:\"23:25:21\",\"2017/12/30 23:59:00\"<br>Смесен формат: някои от раздумките са с относителен-формат, други са с абсолютен формат.",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Относителен",
|
||||
value: "relative"
|
||||
}, {
|
||||
text: "Абсолютен",
|
||||
value: "absolute"
|
||||
}, {
|
||||
text: "Относителен и абсолютен",
|
||||
value: "double"
|
||||
}, {
|
||||
text: "Смесено",
|
||||
value: "medium"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "ul",
|
||||
storage: "locale",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Уникално място на Сървърите",
|
||||
desc: "Тази стойност е налична за някои Японски сървъри",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "nsfw",
|
||||
storage: "nsfw",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Скриване на NSFW снимки",
|
||||
desc: "Силен ефект на размазване",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "cw",
|
||||
storage: "cw",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Скриване на CW съдържание",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "rp",
|
||||
storage: "replyct",
|
||||
checkbox: true,
|
||||
setValue: "hidden",
|
||||
text: {
|
||||
head: "Стил на брояча на отговори",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Показване на 1+, ако отговорите са повече от 1.",
|
||||
value: "hidden"
|
||||
}, {
|
||||
text: "Показване на 1+, ако отговорите са повече от 1.",
|
||||
value: "all"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "gif",
|
||||
storage: "gif",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Анимация на анимирани GIF изображения",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "tag",
|
||||
storage: "tag-range",
|
||||
checkbox: true,
|
||||
setValue: "local",
|
||||
text: {
|
||||
head: "Tag в TL търсене",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Използване в обединената мрежа",
|
||||
value: "all"
|
||||
}, {
|
||||
text: "Използване в локалната мрежа",
|
||||
value: "local"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "via",
|
||||
storage: "viashow",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "С показване",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "mov",
|
||||
storage: "mouseover",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Hide action buttons without mouseover",
|
||||
desc: "You may feel 'mouseover' is unconfortable:(",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Mouseover to show",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Click to show",
|
||||
value: "click"
|
||||
}, {
|
||||
text: "Не",
|
||||
value: "no"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "notfm",
|
||||
storage: "setasread",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Show Notification marker, red colored bell and counter(if you show a notification column.)",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
checkbox: false,
|
||||
doubleText: true,
|
||||
data: [
|
||||
{
|
||||
id: "sentence",
|
||||
storage: "sentence",
|
||||
width: 50,
|
||||
setValue: 500,
|
||||
text: { after: "lines над or" }
|
||||
}, {
|
||||
id: "letters",
|
||||
storage: "letters",
|
||||
width: 50,
|
||||
setValue: 7000,
|
||||
text: { after: "букви над" }
|
||||
}
|
||||
],
|
||||
text: {
|
||||
head: "Auto folding",
|
||||
desc: "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.",
|
||||
}
|
||||
}, {
|
||||
id: "img-height",
|
||||
storage: "img-height",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 80,
|
||||
setValue: 200,
|
||||
text: {
|
||||
head: "Height of images",
|
||||
desc: "Option:Set \"full\" to uncrop.",
|
||||
after: "px"
|
||||
}
|
||||
}, {
|
||||
id: "ticker",
|
||||
storage: "ticker_ok",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Enable #InstanceTicker",
|
||||
desc: "Show colorful stickers about the server. <a href=\"https://cdn.weep.me/mastodon/\">About #InstanceTicker</a> Copyright 2018 weepjp, kyori19.",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "anime",
|
||||
storage: "animation",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Анимация на времевата линия",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "replySound",
|
||||
storage: "replySound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Звук (Отговор)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "favSound",
|
||||
storage: "favSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Звук(Фаворит)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "btSound",
|
||||
storage: "btSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Звук(Подсилване)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "followSound",
|
||||
storage: "followSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Звук(Харесване)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}
|
||||
];
|
||||
var postConstruction = [
|
||||
{
|
||||
id: "cw-text",
|
||||
storage: "cw-text",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 150,
|
||||
setValue: "",
|
||||
text: {
|
||||
head: "Текст за предупреждение по подразбиране",
|
||||
desc: "",
|
||||
after: ""
|
||||
}
|
||||
}, {
|
||||
checkbox: false,
|
||||
doubleText: true,
|
||||
data: [
|
||||
{
|
||||
id: "cw_sentence",
|
||||
storage: "cw_sentence",
|
||||
width: 50,
|
||||
setValue: 500,
|
||||
text: { after: "lines над or" }
|
||||
}, {
|
||||
id: "cw_letters",
|
||||
storage: "cw_letters",
|
||||
width: 50,
|
||||
setValue: 7000,
|
||||
text: { after: "букви над" }
|
||||
}
|
||||
],
|
||||
text: {
|
||||
head: "Предупреждение преди публикуване на дълга раздумка.",
|
||||
desc: "Показване на диалогов прозорец, когато правите твърде дълъг скрит текст.",
|
||||
}
|
||||
}, {
|
||||
id: "cws",
|
||||
storage: "always-cw",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Винаги да е зададено CW",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "vis",
|
||||
storage: "vis",
|
||||
checkbox: true,
|
||||
setValue: "public",
|
||||
text: {
|
||||
head: "Видимост по подразбиране",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Публично",
|
||||
value: "public"
|
||||
}, {
|
||||
text: "Скрито",
|
||||
value: "unlisted"
|
||||
}, {
|
||||
text: "Частно",
|
||||
value: "private"
|
||||
}, {
|
||||
text: "Директно",
|
||||
value: "direct"
|
||||
}, {
|
||||
text: "Памет(запомнено на всеки сървър)",
|
||||
value: "memory"
|
||||
}, {
|
||||
text: "Видимост по подразбиране (Зададени от предпочитанията в Mastodon сървъра)",
|
||||
value: "useapi"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "img",
|
||||
storage: "img",
|
||||
checkbox: true,
|
||||
setValue: "no-act",
|
||||
text: {
|
||||
head: "Предпочитания за публикуване на изображения",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Вмъкване на URL адрес на медия",
|
||||
value: "url"
|
||||
}, {
|
||||
text: "Без вмъкване",
|
||||
value: "no-act"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "box",
|
||||
storage: "box",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Действие на кутията за публикации",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Прибрана",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Отворена и след публикуване",
|
||||
value: "no"
|
||||
}, {
|
||||
text: "Постоянно отворена",
|
||||
value: "absolute"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "quote",
|
||||
storage: "quote",
|
||||
checkbox: true,
|
||||
setValue: "nothing",
|
||||
text: {
|
||||
head: "Quote format",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Only URL",
|
||||
value: "simple"
|
||||
}, {
|
||||
text: "URL and acct(mention to the user)",
|
||||
value: "mention"
|
||||
}, {
|
||||
text: "URL, text and acct(mention to the user)",
|
||||
value: "full"
|
||||
}, {
|
||||
text: "Disabled(Hide buttons on TLs)",
|
||||
value: "nothing"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "main",
|
||||
storage: "mainuse",
|
||||
checkbox: true,
|
||||
setValue: "remain",
|
||||
text: {
|
||||
head: "Default accounts of actions",
|
||||
desc: "Main account can be set on Account Manager.",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Account you used recently",
|
||||
value: "remain"
|
||||
}, {
|
||||
text: "Main account",
|
||||
value: "main"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "sec",
|
||||
storage: "sec",
|
||||
checkbox: true,
|
||||
setValue: "public",
|
||||
text: {
|
||||
head: "Secondary Toot Button",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Hidden",
|
||||
value: "nothing"
|
||||
}, {
|
||||
text: "Публично",
|
||||
value: "public"
|
||||
}, {
|
||||
text: "Скрито",
|
||||
value: "unlisted"
|
||||
}, {
|
||||
text: "Частно",
|
||||
value: "private"
|
||||
}, {
|
||||
text: "Директно",
|
||||
value: "direct"
|
||||
}, {
|
||||
text: "Local Only",
|
||||
value: "local",
|
||||
kirishima: true,
|
||||
kirishimaText: "非対応インスタンスでは「未収載」になります。"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "zero",
|
||||
storage: "emoji-zero-width",
|
||||
checkbox: true,
|
||||
setValue: "normal",
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Zero-width space when inserting emojis",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,254 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="bg">
|
||||
|
||||
<head>
|
||||
<title>Update - TheDesk</title>
|
||||
<link href="../../node_modules/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/master.css" type="text/css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Open Sans';
|
||||
-webkit-app-region: drag;
|
||||
cursor: move;
|
||||
padding: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#start {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100vw;
|
||||
height: calc(100vh - 2.5rem);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#checkbox {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
a,
|
||||
button,
|
||||
input,
|
||||
label,
|
||||
i {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
#updskip {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.skipbtn {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border: 1px solid;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px solid;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.skipbtn:hover {
|
||||
background-color: #b3e5fc;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
#prog {
|
||||
font-size: 200%;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<i class="material-icons pointer waves-effect" onclick="about();">info</i>
|
||||
<i class="material-icons pointer waves-effect" onclick="skipper();">clear</i>
|
||||
<!--a href="update.html">Reload</a-->
|
||||
<div id="start">
|
||||
<div id="box" class="show">
|
||||
<h2>TheDesk</h2>
|
||||
<p>Get latest TheDesk</p>
|
||||
<span id="now"></span>→<b id="ver"></b><br>
|
||||
<span id="det"></span><br>
|
||||
<button class="waves-effect btn windows hide" onclick="update('install')"
|
||||
style="margin-left:15px;">Installer ver.</button>
|
||||
<button class="waves-effect btn windows hide" onclick="update('portable')"
|
||||
style="margin-left:15px;">Portable ver.</button>
|
||||
<button class="waves-effect btn linux hide" onclick="update('linux')"
|
||||
style="margin-left:15px;">Start</button>
|
||||
<button class="waves-effect btn mac hide" onclick="update('mac')"
|
||||
style="margin-left:15px;">Start</button>
|
||||
<br>
|
||||
Some problems?<br>Please download on <a href=\"https://thedesk.top\">Oficial HP</a>.
|
||||
</div>
|
||||
<div id="skipper" class="hide">
|
||||
<h4>You may lose a cool experience!</h4>
|
||||
Skip this update<br>
|
||||
<div id="updskip">
|
||||
<a onclick="window.close();" class="pointer skipbtn waves-effect waves-light">
|
||||
<div>Until next TL loading</div>
|
||||
</a>
|
||||
<a onclick="nextv();" class="pointer skipbtn waves-effect waves-light">
|
||||
<div>Until next version</div>
|
||||
</a>
|
||||
</div>
|
||||
<a class="pointer waves-effect" onclick="skipper();" style="margin-top:5px">Continue updating</a>
|
||||
</div>
|
||||
<div id="dlnow" class="hide">
|
||||
<h4>Downloading...</h4>
|
||||
<h4 id="prog"></h4>
|
||||
<div class="progress">
|
||||
<div class="determinate" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="../../js/common/about.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/end.js"></script>
|
||||
<script>
|
||||
function skipper() {
|
||||
$("#dlnow").addClass("hide");
|
||||
$("#box").toggleClass("show");
|
||||
if ($("#box").hasClass("hide") && $("#skipper").hasClass("hide")) {
|
||||
$("#skipper").removeClass("hide");
|
||||
$("#skipper").addClass("show");
|
||||
} else {
|
||||
$("#box").toggleClass("hide");
|
||||
$("#skipper").toggleClass("hide");
|
||||
$("#skipper").toggleClass("show");
|
||||
}
|
||||
}
|
||||
verck();
|
||||
function update(sel) {
|
||||
$("#box").toggleClass("show");
|
||||
$("#box").toggleClass("hide");
|
||||
$("#dlnow").toggleClass("hide");
|
||||
$("#dlnow").toggleClass("show");
|
||||
$("#prog").text("");
|
||||
var bit = localStorage.getItem("bit");
|
||||
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) {
|
||||
if (sel == "install") {
|
||||
if (bit == "x64") {
|
||||
var url = json["winx64"];
|
||||
var file = "TheDesk-setup.exe";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["winia32"];
|
||||
var file = "TheDesk-setup-ia32.exe";
|
||||
}
|
||||
} else if (sel == "portable") {
|
||||
if (bit == "x64") {
|
||||
var url = json["winx64p"];
|
||||
var file = "TheDesk.exe";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["winia32p"];
|
||||
var file = "TheDesk-ia32.exe";
|
||||
}
|
||||
} else if (sel == "linux") {
|
||||
if (bit == "x64") {
|
||||
var url = json["linuxx64"];
|
||||
var file = "TheDesk-linux-x64.zip";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["linuxia64"];
|
||||
var file = "TheDesk-linux-ia32.zip";
|
||||
}
|
||||
} else if (sel == "mac") {
|
||||
var url = json["mac"];
|
||||
shell.openExternal(url);
|
||||
return false;
|
||||
}
|
||||
postMessage(["downloadButton", [url, file]], "*")
|
||||
});
|
||||
|
||||
}
|
||||
function quit() {
|
||||
postMessage(["sendSinmpleIpc", "quit"], "*")
|
||||
}
|
||||
function updateProg(arg) {
|
||||
console.log(arg);
|
||||
$(".determinate").css("width", arg * 100 + "%");
|
||||
$("#prog").text(Math.floor(arg * 100) + "%");
|
||||
}
|
||||
function updateMess(arg) {
|
||||
console.log(arg);
|
||||
$("#prog").text(arg);
|
||||
}
|
||||
function verck() {
|
||||
var platform = localStorage.getItem("platform");
|
||||
var bit = localStorage.getItem("bit");
|
||||
if (platform == "win32") {
|
||||
$('.windows').removeClass("hide")
|
||||
} else if (platform == "linux") {
|
||||
$('.linux').removeClass("hide")
|
||||
} else if (platform == "darwin") {
|
||||
$('.mac').removeClass("hide")
|
||||
}
|
||||
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);
|
||||
if (platform == "win32") {
|
||||
$("#ver").text(json.desk);
|
||||
localStorage.setItem("next-ver", json.desk);
|
||||
} else if (platform == "linux") {
|
||||
$("#ver").text(json.desk_linux);
|
||||
localStorage.setItem("next-ver", json.desk_linux);
|
||||
} else if (platform == "darwin") {
|
||||
$("#ver").text(json.desk_mac);
|
||||
localStorage.setItem("next-ver", json.desk_mac);
|
||||
}
|
||||
var lang = "bg";
|
||||
if (lang == "ja") {
|
||||
$("#det").html(json.detail);
|
||||
} else {
|
||||
$("#det").html(json.detail_en);
|
||||
}
|
||||
|
||||
$("#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>
|
||||
@@ -1,158 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="cs">
|
||||
|
||||
<head>
|
||||
<title>Account Manager - TheDesk</title>
|
||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||
<link href="../../node_modules/materialize-css/dist/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/tl.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../css/userdata.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" 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;
|
||||
}
|
||||
|
||||
.first {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center
|
||||
}
|
||||
|
||||
.first .hide-first {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<meta charset="utf-8">
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body id="mainView">
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<script type="text/javascript" src="../../js/lang/lang.cs.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
<script>
|
||||
var misskeytoken = false;
|
||||
</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>
|
||||
<div class="hide-first">
|
||||
<a href="index.html" class="btn waves-effect orange nex"
|
||||
style="width:100%; max-width:200px;">Zpět</a><br>
|
||||
<h5>Seznam účtů</h5>
|
||||
<div id="acct-list"></div>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<div>
|
||||
<h5>Přidat účet</h5><br>
|
||||
<div id="add">
|
||||
<div class="row">
|
||||
<div class="col s8">
|
||||
<input type="text" id="url" style="width:70%" placeholder="ex)mstdn.jp">
|
||||
<div id="ins-suggest"></div>
|
||||
Uncheck it to skip pasiting code.(login to Mastodon on Windows or macOS) (Recommended: pcheck)<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="linux" />
|
||||
<span>Nastavení kódu</span>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="misskey" />
|
||||
<span>Přihlásit jako Misskey</span>
|
||||
</label><br>
|
||||
<button class="btn waves-effect" onclick="instance()">Login</button><br>
|
||||
</div>
|
||||
<div class="col s4">
|
||||
<span style="font-family:Open Sans;">Supports</span>
|
||||
<div id="support" class="collection transparent"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="auth" style="display:none">
|
||||
Vložte kód a zavřete prohlížeč.<br>
|
||||
<input type="text" id="code" placeholder="Kód">
|
||||
<button class="btn waves-effect" onclick="code()">Auth</button><br>
|
||||
</div>
|
||||
<div id="misskeylogin" style="display:none">
|
||||
<h5>AppSecret</h5>
|
||||
Pro přihlášení do Misskey si přečtěte <a href=\"https://thedesk.top/how-to-misskey-login.html\">dokumentaci (ja)</a>.<br>
|
||||
<input type="hidden" id="misskey-url">
|
||||
<input type="text" id="misskey-key" placeholder="Kód">
|
||||
<button class="btn waves-effect" onclick="misskeyLogin()">Auth</button><br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-first">
|
||||
<h5>Hlavní účet</h5>
|
||||
<div class="input-field" style="width:300px"><span data-trans="your_acct">Vyberte si účet</span>
|
||||
<br>
|
||||
<select id="main-acct-sel" class="acct-sel" style="color:black" onchange="mainacct()"></select>
|
||||
<label></label>
|
||||
</div>
|
||||
Some instance data by <a href="https://instances.social" target="_blank">instances.social API</a><br>
|
||||
<h5 id="ins-title"></h5>
|
||||
Administered by:<a id="ins-admin"></a><br>
|
||||
<span id="ins-desc"></span><br>
|
||||
<img src="../../img/loading.svg" id="ins-prof" width="200"><br>
|
||||
<br>
|
||||
Doména:<span id="ins-name"></span><br>
|
||||
Federované servery:<span id="ins-connect"></span><br>
|
||||
Tooty:<span id="ins-toot"></span><br>
|
||||
Uživatelé:<span id="ins-user"></span>Uživatelé<br>
|
||||
Spojení:<span id="ins-per"></span>%<br>
|
||||
Verze Mastodonu:<span id="ins-ver"></span>@<span id="ins-upd"></span><br>
|
||||
</div>
|
||||
<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/tkn.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>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,476 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="cs" style="overflow:scroll">
|
||||
|
||||
<head>
|
||||
<title>Settings - TheDesk</title>
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||
<link href="../../node_modules/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/themes.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/pickr.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/master.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
input {
|
||||
max-height: 50px !important
|
||||
}
|
||||
|
||||
.pcr-result {
|
||||
height: 1rem !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body id="mainView" style="overflow-y:scroll">
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<script type="text/javascript" src="../../js/lang/lang.cs.js"></script>
|
||||
<script src="https://unpkg.com/json5@^2.0.0/dist/index.min.js"></script>
|
||||
<script src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="setting.vue.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
|
||||
<h4>Předvolby</h4>
|
||||
<ul class="collapsible" data-collapsible="accordion">
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">desktop_windows</i>Systémové předvolby
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h5>Jazyky</h5>
|
||||
To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.<br>
|
||||
<a onclick="changelang('ja')" class="pointer" style="margin-right:5px;">日本語</a><a onclick="changelang('en')" class="pointer" style="margin-right:5px;">English</a><a onclick="changelang('ps')" class="pointer" style="margin-right:5px;">Crowdin translate system(beta)</a><a onclick="changelang('bg')" class="pointer" style="margin-right:5px;">български</a><a onclick="changelang('cs')" class="pointer" style="margin-right:5px;">Česky</a><a onclick="changelang('de')" class="pointer" style="margin-right:5px;">Deutsch</a>
|
||||
<h5>Import a export předvoleb</h5>
|
||||
<button onclick="exportSettings()" class="btn waves-effect lime darken-3"
|
||||
style="width:100%; max-width:200px;">Export</button>
|
||||
<button onclick="importSettings()" class="btn waves-effect cyan darken-3"
|
||||
style="width:100%; max-width:200px;">Import</button>
|
||||
<div id="envView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.id=='notf'"><a onclick="notftest()"
|
||||
class="pointer">Odskoušet oznámení</a><br></template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<label>
|
||||
<input class="with-gap" v-on:click="complete(i,check.value)" v-model="item.setValue"
|
||||
type="radio" v-bind:id="item.id+check.value" v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span>
|
||||
</label>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Změnit</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
<h5>Písmo</h5>
|
||||
Select your favorite font to 'Select'(Windows/ macOS only)<br>
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="font()">Vybrat</button><br>
|
||||
<div id="fonts" class="hide" style="overflow-y:scroll; width:300px; height:500px;"></div>
|
||||
<br>
|
||||
<input type="text" style="width:150px" id="font">
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Uložit</button>
|
||||
<br>
|
||||
<h5>Folder to save</h5>
|
||||
TheDesk uses this value when it try to save pictures or take screenshots.<br>
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="savefolder()">Změnit</button>
|
||||
<br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">color_lens</i>Motivy
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h4>Vybrat motiv</h4>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="black" value="black" />
|
||||
<span>Black</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="white" value="white" />
|
||||
<span>White</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="indigo"
|
||||
value="indigo" />
|
||||
<span>Indigo<span class="imas hide">(エンドレスナイト)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="brown" value="brown" />
|
||||
<span>Brown<span class="imas hide">(ビタースイート・タイム)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="green" value="green" />
|
||||
<span>Green<span class="imas hide">(ユースフルロマンス)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="blue" value="blue" />
|
||||
<span>Blue<span class="imas hide">(渚の花嫁)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="custom"
|
||||
value="custom" />
|
||||
<span>custom</span>
|
||||
</label>
|
||||
<div style="width:300px" id="sel-selector">
|
||||
<select id="custom-sel-sel" class="custom-sel" onchange="customSel()"></select>
|
||||
</div>
|
||||
<h4>Edit and add custom themes</h4>
|
||||
<div style="width:300px" id="edit-selector" data-add="Add new">
|
||||
<select id="custom-edit-sel" class="custom-sel" onchange="custom()">
|
||||
<option value="add_new">Add new</option>
|
||||
</select>
|
||||
</div>
|
||||
<h5>Name</h5>
|
||||
<input type="text" style="width:300px" id="custom_name" placeholder="Name...">
|
||||
<h5>About this theme</h5>
|
||||
<div class="input-field"><textarea style="width:300px" id="custom_desc" class="materialize-textarea"
|
||||
placeholder="About this theme..."></textarea></div>
|
||||
<h5>Color scheme</h5>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="direction" type="radio" id="dark" value="dark"
|
||||
checked="true" />
|
||||
<span>Dark</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="direction" type="radio" id="light"
|
||||
value="light" />
|
||||
<span>Light</span>
|
||||
</label>
|
||||
<div id="pickers">
|
||||
<div>
|
||||
<h5>Primary</h5>Background of components
|
||||
<div id="color-picker0-wrap">
|
||||
<div class="color-picker" id="color-picker0"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker0_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Secondary</h5>Background color
|
||||
<div id="color-picker1-wrap">
|
||||
<div class="color-picker" id="color-picker1"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker1_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Texts</h5>Text color
|
||||
<div id="color-picker2-wrap">
|
||||
<div class="color-picker" id="color-picker2"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker2_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Accent</h5>Background of boosts
|
||||
<div id="color-picker3-wrap">
|
||||
<div class="color-picker" id="color-picker3"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker3_value">
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn-large waves-effect" onclick="customComp()">Změnit</button> <button
|
||||
class="btn waves-effect red disabled" id="delTheme" onclick="deleteIt()">Delete</button><br><br>
|
||||
<input type="text" style="width:300px;height:40px;" id="custom_json" class="materialize-textarea"
|
||||
placeholder="JSON style" readonly><br>
|
||||
Share this code with other TheDesk. Do not share this code with MiAS.
|
||||
<h4>Import of custom themes</h4>
|
||||
Get more themes on <a href=\"https://assets.msky.cafe/\" target=\"_blank\">MiAS</a><br>
|
||||
<input type="text" style="width:300px;height:40px;" id="custom_import" class="materialize-textarea"
|
||||
placeholder="JSON/JSON5 style">
|
||||
<button class="btn waves-effect" onclick="customImp()">Import</button><br>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">reorder</i>Timeline Preferences
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<div id="tlView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<label>
|
||||
<input class="with-gap" v-on:click="complete(i,check.value)" v-model="item.setValue"
|
||||
type="radio" v-bind:id="item.id+check.value" v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span>
|
||||
</label>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Změnit</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
<h5>Custom sound</h5>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(1)">Custom 1</button><span
|
||||
id="c1-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(2)">Custom 2</button><span
|
||||
id="c2-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(3)">Custom 3</button><span
|
||||
id="c3-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(4)">Custom 4</button><span
|
||||
id="c4-file"></span><br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">send</i>Posting Preferences
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<div id="postView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<template v-if="!check.kirishima || (check.kirishima && kirishima)">
|
||||
<label><input class="with-gap" v-on:click="complete(i,check.value)"
|
||||
v-model="item.setValue" type="radio" v-bind:id="item.id+check.value"
|
||||
v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span></label>
|
||||
<span v-if="check.kirishimaText">{{check.kirishimaText}}</span>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Změnit</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
</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;">Uložit</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;">Uložit</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;">Uložit</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;">Uložit</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;">Uložit</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="fab fa-spotify"></i>Spotify and NowPlaying Preferences
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<br><br>
|
||||
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;">Uložit</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>@@templateedit@@</h5>
|
||||
@@templateeditwarn@@<br>
|
||||
<textarea id="np-temp" class="materialize-textarea" data-length="500">#NowPlaying {song} / {album} / {artist}
|
||||
{url}</textarea><br>
|
||||
@@template1@@<br>
|
||||
@@template2@@<br>
|
||||
@@template3@@<br>
|
||||
<button onclick="spotifySave()" class="btn waves-effect" style="width:100px;">Uložit</button>
|
||||
<h5>Attach an Artwork of Spotify</h5>
|
||||
<label>
|
||||
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_yes"
|
||||
value="yes" />
|
||||
<span>Ano</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_no"
|
||||
value="no" />
|
||||
<span>Ne</span>
|
||||
</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()">Uložit</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+Enter+Shift:Post(secondary toot)</li>
|
||||
<li>Alt+Enter:Secondary Toot Button</li>
|
||||
<li>Ctrl+E:Make all notifications read</li>
|
||||
<li>Ctrl+U:@@keyselecttop@@</li>
|
||||
<li>Esc:Hide toot box</li>
|
||||
<li>F5:Super Reload</li>
|
||||
<li>Ctrl+Shift+C:Clear toot box</li>
|
||||
<li>Ctrl+Shift+S:Předvolby</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>
|
||||
以下アスタルテにログインしている場合のみ
|
||||
<br>
|
||||
<li>Ctrl+R:
|
||||
<a href="https://astarte.thedesk.top">アスタルテ暇人ランキング</a>を開く
|
||||
</li><br>
|
||||
@@whenSelected@@
|
||||
<li>F:@@fav@@</li>
|
||||
<li>B:@@bt@@</li>
|
||||
<li>R:@@reply@@</li>
|
||||
</div>
|
||||
<button class="btn waves-effect red" style="width:100%; max-width:500px;"
|
||||
onclick="if(confirm('Delete all data. You cannot undo. Continue?')){ 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://www.pixiv.net/fanbox/creator/28105985" class="btn waves-effect red lighten-2"
|
||||
style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>Support(Pixiv FANBOX)</a>
|
||||
<a href="https://www.patreon.com/cutls" class="btn waves-effect red darken-2"
|
||||
style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>Support(Patreon)</a>
|
||||
<a href="https://liberapay.com/cutls" class="btn waves-effect black-text"
|
||||
style="width:100%; max-width:500px; background-color: #f6c915"><i class="material-icons left">trending_up</i>Support(Liberapay)</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</a>
|
||||
<a href="https://github.com/cutls/TheDesk" class="btn waves-effect black lighten-2"
|
||||
style="width:100%; max-width:500px;"><i class="fab fa-github left"></i>GitHub</a>
|
||||
<a href="index.html?mode=user&code=Cutls@cutls.com" 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@cutls.com</a>
|
||||
<br>
|
||||
Kyash<br>
|
||||
<img src="../../img/kyash.png" width="100"><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 © TheDesk 2018
|
||||
Under <a href="https://github.com/cutls/TheDesk/blob/master/LICENSE">GNU General Public License v3.0</a> and <a
|
||||
href="https://thedesk.top/tos.html">Terms of Use</a>/<a href="https://thedesk.top/priv.html">Privacy
|
||||
Policy</a>
|
||||
<br>Developer: Cutls P(
|
||||
<a href="index.html?mode=user&code=Cutls@cutls.com">@Cutls@cutls.com</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/modal.js"></script>
|
||||
<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/platform/pickr.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>
|
||||
@@ -1,552 +0,0 @@
|
||||
var yesno = [
|
||||
{
|
||||
text: "Ano",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Ne",
|
||||
value: "no"
|
||||
}
|
||||
];
|
||||
var sound = [
|
||||
{
|
||||
text: "None",
|
||||
value: "none"
|
||||
}, {
|
||||
text: "Default",
|
||||
value: "default"
|
||||
}, {
|
||||
text: "Custom 1",
|
||||
value: "c1"
|
||||
}, {
|
||||
text: "Custom 2",
|
||||
value: "c2"
|
||||
}, {
|
||||
text: "Custom 3",
|
||||
value: "c3"
|
||||
}, {
|
||||
text: "Custom 4",
|
||||
value: "c4"
|
||||
}
|
||||
];
|
||||
var envConstruction = [
|
||||
{
|
||||
id: "popup",
|
||||
storage: "popup",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
setValue: 0,
|
||||
width: 50,
|
||||
text: {
|
||||
head: "Popupová oznámení (na Windows)",
|
||||
desc: "Hide to set \"0\"",
|
||||
after: "sec"
|
||||
}
|
||||
}, {
|
||||
id: "notf",
|
||||
storage: "nativenotf",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Native notification",
|
||||
desc: "This does not work on Windows Portable ver.",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "width",
|
||||
storage: "width",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 50,
|
||||
setValue: 300,
|
||||
text: {
|
||||
head: "Minimum width of columns",
|
||||
desc: "Scroll bar will be shown when your window size is more than ammounts of columns.",
|
||||
after: "px above"
|
||||
}
|
||||
}, {
|
||||
id: "fixwidth",
|
||||
storage: "fixwidth",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
setValue: 300,
|
||||
width: 50,
|
||||
text: {
|
||||
head: "Minimální šířka TweetDeck prohlížeče",
|
||||
desc: "",
|
||||
after: "px above"
|
||||
}
|
||||
}, {
|
||||
id: "size",
|
||||
storage: "size",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 50,
|
||||
setValue: 13,
|
||||
text: {
|
||||
head: "Velikost písma",
|
||||
desc: "<span style=\"font-size:13px\">13px(absolutní hodnota)</span>",
|
||||
after: "px"
|
||||
}
|
||||
}, {
|
||||
id: "ha",
|
||||
storage: "ha",
|
||||
checkbox: true,
|
||||
setValue: false,
|
||||
text: {
|
||||
head: "Disable hardware acceleration",
|
||||
desc: "Auto restarted",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Ano",
|
||||
value: "true"
|
||||
}, {
|
||||
text: "Ne",
|
||||
value: "false"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
var tlConstruction = [
|
||||
{
|
||||
id: "time",
|
||||
storage: "datetype",
|
||||
checkbox: true,
|
||||
setValue: "absolute",
|
||||
text: {
|
||||
head: "Časový formát",
|
||||
desc: "Relativní formát: „před 1 minutou“, „před 3 dny“<br>Absolutní formát: „23:25:21“, „2017/12/30 23:59:00“<br>Smíšený formát: tooty publikované dnes jsou v relativním formátu, ostatní jsou v absolutním formátu.",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Relativní",
|
||||
value: "relative"
|
||||
}, {
|
||||
text: "Absolutní",
|
||||
value: "absolute"
|
||||
}, {
|
||||
text: "Relativní i absolutní",
|
||||
value: "double"
|
||||
}, {
|
||||
text: "Smíšený",
|
||||
value: "medium"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "ul",
|
||||
storage: "locale",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Server's unique locale",
|
||||
desc: "This value is available on some Japanese servers",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "nsfw",
|
||||
storage: "nsfw",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Skrývat citlivé obrázky",
|
||||
desc: "Silný efekt rozmazání",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "cw",
|
||||
storage: "cw",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Skrývat obsah za varováními",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "rp",
|
||||
storage: "replyct",
|
||||
checkbox: true,
|
||||
setValue: "hidden",
|
||||
text: {
|
||||
head: "Reply counter style",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Show 1+ if the replies are more than 1.",
|
||||
value: "hidden"
|
||||
}, {
|
||||
text: "Show 1+ if the replies are more than 1.",
|
||||
value: "all"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "gif",
|
||||
storage: "gif",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Animated GIF images animation",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "tag",
|
||||
storage: "tag-range",
|
||||
checkbox: true,
|
||||
setValue: "local",
|
||||
text: {
|
||||
head: "Tag TL Search",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Use federated network",
|
||||
value: "all"
|
||||
}, {
|
||||
text: "Use local network",
|
||||
value: "local"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "via",
|
||||
storage: "viashow",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Show via",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "mov",
|
||||
storage: "mouseover",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Skrýt akční tlačítka bez přejetí myši",
|
||||
desc: "„Přejetí myši“ pro vás může být nepohodlné :(",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Zobrazit přejetím myši",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Zobrazit kliknutím",
|
||||
value: "click"
|
||||
}, {
|
||||
text: "Ne",
|
||||
value: "no"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "notfm",
|
||||
storage: "setasread",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Show Notification marker, red colored bell and counter(if you show a notification column.)",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
checkbox: false,
|
||||
doubleText: true,
|
||||
data: [
|
||||
{
|
||||
id: "sentence",
|
||||
storage: "sentence",
|
||||
width: 50,
|
||||
setValue: 500,
|
||||
text: { after: "lines above or" }
|
||||
}, {
|
||||
id: "letters",
|
||||
storage: "letters",
|
||||
width: 50,
|
||||
setValue: 7000,
|
||||
text: { after: "letters above" }
|
||||
}
|
||||
],
|
||||
text: {
|
||||
head: "Auto folding",
|
||||
desc: "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.",
|
||||
}
|
||||
}, {
|
||||
id: "img-height",
|
||||
storage: "img-height",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 80,
|
||||
setValue: 200,
|
||||
text: {
|
||||
head: "Height of images",
|
||||
desc: "Option:Set \"full\" to uncrop.",
|
||||
after: "px"
|
||||
}
|
||||
}, {
|
||||
id: "ticker",
|
||||
storage: "ticker_ok",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Enable #InstanceTicker",
|
||||
desc: "Show colorful stickers about the server. <a href=\"https://cdn.weep.me/mastodon/\">About #InstanceTicker</a> Copyright 2018 weepjp, kyori19.",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "anime",
|
||||
storage: "animation",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Animation of timelines",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "replySound",
|
||||
storage: "replySound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Sound(Reply)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "favSound",
|
||||
storage: "favSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Sound(Fav)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "btSound",
|
||||
storage: "btSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Sound(Boost)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "followSound",
|
||||
storage: "followSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Sound(Follow)",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}
|
||||
];
|
||||
var postConstruction = [
|
||||
{
|
||||
id: "cw-text",
|
||||
storage: "cw-text",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 150,
|
||||
setValue: "",
|
||||
text: {
|
||||
head: "Default warining text",
|
||||
desc: "",
|
||||
after: ""
|
||||
}
|
||||
}, {
|
||||
checkbox: false,
|
||||
doubleText: true,
|
||||
data: [
|
||||
{
|
||||
id: "cw_sentence",
|
||||
storage: "cw_sentence",
|
||||
width: 50,
|
||||
setValue: 500,
|
||||
text: { after: "lines above or" }
|
||||
}, {
|
||||
id: "cw_letters",
|
||||
storage: "cw_letters",
|
||||
width: 50,
|
||||
setValue: 7000,
|
||||
text: { after: "letters above" }
|
||||
}
|
||||
],
|
||||
text: {
|
||||
head: "Alert before posting a long toot.",
|
||||
desc: "Show dialog whether you make too-long text hidden.",
|
||||
}
|
||||
}, {
|
||||
id: "cws",
|
||||
storage: "always-cw",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Always CW set",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "vis",
|
||||
storage: "vis",
|
||||
checkbox: true,
|
||||
setValue: "public",
|
||||
text: {
|
||||
head: "Výchozí viditelnost",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Veřejné",
|
||||
value: "public"
|
||||
}, {
|
||||
text: "Neuvedené",
|
||||
value: "unlisted"
|
||||
}, {
|
||||
text: "Soukromé",
|
||||
value: "private"
|
||||
}, {
|
||||
text: "Přímé",
|
||||
value: "direct"
|
||||
}, {
|
||||
text: "Memory(memorized as each server)",
|
||||
value: "memory"
|
||||
}, {
|
||||
text: "Default of your visibility(Set on preferences of Mastodon server)",
|
||||
value: "useapi"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "img",
|
||||
storage: "img",
|
||||
checkbox: true,
|
||||
setValue: "no-act",
|
||||
text: {
|
||||
head: "Posting images preferences",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Insert media URL",
|
||||
value: "url"
|
||||
}, {
|
||||
text: "Insert nothig",
|
||||
value: "no-act"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "box",
|
||||
storage: "box",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Action of posting-box",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Folding",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Open after posting",
|
||||
value: "no"
|
||||
}, {
|
||||
text: "Absolutely open",
|
||||
value: "absolute"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "quote",
|
||||
storage: "quote",
|
||||
checkbox: true,
|
||||
setValue: "nothing",
|
||||
text: {
|
||||
head: "Quote format",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Only URL",
|
||||
value: "simple"
|
||||
}, {
|
||||
text: "URL and acct(mention to the user)",
|
||||
value: "mention"
|
||||
}, {
|
||||
text: "URL, text and acct(mention to the user)",
|
||||
value: "full"
|
||||
}, {
|
||||
text: "Disabled(Hide buttons on TLs)",
|
||||
value: "nothing"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "main",
|
||||
storage: "mainuse",
|
||||
checkbox: true,
|
||||
setValue: "remain",
|
||||
text: {
|
||||
head: "Default accounts of actions",
|
||||
desc: "Main account can be set on Account Manager.",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Account you used recently",
|
||||
value: "remain"
|
||||
}, {
|
||||
text: "Main account",
|
||||
value: "main"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "sec",
|
||||
storage: "sec",
|
||||
checkbox: true,
|
||||
setValue: "public",
|
||||
text: {
|
||||
head: "Secondary Toot Button",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Hidden",
|
||||
value: "nothing"
|
||||
}, {
|
||||
text: "Veřejné",
|
||||
value: "public"
|
||||
}, {
|
||||
text: "Neuvedené",
|
||||
value: "unlisted"
|
||||
}, {
|
||||
text: "Soukromé",
|
||||
value: "private"
|
||||
}, {
|
||||
text: "Přímé",
|
||||
value: "direct"
|
||||
}, {
|
||||
text: "Local Only",
|
||||
value: "local",
|
||||
kirishima: true,
|
||||
kirishimaText: "非対応インスタンスでは「未収載」になります。"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "zero",
|
||||
storage: "emoji-zero-width",
|
||||
checkbox: true,
|
||||
setValue: "normal",
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Zero-width space when inserting emojis",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,254 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="cs">
|
||||
|
||||
<head>
|
||||
<title>Update - TheDesk</title>
|
||||
<link href="../../node_modules/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/master.css" type="text/css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Open Sans';
|
||||
-webkit-app-region: drag;
|
||||
cursor: move;
|
||||
padding: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#start {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100vw;
|
||||
height: calc(100vh - 2.5rem);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#checkbox {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
a,
|
||||
button,
|
||||
input,
|
||||
label,
|
||||
i {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
#updskip {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.skipbtn {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border: 1px solid;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px solid;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.skipbtn:hover {
|
||||
background-color: #b3e5fc;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
#prog {
|
||||
font-size: 200%;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<i class="material-icons pointer waves-effect" onclick="about();">info</i>
|
||||
<i class="material-icons pointer waves-effect" onclick="skipper();">clear</i>
|
||||
<!--a href="update.html">Reload</a-->
|
||||
<div id="start">
|
||||
<div id="box" class="show">
|
||||
<h2>TheDesk</h2>
|
||||
<p>Získejte nejnovější TheDesk</p>
|
||||
<span id="now"></span>→<b id="ver"></b><br>
|
||||
<span id="det"></span><br>
|
||||
<button class="waves-effect btn windows hide" onclick="update('install')"
|
||||
style="margin-left:15px;">Verze instalátoru</button>
|
||||
<button class="waves-effect btn windows hide" onclick="update('portable')"
|
||||
style="margin-left:15px;">Přenosná verze</button>
|
||||
<button class="waves-effect btn linux hide" onclick="update('linux')"
|
||||
style="margin-left:15px;">Začít</button>
|
||||
<button class="waves-effect btn mac hide" onclick="update('mac')"
|
||||
style="margin-left:15px;">Začít</button>
|
||||
<br>
|
||||
Máte problémy?<br>Prosím stáhněte si aktualizaci na <a href=\"https://thedesk.top\">oficiální stránce</a>.
|
||||
</div>
|
||||
<div id="skipper" class="hide">
|
||||
<h4>Můžete ztratit úžasné nové funkce!</h4>
|
||||
Přeskočit tuto aktualizaci<br>
|
||||
<div id="updskip">
|
||||
<a onclick="window.close();" class="pointer skipbtn waves-effect waves-light">
|
||||
<div>Do dalšího načtení časové osy</div>
|
||||
</a>
|
||||
<a onclick="nextv();" class="pointer skipbtn waves-effect waves-light">
|
||||
<div>Do příští verze</div>
|
||||
</a>
|
||||
</div>
|
||||
<a class="pointer waves-effect" onclick="skipper();" style="margin-top:5px">Pokračovat v aktualizaci</a>
|
||||
</div>
|
||||
<div id="dlnow" class="hide">
|
||||
<h4>Stahuji...</h4>
|
||||
<h4 id="prog"></h4>
|
||||
<div class="progress">
|
||||
<div class="determinate" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="../../js/common/about.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/end.js"></script>
|
||||
<script>
|
||||
function skipper() {
|
||||
$("#dlnow").addClass("hide");
|
||||
$("#box").toggleClass("show");
|
||||
if ($("#box").hasClass("hide") && $("#skipper").hasClass("hide")) {
|
||||
$("#skipper").removeClass("hide");
|
||||
$("#skipper").addClass("show");
|
||||
} else {
|
||||
$("#box").toggleClass("hide");
|
||||
$("#skipper").toggleClass("hide");
|
||||
$("#skipper").toggleClass("show");
|
||||
}
|
||||
}
|
||||
verck();
|
||||
function update(sel) {
|
||||
$("#box").toggleClass("show");
|
||||
$("#box").toggleClass("hide");
|
||||
$("#dlnow").toggleClass("hide");
|
||||
$("#dlnow").toggleClass("show");
|
||||
$("#prog").text("");
|
||||
var bit = localStorage.getItem("bit");
|
||||
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) {
|
||||
if (sel == "install") {
|
||||
if (bit == "x64") {
|
||||
var url = json["winx64"];
|
||||
var file = "TheDesk-setup.exe";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["winia32"];
|
||||
var file = "TheDesk-setup-ia32.exe";
|
||||
}
|
||||
} else if (sel == "portable") {
|
||||
if (bit == "x64") {
|
||||
var url = json["winx64p"];
|
||||
var file = "TheDesk.exe";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["winia32p"];
|
||||
var file = "TheDesk-ia32.exe";
|
||||
}
|
||||
} else if (sel == "linux") {
|
||||
if (bit == "x64") {
|
||||
var url = json["linuxx64"];
|
||||
var file = "TheDesk-linux-x64.zip";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["linuxia64"];
|
||||
var file = "TheDesk-linux-ia32.zip";
|
||||
}
|
||||
} else if (sel == "mac") {
|
||||
var url = json["mac"];
|
||||
shell.openExternal(url);
|
||||
return false;
|
||||
}
|
||||
postMessage(["downloadButton", [url, file]], "*")
|
||||
});
|
||||
|
||||
}
|
||||
function quit() {
|
||||
postMessage(["sendSinmpleIpc", "quit"], "*")
|
||||
}
|
||||
function updateProg(arg) {
|
||||
console.log(arg);
|
||||
$(".determinate").css("width", arg * 100 + "%");
|
||||
$("#prog").text(Math.floor(arg * 100) + "%");
|
||||
}
|
||||
function updateMess(arg) {
|
||||
console.log(arg);
|
||||
$("#prog").text(arg);
|
||||
}
|
||||
function verck() {
|
||||
var platform = localStorage.getItem("platform");
|
||||
var bit = localStorage.getItem("bit");
|
||||
if (platform == "win32") {
|
||||
$('.windows').removeClass("hide")
|
||||
} else if (platform == "linux") {
|
||||
$('.linux').removeClass("hide")
|
||||
} else if (platform == "darwin") {
|
||||
$('.mac').removeClass("hide")
|
||||
}
|
||||
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);
|
||||
if (platform == "win32") {
|
||||
$("#ver").text(json.desk);
|
||||
localStorage.setItem("next-ver", json.desk);
|
||||
} else if (platform == "linux") {
|
||||
$("#ver").text(json.desk_linux);
|
||||
localStorage.setItem("next-ver", json.desk_linux);
|
||||
} else if (platform == "darwin") {
|
||||
$("#ver").text(json.desk_mac);
|
||||
localStorage.setItem("next-ver", json.desk_mac);
|
||||
}
|
||||
var lang = "cs";
|
||||
if (lang == "ja") {
|
||||
$("#det").html(json.detail);
|
||||
} else {
|
||||
$("#det").html(json.detail_en);
|
||||
}
|
||||
|
||||
$("#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>
|
||||
@@ -1,158 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<title>Account Manager - TheDesk</title>
|
||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||
<link href="../../node_modules/materialize-css/dist/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/tl.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../css/userdata.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" 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;
|
||||
}
|
||||
|
||||
.first {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center
|
||||
}
|
||||
|
||||
.first .hide-first {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<meta charset="utf-8">
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body id="mainView">
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<script type="text/javascript" src="../../js/lang/lang.de.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
<script>
|
||||
var misskeytoken = false;
|
||||
</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>
|
||||
<div class="hide-first">
|
||||
<a href="index.html" class="btn waves-effect orange nex"
|
||||
style="width:100%; max-width:200px;">Zurück</a><br>
|
||||
<h5>Konten</h5>
|
||||
<div id="acct-list"></div>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<div>
|
||||
<h5>Konto hinzufügen</h5><br>
|
||||
<div id="add">
|
||||
<div class="row">
|
||||
<div class="col s8">
|
||||
<input type="text" id="url" style="width:70%" placeholder="ex)mstdn.jp">
|
||||
<div id="ins-suggest"></div>
|
||||
Uncheck it to skip pasiting code.(login to Mastodon on Windows or macOS) (Recommended: pcheck)<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="linux" />
|
||||
<span>Code-Setup</span>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="misskey" />
|
||||
<span>Als Misskey anmelden</span>
|
||||
</label><br>
|
||||
<button class="btn waves-effect" onclick="instance()">Login</button><br>
|
||||
</div>
|
||||
<div class="col s4">
|
||||
<span style="font-family:Open Sans;">Supports</span>
|
||||
<div id="support" class="collection transparent"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="auth" style="display:none">
|
||||
Fügen Sie den Code ein und schließen Sie den Browser.<br>
|
||||
<input type="text" id="code" placeholder="Code">
|
||||
<button class="btn waves-effect" onclick="code()">Auth</button><br>
|
||||
</div>
|
||||
<div id="misskeylogin" style="display:none">
|
||||
<h5>AppSecret</h5>
|
||||
Lies die <a href=\"https://thedesk.top/how-to-misskey-login.html\">Doku (japanisch)</a> um dich bei Misskey einzuloggen.<br>
|
||||
<input type="hidden" id="misskey-url">
|
||||
<input type="text" id="misskey-key" placeholder="Code">
|
||||
<button class="btn waves-effect" onclick="misskeyLogin()">Auth</button><br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-first">
|
||||
<h5>Hauptkonto</h5>
|
||||
<div class="input-field" style="width:300px"><span data-trans="your_acct">Konto auswählen</span>
|
||||
<br>
|
||||
<select id="main-acct-sel" class="acct-sel" style="color:black" onchange="mainacct()"></select>
|
||||
<label></label>
|
||||
</div>
|
||||
Some instance data by <a href="https://instances.social" target="_blank">instances.social API</a><br>
|
||||
<h5 id="ins-title"></h5>
|
||||
Administered by:<a id="ins-admin"></a><br>
|
||||
<span id="ins-desc"></span><br>
|
||||
<img src="../../img/loading.svg" id="ins-prof" width="200"><br>
|
||||
<br>
|
||||
Domain:<span id="ins-name"></span><br>
|
||||
Föderierte Server:<span id="ins-connect"></span><br>
|
||||
Toots:<span id="ins-toot"></span><br>
|
||||
Nutzer:<span id="ins-user"></span>Nutzer<br>
|
||||
Verbindung:<span id="ins-per"></span>%<br>
|
||||
Mastodon Version:<span id="ins-ver"></span>@<span id="ins-upd"></span><br>
|
||||
</div>
|
||||
<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/tkn.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>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,476 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="de" style="overflow:scroll">
|
||||
|
||||
<head>
|
||||
<title>Settings - TheDesk</title>
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||
<link href="../../node_modules/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/themes.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/pickr.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/master.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
input {
|
||||
max-height: 50px !important
|
||||
}
|
||||
|
||||
.pcr-result {
|
||||
height: 1rem !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body id="mainView" style="overflow-y:scroll">
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<script type="text/javascript" src="../../js/lang/lang.de.js"></script>
|
||||
<script src="https://unpkg.com/json5@^2.0.0/dist/index.min.js"></script>
|
||||
<script src="../../node_modules/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="setting.vue.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
|
||||
<h4>Einstellungen</h4>
|
||||
<ul class="collapsible" data-collapsible="accordion">
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">desktop_windows</i>Systemeinstellungen
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h5>Sprachen</h5>
|
||||
To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.<br>
|
||||
<a onclick="changelang('ja')" class="pointer" style="margin-right:5px;">日本語</a><a onclick="changelang('en')" class="pointer" style="margin-right:5px;">English</a><a onclick="changelang('ps')" class="pointer" style="margin-right:5px;">Crowdin translate system(beta)</a><a onclick="changelang('bg')" class="pointer" style="margin-right:5px;">български</a><a onclick="changelang('cs')" class="pointer" style="margin-right:5px;">Česky</a><a onclick="changelang('de')" class="pointer" style="margin-right:5px;">Deutsch</a>
|
||||
<h5>Import und Export von Einstellungen</h5>
|
||||
<button onclick="exportSettings()" class="btn waves-effect lime darken-3"
|
||||
style="width:100%; max-width:200px;">Export</button>
|
||||
<button onclick="importSettings()" class="btn waves-effect cyan darken-3"
|
||||
style="width:100%; max-width:200px;">Import</button>
|
||||
<div id="envView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.id=='notf'"><a onclick="notftest()"
|
||||
class="pointer">Benachrichtigungen testen</a><br></template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<label>
|
||||
<input class="with-gap" v-on:click="complete(i,check.value)" v-model="item.setValue"
|
||||
type="radio" v-bind:id="item.id+check.value" v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span>
|
||||
</label>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Ändern</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
<h5>Schriftart</h5>
|
||||
Wählen Sie Ihre Lieblingsschrift. 'Select'(nur Windows/ macOS)<br>
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="font()">Auswahl</button><br>
|
||||
<div id="fonts" class="hide" style="overflow-y:scroll; width:300px; height:500px;"></div>
|
||||
<br>
|
||||
<input type="text" style="width:150px" id="font">
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="settings()">Speichern</button>
|
||||
<br>
|
||||
<h5>Ordner zum Speichern</h5>
|
||||
TheDesk verwendet diesen Ordner, wenn es versucht Bilder zu speichern oder Screenshots zu machen.<br>
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="savefolder()">Ändern</button>
|
||||
<br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">color_lens</i>Designs
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h4>Design auswählen</h4>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="black" value="black" />
|
||||
<span>Black</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="white" value="white" />
|
||||
<span>White</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="indigo"
|
||||
value="indigo" />
|
||||
<span>Indigo<span class="imas hide">(エンドレスナイト)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="brown" value="brown" />
|
||||
<span>Brown<span class="imas hide">(ビタースイート・タイム)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="green" value="green" />
|
||||
<span>Green<span class="imas hide">(ユースフルロマンス)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="blue" value="blue" />
|
||||
<span>Blue<span class="imas hide">(渚の花嫁)</span></span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="theme" type="radio" id="custom"
|
||||
value="custom" />
|
||||
<span>custom</span>
|
||||
</label>
|
||||
<div style="width:300px" id="sel-selector">
|
||||
<select id="custom-sel-sel" class="custom-sel" onchange="customSel()"></select>
|
||||
</div>
|
||||
<h4>Bearbeiten und hinzufügen von eigenen Designs</h4>
|
||||
<div style="width:300px" id="edit-selector" data-add="Neues hinzufügen">
|
||||
<select id="custom-edit-sel" class="custom-sel" onchange="custom()">
|
||||
<option value="add_new">Neues hinzufügen</option>
|
||||
</select>
|
||||
</div>
|
||||
<h5>Name</h5>
|
||||
<input type="text" style="width:300px" id="custom_name" placeholder="Name...">
|
||||
<h5>Über dieses Design</h5>
|
||||
<div class="input-field"><textarea style="width:300px" id="custom_desc" class="materialize-textarea"
|
||||
placeholder="Über dieses Design..."></textarea></div>
|
||||
<h5>Farbschema</h5>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="direction" type="radio" id="dark" value="dark"
|
||||
checked="true" />
|
||||
<span>Dark</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="settings()" name="direction" type="radio" id="light"
|
||||
value="light" />
|
||||
<span>Light</span>
|
||||
</label>
|
||||
<div id="pickers">
|
||||
<div>
|
||||
<h5>Primary</h5>Hintergrund der Komponenten
|
||||
<div id="color-picker0-wrap">
|
||||
<div class="color-picker" id="color-picker0"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker0_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Secondary</h5>Hintergrundfarbe
|
||||
<div id="color-picker1-wrap">
|
||||
<div class="color-picker" id="color-picker1"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker1_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Texts</h5>Textfarbe
|
||||
<div id="color-picker2-wrap">
|
||||
<div class="color-picker" id="color-picker2"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker2_value">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Accent</h5>Hintergrund des Boosts
|
||||
<div id="color-picker3-wrap">
|
||||
<div class="color-picker" id="color-picker3"></div>
|
||||
</div>
|
||||
<input type="hidden" id="color-picker3_value">
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn-large waves-effect" onclick="customComp()">Ändern</button> <button
|
||||
class="btn waves-effect red disabled" id="delTheme" onclick="deleteIt()">Löschen</button><br><br>
|
||||
<input type="text" style="width:300px;height:40px;" id="custom_json" class="materialize-textarea"
|
||||
placeholder="JSON style" readonly><br>
|
||||
Teilen Sie diesen Code mit anderen TheDesk. Teilen Sie diesen Code nicht mit MiAS.
|
||||
<h4>Import von eigenen Designs</h4>
|
||||
Mehr Designs auf: <a href=\"https://assets.msky.cafe/\" target=\"_blank\">MiAS</a><br>
|
||||
<input type="text" style="width:300px;height:40px;" id="custom_import" class="materialize-textarea"
|
||||
placeholder="JSON/JSON5 style">
|
||||
<button class="btn waves-effect" onclick="customImp()">Import</button><br>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">reorder</i>Verlaufseinstellungen
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<div id="tlView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<label>
|
||||
<input class="with-gap" v-on:click="complete(i,check.value)" v-model="item.setValue"
|
||||
type="radio" v-bind:id="item.id+check.value" v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span>
|
||||
</label>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Ändern</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
<h5>Eigener Ton</h5>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(1)">Custom 1</button><span
|
||||
id="c1-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(2)">Custom 2</button><span
|
||||
id="c2-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(3)">Custom 3</button><span
|
||||
id="c3-file"></span><br>
|
||||
<button class="btn waves-effect" style="width:120px;" onclick="customSound(4)">Custom 4</button><span
|
||||
id="c4-file"></span><br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">send</i>Einstellungen für Tröts Senden
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<div id="postView">
|
||||
<template v-for="(item, i) in config">
|
||||
<h5>{{item.text.head}}</h5>
|
||||
<template v-if="item.text.desc">
|
||||
<span v-html="item.text.desc"></span><br>
|
||||
</template>
|
||||
<template v-if="item.checkbox">
|
||||
<template v-for="(check, j) in item.text.checkbox">
|
||||
<template v-if="!check.kirishima || (check.kirishima && kirishima)">
|
||||
<label><input class="with-gap" v-on:click="complete(i,check.value)"
|
||||
v-model="item.setValue" type="radio" v-bind:id="item.id+check.value"
|
||||
v-bind:value="check.value" />
|
||||
<span>{{check.text}}</span></label>
|
||||
<span v-if="check.kirishimaText">{{check.kirishimaText}}</span>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="item.doubleText">
|
||||
<template v-for="(textbox, j) in item.data">
|
||||
<input type="text" v-model="textbox.setValue" type="radio" v-bind:id="textbox.id"
|
||||
v-bind:style="{ width: textbox.width+'px'}" />{{textbox.text.after}}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<input type="text" v-model="item.setValue" type="radio" v-bind:id="item.id"
|
||||
v-bind:style="{ width: item.width+'px'}" />{{item.text.after}}
|
||||
</template>
|
||||
<button class="btn waves-effect" style="width:100px;"
|
||||
v-on:click="complete(i)">Ändern</button>
|
||||
</template><br>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">keyboard</i>Tastaturkürzel Einstellungen
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h5>Schnell Einfügen</h5>
|
||||
Sie können Buchstaben und Emojis mit 3-Tasten-Kombination einfügen<br>
|
||||
Ctrl+Shift+1:<input type="text" style="width:150px" id="oks-1">
|
||||
<button onclick="oks(1)" class="btn waves-effect" style="width:100px;">Speichern</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;">Speichern</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;">Speichern</button><br><br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">bookmark</i>Einstellungen für Stumm & Hervorheben
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h5>Client Stumm</h5>
|
||||
<div id="mute-cli"></div>
|
||||
<h5>Client Hervorheben</h5>
|
||||
Klicken Sie auf den Client-Namen des Tröts, um Ausblenden oder Hervorheben umzuschalten.
|
||||
<h5>Wörter Ausblenden</h5>
|
||||
\"Enter\" zum setzen<br>
|
||||
<div class="chips" id="wordmute" style="background-color:gray;"></div>
|
||||
<button onclick="wordmuteSave()" class="btn waves-effect" style="width:100px;">Speichern</button>
|
||||
<h5>Wörter Hervorheben</h5>
|
||||
\"Enter\" zum setzen<br>
|
||||
<div class="chips" id="wordemp" style="background-color:gray;"></div>
|
||||
<button onclick="wordempSave()" class="btn waves-effect" style="width:100px;">Speichern</button>
|
||||
<h5>Benutzer Hervorheben</h5>
|
||||
Set on users data modals.
|
||||
<span class="emphasized"> Diese Farbe zum Hervorheben verwenden </span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="fab fa-spotify"></i>Spotify und NowPlaying Einstellungen
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<br><br>
|
||||
Klick <i class="material-icons" style="font-size:24px;">music_note</i>Symbol für NowPlaying<br>
|
||||
<h5>Kontoverbindung</h5>
|
||||
TheDesk speichert Ihre Daten auf dem 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;">Speichern</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>Verbinden</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>Trennen</a>
|
||||
<h5>@@templateedit@@</h5>
|
||||
@@templateeditwarn@@<br>
|
||||
<textarea id="np-temp" class="materialize-textarea" data-length="500">#NowPlaying {song} / {album} / {artist}
|
||||
{url}</textarea><br>
|
||||
@@template1@@<br>
|
||||
@@template2@@<br>
|
||||
@@template3@@<br>
|
||||
<button onclick="spotifySave()" class="btn waves-effect" style="width:100px;">Speichern</button>
|
||||
<h5>Das Artwork von Spotify anhängen</h5>
|
||||
<label>
|
||||
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_yes"
|
||||
value="yes" />
|
||||
<span>Ja</span>
|
||||
</label>
|
||||
<label>
|
||||
<input class="with-gap" onchange="spotifyFlagSave()" name="awk" type="radio" id="awk_no"
|
||||
value="no" />
|
||||
<span>Nein</span>
|
||||
</label>
|
||||
|
||||
<br>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">hearing</i>Einstellungen Vorlesefunktion
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<h5>Geschwindigkeit</h5>
|
||||
1-100(Standard: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>Stimmlage</h5>
|
||||
0-100(Standard: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>Lautstärke</h5>
|
||||
0-100(Standard: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 ist ein Open-Source Mastodon Client für PC.">
|
||||
<button class="btn waves-effect blue" style="width:150px;" onclick="voicePlay()"
|
||||
id="testplay">Abspielen/Stoppen</button><br>
|
||||
<br>
|
||||
<button class="btn waves-effect" style="width:100px;" onclick="voiceSettings()">Speichern</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>Zurück</a>
|
||||
<br>
|
||||
<br>Tastenkombinationen
|
||||
<li>Ctrl+1-9:Wechsle zu n(1-9)ten Spalte</li>
|
||||
<li>N:Tröt-Box öffnen</li>
|
||||
<li>X:Tröt-Box umschalten</li>
|
||||
<li>Ctrl+Enter:Senden</li>
|
||||
<li>Ctrl+Enter+Shift:Senden (Zweit-Tröt)</li>
|
||||
<li>Alt+Enter:Zweite Tröt-Tasten</li>
|
||||
<li>Ctrl+E:Markiere alle Benachrichtigungen als gelesen.</li>
|
||||
<li>Ctrl+U:Select the top & left(No.1 column) toot</li>
|
||||
<li>Esc:Tröt-Box ausblenden</li>
|
||||
<li>F5:Alles neu laden</li>
|
||||
<li>Ctrl+Shift+C:Eingabe löschen</li>
|
||||
<li>Ctrl+Shift+S:Einstellungen</li>
|
||||
<li>Ctrl+Shift+M:Kontenverwaltung</li>
|
||||
<li>Ctrl+Shift+N:NowPlaying(Spotify)</li>
|
||||
<li>Ctrl+Shift+P:Ausgewähltes Profil anzeigen</li>
|
||||
<li>←/→:Nächstes oder vorheriges Bild anzeigen</li>
|
||||
<li>Mousewheel:Zoom a image</li>
|
||||
<div class="hide kirishima">
|
||||
以下Markdownに対応したインスタンスのみ。
|
||||
<br>
|
||||
<li>Ctrl+B/I/S/U:太字/斜字/取り消し/下線</li>
|
||||
以下アスタルテにログインしている場合のみ
|
||||
<br>
|
||||
<li>Ctrl+R:
|
||||
<a href="https://astarte.thedesk.top">アスタルテ暇人ランキング</a>を開く
|
||||
</li><br>
|
||||
Wenn ein Tröt ausgewählt ist:
|
||||
<li>F:Diesen Tröt favorisieren</li>
|
||||
<li>B:Diesen Tröt verstärken</li>
|
||||
<li>R:Auf diesen Tröt antworten</li>
|
||||
</div>
|
||||
<button class="btn waves-effect red" style="width:100%; max-width:500px;"
|
||||
onclick="if(confirm('Alle Daten löschen. Kein Rückgängig mehr möglich! Fortfahren?')){ localStorage.clear(); location.href='index.html'; }"><i
|
||||
class="material-icons left">delete</i>Reset(Gefährlich)</button><br><br>
|
||||
<button class="btn waves-effect indigo" onclick="about()" style="width:100%; max-width:500px;"><i
|
||||
class="material-icons left">info</i>Über 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>Homepage</a>
|
||||
<a href="https://www.pixiv.net/fanbox/creator/28105985" class="btn waves-effect red lighten-2"
|
||||
style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>Unterstützen(Pixiv FANBOX)</a>
|
||||
<a href="https://www.patreon.com/cutls" class="btn waves-effect red darken-2"
|
||||
style="width:100%; max-width:500px;"><i class="material-icons left">trending_up</i>Unterstützen(Patreon)</a>
|
||||
<a href="https://liberapay.com/cutls" class="btn waves-effect black-text"
|
||||
style="width:100%; max-width:500px; background-color: #f6c915"><i class="material-icons left">trending_up</i>Unterstützen(Liberapay)</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>Hilfe/Docs</a>
|
||||
<a href="https://github.com/cutls/TheDesk" class="btn waves-effect black lighten-2"
|
||||
style="width:100%; max-width:500px;"><i class="fab fa-github left"></i>GitHub</a>
|
||||
<a href="index.html?mode=user&code=Cutls@cutls.com" 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@cutls.com</a>
|
||||
<br>
|
||||
Kyash<br>
|
||||
<img src="../../img/kyash.png" width="100"><br>
|
||||
<a onclick="localStorage.removeItem('new-ver-skip'); location.href='index.html';"
|
||||
class="pointer">Nach Updates suchen</a><br>
|
||||
<a href="oss.html">OSS License</a><br>
|
||||
<span style="font-family:Open Sans;">Copyright © TheDesk 2018
|
||||
Under <a href="https://github.com/cutls/TheDesk/blob/master/LICENSE">GNU General Public License v3.0</a> and <a
|
||||
href="https://thedesk.top/tos.html">Terms of Use</a>/<a href="https://thedesk.top/priv.html">Privacy
|
||||
Policy</a>
|
||||
<br>Developer: Cutls P(
|
||||
<a href="index.html?mode=user&code=Cutls@cutls.com">@Cutls@cutls.com</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/modal.js"></script>
|
||||
<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/platform/pickr.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>
|
||||
@@ -1,552 +0,0 @@
|
||||
var yesno = [
|
||||
{
|
||||
text: "Ja",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Nein",
|
||||
value: "no"
|
||||
}
|
||||
];
|
||||
var sound = [
|
||||
{
|
||||
text: "Ohne",
|
||||
value: "none"
|
||||
}, {
|
||||
text: "Standard",
|
||||
value: "default"
|
||||
}, {
|
||||
text: "Custom 1",
|
||||
value: "c1"
|
||||
}, {
|
||||
text: "Custom 2",
|
||||
value: "c2"
|
||||
}, {
|
||||
text: "Custom 3",
|
||||
value: "c3"
|
||||
}, {
|
||||
text: "Custom 4",
|
||||
value: "c4"
|
||||
}
|
||||
];
|
||||
var envConstruction = [
|
||||
{
|
||||
id: "popup",
|
||||
storage: "popup",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
setValue: 0,
|
||||
width: 50,
|
||||
text: {
|
||||
head: "Popup-Benachrichtigung(unter Windows)",
|
||||
desc: "Bei \"0\" Ausgeschaltet.",
|
||||
after: "Sek"
|
||||
}
|
||||
}, {
|
||||
id: "notf",
|
||||
storage: "nativenotf",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "System Benachrichtigungen",
|
||||
desc: "Dies funktioniert nicht mit der Portablen Windows Version.",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "width",
|
||||
storage: "width",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 50,
|
||||
setValue: 300,
|
||||
text: {
|
||||
head: "Minimale Breite der Spalten",
|
||||
desc: "Die Scroll-Leiste wird angezeigt, wenn Spalten breiter als das Fenster sind.",
|
||||
after: "px über"
|
||||
}
|
||||
}, {
|
||||
id: "fixwidth",
|
||||
storage: "fixwidth",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
setValue: 300,
|
||||
width: 50,
|
||||
text: {
|
||||
head: "Minimale Breite des TweetDeck-Browsers",
|
||||
desc: "",
|
||||
after: "px über"
|
||||
}
|
||||
}, {
|
||||
id: "size",
|
||||
storage: "size",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 50,
|
||||
setValue: 13,
|
||||
text: {
|
||||
head: "Schriftgröße",
|
||||
desc: "<span style=\"font-size:13px\">13px(Absoluter Wert)</span>",
|
||||
after: "px"
|
||||
}
|
||||
}, {
|
||||
id: "ha",
|
||||
storage: "ha",
|
||||
checkbox: true,
|
||||
setValue: false,
|
||||
text: {
|
||||
head: "Hardwarebeschleunigung deaktivieren",
|
||||
desc: "Automatischer Neustart",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Ja",
|
||||
value: "true"
|
||||
}, {
|
||||
text: "Nein",
|
||||
value: "false"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
];
|
||||
var tlConstruction = [
|
||||
{
|
||||
id: "time",
|
||||
storage: "datetype",
|
||||
checkbox: true,
|
||||
setValue: "absolute",
|
||||
text: {
|
||||
head: "Zeitformat",
|
||||
desc: "Relatives Format:\"vor 1 Minuten\",\"vor 3 Tagen\"<br>Absolutes Format:\"23:25:21\",\"2017/12/30 23:59:00\"<br>Gemischtes Format:Die heute geposteten Zahn sind relativ formatiert, andere sind absolut formatiert.",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Relativ",
|
||||
value: "relative"
|
||||
}, {
|
||||
text: "Absolut",
|
||||
value: "absolute"
|
||||
}, {
|
||||
text: "Sowohl relativ als auch absolut",
|
||||
value: "double"
|
||||
}, {
|
||||
text: "Gemischt",
|
||||
value: "medium"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "ul",
|
||||
storage: "locale",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Server's unique locale",
|
||||
desc: "Dieser Wert ist auf einigen japanischen Servern verfügbar",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "nsfw",
|
||||
storage: "nsfw",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "NSFW Bilder ausblenden",
|
||||
desc: "Starker Unschärfeeffekt",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "cw",
|
||||
storage: "cw",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Hide CW contents",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "rp",
|
||||
storage: "replyct",
|
||||
checkbox: true,
|
||||
setValue: "hidden",
|
||||
text: {
|
||||
head: "Aussehen der Antwortzähler",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "1+ anzeigen, bei mehr als einer Antworten.",
|
||||
value: "hidden"
|
||||
}, {
|
||||
text: "1+ anzeigen, bei mehr als einer Antworten.",
|
||||
value: "all"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "gif",
|
||||
storage: "gif",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Animierte GIF-Bilder abspielen",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "tag",
|
||||
storage: "tag-range",
|
||||
checkbox: true,
|
||||
setValue: "local",
|
||||
text: {
|
||||
head: "Suche im Tag-Verlauf",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Auch in Verbundenen Netzwerken",
|
||||
value: "all"
|
||||
}, {
|
||||
text: "Nur im lokalen Netzwerk",
|
||||
value: "local"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "via",
|
||||
storage: "viashow",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Show via",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "mov",
|
||||
storage: "mouseover",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Aktionsbuttons ausblenden wenn der Mauszeiger weg ist.",
|
||||
desc: "Du wirst vielleicht das Gefühl haben, dass \"Mouseover\" unangenehm ist :-(",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Maus drüber zum Anzeigen",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Klicken um anzuzeigen",
|
||||
value: "click"
|
||||
}, {
|
||||
text: "Nein",
|
||||
value: "no"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "notfm",
|
||||
storage: "setasread",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Benachrichtigungs-Markierung, rote Klingel und Zähler anzeigen(wenn Sie eine Benachrichtigungsspalte haben.)",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
checkbox: false,
|
||||
doubleText: true,
|
||||
data: [
|
||||
{
|
||||
id: "sentence",
|
||||
storage: "sentence",
|
||||
width: 50,
|
||||
setValue: 500,
|
||||
text: { after: "Zeilen über oder" }
|
||||
}, {
|
||||
id: "letters",
|
||||
storage: "letters",
|
||||
width: 50,
|
||||
setValue: 7000,
|
||||
text: { after: "Buchstaben über" }
|
||||
}
|
||||
],
|
||||
text: {
|
||||
head: "Automatisches Zusammenfalten",
|
||||
desc: "TheDesk faltet nicht Tröts von 5 Zeichen oder weniger. Zusammengefaltet, werden keine Zeilen angezeigt. TheDesk zählen nur richtige Zeilen. (Zeilenumbrüche nicht.)",
|
||||
}
|
||||
}, {
|
||||
id: "img-height",
|
||||
storage: "img-height",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 80,
|
||||
setValue: 200,
|
||||
text: {
|
||||
head: "Höhe der Bilder",
|
||||
desc: "Option:Setze \"full\" für Unbeschnitten.",
|
||||
after: "px"
|
||||
}
|
||||
}, {
|
||||
id: "ticker",
|
||||
storage: "ticker_ok",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Aktiviere #InstanceTicker",
|
||||
desc: "Zeigt bunte Sticker über den Server. <a href=\"https://wee.jp/\">Über #InstanceTicker</a> Copyright 2018 weepjp, kyori19.",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "anime",
|
||||
storage: "animation",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Animation der Verläufe",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "replySound",
|
||||
storage: "replySound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Ton bei Antwort",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "favSound",
|
||||
storage: "favSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Ton bei Favorit",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "btSound",
|
||||
storage: "btSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Ton bei Verstärkung",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}, {
|
||||
id: "followSound",
|
||||
storage: "followSound",
|
||||
checkbox: true,
|
||||
setValue: "none",
|
||||
text: {
|
||||
head: "Ton bei Folgen",
|
||||
desc: "",
|
||||
checkbox: sound
|
||||
}
|
||||
}
|
||||
];
|
||||
var postConstruction = [
|
||||
{
|
||||
id: "cw-text",
|
||||
storage: "cw-text",
|
||||
checkbox: false,
|
||||
doubleText: false,
|
||||
width: 150,
|
||||
setValue: "",
|
||||
text: {
|
||||
head: "Standard Warnung",
|
||||
desc: "",
|
||||
after: ""
|
||||
}
|
||||
}, {
|
||||
checkbox: false,
|
||||
doubleText: true,
|
||||
data: [
|
||||
{
|
||||
id: "cw_sentence",
|
||||
storage: "cw_sentence",
|
||||
width: 50,
|
||||
setValue: 500,
|
||||
text: { after: "Zeilen über oder" }
|
||||
}, {
|
||||
id: "cw_letters",
|
||||
storage: "cw_letters",
|
||||
width: 50,
|
||||
setValue: 7000,
|
||||
text: { after: "Buchstaben über" }
|
||||
}
|
||||
],
|
||||
text: {
|
||||
head: "Warnung vor dem Versenden eines langen Toots.",
|
||||
desc: "Dialog anzeigen, ob Sie den zu langen Text verstecken möchten.",
|
||||
}
|
||||
}, {
|
||||
id: "cws",
|
||||
storage: "always-cw",
|
||||
checkbox: true,
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Always CW set",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}, {
|
||||
id: "vis",
|
||||
storage: "vis",
|
||||
checkbox: true,
|
||||
setValue: "public",
|
||||
text: {
|
||||
head: "Standardsichtbarkeit",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Öffentlich",
|
||||
value: "public"
|
||||
}, {
|
||||
text: "Nicht aufgeführt",
|
||||
value: "unlisted"
|
||||
}, {
|
||||
text: "Privat",
|
||||
value: "private"
|
||||
}, {
|
||||
text: "Direkt",
|
||||
value: "direct"
|
||||
}, {
|
||||
text: "Merken (bei jeden Server gespeichert)",
|
||||
value: "memory"
|
||||
}, {
|
||||
text: "Ihrer Standard-Sichtbarkeit (Einstellungen des Mastodon-Servers setzen)",
|
||||
value: "useapi"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "img",
|
||||
storage: "img",
|
||||
checkbox: true,
|
||||
setValue: "no-act",
|
||||
text: {
|
||||
head: "Bilder-Einstellungen fürs Senden",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "MedienURL einfügen",
|
||||
value: "url"
|
||||
}, {
|
||||
text: "Nichts einfügen",
|
||||
value: "no-act"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "box",
|
||||
storage: "box",
|
||||
checkbox: true,
|
||||
setValue: "yes",
|
||||
text: {
|
||||
head: "Verhalten der Posting-Box",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Zusammengeklappt",
|
||||
value: "yes"
|
||||
}, {
|
||||
text: "Nach dem Posting offen",
|
||||
value: "no"
|
||||
}, {
|
||||
text: "Alles geöffnet",
|
||||
value: "absolute"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "quote",
|
||||
storage: "quote",
|
||||
checkbox: true,
|
||||
setValue: "nothing",
|
||||
text: {
|
||||
head: "Zitierformat",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Nur URL",
|
||||
value: "simple"
|
||||
}, {
|
||||
text: "URL und Name (Hinweis auf den Benutzer)",
|
||||
value: "mention"
|
||||
}, {
|
||||
text: "URL, Text und Name(Hinweis auf den Benutzer)",
|
||||
value: "full"
|
||||
}, {
|
||||
text: "Deaktiviert (Taste in Verlauf ausgeblendet)",
|
||||
value: "nothing"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "main",
|
||||
storage: "mainuse",
|
||||
checkbox: true,
|
||||
setValue: "remain",
|
||||
text: {
|
||||
head: "Standard-Konto für Aktionen",
|
||||
desc: "Das Hauptkonto kann in der Kontoverwaltung gestellt werden.",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Konto, das Sie kürzlich verwendet haben",
|
||||
value: "remain"
|
||||
}, {
|
||||
text: "Hauptkonto",
|
||||
value: "main"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "sec",
|
||||
storage: "sec",
|
||||
checkbox: true,
|
||||
setValue: "public",
|
||||
text: {
|
||||
head: "Zweite Tröt-Tasten",
|
||||
desc: "",
|
||||
checkbox: [
|
||||
{
|
||||
text: "Versteckt",
|
||||
value: "nothing"
|
||||
}, {
|
||||
text: "Öffentlich",
|
||||
value: "public"
|
||||
}, {
|
||||
text: "Nicht aufgeführt",
|
||||
value: "unlisted"
|
||||
}, {
|
||||
text: "Privat",
|
||||
value: "private"
|
||||
}, {
|
||||
text: "Direkt",
|
||||
value: "direct"
|
||||
}, {
|
||||
text: "Nur lokal",
|
||||
value: "local",
|
||||
kirishima: true,
|
||||
kirishimaText: "非対応インスタンスでは「未収載」になります。"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
id: "zero",
|
||||
storage: "emoji-zero-width",
|
||||
checkbox: true,
|
||||
setValue: "normal",
|
||||
setValue: "no",
|
||||
text: {
|
||||
head: "Emojis ohne Abstand Einfügen",
|
||||
desc: "",
|
||||
checkbox: yesno
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,254 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<title>Update - TheDesk</title>
|
||||
<link href="../../node_modules/materialize-css/dist/css/materialize.css" type="text/css" rel="stylesheet">
|
||||
<link href="../../css/master.css" type="text/css" rel="stylesheet">
|
||||
<meta charset="utf-8">
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Open Sans';
|
||||
-webkit-app-region: drag;
|
||||
cursor: move;
|
||||
padding: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#start {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100vw;
|
||||
height: calc(100vh - 2.5rem);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#checkbox {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
a,
|
||||
button,
|
||||
input,
|
||||
label,
|
||||
i {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
#updskip {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.skipbtn {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border: 1px solid;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px solid;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.skipbtn:hover {
|
||||
background-color: #b3e5fc;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
#prog {
|
||||
font-size: 200%;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<i class="material-icons pointer waves-effect" onclick="about();">info</i>
|
||||
<i class="material-icons pointer waves-effect" onclick="skipper();">clear</i>
|
||||
<!--a href="update.html">Reload</a-->
|
||||
<div id="start">
|
||||
<div id="box" class="show">
|
||||
<h2>TheDesk</h2>
|
||||
<p>Neusten TheDesk holen.</p>
|
||||
<span id="now"></span>→<b id="ver"></b><br>
|
||||
<span id="det"></span><br>
|
||||
<button class="waves-effect btn windows hide" onclick="update('install')"
|
||||
style="margin-left:15px;">Installer Version</button>
|
||||
<button class="waves-effect btn windows hide" onclick="update('portable')"
|
||||
style="margin-left:15px;">Portable Version</button>
|
||||
<button class="waves-effect btn linux hide" onclick="update('linux')"
|
||||
style="margin-left:15px;">Start</button>
|
||||
<button class="waves-effect btn mac hide" onclick="update('mac')"
|
||||
style="margin-left:15px;">Start</button>
|
||||
<br>
|
||||
Gibt es Probleme?<br>Bitte von <a href=\"https://thedesk.top\">Offizielle Homepage</a> herunterladen.
|
||||
</div>
|
||||
<div id="skipper" class="hide">
|
||||
<h4>Du kannst ein cooles Erlebnis verpassen!</h4>
|
||||
Update überspringen<br>
|
||||
<div id="updskip">
|
||||
<a onclick="window.close();" class="pointer skipbtn waves-effect waves-light">
|
||||
<div>Bis zur nächsten Verlaufsaktualisierung</div>
|
||||
</a>
|
||||
<a onclick="nextv();" class="pointer skipbtn waves-effect waves-light">
|
||||
<div>Bis zur nächsten Version</div>
|
||||
</a>
|
||||
</div>
|
||||
<a class="pointer waves-effect" onclick="skipper();" style="margin-top:5px">Aktualisieren fortsetzen</a>
|
||||
</div>
|
||||
<div id="dlnow" class="hide">
|
||||
<h4>Herunterladen...</h4>
|
||||
<h4 id="prog"></h4>
|
||||
<div class="progress">
|
||||
<div class="determinate" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="../../js/common/about.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/end.js"></script>
|
||||
<script>
|
||||
function skipper() {
|
||||
$("#dlnow").addClass("hide");
|
||||
$("#box").toggleClass("show");
|
||||
if ($("#box").hasClass("hide") && $("#skipper").hasClass("hide")) {
|
||||
$("#skipper").removeClass("hide");
|
||||
$("#skipper").addClass("show");
|
||||
} else {
|
||||
$("#box").toggleClass("hide");
|
||||
$("#skipper").toggleClass("hide");
|
||||
$("#skipper").toggleClass("show");
|
||||
}
|
||||
}
|
||||
verck();
|
||||
function update(sel) {
|
||||
$("#box").toggleClass("show");
|
||||
$("#box").toggleClass("hide");
|
||||
$("#dlnow").toggleClass("hide");
|
||||
$("#dlnow").toggleClass("show");
|
||||
$("#prog").text("");
|
||||
var bit = localStorage.getItem("bit");
|
||||
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) {
|
||||
if (sel == "install") {
|
||||
if (bit == "x64") {
|
||||
var url = json["winx64"];
|
||||
var file = "TheDesk-setup.exe";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["winia32"];
|
||||
var file = "TheDesk-setup-ia32.exe";
|
||||
}
|
||||
} else if (sel == "portable") {
|
||||
if (bit == "x64") {
|
||||
var url = json["winx64p"];
|
||||
var file = "TheDesk.exe";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["winia32p"];
|
||||
var file = "TheDesk-ia32.exe";
|
||||
}
|
||||
} else if (sel == "linux") {
|
||||
if (bit == "x64") {
|
||||
var url = json["linuxx64"];
|
||||
var file = "TheDesk-linux-x64.zip";
|
||||
} else if (bit == "ia32") {
|
||||
var url = json["linuxia64"];
|
||||
var file = "TheDesk-linux-ia32.zip";
|
||||
}
|
||||
} else if (sel == "mac") {
|
||||
var url = json["mac"];
|
||||
shell.openExternal(url);
|
||||
return false;
|
||||
}
|
||||
postMessage(["downloadButton", [url, file]], "*")
|
||||
});
|
||||
|
||||
}
|
||||
function quit() {
|
||||
postMessage(["sendSinmpleIpc", "quit"], "*")
|
||||
}
|
||||
function updateProg(arg) {
|
||||
console.log(arg);
|
||||
$(".determinate").css("width", arg * 100 + "%");
|
||||
$("#prog").text(Math.floor(arg * 100) + "%");
|
||||
}
|
||||
function updateMess(arg) {
|
||||
console.log(arg);
|
||||
$("#prog").text(arg);
|
||||
}
|
||||
function verck() {
|
||||
var platform = localStorage.getItem("platform");
|
||||
var bit = localStorage.getItem("bit");
|
||||
if (platform == "win32") {
|
||||
$('.windows').removeClass("hide")
|
||||
} else if (platform == "linux") {
|
||||
$('.linux').removeClass("hide")
|
||||
} else if (platform == "darwin") {
|
||||
$('.mac').removeClass("hide")
|
||||
}
|
||||
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);
|
||||
if (platform == "win32") {
|
||||
$("#ver").text(json.desk);
|
||||
localStorage.setItem("next-ver", json.desk);
|
||||
} else if (platform == "linux") {
|
||||
$("#ver").text(json.desk_linux);
|
||||
localStorage.setItem("next-ver", json.desk_linux);
|
||||
} else if (platform == "darwin") {
|
||||
$("#ver").text(json.desk_mac);
|
||||
localStorage.setItem("next-ver", json.desk_mac);
|
||||
}
|
||||
var lang = "de";
|
||||
if (lang == "ja") {
|
||||
$("#det").html(json.detail);
|
||||
} else {
|
||||
$("#det").html(json.detail_en);
|
||||
}
|
||||
|
||||
$("#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>
|
||||
@@ -1,158 +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="../../node_modules/materialize-css/dist/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/tl.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../css/userdata.css" rel="stylesheet" type="text/css">
|
||||
<link href="../../node_modules/@fortawesome/fontawesome-free/css/all.min.css" type="text/css" 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;
|
||||
}
|
||||
|
||||
.first {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center
|
||||
}
|
||||
|
||||
.first .hide-first {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<meta charset="utf-8">
|
||||
<!--
|
||||
<script type="text/javascript">
|
||||
var _jipt = [];
|
||||
_jipt.push(['project', 'thedesk']);
|
||||
</script>
|
||||
<script type="text/javascript" src="https://cdn.crowdin.com/jipt/jipt.js"></script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body id="mainView">
|
||||
<script type="text/javascript" src="../../node_modules/jquery/dist/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../js/platform/first.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/materialize-css/dist/js/materialize.js"></script>
|
||||
<script type="text/javascript" src="../../js/lang/lang.en.js"></script>
|
||||
<script type="text/javascript" src="../../node_modules/sweetalert2/dist/sweetalert2.all.min.js"></script>
|
||||
<script>
|
||||
var misskeytoken = false;
|
||||
</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>
|
||||
<div class="hide-first">
|
||||
<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>
|
||||
</div>
|
||||
<div>
|
||||
<h5>Add an account</h5><br>
|
||||
<div id="add">
|
||||
<div class="row">
|
||||
<div class="col s8">
|
||||
<input type="text" id="url" style="width:70%" placeholder="ex)mstdn.jp">
|
||||
<div id="ins-suggest"></div>
|
||||
Uncheck it to skip pasiting code.(login to Mastodon on Windows or macOS) (Recommended: pcheck)<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="linux" />
|
||||
<span>Code setup</span>
|
||||
</label>
|
||||
<br>
|
||||
<label>
|
||||
<input type="checkbox" class="filled-in" id="misskey" />
|
||||
<span>Login as Misskey</span>
|
||||
</label><br>
|
||||
<button class="btn waves-effect" onclick="instance()">Login</button><br>
|
||||
</div>
|
||||
<div class="col s4">
|
||||
<span style="font-family:Open Sans;">Supports</span>
|
||||
<div id="support" class="collection transparent"></div>
|
||||
</div>
|
||||
</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>
|
||||
<div id="misskeylogin" style="display:none">
|
||||
<h5>AppSecret</h5>
|
||||
Read <a href=\"https://thedesk.top/how-to-misskey-login.html\">Docs(ja)</a> to login Misskey.<br>
|
||||
<input type="hidden" id="misskey-url">
|
||||
<input type="text" id="misskey-key" placeholder="Code">
|
||||
<button class="btn waves-effect" onclick="misskeyLogin()">Auth</button><br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-first">
|
||||
<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>
|
||||
Some instance data by <a href="https://instances.social" target="_blank">instances.social API</a><br>
|
||||
<h5 id="ins-title"></h5>
|
||||
Administered by:<a id="ins-admin"></a><br>
|
||||
<span id="ins-desc"></span><br>
|
||||
<img src="../../img/loading.svg" id="ins-prof" width="200"><br>
|
||||
<br>
|
||||
Domain:<span id="ins-name"></span><br>
|
||||
Federated servers:<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>@<span id="ins-upd"></span><br>
|
||||
</div>
|
||||
<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/tkn.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>
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user