diff --git a/app/css/master.css b/app/css/master.css index f9a2b862..39045d7e 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -298,6 +298,10 @@ blockquote:before, .quote:before { border-color:var(--color); padding:5px; } +#pickers{ + display:flex; + flex-wrap: wrap; +} /*スクロールバー*/ diff --git a/app/css/pickr.css b/app/css/pickr.css new file mode 100644 index 00000000..8fbd6027 --- /dev/null +++ b/app/css/pickr.css @@ -0,0 +1 @@ +.pickr{position:relative;overflow:visible;z-index:1}.pickr *{box-sizing:border-box}.pickr button,.pickr input{outline:none;border:none}.pickr button:focus,.pickr input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px currentColor}.pickr .pcr-button{position:relative;height:2em;width:2em;padding:.5em;border-radius:.15em;cursor:pointer;background:currentColor;transition:all .3s;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.pickr .pcr-button:before{background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pickr .pcr-button:after,.pickr .pcr-button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%}.pickr .pcr-button:after{background:url('data:image/svg+xml;utf8, ') no-repeat 50%;background-size:70%;opacity:0}.pickr .pcr-button.clear{background:hsla(0,0%,100%,.25)}.pickr .pcr-button.clear:after{opacity:1}.pickr .pcr-button.clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px #75797e}.pickr .pcr-button.disabled{cursor:not-allowed}.pcr-app{margin-top: 10px;display:flex;flex-direction:column;z-index:10000;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;box-shadow:0 .15em 1.5em 0 rgba(0,0,0,.1),0 0 1em 0 rgba(0,0,0,.03);top:5px;height:15em;width:28.5em;max-width:95vw;padding:.8em;border-radius:.1em;opacity:0;visibility:hidden;transition:opacity .3s}.pcr-app.visible{visibility:visible;opacity:1}.pcr-app .swatches{display:flex;flex-wrap:wrap;margin-top:.75em}@supports (display:grid){.pcr-app .swatches{display:grid;align-items:center;justify-content:space-around;grid-template-columns:repeat(auto-fit,1.75em)}}.pcr-app .swatches>button{position:relative;width:1.75em;height:1.75em;border-radius:.15em;cursor:pointer;margin:2.5px;flex-shrink:0;justify-self:center;transition:all .15s;overflow:hidden;background:transparent;z-index:1}.pcr-app .swatches>button:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:6px;border-radius:.15em;z-index:-1}.pcr-app .swatches>button:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:currentColor;border:1px solid rgba(0,0,0,.05);border-radius:.15em;box-sizing:border-box}.pcr-app .swatches>button:hover{filter:brightness(1.05)}.pcr-app .pcr-interaction{display:flex;align-items:center;margin:.75em -.2em 0}.pcr-app .pcr-interaction>*{margin:0 .2em}.pcr-app .pcr-interaction input{letter-spacing:.07em;font-size:.75em;text-align:center;cursor:pointer;color:#75797e;background:#f1f3f4;border-radius:.15em;transition:all .15s;padding:.45em .5em}.pcr-app .pcr-interaction input:hover{filter:brightness(.975)}.pcr-app .pcr-interaction input:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(66,133,244,.75)}.pcr-app .pcr-interaction .pcr-result{color:#75797e;text-align:left;flex-grow:1;min-width:1em;transition:all .2s;border-radius:.15em;background:#f1f3f4;cursor:text}.pcr-app .pcr-interaction .pcr-result::selection{background:#4285f4;color:#fff}.pcr-app .pcr-interaction .pcr-type.active{color:#fff;background:#4285f4}.pcr-app .pcr-interaction .pcr-clear,.pcr-app .pcr-interaction .pcr-save{width:auto;color:#fff}.pcr-app .pcr-interaction .pcr-clear:hover,.pcr-app .pcr-interaction .pcr-save:hover{filter:brightness(.925)}.pcr-app .pcr-interaction .pcr-save{background:#4285f4}.pcr-app .pcr-interaction .pcr-clear{background:#f44250}.pcr-app .pcr-interaction .pcr-clear:focus{box-shadow:0 0 0 1px #f1f3f4,0 0 0 3px rgba(244,66,80,.75)}.pcr-app .pcr-selection{display:flex;justify-content:space-between;flex-grow:1}.pcr-app .pcr-selection .pcr-picker{position:absolute;height:18px;width:18px;border:2px solid #fff;border-radius:100%;user-select:none;cursor:-moz-grab;cursor:-webkit-grabbing}.pcr-app .pcr-selection .pcr-color-preview{position:relative;z-index:1;width:2em;display:flex;flex-direction:column;justify-content:space-between;margin-right:.75em}.pcr-app .pcr-selection .pcr-color-preview:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app .pcr-selection .pcr-color-preview .pcr-last-color{cursor:pointer;transition:background-color .3s,box-shadow .3s;border-radius:.15em .15em 0 0;z-index:2}.pcr-app .pcr-selection .pcr-color-preview .pcr-current-color{border-radius:0 0 .15em .15em}.pcr-app .pcr-selection .pcr-color-preview .pcr-current-color,.pcr-app .pcr-selection .pcr-color-preview .pcr-last-color{background:currentColor;width:100%;height:50%}.pcr-app .pcr-selection .pcr-color-chooser,.pcr-app .pcr-selection .pcr-color-opacity,.pcr-app .pcr-selection .pcr-color-palette{position:relative;user-select:none;display:flex;flex-direction:column}.pcr-app .pcr-selection .pcr-color-palette{width:100%;z-index:1}.pcr-app .pcr-selection .pcr-color-palette .pcr-palette{height:100%;border-radius:.15em}.pcr-app .pcr-selection .pcr-color-palette .pcr-palette:before{position:absolute;content:"";top:0;left:0;width:100%;height:100%;background:url('data:image/svg+xml;utf8, ');background-size:.5em;border-radius:.15em;z-index:-1}.pcr-app .pcr-selection .pcr-color-chooser,.pcr-app .pcr-selection .pcr-color-opacity{margin-left:.75em}.pcr-app .pcr-selection .pcr-color-chooser .pcr-picker,.pcr-app .pcr-selection .pcr-color-opacity .pcr-picker{left:50%;transform:translateX(-50%)}.pcr-app .pcr-selection .pcr-color-chooser .pcr-slider,.pcr-app .pcr-selection .pcr-color-opacity .pcr-slider{width:8px;height:100%;border-radius:50em}.pcr-app .pcr-selection .pcr-color-chooser .pcr-slider{background:linear-gradient(180deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.pcr-app .pcr-selection .pcr-color-opacity .pcr-slider{background:linear-gradient(180deg,transparent,#000),url('data:image/svg+xml;utf8, ');background-size:100%,50%} \ No newline at end of file diff --git a/app/js/emoji/default-emoji.js b/app/js/emoji/default-emoji.js index 84ea9ecb..8c227803 100644 --- a/app/js/emoji/default-emoji.js +++ b/app/js/emoji/default-emoji.js @@ -70,7 +70,7 @@ function defEmoji(target){ $("#textarea").focus(); var selin = $("#textarea").prop('selectionStart'); if(!selin){ - selin=0; + selin=0; } localStorage.setItem("cursor", selin); } diff --git a/app/js/lang/lang.en.js b/app/js/lang/lang.en.js index 341e3470..54b24825 100644 --- a/app/js/lang/lang.en.js +++ b/app/js/lang/lang.en.js @@ -178,6 +178,7 @@ var lang={ "lang_parse_voted":"Voted", "lang_parse_vote":"Voted", "lang_parse_unvoted":"Show the result without voting", + "lang_parse_endedvote":"Expired", //misskey "lang_misskeyparse_renote":"Repost", "lang_misskeyparse_renoteqt":"Renote", diff --git a/app/js/lang/lang.ja.js b/app/js/lang/lang.ja.js index c44be155..9d4ba290 100644 --- a/app/js/lang/lang.ja.js +++ b/app/js/lang/lang.ja.js @@ -179,6 +179,7 @@ var lang={ "lang_parse_voted":"投票済みです", "lang_parse_vote":"投票", "lang_parse_unvoted":"結果だけ見る", + "lang_parse_endedvote":"終了済み", //misskey "lang_misskeyparse_renote":"再投稿", "lang_misskeyparse_renoteqt":"引用", diff --git a/app/js/lang/lang.ps.js b/app/js/lang/lang.ps.js new file mode 100644 index 00000000..1b046e44 --- /dev/null +++ b/app/js/lang/lang.ps.js @@ -0,0 +1,206 @@ +var lang={ + "language": "crwdns1960:0crwdne1960:0", + "lang_toot": "crwdns1962:0crwdne1962:0", + "lang_there": "crwdns1964:0crwdne1964:0", + "lang_nothing": "crwdns1966:0crwdne1966:0", + "lang_yesno": "crwdns1968:0crwdne1968:0", + "lang_no": "crwdns1970:0crwdne1970:0", + "lang_progress": "crwdns1972:0crwdne1972:0", + "lang_edit": "crwdns1974:0crwdne1974:0", + "lang_del": "crwdns1976:0crwdne1976:0", + "lang_add": "crwdns1978:0crwdne1978:0", + "lang_fatalerroroccured": "crwdns1980:0crwdne1980:0", + "lang_speech": "crwdns1982:0crwdne1982:0", + "lang_lang": "crwdns1984:0crwdne1984:0", + "lang_langlocale": "crwdns1986:0crwdne1986:0", + "lang_back": "crwdns1988:0crwdne1988:0", + "lang_set": "crwdns1990:0crwdne1990:0", + "lang_langadd": "crwdns2364:0crwdne2364:0", + "lang_version_usever": "crwdns1994:0{{ver}}crwdne1994:0", + "lang_version_skipver": "crwdns1996:0crwdne1996:0", + "lang_login_noauth": "crwdns1998:0crwdne1998:0", + "lang_manager_info": "crwdns2000:0crwdne2000:0", + "lang_manager_refresh": "crwdns2002:0crwdne2002:0", + "lang_manager_delete": "crwdns2004:0crwdne2004:0", + "lang_manager_color": "crwdns2006:0crwdne2006:0", + "lang_manager_confirm": "crwdns2008:0crwdne2008:0", + "lang_manager_mainAcct": "crwdns2010:0crwdne2010:0", + "lang_manager_def": "crwdns2012:0crwdne2012:0", + "lang_manager_none": "crwdns2014:0crwdne2014:0", + "lang_manager_godev": "crwdns2016:0crwdne2016:0", + "lang_bbmd_misskey": "crwdns2018:0crwdne2018:0", + "lang_emoji_get": "crwdns2020:0crwdne2020:0", + "lang_emoji_custom": "crwdns2022:0crwdne2022:0", + "lang_defaultemojis_text": "crwdns2388:0{{cat}}crwdne2388:0", + "lang_postimg_previewdis": "crwdns2024:0crwdne2024:0", + "lang_postimg_aftupload": "crwdns2026:0crwdne2026:0", + "lang_post_tagTL": "crwdns2028:0crwdne2028:0", + "lang_post_tagVis": "crwdns2030:0crwdne2030:0", + "lang_post_cwtitle": "crwdns2032:0crwdne2032:0", + "lang_post_cwtxt": "crwdns2034:0crwdne2034:0", + "lang_post_btn1": "crwdns2036:0crwdne2036:0", + "lang_post_btn2": "crwdns2038:0crwdne2038:0", + "lang_post_btn3": "crwdns2040:0crwdne2040:0", + "lang_status_favWarn": "crwdns2042:0crwdne2042:0", + "lang_status_btWarn": "crwdns2044:0crwdne2044:0", + "lang_status_follow": "crwdns2046:0crwdne2046:0", + "lang_status_unfollow": "crwdns2048:0crwdne2048:0", + "lang_status_block": "crwdns2050:0crwdne2050:0", + "lang_status_unblock": "crwdns2052:0crwdne2052:0", + "lang_status_mute": "crwdns2054:0crwdne2054:0", + "lang_status_unmute": "crwdns2056:0crwdne2056:0", + "lang_status_redraft": "crwdns2058:0crwdne2058:0", + "lang_status_emphas": "crwdns2060:0crwdne2060:0", + "lang_status_unemphas": "crwdns2062:0crwdne2062:0", + "lang_status_unendorse": "crwdns2064:0crwdne2064:0", + "lang_status_endorse": "crwdns2066:0crwdne2066:0", + "lang_suggest_nodata": "crwdns2068:0crwdne2068:0", + "lang_usetxtbox_reply": "crwdns2070:0crwdne2070:0", + "lang_cards_check": "crwdns2072:0crwdne2072:0", + "lang_cards_pip": "crwdns2074:0crwdne2074:0", + "lang_details_nodata": "crwdns2076:0crwdne2076:0", + "lang_details_filtered": "crwdns2078:0crwdne2078:0", + "lang_details_embed": "crwdns2080:0crwdne2080:0", + "lang_details_url": "crwdns2082:0crwdne2082:0", + "lang_details_txt": "crwdns2084:0crwdne2084:0", + "lang_filter_nodata": "crwdns2086:0crwdne2086:0", + "lang_filter_errordegree": "crwdns2088:0crwdne2088:0", + "lang_list_nodata": "crwdns2090:0crwdne2090:0", + "lang_list_show": "crwdns2092:0crwdne2092:0", + "lang_list_users": "crwdns2094:0crwdne2094:0", + "lang_list_nouser": "crwdns2096:0crwdne2096:0", + "lang_list_add": "crwdns2098:0crwdne2098:0", + "lang_list_remove": "crwdns2100:0crwdne2100:0", + "lang_notf_new": "crwdns2102:0crwdne2102:0", + "lang_speech_refresh": "crwdns2348:0crwdne2348:0", + "lang_src_ts": "crwdns2106:0crwdne2106:0", + "lang_src_people": "crwdns2108:0crwdne2108:0", + "lang_tags_always": "crwdns2110:0crwdne2110:0", + "lang_tags_realtime": "crwdns2112:0crwdne2112:0", + "lang_tags_tagunpin": "crwdns2114:0{{tag}}crwdne2114:0", + "lang_tags_tagwarn": "crwdns2116:0{{tag}}crwdne2116:0", + "lang_tl_media": "crwdns2118:0crwdne2118:0", + "lang_tl_reconnect": "crwdns2120:0crwdne2120:0", + "lang_layout_gotop": "crwdns2122:0crwdne2122:0", + "lang_layout_thisacct": "crwdns2124:0{{notf}}crwdne2124:0", + "lang_layout_delthis": "crwdns2126:0crwdne2126:0", + "lang_layout_setthis": "crwdns2128:0crwdne2128:0", + "lang_layout_mediafil": "crwdns2130:0crwdne2130:0", + "lang_layout_linkana": "crwdns2132:0crwdne2132:0", + "lang_layout_linkanades": "crwdns2134:0crwdne2134:0", + "lang_layout_tts": "crwdns2136:0crwdne2136:0", + "lang_layout_reconnect": "crwdns2138:0crwdne2138:0", + "lang_layout_headercolor": "crwdns2140:0crwdne2140:0", + "lang_layout_nodata": "crwdns2142:0crwdne2142:0", + "lang_layout_dm": "crwdns2144:0crwdne2144:0", + "lang_layout_webviewmode": "crwdns2146:0crwdne2146:0", + "lang_excluded": "crwdns2368:0crwdne2368:0", + "lang_layout_excludingbt": "crwdns2390:0crwdne2390:0", + "lang_spotify_img": "crwdns2148:0crwdne2148:0", + "lang_spotify_imgno": "crwdns2150:0crwdne2150:0", + "lang_spotify_acct": "crwdns2152:0crwdne2152:0", + "lang_spotify_np": "crwdns2154:0crwdne2154:0", + "lang_setting_npprovide": "crwdns2370:0{{set}}crwdne2370:0", + "lang_hisdata_frcreq": "crwdns2156:0crwdne2156:0", + "lang_hisdata_frcwarn": "crwdns2158:0crwdne2158:0", + "lang_hisdata_taketime": "crwdns2160:0crwdne2160:0", + "lang_hisdata_notonmisskey": "crwdns2162:0crwdne2162:0", + "lang_showontl_movetxt": "crwdns2164:0crwdne2164:0", + "lang_showontl_movebtn": "crwdns2166:0crwdne2166:0", + "lang_showontl_botacct": "crwdns2168:0[bot]crwdne2168:0", + "lang_showontl_followed": "crwdns2170:0crwdne2170:0", + "lang_showontl_notf": "crwdns2172:0crwdne2172:0", + "lang_showontl_domain": "crwdns2174:0crwdne2174:0", + "lang_showontl_listwarn": "crwdns2176:0crwdne2176:0", + "lang_parse_mentioned": "crwdns2178:0crwdne2178:0", + "lang_parse_faved": "crwdns2180:0crwdne2180:0", + "lang_parse_bted": "crwdns2182:0crwdne2182:0", + "lang_parse_btedsimple": "crwdns2184:0crwdne2184:0", + "lang_parse_notftime": "crwdns2186:0crwdne2186:0", + "lang_parse_cwshow": "crwdns2188:0crwdne2188:0", + "lang_parse_fulltext": "crwdns2190:0crwdne2190:0", + "lang_parse_autofold": "crwdns2192:0crwdne2192:0", + "lang_parse_more": "crwdns2194:0crwdne2194:0", + "lang_parse_url": "crwdns2196:0crwdne2196:0", + "lang_parse_tagTL": "crwdns2198:0{{tag}}crwdne2198:0", + "lang_parse_tagtoot": "crwdns2200:0{{tag}}crwdne2200:0", + "lang_parse_tagpin": "crwdns2202:0{{tag}}crwdne2202:0", + "lang_parse_public": "crwdns2204:0crwdne2204:0", + "lang_parse_unlisted": "crwdns2206:0crwdne2206:0", + "lang_parse_private": "crwdns2208:0crwdne2208:0", + "lang_parse_direct": "crwdns2210:0crwdne2210:0", + "lang_parse_clickcopy": "crwdns2212:0crwdne2212:0", + "lang_parse_clickcopyurl": "crwdns2214:0crwdne2214:0", + "lang_parse_trans": "crwdns2216:0crwdne2216:0", + "lang_parse_replyto": "crwdns2218:0crwdne2218:0", + "lang_parse_bt": "crwdns2220:0crwdne2220:0", + "lang_parse_fav": "crwdns2222:0crwdne2222:0", + "lang_parse_quote": "crwdns2224:0crwdne2224:0", + "lang_parse_del": "crwdns2226:0crwdne2226:0", + "lang_parse_pin": "crwdns2228:0crwdne2228:0", + "lang_parse_det": "crwdns2230:0crwdne2230:0", + "lang_parse_redraft": "crwdns2232:0crwdne2232:0", + "lang_parse_followed": "crwdns2234:0crwdne2234:0", + "lang_parse_clientop": "crwdns2236:0crwdne2236:0", + "lang_parse_clienttxt": "crwdns2238:0crwdne2238:0", + "lang_parse_clientno": "crwdns2240:0crwdne2240:0", + "lang_parse_clientemp": "crwdns2242:0crwdne2242:0", + "lang_parse_clientmute": "crwdns2244:0crwdne2244:0", + "lang_parse_mute": "crwdns2246:0crwdne2246:0", + "lang_parse_voted": "crwdns2392:0crwdne2392:0", + "lang_parse_vote": "crwdns2394:0crwdne2394:0", + "lang_parse_unvoted": "crwdns2396:0crwdne2396:0", + "lang_parse_endedvote": "crwdns2398:0crwdne2398:0", + "lang_misskeyparse_renote": "crwdns2248:0crwdne2248:0", + "lang_misskeyparse_renoteqt": "crwdns2250:0crwdne2250:0", + "lang_misskeyparse_reaction": "crwdns2252:0crwdne2252:0", + "lang_misskeyparse_tagnostr": "crwdns2254:0crwdne2254:0", + "lang_misskeyparse_listnostr": "crwdns2256:0crwdne2256:0", + "lang_misskeyparse_home": "crwdns2258:0crwdne2258:0", + "lang_misskeyparse_followers": "crwdns2260:0crwdne2260:0", + "lang_misskeyparse_specified": "crwdns2262:0crwdne2262:0", + "lang_misskeyparse_qt": "crwdns2264:0crwdne2264:0", + "lang_misskeyparse_renoted": "crwdns2266:0crwdne2266:0", + "lang_misskeyparse_quoted": "crwdns2268:0crwdne2268:0", + "lang_misskeyparse_reacted": "crwdns2372:0crwdne2372:0", + "lang_setting_time": "crwdns2272:0{{set}}crwdne2272:0", + "lang_setting_theme": "crwdns2274:0{{set}}crwdne2274:0", + "lang_setting_nsfw": "crwdns2276:0{{set}}crwdne2276:0", + "lang_setting_cw": "crwdns2278:0{{set}}crwdne2278:0", + "lang_setting_cwtext": "crwdns2280:0{{set}}crwdne2280:0", + "lang_setting_cws": "crwdns2282:0{{set}}crwdne2282:0", + "lang_setting_rp": "crwdns2284:0{{set}}crwdne2284:0", + "lang_setting_vis": "crwdns2286:0{{set}}crwdne2286:0", + "lang_setting_popup": "crwdns2288:0{{set}}crwdne2288:0", + "lang_setting_off": "crwdns2290:0crwdne2290:0", + "lang_setting_s": "crwdns2292:0crwdne2292:0", + "lang_setting_box": "crwdns2294:0{{set}}crwdne2294:0", + "lang_setting_gif": "crwdns2296:0{{set}}crwdne2296:0", + "lang_setting_selt": "crwdns2298:0{{set1}}crwdnd2298:0{{set2}}crwdne2298:0", + "lang_setting_autocw": "crwdns2300:0{{set1}}crwdnd2300:0{{set2}}crwdne2300:0", + "lang_setting_width": "crwdns2302:0{{set}}crwdne2302:0", + "lang_setting_fixwidth": "crwdns2386:0{{set}}crwdne2386:0", + "lang_setting_img": "crwdns2304:0{{set}}crwdne2304:0", + "lang_setting_font": "crwdns2306:0{{set}}crwdne2306:0", + "lang_setting_default": "crwdns2308:0crwdne2308:0", + "lang_setting_size": "crwdns2310:0{{set}}crwdne2310:0", + "lang_setting_imgheight": "crwdns2312:0{{set}}crwdne2312:0", + "lang_setting_ticker": "crwdns2314:0{{set}}crwdne2314:0", + "lang_setting_animation": "crwdns2400:0{{set}}crwdne2400:0", + "lang_setting_tag": "crwdns2316:0{{set}}crwdne2316:0", + "lang_setting_boxConfirm": "crwdns2318:0{{set}}crwdne2318:0", + "lang_setting_ul": "crwdns2320:0{{set}}crwdne2320:0", + "lang_setting_notf": "crwdns2322:0{{set}}crwdne2322:0", + "lang_setting_quote": "crwdns2324:0{{set}}crwdne2324:0", + "lang_setting_via": "crwdns2326:0{{set}}crwdne2326:0", + "lang_setting_mov": "crwdns2328:0{{set}}crwdne2328:0", + "lang_setting_setasread": "crwdns2330:0{{set}}crwdne2330:0", + "lang_setting_main": "crwdns2332:0{{set}}crwdne2332:0", + "lang_setting_sec": "crwdns2334:0{{set}}crwdne2334:0", + "lang_setting_ksref": "crwdns2336:0crwdne2336:0", + "lang_setting_nomuting": "crwdns2338:0crwdne2338:0", + "lang_setting_notftest": "crwdns2340:0crwdne2340:0", + "lang_setting_notftestprof": "crwdns2342:0crwdne2342:0", + "lang_setting_exportwarn": "crwdns2344:0crwdne2344:0", + "lang_setting_importwarn": "crwdns2346:0crwdne2346:0" +} \ No newline at end of file diff --git a/app/js/login/login.js b/app/js/login/login.js index cc21e28a..811eef26 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -11,9 +11,9 @@ function ck() { if(!main){ localStorage.setItem("main",0) } - var domain = localStorage.getItem("domain_0"); + var domainz = localStorage.getItem("domain_0"); var at = localStorage.getItem("acct_0_at"); - var oldat = localStorage.getItem(domain + "_at"); + var oldat = localStorage.getItem(domainz + "_at"); if(oldat){ console.log("Move to New Account Management System") var multi = localStorage.getItem("multi"); @@ -77,7 +77,7 @@ function login(url) { var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ scopes: 'read write follow', client_name: "TheDesk(PC)", @@ -85,7 +85,7 @@ function login(url) { website: "https://thedesk.top" })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); var auth = "https://" + url + "/oauth/authorize?client_id=" + json[ @@ -96,9 +96,7 @@ function login(url) { localStorage.setItem("client_secret", json["client_secret"]); $("#auth").show(); $("#masara").hide(); - const { - shell - } = require('electron'); + const { shell } = require('electron'); shell.openExternal(auth); diff --git a/app/js/login/manager.js b/app/js/login/manager.js index ee7e24d5..e4b9afb8 100644 --- a/app/js/login/manager.js +++ b/app/js/login/manager.js @@ -286,7 +286,7 @@ function login(url) { var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ scopes: 'read write follow', client_name: "TheDesk(PC)", @@ -294,7 +294,7 @@ function login(url) { website: "https://thedesk.top" })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); localStorage.setItem("msky","false"); @@ -326,43 +326,41 @@ function misskeyLogin(url) { if(!url){ var url=$("#misskey-url").val(); } - var multi = localStorage.getItem("multi"); - var obj = JSON.parse(multi); + var start = "https://"+url+"/api/app/create"; + var httpreq = new XMLHttpRequest(); + httpreq.open('POST', start, true); + httpreq.setRequestHeader('Content-Type', 'application/json'); + httpreq.responseType = "json"; + localStorage.setItem("msky","true"); + httpreq.send(JSON.stringify({ + name: "TheDesk(PC)", + description: "Mastodon client for PC", + permission: ["read","write","follow"] + })); + httpreq.onreadystatechange = function() { + if (httpreq.readyState === 4) { + var json = httpreq.response; + console.log(json); + misskeyAuth(url, json.secret) + } + } + + +} +function misskeyAuth(url, mkc){ var start = "https://"+url+"/api/auth/session/generate"; var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; - localStorage.setItem("msky","true"); - if(url=="misskey.xyz" && misskeytoken){ - var mkc=misskeytoken; - localStorage.setItem("mkc",mkc) - }else{ - var mkc=$("#misskey-key").val(); - localStorage.setItem("mkc",mkc) - if(!mkc){ - $("#misskeylogin").show(); - $("#misskey-url").val(url); - if(confirm(lang.lang_manager_godev)){ - const { - shell - } = require('electron'); - console.log("https://"+url+"/dev") - shell.openExternal("https://"+url+"/dev"); - shell.openExternal("https://thedesk.top/how-to-login-misskey.html"); - } + httpreq.responseType = "json"; - return false; - }else{ - $("#misskeylogin").hide(); - $("#misskey-url").val(""); - } - } + localStorage.setItem("mkc",mkc) + localStorage.setItem("msky","true"); httpreq.send(JSON.stringify({ appSecret: mkc })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); const { @@ -375,11 +373,8 @@ function misskeyLogin(url) { $("#misskey").prop("checked", false); localStorage.setItem("domain_tmp",url); shell.openExternal(json.url); - var electron = require("electron"); } } - - } //テキストボックスにURL入れた @@ -407,13 +402,13 @@ function code(code) { var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ token:code, appSecret:localStorage.getItem("mkc") })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; var i = sha256(json.accessToken + localStorage.getItem("mkc")); console.log(json); @@ -454,7 +449,7 @@ function code(code) { var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ grant_type: "authorization_code", redirect_uri: "https://thedesk.top/hello.html", @@ -463,7 +458,7 @@ function code(code) { code: code })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); if (json["access_token"]) { @@ -595,13 +590,13 @@ function misskeyRefresh(obj,target,url){ var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ username:obj[target].user, i:localStorage.getItem("at") })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); return; diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 8dc28f14..41ef4583 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -58,9 +58,7 @@ //hrefがhttp/httpsならブラウザで if(urls){ if (urls[0]) { - const { - shell - } = require('electron'); + const {shell} = require('electron'); 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"; @@ -81,8 +79,7 @@ //よく使うライブラリ /*マルチバイト用切り出し*/ $.isSurrogatePear = function(upper, lower) { - return 0xD800 <= upper && upper <= 0xDBFF && 0xDC00 <= lower && lower <= - 0xDFFF; + return 0xD800 <= upper && upper <= 0xDBFF && 0xDC00 <= lower && lower <= 0xDFFF; }; $.mb_strlen = function(str) { var ret = 0; diff --git a/app/js/platform/first.js b/app/js/platform/first.js index 47b34426..255b6cfc 100644 --- a/app/js/platform/first.js +++ b/app/js/platform/first.js @@ -81,4 +81,80 @@ function formattimeutc(date){ str=str+date.getUTCMinutes() } return str; +} +var electron = require("electron"); +var ipc = electron.ipcRenderer; +ipc.send('custom-css-request', ""); +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) +}) +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) +}) +function makeCID(){ + return randomStr(8)+"-"+randomStr(4)+"-"+randomStr(4)+"-"+randomStr(4)+"-"+randomStr(12); +} +function randomStr(l){ + // 生成する文字列に含める文字セット + var c = "abcdefghijklmnopqrstuvwxyz0123456789"; + var cl = c.length; + var r = ""; + for(var i=0; i4&&void 0!==arguments[4]?arguments[4]:{};return e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(o)||(o=[o]),e.forEach(e=>o.forEach(o=>e[t](o,i,function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{};const n=c(e,"data-con"),i=c(e,"data-key");i&&(o[i]=e);const s=Array.from(e.children),r=n?o[n]={}:o;for(let e of s){const o=c(e,"data-arr");o?(r[o]||(r[o]=[])).push(e):t(e,r)}return o}(a(t))}function p(t){let e=t.path||t.composedPath&&t.composedPath();if(e)return e;let o=t.target.parentElement;for(e=[t.target,o];o=o.parentElement;)e.push(o);return e.push(document,window),e}function h(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const o=t=>t>="0"&&t<="9"||"-"===t||"."===t;function n(n){const i=t.value,s=t.selectionStart;let r=s,a="";for(let t=s-1;t>0&&o(i[t]);t--)a=i[t]+a,r--;for(let t=s,e=i.length;t0&&!isNaN(a)&&isFinite(a)){const o=n.deltaY<0?1:-1,s=n.ctrlKey?5*o:o;let c=Number(a)+s;!e&&c<0&&(c=0);const l=i.substr(0,r)+c+i.substring(r+a.length,i.length),p=r+String(c).length;t.value=l,t.focus(),t.setSelectionRange(p,p)}n.preventDefault(),t.dispatchEvent(new Event("input"))}i(t,"focus",()=>i(window,"wheel",n)),i(t,"blur",()=>s(window,"wheel",n))}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var o=[],n=!0,i=!1,s=void 0;try{for(var r,a=t[Symbol.iterator]();!(n=(r=a.next()).done)&&(o.push(r.value),!e||o.length!==e);n=!0);}catch(t){i=!0,s=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw s}}return o}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}const d=Math.min,f=Math.max;function v(t,e,o){t=t/360*6,e/=100,o/=100;let n=Math.floor(t),i=t-n,s=o*(1-e),r=o*(1-i*e),a=o*(1-(1-i)*e),c=n%6;return[255*[o,r,s,s,a,o][c],255*[a,o,o,r,s,s][c],255*[s,s,a,o,o,r][c]]}function y(t,e,o){let n,i,s;const r=d(t/=255,e/=255,o/=255),a=f(t,e,o),c=a-r;if(0===c)n=i=0;else{i=c/a;let s=((a-t)/6+c/2)/c,r=((a-e)/6+c/2)/c,l=((a-o)/6+c/2)/c;t===a?n=l-r:e===a?n=1/3+s-l:o===a&&(n=2/3+r-s),n<0?n+=1:n>1&&(n-=1)}return[360*n,100*i,100*(s=a)]}function g(t,e,o,n){return e/=100,o/=100,[...y(255*(1-d(1,(t/=100)*(1-(n/=100))+n)),255*(1-d(1,e*(1-n)+n)),255*(1-d(1,o*(1-n)+n)))]}function m(t,e,o){return e/=100,[t,2*(e*=(o/=100)<.5?o:1-o)/(o+e)*100,100*(o+e)]}function b(t){return y(...t.match(/.{2}/g).map(t=>parseInt(t,16)))}function _(t){const e={cmyk:/^cmyk[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)/i,rgba:/^(rgb|rgba)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsla:/^(hsl|hsla)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsva:/^(hsv|hsva)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hex:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},o=t=>t.map(t=>/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0);let n;for(let r in e)if(n=e[r].exec(t))switch(r){case"cmyk":{let t=u(o(n),5),e=t[1],i=t[2],s=t[3],a=t[4];if(e>100||i>100||s>100||a>100)break;return{values:[...g(e,i,s,a),1],type:r}}case"rgba":{let t=u(o(n),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>255||i>255||s>255||c<0||c>1)break;return{values:[...y(e,i,s),c],type:r}}case"hex":{const t=(t,e)=>[t.substring(0,e),t.substring(e,t.length)];let e,o=u(n,2)[1];if(3===o.length?o+="F":6===o.length&&(o+="FF"),4===o.length){var i=u(t(o,3).map(t=>t+t),2);o=i[0],e=i[1]}else if(8===o.length){var s=u(t(o,6),2);o=s[0],e=s[1]}return e=parseInt(e,16)/255,{values:[...b(o),e],type:r}}case"hsla":{let t=u(o(n),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>360||i>100||s>100||c<0||c>1)break;return{values:[...m(e,i,s),c],type:r}}case"hsva":{let t=u(o(n),6),e=t[2],i=t[3],s=t[4],a=t[5],c=void 0===a?1:a;if(e>360||i>100||s>100||c<0||c>1)break;return{values:[e,i,s,c],type:r}}}return{values:null,type:null}}function w(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i=Math.ceil,s={h:t,s:e,v:o,a:n,toHSVA(){const t=[s.h,s.s,s.v],e=t.map(i);return t.push(s.a),t.toString=(()=>`hsva(${e[0]}, ${e[1]}%, ${e[2]}%, ${s.a.toFixed(1)})`),t},toHSLA(){const t=function(t,e,o){let n=(2-(e/=100))*(o/=100)/2;return 0!==n&&(e=1===n?0:n<.5?e*o/(2*n):e*o/(2-2*n)),[t,100*e,100*n]}(s.h,s.s,s.v),e=t.map(i);return t.push(s.a),t.toString=(()=>`hsla(${e[0]}, ${e[1]}%, ${e[2]}%, ${s.a.toFixed(1)})`),t},toRGBA(){const t=v(s.h,s.s,s.v),e=t.map(i);return t.push(s.a),t.toString=(()=>`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${s.a.toFixed(1)})`),t},toCMYK(){const t=function(t,e,o){const n=v(t,e,o),i=n[0]/255,s=n[1]/255,r=n[2]/255;let a,c,l,p;return[100*(c=1===(a=d(1-i,1-s,1-r))?0:(1-i-a)/(1-a)),100*(l=1===a?0:(1-s-a)/(1-a)),100*(p=1===a?0:(1-r-a)/(1-a)),100*a]}(s.h,s.s,s.v),e=t.map(i);return t.toString=(()=>`cmyk(${e[0]}%, ${e[1]}%, ${e[2]}%, ${e[3]}%)`),t},toHEX(){const t=function(t,e,o){return v(t,e,o).map(t=>Math.round(t).toString(16).padStart(2,"0"))}(...[s.h,s.s,s.v]);return t.toString=(()=>{const e=s.a>=1?"":Number((255*s.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return`#${t.join("").toUpperCase()+e}`}),t},clone:()=>w(s.h,s.s,s.v,s.a)};return s}function k(t){const e={options:Object.assign({lockX:!1,lockY:!1,onchange:()=>0},t),_tapstart(t){i(document,["mouseup","touchend","touchcancel"],e._tapstop),i(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e._tapmove(t)},_tapmove(t){const o=e.options,n=e.cache,i=o.element,s=e.options.wrapper.getBoundingClientRect();let r=0,a=0;if(t){const e=t&&t.touches&&t.touches[0];r=t?(e||t).clientX:0,a=t?(e||t).clientY:0,rs.left+s.width&&(r=s.left+s.width),as.top+s.height&&(a=s.top+s.height),r-=s.left,a-=s.top}else n&&(r=n.x*s.width,a=n.y*s.height);o.lockX||(i.style.left=`calc(${r/s.width*100}% - ${i.offsetWidth/2}px)`),o.lockY||(i.style.top=`calc(${a/s.height*100}% - ${i.offsetWidth/2}px)`),e.cache={x:r/s.width,y:a/s.height},o.onchange(r,a)},_tapstop(){s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=e.options.wrapper.getBoundingClientRect();e._tapmove({clientX:n.left+t,clientY:n.top+o})},destroy(){const t=e.options,o=e._tapstart;s([t.wrapper,t.element],"mousedown",o),s([t.wrapper,t.element],"touchstart",o,{passive:!1})}},o=e.options,n=e._tapstart;return i([o.wrapper,o.element],"mousedown",n),i([o.wrapper,o.element],"touchstart",n,{passive:!1}),e}function A(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=Object.assign({onchange:()=>0,className:"",elements:[]},t),i(t.elements,"click",e=>{t.elements.forEach(o=>o.classList[e.target===o?"add":"remove"](t.className)),t.onchange(e)}),{destory:()=>s(t.elements,"click",this._ontap)}}class C{constructor(t){this.options=Object.assign({useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},swatches:null,default:"fff",defaultRepresentation:"HEX",position:"middle",adjustableNumbers:!0,showAlways:!1,parent:void 0,closeWithKey:"Escape"},t),this.options.components.interaction||(this.options.components.interaction={}),this._initializingActive=!0,this._recalc=!0,this._color=w(),this._lastColor=w(),this._swatchColors=[],this._eventListener={swatchselect:[],change:[],save:[],init:[]},this._preBuild(),this._buildComponents(),this._bindEvents(),this._representation=this.options.defaultRepresentation,this.setColorRepresentation(this._representation),this._finalBuild(),this._rePositioningPicker();const e=this.options.swatches;e&&e.length&&e.forEach(t=>this.addSwatch(t)),requestAnimationFrame(function t(){if(!this._root.app.offsetParent)return requestAnimationFrame(t.bind(this));this.setColor(this.options.default),this._initializingActive=!1,this._emit("init")}.bind(this))}_preBuild(){const t=this.options;"string"==typeof t.el&&(t.el=document.querySelector(t.el)),this._root=function(t){const e=t.components,o=t.strings,n=t.useAsButton,i=t=>t?"":'style="display:none" hidden',s=l(`\n
\n \n ${n?"":''}\n\n
\n
\n
\n \n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n\n
\n
\n
\n
\n
\n\n
\n\n
\n \n\n \n \n \n \n \n\n \n \n
\n
\n
\n `),r=s.interaction;return r.options.find(t=>!t.hidden&&!t.classList.add("active")),r.type=(()=>r.options.find(t=>t.classList.contains("active"))),s}(t),t.useAsButton&&(t.parent||(t.parent="body"),this._root.button=t.el),document.body.appendChild(this._root.root)}_finalBuild(){const t=this.options,e=this._root;document.body.removeChild(e.root),t.parent&&("string"==typeof t.parent&&(t.parent=document.querySelector(t.parent)),t.parent.appendChild(e.app)),t.useAsButton||t.el.parentElement.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),t.showAlways?e.app.classList.add("visible"):this.hide()}_buildComponents(){const t=this,e=this.options.components,o={palette:k({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange(e,o){const n=t._color,i=t._root,s=t.options;n.s=e/this.wrapper.offsetWidth*100,n.v=100-o/this.wrapper.offsetHeight*100,n.v<0&&(n.v=0);const r=n.toRGBA().toString();this.element.style.background=r,this.wrapper.style.background=`\n linear-gradient(to top, rgba(0, 0, 0, ${n.a}), transparent), \n linear-gradient(to left, hsla(${n.h}, 100%, 50%, ${n.a}), rgba(255, 255, 255, ${n.a}))\n `,s.comparison||(i.button.style.color=r,s.useAsButton||(i.preview.lastColor.style.color=r)),i.preview.currentColor.style.color=r,t._recalc&&t._updateOutput(),i.button.classList.remove("clear")}}),hue:k({lockX:!0,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange(n,i){e.hue&&(t._color.h=i/this.wrapper.offsetHeight*360,this.element.style.backgroundColor=`hsl(${t._color.h}, 100%, 50%)`,o.palette.trigger())}}),opacity:k({lockX:!0,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange(o,n){e.opacity&&(t._color.a=Math.round(n/this.wrapper.offsetHeight*100)/100,this.element.style.background=`rgba(0, 0, 0, ${t._color.a})`,t.components.palette.trigger())}}),selectable:A({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=o}_bindEvents(){const t=this._root,e=this.options,o=[i(t.interaction.clear,"click",()=>this._clearColor()),i(t.preview.lastColor,"click",()=>this.setHSVA(...this._lastColor.toHSVA())),i(t.interaction.save,"click",()=>{!this.applyColor()&&!e.showAlways&&this.hide()}),i(t.interaction.result,["keyup","input"],t=>{this._recalc=!1,this.setColor(t.target.value,!0)&&!this._initializingActive&&this._emit("change",this._color),t.stopImmediatePropagation()}),i([t.palette.palette,t.palette.picker,t.hue.slider,t.hue.picker,t.opacity.slider,t.opacity.picker],["mousedown","touchstart"],()=>this._recalc=!0),i(window,"resize",()=>this._rePositioningPicker)];if(!e.showAlways){const n=e.closeWithKey;o.push(i(t.button,"click",()=>this.isOpen()?this.hide():this.show()),i(document,"keyup",t=>this.isOpen()&&(t.key===n||t.code===n)&&this.hide()),i(document,["touchstart","mousedown"],e=>{this.isOpen()&&!p(e).some(e=>e===t.app||e===t.button)&&this.hide()},{capture:!0}))}e.adjustableNumbers&&h(t.interaction.result,!1),this._eventBindings=o}_rePositioningPicker(){const t=this._root,e=this._root.app;if(this.options.parent){const o=t.button.getBoundingClientRect();e.style.position="fixed",e.style.marginLeft=`${o.left}px`,e.style.marginTop=`${o.top}px`}const o=t.button.getBoundingClientRect(),n=e.getBoundingClientRect(),i=e.style;n.bottom>window.innerHeight?i.top=`${-n.height-5}px`:o.bottom+n.heightwindow.innerWidth&&l-window.innerWidthwindow.innerWidth&&(a=s.left),i.left=`${a}px`}_updateOutput(){if(this._root.interaction.type()){const t=`to${this._root.interaction.type().getAttribute("data-type")}`;this._root.interaction.result.value="function"==typeof this._color[t]?this._color[t]().toString():""}this._initializingActive||this._emit("change",this._color)}_clearColor(){const t=this._root,e=this.options;e.useAsButton||(t.button.style.color="rgba(0, 0, 0, 0.4)"),t.button.classList.add("clear"),e.showAlways||this.hide(),this._emit("save",null)}_emit(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),n=1;nt(...o,this))}on(t,e){return"function"==typeof e&&"string"==typeof t&&t in this._eventListener&&this._eventListener[t].push(e),this}off(t,e){const o=this._eventListener[t];if(o){const t=o.indexOf(e);~t&&o.splice(t,1)}return this}addSwatch(t){const e=_(t).values;if(e){const t=this._swatchColors,o=this._root,n=w(...e),s=a(``);return o.swatches.appendChild(s),t.push({element:s,hsvaColorObject:n}),this._eventBindings.push(i(s,"click",()=>{this.setHSVA(...n.toHSVA(),!0),this._emit("swatchselect",n)})),!0}return!1}removeSwatch(t){if("number"==typeof t){const e=this._swatchColors[t];if(e){const o=e.element;return this._root.swatches.removeChild(o),this._swatchColors.splice(t,1),!0}}return!1}applyColor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this._root,o=e.preview,n=e.button,i=this._color.toRGBA().toString();o.lastColor.style.color=i,this.options.useAsButton||(n.style.color=i),n.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color)}destroy(){this._eventBindings.forEach(t=>s(...t)),Object.keys(this.components).forEach(t=>this.components[t].destroy())}destroyAndRemove(){this.destroy();const t=this._root.root;t.parentElement.removeChild(t)}hide(){return this._root.app.classList.remove("visible"),this}show(){if(!this.options.disabled)return this._root.app.classList.add("visible"),this._rePositioningPicker(),this}isOpen(){return this._root.app.classList.contains("visible")}setHSVA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||o<0||o>100||n<0||n>1)return!1;const r=this.components,a=r.hue,c=r.opacity,l=r.palette,p=a.options.wrapper.offsetHeight*(t/360);a.update(0,p);const h=c.options.wrapper.offsetHeight*n;c.update(0,h);const u=l.options.wrapper,d=u.offsetWidth*(e/100),f=u.offsetHeight*(1-o/100);return l.update(d,f),this._color=w(t,e,o,n),this._recalc=s,this._recalc&&this._updateOutput(),i||this.applyColor(),!0}setColor(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===t)return this._clearColor(),!0;const o=_(t),n=o.values,i=o.type;if(n){const t=i.toUpperCase(),o=this._root.interaction.options,s=o.find(e=>e.getAttribute("data-type")===t);if(!s.hidden)for(const t of o)t.classList[t===s?"add":"remove"]("active");return this.setHSVA(...n,e)}}setColorRepresentation(t){return t=t.toUpperCase(),!!this._root.interaction.options.find(e=>e.getAttribute("data-type")===t&&!e.click())}getColorRepresentation(){return this._representation}getColor(){return this._color}getRoot(){return this._root}disable(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}enable(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}C.utils={once:(t,e,o,n)=>i(t,e,function t(){o.apply(this,arguments),this.removeEventListener(e,t)},n),on:i,off:s,eventPath:p,createElementFromString:a,adjustableInputNumbers:h,removeAttribute:c,createFromTemplate:l},C.create=(t=>new C(t)),C.version="0.4.2";e.default=C}]).default}); +//# sourceMappingURL=pickr.min.js.map \ No newline at end of file diff --git a/app/js/post/bb-md.js b/app/js/post/bb-md.js index abe94bad..75a88882 100644 --- a/app/js/post/bb-md.js +++ b/app/js/post/bb-md.js @@ -290,10 +290,10 @@ function preview(){ for(let l = 0; l < li.length; l++) { var u=li[l].match(/^1\. (.+)$/); var listUl='
  • '+u[1]+'
  • '; - if(l == 0){ + if(l === 0){ listUl='
      '+listUl; } - if(l==li.length-1){ + if(l===li.length-1){ listUl=listUl+'
    '; } var bb=bb.replace(new RegExp(li[l], ""),listUl); diff --git a/app/js/post/emoji.js b/app/js/post/emoji.js index 85fc4629..c184b157 100644 --- a/app/js/post/emoji.js +++ b/app/js/post/emoji.js @@ -90,7 +90,7 @@ function emojiList(target) { var page = Math.ceil(num / 126); $("#emoji-sum").text(page); var ct = Math.ceil(start / 126); - if (ct == 0) { + if (ct === 0) { var ct = 1; $("#emoji-before").addClass("disabled"); } else { diff --git a/app/js/post/img.js b/app/js/post/img.js index 51310143..0dcd41d2 100644 --- a/app/js/post/img.js +++ b/app/js/post/img.js @@ -106,7 +106,7 @@ function media(b64, type, no) { var start = "https://" + domain + "/api/drive/files/create"; httpreq.open('POST', start, true); httpreq.upload.addEventListener("progress", progshow, false); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; if ($("#nsfw").hasClass("nsfw-avail")) { var nsfw = true; } else { @@ -121,12 +121,12 @@ function media(b64, type, no) { var start = "https://" + domain + "/api/v1/media"; httpreq.open('POST', start, true); httpreq.upload.addEventListener("progress", progshow, false); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.send(fd); } httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); var img = localStorage.getItem("img"); diff --git a/app/js/post/misskeystatus.js b/app/js/post/misskeystatus.js index 77b28b50..6724c2f6 100644 --- a/app/js/post/misskeystatus.js +++ b/app/js/post/misskeystatus.js @@ -1,7 +1,7 @@ //Renpost function renote(id, acct_id, remote) { if ($("#pub_" + id).hasClass("rted")) { - return + return false; } var domain = localStorage.getItem("domain_" + acct_id); var at = localStorage.getItem("acct_"+ acct_id + "_at"); @@ -12,10 +12,10 @@ function renote(id, acct_id, remote) { var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({i:at,renoteId:id})); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); $("[toot-id=" + id + "]").addClass("rted"); @@ -58,10 +58,10 @@ function reactiontoggle(id,acct_id,tlid){ var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({i:at,noteId:id})); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); if(json.reactionCounts){ @@ -158,10 +158,10 @@ function reaction(mode,id,acct_id,tlid){ var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({i:at,noteId:id,reaction:mode})); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { $(".fav_"+id).toggleClass("yellow-text"); } } @@ -177,7 +177,7 @@ function vote(acct_id,id,to){ var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({i:at,noteId:id,choice:to})); httpreq.onreadystatechange = function() { voterefresh(acct_id,id) diff --git a/app/js/post/post.js b/app/js/post/post.js index aa3cf5fa..4136fc55 100644 --- a/app/js/post/post.js +++ b/app/js/post/post.js @@ -11,7 +11,7 @@ function sec(){ } function post(mode,postvis) { if($("#toot-post-btn").prop("disabled")){ - return + return false; } var str = $("#textarea").val(); var acct_id = $("#post-acct-sel").val(); @@ -57,13 +57,13 @@ function post(mode,postvis) { buttons: [lang.lang_post_btn1,lang.lang_post_btn2, lang.lang_post_btn3] } dialog.showMessageBox(options, function(arg) { - if(arg==1){ + if(arg===1){ $("#cw-text").show(); $("#cw").addClass("yellow-text"); $("#cw").addClass("cw-avail"); $("#cw-text").val(plus); post("pass"); - }else if(arg==2){ + }else if(arg===2){ post("pass"); } }) @@ -162,10 +162,10 @@ function post(mode,postvis) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify(toot)); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { if(str.indexOf(localStorage.getItem("stable"))==-1){ localStorage.removeItem("stable") } @@ -234,10 +234,10 @@ function misskeyPost(){ var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify(toot)); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { if(str.indexOf(localStorage.getItem("stable"))==-1){ localStorage.removeItem("stable") } diff --git a/app/js/post/status.js b/app/js/post/status.js index 13860500..43301ab9 100644 --- a/app/js/post/status.js +++ b/app/js/post/status.js @@ -13,10 +13,10 @@ function fav(id, acct_id, remote) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; if(remote!="remote"){ //APIのふぁぼカウントがおかしい @@ -63,10 +63,10 @@ function rt(id, acct_id, remote) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); if (remote != "remote") { @@ -133,10 +133,10 @@ function follow(acct_id,remote) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify(ent)); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); if ($("#his-data").hasClass("following")) { @@ -168,10 +168,10 @@ function block(acct_id) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { if ($("#his-data").hasClass("blocking")) { $("#his-data").removeClass("blocking"); $("#his-block-btn").text(lang.lang_status_block); @@ -210,10 +210,10 @@ function mute(acct_id) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(rq); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { if ($("#his-data").hasClass("muting")) { $("#his-data").removeClass("muting"); $("#his-mute-btn").text(lang.lang_status_mute); @@ -234,7 +234,7 @@ function del(id, acct_id) { var httpreq = new XMLHttpRequest(); httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({i:at,noteId:id})); }else{ var start = "https://" + domain + "/api/v1/statuses/" + id; @@ -242,11 +242,11 @@ function del(id, acct_id) { httpreq.open('DELETE', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); } httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { } } } @@ -300,10 +300,10 @@ function pin(id, acct_id) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); if ($("[toot-id=" + id + "]").hasClass("pined")) { @@ -326,10 +326,10 @@ function request(id, flag, acct_id) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); showReq(); @@ -349,10 +349,10 @@ function domainblock(add, flag, acct_id) { httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); showDom(); @@ -406,10 +406,10 @@ function pinUser(){ httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); if ($("#his-end-btn").hasClass("endorsed")) { diff --git a/app/js/tl/card.js b/app/js/tl/card.js index 4da9d56e..d9e981f3 100644 --- a/app/js/tl/card.js +++ b/app/js/tl/card.js @@ -83,7 +83,7 @@ function additional(acct_id, tlid) { var xmlHttpRequest = new XMLHttpRequest(); xmlHttpRequest.onreadystatechange = function() { - if( this.readyState == 4 && this.status == 200 ) { + if( this.readyState === 4 && this.status === 200 ) { if( this.response){ var json=this.response; var emojis=json.emojis; diff --git a/app/js/tl/datails.js b/app/js/tl/datails.js index eb4ec0bf..1252348c 100644 --- a/app/js/tl/datails.js +++ b/app/js/tl/datails.js @@ -78,10 +78,11 @@ function details(id, acct_id, tlid) { $("#tootmodal").attr("data-user",scn); } context(id, acct_id); + var dom=null; if(!local){ - var dom=scn.replace(/.+@/g,''); + dom=scn.replace(/.+@/g,''); }else{ - var dom=domain; + dom=domain; } beforeToot(id, acct_id, dom); userToot(id, acct_id, uid); @@ -448,7 +449,7 @@ function shot(){ }) } //翻訳 -function trans(tar){ +function trans(tar,to){ var html=$("#toot-this .toot").html(); if(html.match(/^

    (.+)<\/p>$/)){ html = html.match(/^

    (.+)<\/p>$/)[1]; @@ -457,18 +458,21 @@ function trans(tar){ html = html.replace(/

    /g, "\n"); html = html.replace(/<\/p>/g, "\n"); html=$.strip_tags(html); + if(~tar.indexOf("zh")){ + tar="zh"; + } $("#toot-this .additional").text("Loading...(Powered by Google Translate)"); - var exec='https://script.google.com/macros/s/AKfycbz0ETqcUxwNlw961GjErNb7vr_X18N2s1AS5Xu5nFTbYXcdcRM/exec?text='+encodeURIComponent(html)+'&source='+tar+'&target=ja' + var exec='https://script.google.com/macros/s/AKfycbxhwW5tjjop9Irg-y1zr_WsXlCKEzwWG6KuoOt_vVRDfEbRv0c/exec?format=json&text='+encodeURIComponent(html)+'&source='+tar+'&target='+to console.log(exec); fetch(exec, { method: 'GET', }).then(function(response) { - return response.text(); + return response.json(); }).catch(function(error) { todo(error); console.error(error); }).then(function(text) { - $("#toot-this .additional").html(''+text+''); + $("#toot-this .additional").html(''+text.text+''); }); } //ブラウザで開く diff --git a/app/js/tl/date.js b/app/js/tl/date.js index 3ab4d752..505eb54d 100644 --- a/app/js/tl/date.js +++ b/app/js/tl/date.js @@ -15,10 +15,11 @@ function date(str, datetype) { } else { var min = date.getMinutes(); } + var sec=null; if (date.getSeconds() < 10) { - var sec = "0" + date.getSeconds(); + sec = "0" + date.getSeconds(); } else { - var sec = date.getSeconds(); + sec = date.getSeconds(); } if (datetype == "full") { var ret = date.getFullYear() + "/" + month + "/" + date.getDate() + "/ " + @@ -56,10 +57,11 @@ function date(str, datetype) { //特殊フォーマット(インスタンス情報で利用) function crat(str) { var date = new Date(str); + var mnt=null; if(date.getMonth()<9){ - var mnt="0"+(date.getMonth()+1); + mnt="0"+(date.getMonth()+1); }else{ - var mnt=date.getMonth()+1; + mnt=date.getMonth()+1; } if(date.getDate()<10){ var dat="0"+date.getDate(); diff --git a/app/js/tl/dm.js b/app/js/tl/dm.js index 38215ae2..8167bddd 100644 --- a/app/js/tl/dm.js +++ b/app/js/tl/dm.js @@ -32,9 +32,6 @@ function dmParse(obj, mix, acct_id, tlid, popup, mutefilter) { console.log(obj); var templete = ''; if(obj[0]){ - if(tlid==1){ - console.log("testalive:"+"lastunix_"+ tlid+":"+date(obj[0].created_at, 'unix')) - } localStorage.setItem("lastunix_"+ tlid,date(obj[0].created_at, 'unix')); } diff --git a/app/js/tl/filter.js b/app/js/tl/filter.js index 43542eed..bc20ee89 100644 --- a/app/js/tl/filter.js +++ b/app/js/tl/filter.js @@ -192,7 +192,7 @@ function makeNewFilter(){ httpreq.open(method, start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ phrase: phr, context: cont, @@ -201,7 +201,7 @@ function makeNewFilter(){ expires_in:time })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; filter(); filterUpdate(acct_id) @@ -283,10 +283,10 @@ function filterDel(id,acct_id){ httpreq.open("DELETE", start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; filter(); filterUpdate(acct_id) diff --git a/app/js/tl/list.js b/app/js/tl/list.js index 428188bb..ae5d0747 100644 --- a/app/js/tl/list.js +++ b/app/js/tl/list.js @@ -56,12 +56,12 @@ function makeNewList(){ httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ title: text })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; list(); $("#list-add").val("") @@ -166,12 +166,12 @@ function listAdd(id,user,acct_id){ httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ account_ids: [user] })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; hisList(user,acct_id) } @@ -186,12 +186,12 @@ function listRemove(id,user,acct_id){ httpreq.open('DELETE', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ account_ids: [user] })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; hisList(user,acct_id) } diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js index f018f4a9..736b3e19 100644 --- a/app/js/tl/notification.js +++ b/app/js/tl/notification.js @@ -39,10 +39,10 @@ function notfColumn(acct_id, tlid, sys){ var body=""; } - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(body); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; var max_id = httpreq.getResponseHeader("link").match(/\?max_id=([0-9]+)/)[1]; if(json[0]){ @@ -391,10 +391,10 @@ function notfmore(tlid) { var body=""; } - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(body); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); var max_id = httpreq.getResponseHeader("link").match(/\?max_id=([0-9]+)/)[1]; diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 12c7dc23..779f7003 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -2,7 +2,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { var templete = ''; if(obj[0]){ - if(tlid==1){ + if(tlid===1){ console.log("testalive:"+"lastunix_"+ tlid+":"+date(obj[0].created_at, 'unix')) } localStorage.setItem("lastunix_"+ tlid,date(obj[0].created_at, 'unix')); @@ -84,7 +84,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { var card = localStorage.getItem("card_" + tlid); if (!sent) { - var sent = 500; + sent = 500; } if (!ltr) { var ltr = 500; @@ -614,8 +614,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { }); } //日本語じゃない - if(toot.language!="ja"){ - var trans='

    '; + if(toot.language!=lang.language && toot.language){ + var trans=''; }else{ var trans=""; } @@ -673,9 +673,14 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { } var result_hide="hide"; } + if(toot.poll.expired){ + var ended=lang.lang_parse_endedvote; + }else{ + var ended=date(toot.poll.expires_at, datetype); + } Object.keys(choices).forEach(function(keyc) { var choice = choices[keyc]; - if(!toot.poll.voted){ + if(!toot.poll.voted && !toot.poll.expired){ var votesel='voteSelMastodon(\''+acct_id+'\',\''+toot.poll.id+'\','+keyc+','+toot.poll.multiple+')'; var voteclass="pointer waves-effect waves-light"; }else{ @@ -686,7 +691,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { }); poll='
    '+poll+myvote+'' + - date(toot.poll.expires_at, datetype) + '
    '; + ended+ ''; } templete = templete + '
    '+his[0].uses+'toots #' + tag.name + ' '+his[0].accounts+lang.lang_src_people; diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js index 9386dfaa..d13924b4 100644 --- a/app/js/tl/tl.js +++ b/app/js/tl/tl.js @@ -289,7 +289,7 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) { say(obj.content) } var templete = parse([obj], type, acct_id, tlid,"",mute); - if ($("timeline_box_"+tlid+"_box .tl-box").scrollTop() == 0) { + if ($("timeline_box_"+tlid+"_box .tl-box").scrollTop() === 0) { $("#timeline_" + tlid).prepend(templete); }else{ var pool = localStorage.getItem("pool_" + tlid); @@ -578,7 +578,7 @@ function com(type, data) { return "tag/" + data + "?" }else if (type == "list") { return "list/" + data + "?" - }else if (type="dm") { + }else if (type=="dm") { return "direct?" } } diff --git a/app/js/ui/img.js b/app/js/ui/img.js index 7593c77a..50f90f37 100644 --- a/app/js/ui/img.js +++ b/app/js/ui/img.js @@ -222,13 +222,13 @@ function imgCont(type) { } } } - if ($("#" + id + "-image-" + (key * 1 + 1)).length == 0) { + if ($("#" + id + "-image-" + (key * 1 + 1)).length === 0) { $("#image-next").prop("disabled", true); } else { $("#image-next").prop("disabled", false); } console.log("#" + id + "-image-" + (key * 1 - 1)); - if ($("#" + id + "-image-" + (key * 1 - 1)).length == 0) { + if ($("#" + id + "-image-" + (key * 1 - 1)).length === 0) { $("#image-prev").prop("disabled", true); } else { $("#image-prev").prop("disabled", false); @@ -289,7 +289,7 @@ function zoom(z) { 'cursor': 'move' }); //指が触れたか検知 $(this).on('touchmove', function(event) { - if ($(target).data('down') == true) { + if ($(target).data('down') === true) { // スクロール console.log($(target).data('x')); target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') - diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index 44336976..96f692e2 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -311,7 +311,7 @@ function removeColumn(tlid) { ipc.send('column-del', ""); ipc.on('column-del-reply', function (event, arg) { console.log(arg); - if(arg==1){ + if(arg===1){ localStorage.removeItem("card_" + tlid); obj.splice(tlid, 1); for(var i=0;i { + 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;} + var descC=$("#custom_desc").val(); + var primaryC=$("#color-picker0_value").val(); + if(!primaryC){primaryC="rgb(255,255,255)"} + var secondaryC=$("#color-picker1_value").val(); + 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)"} + var multi = localStorage.getItem("multi"); + var my=JSON.parse(multi)[0].name; + var id=$("#custom-edit-sel").val(); + if(id=="add_new"){ + id=makeCID(); + } + var json={ + "name": nameC, + "author": my, + "desc": descC, + "base": $("[name=direction]:checked").val(), + "vars": { + "primary": primaryC, + "secondary": secondaryC, + "text": textC + }, + "props": { + "TheDeskAccent": accentC + }, + "id": id + } + $("#custom_json").val(JSON.stringify(json)); + themes(); + $("#custom_name").val(""); + $("#custom_desc").val(""); + $("#dark").prop("checked", true); + $("#custom_json").val(""); + $("#color-picker0-wrap").html('
    ') + $("#color-picker1-wrap").html('
    ') + $("#color-picker2-wrap").html('
    ') + $("#color-picker3-wrap").html('
    ') + $("#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"); + ipc.send('theme-json-create', JSON.stringify(json)); +} +function deleteIt(){ + var id=$("#custom-sel-sel").val(); + $("#custom_name").val(""); + $("#custom_desc").val(""); + $("#dark").prop("checked", true); + $("#custom_json").val(""); + $("#color-picker0-wrap").html('
    ') + $("#color-picker1-wrap").html('
    ') + $("#color-picker2-wrap").html('
    ') + $("#color-picker3-wrap").html('
    ') + $("#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"); + ipc.on('theme-json-delete-complete', function (event, args) { + ctLoad() + }); + ipc.send('theme-json-delete', id); +} +function ctLoad(){ + ipc.send('theme-json-list', ""); + ipc.on('theme-json-list-response', function (event, args) { + console.log(args); + var templete=""; + Object.keys(args).forEach(function(key) { + var theme = args[key]; + var themeid=theme.id + templete = templete+''; + }); + if(args[0]){ + localStorage.setItem("customtheme-id",args[0].id) + } + $("#custom-sel-sel").html(templete); + templete=''+templete; + $("#custom-edit-sel").html(templete); + $('select').material_select('update'); + }); +} +function customSel(){ + var id=$("#custom-sel-sel").val(); + localStorage.setItem("customtheme-id",id) +} +function custom(){ + var id=$("#custom-edit-sel").val(); + if(id=="add_new"){ + $("#custom_name").val(""); + $("#custom_desc").val(""); + $("#dark").prop("checked", true); + $("#custom_json").val(""); + $("#color-picker0-wrap").html('
    ') + $("#color-picker1-wrap").html('
    ') + $("#color-picker2-wrap").html('
    ') + $("#color-picker3-wrap").html('
    ') + $("#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") + }else{ + $("#delTheme").removeClass("disabled") + ipc.send('theme-json-request', id); + ipc.on('theme-json-response', function (event, args) { + console.log(args); + $("#custom_name").val(args.name); + $("#custom_desc").val(args.desc); + $("#"+args.base).prop("checked", true); + $("#color-picker0-wrap").html('
    ') + pickerDefine(0,rgbToHex(args.vars.primary)) + $("#color-picker0_value").val(args.vars.primary); + $("#color-picker1-wrap").html('
    ') + pickerDefine(1,rgbToHex(args.vars.secondary)) + $("#color-picker1_value").val(args.vars.secondary); + $("#color-picker2-wrap").html('
    ') + $("#color-picker2_value").val(args.vars.text); + pickerDefine(2,rgbToHex(args.vars.text)) + if(args.props){ + if(args.props.TheDeskAccent){ + var accent=args.props.TheDeskAccent; + }else{ + var accent=args.vars.secondary; + } + }else{ + var accent=args.vars.secondary; + } + $("#color-picker3-wrap").html('
    ') + pickerDefine(3,rgbToHex(accent)) + $("#custom_json").val(JSON.stringify(args)); + }); + } +} +function customImp(){ + var json=$("#custom_import").val(); + if(JSON5.parse(json)){ + ipc.send('theme-json-create', json); + }else{ + alert("Error") + } +} + +ipc.on('theme-json-create-complete', function (event, args) { + $("#custom_import").val(""); + ctLoad() +}); +//最初に読む +load(); +climute(); +wordmute(); +wordemp(); +checkSpotify(); +voiceSettingLoad(); +oksload(); +npprovider(); +ctLoad() \ No newline at end of file diff --git a/app/js/ui/theme.js b/app/js/ui/theme.js index 18d93523..ca5b65d0 100644 --- a/app/js/ui/theme.js +++ b/app/js/ui/theme.js @@ -11,6 +11,7 @@ function themes(theme) { $("html").removeClass("greentheme"); $("html").removeClass("browntheme"); $("html").removeClass("blacktheme"); + $("html").removeClass("customtheme"); $("html").addClass(theme+"theme"); var font = localStorage.getItem("font"); if(font){ @@ -18,5 +19,10 @@ function themes(theme) { }else{ $("html").css("font-family",""); } + if(theme=="custom"){ + if(localStorage.getItem("customtheme-id")){ + ipc.send('theme-css-request', localStorage.getItem("customtheme-id")); + } + } } themes(); \ No newline at end of file diff --git a/app/js/userdata/prof-edit.js b/app/js/userdata/prof-edit.js index 080871c7..3b6d7bdf 100644 --- a/app/js/userdata/prof-edit.js +++ b/app/js/userdata/prof-edit.js @@ -12,13 +12,13 @@ function profedit() { httpreq.open('PATCH', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify({ display_name: name, note: des, })); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { $('#his-data').modal('close'); todc(); } @@ -47,10 +47,10 @@ function imgChange(imgfile, target) { httpreq.open('PATCH', start, true); httpreq.upload.addEventListener("progress", progshow, false); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(fd); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { var json = httpreq.response; console.log(json); $('#his-data').modal('close'); diff --git a/app/js/userdata/showOnTL.js b/app/js/userdata/showOnTL.js index 30f03272..a464d32d 100644 --- a/app/js/userdata/showOnTL.js +++ b/app/js/userdata/showOnTL.js @@ -46,7 +46,7 @@ function udgEx(user,acct_id){ shell.openExternal(url); } }); - return; + return true; } function udg(user, acct_id) { reset(); diff --git a/app/language.js b/app/language.js new file mode 100644 index 00000000..060a196e --- /dev/null +++ b/app/language.js @@ -0,0 +1,155 @@ +// Create the Application's main menu +function templete(lang){ + const electron = require("electron"); + const app = electron.app; + const BrowserWindow = electron.BrowserWindow; + const dict={ + "application":{ + "ja":"アプリケーション", + "en":"Application" + }, + "about":{ + "ja":"TheDeskについて", + "en":"About TheDesk" + }, + "quit":{ + "ja":"終了", + "en":"Quit" + }, + "edit":{ + "ja":"編集", + "en":"Edit" + }, + "undo":{ + "ja":"元に戻す", + "en":"Undo" + }, + "redo":{ + "ja":"やり直す", + "en":"Redo" + }, + "cut":{ + "ja":"切り取り", + "en":"Cut" + }, + "copy":{ + "ja":"コピー", + "en":"Copy" + }, + "paste":{ + "ja":"貼り付け", + "en":"Paste" + }, + "selall":{ + "ja":"すべて選択", + "en":"Select All" + }, + "view":{ + "ja":"表示", + "en":"View" + }, + "reload":{ + "ja":"再読み込み", + "en":"Reload" + }, + "window":{ + "ja":"ウィンドウ", + "en":"Window" + }, + "minimun":{ + "ja":"最小化", + "en":"Minimarize" + }, + "close":{ + "ja":"閉じる", + "en":"Close" + } + } + const menu = [{ + label: dict.application[lang], + submenu: [ + { label: dict.about[lang], click: function() { + var ver=app.getVersion() + var window = new BrowserWindow({width: 300, height: 460, + "transparent": false, // ウィンドウの背景を透過 + "frame": false, // 枠の無いウィンドウ + "resizable": false }); + window.loadURL('file://' + __dirname + '/about.html?ver='+ver); + } }, + { type: "separator" }, + { label: dict.quit[lang], accelerator: "Command+Q", click: function() { app.quit(); }} + + ]}, { + label: dict.edit[lang], + submenu: [ + { label: dict.undo[lang], accelerator: "CmdOrCtrl+Z", selector: "undo:" }, + { label: dict.redo[lang], accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" }, + { type: "separator" }, + { label: dict.cut[lang], accelerator: "CmdOrCtrl+X", selector: "cut:" }, + { label: dict.copy[lang], accelerator: "CmdOrCtrl+C", selector: "copy:" }, + { label: dict.paste[lang], accelerator: "CmdOrCtrl+V", selector: "paste:" }, + { label: dict.selall[lang], accelerator: "CmdOrCtrl+A", selector: "selectAll:" } + ]},{ + label: dict.view[lang], + submenu: [ + { + label: 'Toggle Developer Tools', + accelerator: 'Alt+Command+I', + click: function() { mainWindow.toggleDevTools(); } + }, + { + label: dict.reload[lang], + accelerator: 'CmdOrCtrl+R', + click: function() { mainWindow.webContents.send('reload', " "); } + } + ] + }, + { + label: dict.window[lang], + role: 'window', + submenu: [ + { + label: dict.minimun[lang], + accelerator: 'CmdOrCtrl+M', + role: 'minimize' + }, + { + label: dict.close[lang], + accelerator: 'CmdOrCtrl+W', + role: 'close' + }, + ] + } + ]; + return menu; +} +function delsel(lang){ + const dict={ + "delete":{ + "ja":"カラム削除", + "en":"Delete this column" + }, + "mess":{ + "ja":"カラムを削除しますか?(すべてのカラムのリンク解析がOFFになります。)", + "en":"Delete this column(URL analyzes of all windows will be disabled.)" + }, + "yes":{ + "ja":"はい", + "en":"Yes" + }, + "no":{ + "ja":"いいえ", + "en":"No" + } + } + const options = { + type: 'info', + title: dict.delete[lang], + message: dict.mess[lang], + buttons: [dict.no[lang], dict.yes[lang]] + } + return options; +} + +exports.template = templete; +exports.delsel = delsel; \ No newline at end of file diff --git a/app/main.js b/app/main.js index b67921a7..d57b72e4 100644 --- a/app/main.js +++ b/app/main.js @@ -9,9 +9,11 @@ const shell = electron.shell; const os = require('os') const path = require('path') const fm = require('font-manager'); +const language = require('./language.js'); const Menu=electron.Menu var updatewin=null; const join = require('path').join; +var JSON5 = require('json5'); // アプリケーションをコントロールするモジュール const app = electron.app; // ウィンドウを作成するモジュール @@ -24,6 +26,8 @@ let mainWindow; 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 customcss=join(app.getPath("userData"), "custom.css"); + var tmp_img = join(app.getPath("userData"), "tmp.png"); var window_size; try { @@ -43,9 +47,21 @@ try { height: "string", x: "string", y: "string" + }; // デフォルトバリュー } - +try { + var lang = fs.readFileSync(lang_path, 'utf8'); +} catch (e) { + var lang=app.getLocale(); + if(~lang.indexOf("ja")){ + lang="ja"; + }else{ + lang="en"; + } + fs.writeFileSync(lang_path,lang); +} +console.log("launch:"+lang); // 全てのウィンドウが閉じたら終了 app.on('window-all-closed', function() { if (process.platform != 'darwin') { @@ -64,17 +80,6 @@ function createWindow() { var arg={width:window_size.width,height:window_size.height,x:window_size.x,y:window_size.y,simpleFullscreen:true} } mainWindow = new BrowserWindow(arg); - try { - var lang = fs.readFileSync(lang_path, 'utf8'); - } catch (e) { - var lang=app.getLocale(); - if(~lang.indexOf("ja")){ - lang="ja"; - }else{ - lang="en"; - } - fs.writeFileSync(lang_path,lang); - } electron.session.defaultSession.clearCache(() => {}) if(process.argv){ if(process.argv[1]){ @@ -119,60 +124,11 @@ function createWindow() { mainWindow.on('maximize', function() { fs.writeFileSync(max_info_path, JSON.stringify(mainWindow.getBounds())); }); - // Create the Application's main menu - var template = [{ - label: "アプリケーション", - submenu: [ - { label: "TheDeskについて", click: function() { about(); } }, - { type: "separator" }, - { label: "終了", accelerator: "Command+Q", click: function() { app.quit(); }} - - ]}, { - label: "編集", - submenu: [ - { label: "元に戻す", accelerator: "CmdOrCtrl+Z", selector: "undo:" }, - { label: "やり直し", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" }, - { type: "separator" }, - { label: "切り取り", accelerator: "CmdOrCtrl+X", selector: "cut:" }, - { label: "コピー", accelerator: "CmdOrCtrl+C", selector: "copy:" }, - { label: "貼り付け", accelerator: "CmdOrCtrl+V", selector: "paste:" }, - { label: "すべて選択", accelerator: "CmdOrCtrl+A", selector: "selectAll:" } - ]},{ - label: "表示", - submenu: [ - { - label: 'Toggle Developer Tools', - accelerator: 'Alt+Command+I', - click: function() { mainWindow.toggleDevTools(); } - }, - { - label: '再読み込み', - accelerator: 'CmdOrCtrl+R', - click: function() { mainWindow.webContents.send('reload', " "); } - } - ] - }, - { - label: 'ウィンドウ', - role: 'window', - submenu: [ - { - label: '最小化', - accelerator: 'CmdOrCtrl+M', - role: 'minimize' - }, - { - label: '閉じる', - accelerator: 'CmdOrCtrl+W', - role: 'close' - }, - ] - } - ]; + var platform=process.platform; var bit=process.arch; if(platform=="darwin"){ - Menu.setApplicationMenu(Menu.buildFromTemplate(template)); + Menu.setApplicationMenu(Menu.buildFromTemplate(language.template(lang))); } } // Electronの初期化完了後に実行 @@ -211,9 +167,99 @@ ipc.on('native-notf', function(e, args) { }); //言語 ipc.on('lang', function(e, arg) { + console.log("set:"+arg); fs.writeFileSync(lang_path,arg); mainWindow.webContents.send('langres', ""); }) +//CSS +ipc.on('custom-css-create', function(e, arg) { + fs.writeFileSync(customcss,arg); + mainWindow.webContents.send('custom-css-create-complete', ""); +}) +ipc.on('custom-css-request', function(e, arg) { + try { + var css = fs.readFileSync(customcss, 'utf8'); + } catch (e) { + var css=""; + } + mainWindow.webContents.send('custom-css-response', css); +}) +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))); + if(JSON5.parse(arg)["id"]){ + mainWindow.webContents.send('theme-json-create-complete', ""); + }else{ + mainWindow.webContents.send('theme-json-create-complete', "error"); + } +}) +ipc.on('theme-json-delete', function(e, arg) { + var themecss=join(app.getPath("userData"), arg+".thedesktheme"); + console.log(themecss); + fs.unlink(themecss, function (err) { + mainWindow.webContents.send('theme-json-delete-complete', ""); + }); +}) +ipc.on('theme-json-request', function(e, arg) { + var themecss=join(app.getPath("userData"), arg+".thedesktheme"); + var json = JSON.parse(fs.readFileSync(themecss, 'utf8')); + mainWindow.webContents.send('theme-json-response', json); +}) +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 primary=json.vars.primary; + var secondary=json.vars.secondary; + var text=json.vars.text; + if(json.base=="light"){ + var drag="rgba(255, 255, 255, 0.8)"; + var beforehover="#757575"; + }else{ + var drag="rgba(0, 0, 0, 0.8)"; + var beforehover="#9e9e9e"; + } + if(json.props){ + if(json.props.TheDeskAccent){ + var emphasized=json.props.TheDeskAccent + }else{ + var emphasized=secondary; + } + }else{ + var emphasized=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:"+secondary+ + +"--active:"+primary+";--postbox:"+primary+";--modalfooter:"+primary+";}.blacktheme #imagemodal{background: url(\"../img/pixel.svg\");}"; + mainWindow.webContents.send('theme-css-response', css); + } catch (e) { + var css=""; + } + +}) +ipc.on('theme-json-list', function(e, arg) { + fs.readdir(app.getPath("userData"), function(err, files){ + if (err) throw err; + var fileList = files.filter(function(file){ + var tfile=join(app.getPath("userData"), file); + return fs.statSync(tfile).isFile() && /.*\.thedesktheme$/.test(tfile); //絞り込み + }) + var themes=[]; + for(var i=0;i { }); ipc.on('column-del', (e, args) => { -const options = { - type: 'info', - title: 'カラム削除', - message: "カラムを削除しますか?(すべてのカラムのリンク解析がOFFになります。)", - buttons: ['いいえ', 'はい'] - } + console.log(lang); + var options=language.delsel(lang) dialog.showMessageBox(options, function(index) { mainWindow.webContents.send('column-del-reply', index); }) @@ -505,7 +548,7 @@ ipc.on('nano', function (e, x, y) { buttons: ['拒否', '許可','永続的に許可'] } dialog.showMessageBox(options, function(index) { - if(index==2){ + if(index===2){ mainWindow.webContents.send('adobeagree', "true"); } if(index>0){ diff --git a/app/nano.html b/app/nano.html index 9173c5d5..930193eb 100644 --- a/app/nano.html +++ b/app/nano.html @@ -178,10 +178,10 @@ function post(){ httpreq.open('POST', start, true); httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); - httpreq.responseType = 'json'; + httpreq.responseType = "json"; httpreq.send(JSON.stringify(toot)); httpreq.onreadystatechange = function() { - if (httpreq.readyState == 4) { + if (httpreq.readyState === 4) { $("#textarea").val(""); } } diff --git a/app/package-lock.json b/app/package-lock.json index ca43211a..14cfd0d0 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "thedesk", - "version": "17.0.2", + "version": "17.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1655,6 +1655,21 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", + "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", + "requires": { + "minimist": "^1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -1947,7 +1962,8 @@ "node-addon-api": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.6.2.tgz", - "integrity": "sha512-479Bjw9nTE5DdBSZZWprFryHGjUaQC31y1wHo19We/k0BZlrmhqQitWoUL0cD8+scljCbIUL+E58oRDEakdGGA==" + "integrity": "sha512-479Bjw9nTE5DdBSZZWprFryHGjUaQC31y1wHo19We/k0BZlrmhqQitWoUL0cD8+scljCbIUL+E58oRDEakdGGA==", + "optional": true }, "node-gyp": { "version": "3.8.0", @@ -2119,6 +2135,7 @@ "version": "0.1.3", "resolved": "https://registry.npmjs.org/nowplaying-node/-/nowplaying-node-0.1.3.tgz", "integrity": "sha512-nEvuw93xmgZS7X1XqUaLJXhd4iB54xjTOnYuEEoPMBHHs3QWGECNKvnD0uDBCe269sUK8Z5InX5rPjzf3vRVrw==", + "optional": true, "requires": { "@types/node": "^10.1.2", "node-addon-api": "^1.2.0", diff --git a/app/package.json b/app/package.json index f29572cd..3bdc70b9 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "thedesk", - "version": "17.1.1", + "version": "17.2.0", "description": "TheDesk is a Mastodon client for PC.", "main": "main.js", "scripts": { @@ -37,6 +37,7 @@ "electron-dl": "^1.11.0", "font-manager": "^0.3.0", "jimp": "^0.2.28", + "json5": "^2.1.0", "node-notifier": "^5.2.1", "sumchecker": "^2.0.2" }, diff --git a/app/view/en/index.html b/app/view/en/index.html index cdd3f769..3407cb62 100644 --- a/app/view/en/index.html +++ b/app/view/en/index.html @@ -32,7 +32,7 @@ + +

    Preferences

    • @@ -30,21 +34,11 @@
    Languages
    - 日本語(Japanese)/English/Crowdin web translate/ + To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.
    + 日本語(Japanese)/English/Crowdin web translate/
    Import and export of preferences
    -
    Themes
    - - - - - - - - - -
    Popup notification(on Windows)
    Hide to set "0"
    @@ -88,6 +82,72 @@
  • +
    + color_lensThemes +
    +
    +

    Select theme

    + + + + + + + + + + + + +
    + +
    +

    Edit and add custom themes

    +
    + +
    +
    Name
    + +
    About this theme
    +
    +
    Color scheme
    + + + + +
    +
    +
    Primary
    Background of components +
    + +
    +
    +
    Secondary
    Background color +
    + +
    +
    +
    Texts
    Text color +
    + +
    +
    +
    Accent
    Background of boosts +
    + +
    +
    +  

    +
    + Share this code with other TheDesk. Do not share this code with MiAS. +

    Import of custom themes

    + Get more themes on MiAS
    + +
    +
  • +
  • reorderTimeline Preferences
    @@ -322,7 +382,7 @@ Spotify and NowPlaying Preferences
    - h5>NowPlaying Provider(Windows) +
    NowPlaying Provider(Windows)
    macOS and Linux are not supported. AIMP and iTunes were checked by developer.
    CAD:foobar2000, MusicBee,J. River Media Center, Media Jukebox
    WLM:Last.fm Client, TTPlayer, OpenPandora, Zune.
    For foobar2000, foo_cad plugin is required. And MusicBee requires CAD.
    @@ -337,7 +397,7 @@ -
    +

    Click music_noteicon to NowPlaying
    Account Connection
    TheDesk save your data on thedesk.top server.
    @@ -443,6 +503,7 @@ TheDeskおよびCutls Pは被災地支援のため + \ No newline at end of file diff --git a/app/view/ja/index.html b/app/view/ja/index.html index 8860d5a0..e8e93a2c 100644 --- a/app/view/ja/index.html +++ b/app/view/ja/index.html @@ -32,7 +32,7 @@ + +

    設定

    • @@ -30,21 +34,11 @@
    言語
    -
    日本語(Japanese)/English/Crowdin web translate/ + To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.
    + 日本語(Japanese)/English/Crowdin web translate/
    設定のインポートとエクスポート
    -
    テーマの設定
    - - - - - - - - - -
    新規通知のポップアップお知らせの表示秒数
    0に設定すると表示されません
    @@ -88,6 +82,72 @@
  • +
    + color_lensテーマの設定 +
    +
    +

    テーマの選択

    + + + + + + + + + + + + +
    + +
    +

    カスタムテーマの作成・編集

    +
    + +
    +
    名前
    + +
    説明
    +
    +
    色の系統
    + + + + +
    +
    +
    Primary
    補助要素に使われる背景色 +
    + +
    +
    +
    Secondary
    全体の背景色など +
    + +
    +
    +
    Texts
    テキストの色 +
    + +
    +
    +
    Accent
    ブーストの背景色など +
    + +
    +
    +  

    +
    + このコードは他のTheDeskなどとシェアできます。このコードをMiASに貼ることはご遠慮ください。詳細:テーマ互換性 +

    カスタムテーマのインポート

    + MiAS上の80を超えるテーマを張り付けることもできます。
    + +
    +
  • +
  • reorderタイムラインの設定
    @@ -322,7 +382,7 @@ SpotifyとNowPlayingの設定
    - h5>NowPlayingのソース(Windows) +
    NowPlayingのソース(Windows)
    macOSやLinuxでは動作しません。AIMPとiTunes以外未検証です。
    foobar2000, MusicBee,J. River Media Center, Media JukeboxはCADを、Last.fm Client, TTPlayer, OpenPandora, ZuneはWLMを選んでください。
    ただし、foobar2000はfoo_cad pluginが必要です。MusicBeeもCADを有効にする必要があります。
    @@ -337,7 +397,7 @@ -
    +

    music_noteボタンから簡単にNowPlayingができます。
    アカウントの連携
    APIの性質上,thedesk.topへアクセスします。
    @@ -443,6 +503,7 @@ TheDeskおよびCutls Pは被災地支援のため + \ No newline at end of file diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index 5f379d1e..c64acacd 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -582,17 +582,18 @@ var tlid=0; HP
    GitHub

    -
    {{setlang}}
    + To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.
    {{langlist}}
    {{backup}}
    -
    {{theme}}
    - - - - - - - - - -
    {{popup}}
    {{popupwarn}}
    @@ -88,6 +82,72 @@
  • +
    + color_lens{{theme}} +
    +
    +

    {{themeSel}}

    + + + + + + + + + + + + +
    + +
    +

    {{customtheme}}

    +
    + +
    +
    {{name}}
    + +
    {{desc}}
    +
    +
    {{customthemeDirection}}
    + + + + +
    +
    +
    Primary
    {{secondarycolor}} +
    + +
    +
    +
    Secondary
    {{primary}} +
    + +
    +
    +
    Texts
    {{text}} +
    + +
    +
    +
    Accent
    {{accent}} +
    + +
    +
    +  

    +
    + {{customShare}} +

    {{customImport}}

    + {{cImpWarn}}
    + +
    +
  • +
  • reorder{{timeline}}
    @@ -322,7 +382,7 @@ {{spotify}}
    - h5>{{npProvider}} +
    {{npProvider}}
    {{npPeoviderWarn}}
    @@ -337,7 +397,7 @@ -
    +

    {{spotifynote1}}music_note{{spotifynote2}}
    {{link}}
    {{linkwarn}}
    @@ -443,6 +503,7 @@ TheDeskおよびCutls Pは被災地支援のため + \ No newline at end of file diff --git a/app/view/ps/index.html b/app/view/ps/index.html index 59a0739a..ae6ad980 100644 --- a/app/view/ps/index.html +++ b/app/view/ps/index.html @@ -32,7 +32,7 @@ + +

    crwdns524:0crwdne524:0

    • @@ -30,21 +34,11 @@
    crwdns530:0crwdne530:0
    -
    日本語(Japanese)/English/Crowdin web translate/ + To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.
    + 日本語(Japanese)/English/Crowdin web translate/
    crwdns531:0crwdne531:0
    -
    crwdns534:0crwdne534:0
    - - - - - - - - - -
    crwdns1898:0crwdne1898:0
    crwdns536:0crwdne536:0
    @@ -59,12 +53,12 @@
    -
    crwdns541:0crwdne541:0
    crwdns542:0crwdne542:0 +
    crwdns2376:0crwdne2376:0
    crwdns542:0crwdne542:0
    pxcrwdns543:0crwdne543:0
    -
    {{fixwidth}}
    {{fixwidthwarn}} +
    crwdns2378:0crwdne2378:0
    crwdns2380:0crwdne2380:0 pxcrwdns543:0crwdne543:0
    @@ -88,6 +82,72 @@
  • +
    + color_lenscrwdns534:0crwdne534:0 +
    +
    +

    crwdns2422:0crwdne2422:0

    + + + + + + + + + + + + +
    + +
    +

    crwdns2424:0crwdne2424:0

    +
    + +
    +
    crwdns2438:0crwdne2438:0
    + +
    crwdns2440:0crwdne2440:0
    +
    +
    crwdns2426:0crwdne2426:0
    + + + + +
    +
    +
    Primary
    crwdns2430:0crwdne2430:0 +
    + +
    +
    +
    Secondary
    crwdns2428:0crwdne2428:0 +
    + +
    +
    +
    Texts
    crwdns2432:0crwdne2432:0 +
    + +
    +
    +
    Accent
    crwdns2434:0crwdne2434:0 +
    + +
    +
    +  

    +
    + crwdns2442:0crwdne2442:0 +

    crwdns2444:0crwdne2444:0

    + {{cImpWarn}}
    + +
    +
  • +
  • reordercrwdns550:0crwdne550:0
    @@ -182,7 +242,7 @@
    -
    {{animation}}
    +
    crwdns2446:0crwdne2446:0
    @@ -322,8 +382,8 @@ crwdns624:0crwdne624:0
    - h5>{{npProvider}} - {{npPeoviderWarn}}
    +
    crwdns2354:0crwdne2354:0
    + crwdns2356:0crwdne2356:0
    @@ -337,7 +397,7 @@ -
    +

    crwdns625:0crwdne625:0music_notecrwdns626:0crwdne626:0
    crwdns627:0crwdne627:0
    crwdns628:0crwdne628:0
    @@ -348,9 +408,9 @@ crwdns632:0crwdne632:0

    - crwdns633:0{song}crwdnd633:0{album}crwdnd633:0{artist}crwdnd633:0{url}crwdne633:0
    - crwdns634:0{url}crwdnd634:0{composer}crwdnd634:0{hz}crwdnd634:0{bitRate}crwdnd634:0{genre}crwdne634:0
    - {{templete3}}
    + crwdns2358:0{song}crwdnd2358:0{album}crwdnd2358:0{artist}crwdnd2358:0{url}crwdne2358:0
    + crwdns2360:0{song}crwdnd2360:0{album}crwdnd2360:0{artist}crwdnd2360:0{composer}crwdnd2360:0{hz}crwdnd2360:0{bitRate}crwdnd2360:0{genre}crwdne2360:0
    + crwdns2362:0{song}crwdnd2362:0{album}crwdnd2362:0{artist}crwdne2362:0
    CINDERELLA NowPlaying(imastodon.net限定)では作曲家{composer}/作詞家{lyricist}/BPM{bpm}が有効です。
    CINDERELLA NowPlayingはimastodon.netにログインしているとき、トゥート欄に「//」を入力し、その後に曲名を入れることで可能です。

    @@ -443,6 +503,7 @@ TheDeskおよびCutls Pは被災地支援のため + \ No newline at end of file diff --git a/app/view/ps/update.html b/app/view/ps/update.html index 7f194588..bbc0993a 100644 --- a/app/view/ps/update.html +++ b/app/view/ps/update.html @@ -78,9 +78,9 @@ a,button,input,label,i{

    crwdns669:0crwdne669:0



    - + - {{snap}}
    + crwdns2384:0crwdne2384:0