From 2856aec405a2540a242f11de2785a5aa575fee48 Mon Sep 17 00:00:00 2001 From: Cutls Date: Wed, 13 Mar 2019 00:51:07 +0900 Subject: [PATCH] Titlebar(test) --- app/css/master.css | 20 ++++++++++ app/css/post.css | 4 ++ app/css/tl.css | 4 ++ app/js/lang/lang.en.js | 3 +- app/js/lang/lang.ja.js | 3 +- app/js/login/login.js | 1 + app/js/post/emoji.js | 2 + app/js/post/post.js | 13 +++--- app/js/post/suggest.js | 55 +++++++++++++++++++++----- app/js/post/use-txtbox.js | 14 +++++-- app/js/tl/notification.js | 4 +- app/js/tl/parse.js | 26 ++++++++++-- app/js/tl/tag.js | 25 ++++++++++-- app/js/ui/menubar.js | 18 +++++++++ app/js/ui/post-box.js | 1 + app/main.js | 13 ++++-- app/view/en/index.html | 5 ++- app/view/en/setting.html | 11 +++++- app/view/ja/index.html | 5 ++- app/view/ja/setting.html | 11 +++++- app/view/make/index.sample.html | 20 +++++----- app/view/make/language/setting.en.json | 1 + app/view/make/language/setting.ja.json | 1 + app/view/make/setting.sample.html | 11 +++++- app/view/ps/acct.html | 4 +- app/view/ps/index.html | 9 +++-- app/view/ps/setting.html | 15 +++++-- app/view/ps/update.html | 4 +- 28 files changed, 240 insertions(+), 63 deletions(-) create mode 100644 app/js/ui/menubar.js diff --git a/app/css/master.css b/app/css/master.css index 39045d7e..68a6b48b 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -9,6 +9,26 @@ html,body{ background-color: var(--bg); color: var(--color); } +body{ + border: thin solid gray; +} +#titlebar{ + font-family: Open Sans; + background-color: var(--notfbox); + -webkit-app-region: drag; + width: 100vw; + height: 2.5rem; + padding: 0.5rem; +} +#titlebar i{ + -webkit-app-region: no-drag; +} +#tb-btns{ + right: 0; + top: 0; + position: absolute; + cursor: pointer; +} .btn { margin: 5px; text-transform: none; diff --git a/app/css/post.css b/app/css/post.css index 1b4fc3c9..14f9b776 100644 --- a/app/css/post.css +++ b/app/css/post.css @@ -64,6 +64,10 @@ } #emoji { +} +#suggest{ + max-height:300px; + overflow-y: scroll; } #emoji-list { width: 100%; diff --git a/app/css/tl.css b/app/css/tl.css index 7fd03b9b..447b258e 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -111,6 +111,7 @@ iframe { height: 100vh; flex: 1; border: thin solid gray; + border-top:none; } .box .pin,#his-data .pin{ display:none; @@ -242,6 +243,9 @@ grid-area: toot; font-size:1.2rem; margin-right:2px; } +.action .fa-quote-right{ + margin-top: 2px; +} .actct{ color:var(--beforehover); } diff --git a/app/js/lang/lang.en.js b/app/js/lang/lang.en.js index 5c224654..b4a2b5c4 100644 --- a/app/js/lang/lang.en.js +++ b/app/js/lang/lang.en.js @@ -101,7 +101,8 @@ var lang={ "lang_tags_always":"Always toots with ", "lang_tags_realtime":"Tag-stream toot", "lang_tags_tagunpin":"Unpin {{tag}}", - "lang_tags_tagwarn":"When you toot without {{tag}}, tag-streaming mode will be off.", + "lang_tags_unrealtime":"Disable TsT", + "lang_tags_tagwarn":"Auto complete {{tag}}, if toot without {{tag}}", //tl/tl.js "lang_tl_media":"Media", "lang_tl_reconnect":"Reconnect to streaming API", diff --git a/app/js/lang/lang.ja.js b/app/js/lang/lang.ja.js index 9784a25c..05618d44 100644 --- a/app/js/lang/lang.ja.js +++ b/app/js/lang/lang.ja.js @@ -101,7 +101,8 @@ var lang={ "lang_tags_always":"常に", "lang_tags_realtime":"実況", "lang_tags_tagunpin":"{{tag}}をよく使うタグから削除", - "lang_tags_tagwarn":"次に{{tag}}なしでトゥートするまで全てのトゥートに{{tag}}が付与されます。", + "lang_tags_unrealtime":"実況解除", + "lang_tags_tagwarn":"{{tag}}がない場合自動で補完されます。", //tl/tl.js "lang_tl_media":"メディア", "lang_tl_reconnect":"Streamingに再接続しました", diff --git a/app/js/login/login.js b/app/js/login/login.js index 811eef26..30fbff5f 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -5,6 +5,7 @@ localStorage.removeItem("kirishima") localStorage.removeItem("imas") localStorage.removeItem("image"); +localStorage.removeItem("stable") localStorage.setItem("mode_misskey.xyz","misskey") function ck() { var main = localStorage.getItem("main"); diff --git a/app/js/post/emoji.js b/app/js/post/emoji.js index c184b157..19750457 100644 --- a/app/js/post/emoji.js +++ b/app/js/post/emoji.js @@ -15,6 +15,7 @@ function emojiToggle() { if ($("#emoji").hasClass("hide")) { $("#emoji").removeClass("hide") $("#right-side").show() + $("#suggest").html(""); if (!localStorage.getItem("emoji_" + acct_id)) { var html = ''; @@ -25,6 +26,7 @@ function emojiToggle() { } else { $("#poll").addClass("hide") $("#emoji").addClass("hide") + $("#suggest").html(""); $("#right-side").hide() } diff --git a/app/js/post/post.js b/app/js/post/post.js index 4136fc55..9cf6dae7 100644 --- a/app/js/post/post.js +++ b/app/js/post/post.js @@ -45,6 +45,7 @@ function post(mode,postvis) { }else{ var cw_ltres=localStorage.getItem("cw_letters"); } + if(domain!="kirishima.cloud"){ if(mode!="pass" && !$("#cw").hasClass("cw-avail") && (str.length>cw_sent || (str.split("\n").length - 1)>cw_ltres)){ var electron = require("electron"); var remote=electron.remote; @@ -69,6 +70,7 @@ function post(mode,postvis) { }) return false; } +} if(localStorage.getItem("mode_" + domain)=="misskey"){ misskeyPost(); return; @@ -78,6 +80,9 @@ function post(mode,postvis) { var at = localStorage.getItem("acct_"+ acct_id + "_at"); var start = "https://" + domain + "/api/v1/statuses"; var reply = $("#reply").val(); + if(str.indexOf(localStorage.getItem("stable"))==-1){ + str+" #"+localStorage.getItem("stable"); + } var toot={ status: str } @@ -106,6 +111,7 @@ function post(mode,postvis) { toot.status=str+"👁️"; } //ここに非公開・未収載タグについてwarn + if(domain!="kirishima.cloud" && domain!="imastodon.net"){ if(~str.indexOf("#")){ if(vis == "local" || vis=="unlisted" || vis=="direct" || vis=="private"){ if(!confirm(lang.lang_post_tagVis)){ @@ -113,6 +119,7 @@ function post(mode,postvis) { } } } +} if ($("#cw").hasClass("cw-avail")) { var spo = $("#cw-text").val(); cw(); @@ -166,11 +173,7 @@ function post(mode,postvis) { httpreq.send(JSON.stringify(toot)); httpreq.onreadystatechange = function() { if (httpreq.readyState === 4) { - if(str.indexOf(localStorage.getItem("stable"))==-1){ - localStorage.removeItem("stable") - } var json = httpreq.response; - console.log(json); var box = localStorage.getItem("box"); if (box == "yes" || !box) { $("#textarea").blur(); @@ -261,7 +264,7 @@ function misskeyPost(){ function clear() { $("#textarea").val(""); if(localStorage.getItem("stable")){ - $("#textarea").val(localStorage.getItem("stable")); + $("#textarea").val("#"+localStorage.getItem("stable")+" ") } $("#textarea").attr("placeholder", lang.lang_toot); $("#reply").val(""); diff --git a/app/js/post/suggest.js b/app/js/post/suggest.js index d0af6766..0e36ab3f 100644 --- a/app/js/post/suggest.js +++ b/app/js/post/suggest.js @@ -13,6 +13,13 @@ input.addEventListener("focus", function() { window.clearInterval(timer); timer = window.setInterval(function() { var new_val = input.value; + if(new_val==""){ + $("#suggest").html(""); + if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + $("#right-side").hide() + } + return; + } if (prev_val != new_val) { var semoji = new_val.match(/:(\S{3,})/); if(semoji){ @@ -32,7 +39,15 @@ input.addEventListener("focus", function() { } } } - + if(ehtml!=""){ + $("#right-side").show() + $("#poll").addClass("hide") + $("#emoji").addClass("hide") + }else{ + if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + $("#right-side").hide() + } + } $("#suggest").html(ehtml); } @@ -52,7 +67,10 @@ input.addEventListener("focus", function() { } else if (acct && acct[1]) { var q = acct[1]; }else { - //$("#suggest").html(""); + $("#suggest").html(""); + if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + $("#right-side").hide() + } return; } var domain = localStorage.getItem("domain_" + acct_id); @@ -72,24 +90,38 @@ input.addEventListener("focus", function() { todo(error); console.error(error); }).then(function(json) { - if (json.hashtags[0] && tag[1]) { + if (json.hashtags[0] && tag) { + if(tag[1]){ var tags = ""; Object.keys(json.hashtags).forEach(function(key4) { var tag = json.hashtags[key4]; - tags = tags + '#' + tag + ' '; + if(tag!=q){ + tags = tags + '#' + tag + '
'; + } }); - $("#suggest").html("Tags:" + tags); + $("#right-side").show() + $("#suggest").html("Tags:
" + tags); + $("#poll").addClass("hide") + $("#emoji").addClass("hide") + } } else if (json.accounts[0] && acct[1]) { var accts = ""; Object.keys(json.accounts).forEach(function(key3) { var acct = json.accounts[key3]; - accts = accts + '@' + acct.acct + ' '; + if(acct.acct!=q){ + accts = accts + '@' + acct.acct + '
'; + } }); - $("#suggest").html("@:" + accts); + $("#right-side").show() + $("#suggest").html("@:
" + accts); + $("#poll").addClass("hide") + $("#emoji").addClass("hide") } else { - $("#suggest").html("Not Found"); + if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + $("#right-side").hide() + } } }); } @@ -121,6 +153,9 @@ function tagInsert(code, del) { } $("#textarea").val(newt); $("#textarea").focus(); + if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){ + $("#right-side").hide() + } $("#suggest").html(""); } function cgNPs(q){ diff --git a/app/js/post/use-txtbox.js b/app/js/post/use-txtbox.js index e1cca3e4..d382812b 100644 --- a/app/js/post/use-txtbox.js +++ b/app/js/post/use-txtbox.js @@ -1,10 +1,15 @@ /*リプライ*/ -function re(id,at,acct_id,mode){ +function re(id,ats_cm,acct_id,mode){ + clear(); + var ats=ats_cm.split(','); localStorage.setItem("nohide",true); show(); $("#reply").val(id); - var te=$("#textarea").val(); - $("#textarea").val("@"+at+" "+te); + for(var i=0;i@' + mention.acct + ' '; + //自分は除外 + //自インスタンスかどうかを確認し、IDの一致 + if(mention.acct==mention.username && mention.id==localStorage.getItem("user-id_" + acct_id)){ + //自分 + }else{ + //そのトゥの人NG + if(toot.account.acct!=mention.acct){ + to_mention.push(mention.acct); + } + } + }); + to_mention.push(toot.account.acct); mentions = '
' + mentions + '
'; + }else{ + var to_mention=[toot.account.acct]; } var tagck = toot.tags[0]; var tags = ""; @@ -726,7 +746,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { '
'+vis+'
'+ '' + '' + @@ -735,7 +755,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) { '\')" class="waves-effect waves-dark btn-flat actct" style="padding:0" title="'+lang.lang_parse_bt+'">' + toot.reblogs_count + '' + - '
' + '
#' + tag + ' TL Toot '+ - ''+lang.lang_tags_realtime+' '+lang.lang_del+' '; + if(nowPT!=tag){ + console.log(nowPT+"/"+tag); + var ptt=lang.lang_tags_realtime; + var nowon=""; + }else{ + var ptt=lang.lang_tags_unrealtime; + var nowon="("+lang.lang_tags_realtime+")"; + } + tags = tags + '#' + tag + ''+nowon+' TL Toot '+ + ''+ptt+' '+lang.lang_del+' '; }); if(obj.length>0){ $("#taglist").append("My Tags:" + tags); @@ -106,6 +115,14 @@ function tagTL(a,b,c,d){ tl(a,b,acct_id,d); } function autoToot(tag){ - localStorage.setItem("stable",tag); - Materialize.toast(lang.lang_tags_tagwarn +replace("{{tag}}" ,tag).replace("{{tag}}" ,tag),3000); + var nowPT=localStorage.getItem("stable") + if(nowPT==tag){ + localStorage.removeItem("stable"); + Materialize.toast(lang.lang_tags_unrealtime,3000); + }else{ + localStorage.setItem("stable",tag); + Materialize.toast(lang.lang_tags_tagwarn.replace("{{tag}}" ,tag).replace("{{tag}}" ,tag),3000); + brInsert('#' + tag+" ") + } + favTag(); } \ No newline at end of file diff --git a/app/js/ui/menubar.js b/app/js/ui/menubar.js new file mode 100644 index 00000000..74cffc58 --- /dev/null +++ b/app/js/ui/menubar.js @@ -0,0 +1,18 @@ +function quit(){ + console.log("quit") + var electron = require("electron"); + var ipc = electron.ipcRenderer; + ipc.send('quit', 'go'); +} +function minimize(){ + console.log("mini") + var electron = require("electron"); + var ipc = electron.ipcRenderer; + ipc.send('minimize', 'go'); +} +function maxToggle(){ + console.log("max") + var electron = require("electron"); + var ipc = electron.ipcRenderer; + ipc.send('maximize', 'go'); +} \ No newline at end of file diff --git a/app/js/ui/post-box.js b/app/js/ui/post-box.js index e9fc1d50..05ce2081 100644 --- a/app/js/ui/post-box.js +++ b/app/js/ui/post-box.js @@ -1,6 +1,7 @@ /*ささやきボックス(Cr民並感)*/ //✕隠す function hide() { + $("#right-side").hide() $('#post-box').fadeOut() $("#post-box").removeClass("appear") $("#emoji").addClass("hide") diff --git a/app/main.js b/app/main.js index 2c34e679..38ab0479 100644 --- a/app/main.js +++ b/app/main.js @@ -83,7 +83,9 @@ function createWindow() { var bit=process.arch; if(platform=="linux"){ var arg={width:window_size.width,height:window_size.height,x:window_size.x,y:window_size.y,icon: __dirname + '/desk.png'} - }else{ + }else if(platform=="win32"){ + var arg={width:window_size.width,height:window_size.height,x:window_size.x,y:window_size.y,simpleFullscreen:true} + }else if(platform=="darwin"){ var arg={width:window_size.width,height:window_size.height,x:window_size.x,y:window_size.y,simpleFullscreen:true} } mainWindow = new BrowserWindow(arg); @@ -143,8 +145,13 @@ app.on('ready', createWindow); var onError = function(err,response){ console.error(err,response); }; - var ipc = electron.ipcMain; +ipc.on('minimize', function(e, args) { + mainWindow.minimize(); +}); +ipc.on('maximize', function(e, args) { + mainWindow.isMaximized() ? mainWindow.unmaximize() : mainWindow.maximize(); +}); ipc.on('native-notf', function(e, args) { var platform=process.platform; var bit=process.arch; @@ -543,7 +550,7 @@ ipc.on('nano', function (e, x, y) { window_pos = [0,0]; // デフォルトバリュー } var nanowindow = new BrowserWindow({width: 350, height: 200, - "transparent": false, // ウィンドウの背景を透過 + "transparent": false, // ウィンドウの背景を透過 "frame": false, // 枠の無いウィンドウ "resizable": false }); nanowindow.loadURL('file://' + __dirname + '/nano.html'); diff --git a/app/view/en/index.html b/app/view/en/index.html index 9b9f6d75..d5b89896 100644 --- a/app/view/en/index.html +++ b/app/view/en/index.html @@ -125,7 +125,6 @@ var tlid=0; Markdownエディタを表示 -
visibility_off @@ -202,6 +201,7 @@ var tlid=0;
+
@@ -879,4 +879,5 @@ var tlid=0; - \ No newline at end of file + + \ No newline at end of file diff --git a/app/view/en/setting.html b/app/view/en/setting.html index d9de06a8..187176fe 100644 --- a/app/view/en/setting.html +++ b/app/view/en/setting.html @@ -255,6 +255,11 @@ +
+
{{actionBtns}}
+
+ {{actionBtnsDesc}}
+ {{alltoots}}{{icons}}
  • @@ -320,8 +325,9 @@ - + + +
    Default accounts of actions
    Main account can be set on Account Manager.
    @@ -462,6 +468,7 @@
  • X:Toggle toot box
  • Ctrl+Enter:Post
  • Ctrl+Enter+Shift:Post(secondary toot)
  • +
  • Alt+Enter:Secondary Toot Button
  • Ctrl+E:Make all notifications read
  • Esc:Hide toot box
  • F5:Super Reload
  • diff --git a/app/view/ja/index.html b/app/view/ja/index.html index c896460a..0dd12cd5 100644 --- a/app/view/ja/index.html +++ b/app/view/ja/index.html @@ -125,7 +125,6 @@ var tlid=0; Markdownエディタを表示 -
    visibility_off @@ -202,6 +201,7 @@ var tlid=0;
    +
    サーバーによって実装が異なります。 @@ -879,4 +879,5 @@ var tlid=0; - \ No newline at end of file + + \ No newline at end of file diff --git a/app/view/ja/setting.html b/app/view/ja/setting.html index 750ac349..157658f6 100644 --- a/app/view/ja/setting.html +++ b/app/view/ja/setting.html @@ -255,6 +255,11 @@ +
    +
    {{actionBtns}}
    +
    + {{actionBtnsDesc}}
    + {{alltoots}}{{icons}}
  • @@ -320,8 +325,9 @@ - + + +
    投稿後や起動時のアカウント
    メインアカウントはアカウント設定で指定できます。投稿以外のアカウント選択にも影響します。
    @@ -462,6 +468,7 @@
  • X:投稿パネルを開閉
  • Ctrl+Enter:投稿
  • Ctrl+Enter+Shift:投稿(セカンダリートゥート)
  • +
  • Alt+Enter:セカンダリートゥートボタン
  • Ctrl+E:全ての通知を既読にする
  • Esc:投稿パネルを消す
  • F5:スーパーリロード
  • diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index c64acacd..36c367ab 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -125,7 +125,6 @@ var tlid=0; Markdownエディタを表示 -
    visibility_off @@ -202,6 +201,7 @@ var tlid=0;
    +
    {{emojiWarn}} @@ -582,17 +582,18 @@ var tlid=0; HP
    GitHub

    -
  • @@ -320,8 +325,9 @@ - + + +
    {{main}}
    {{mainwarn}}
    @@ -462,6 +468,7 @@
  • X:{{keytoggle}}
  • Ctrl+Enter:{{keypost}}
  • Ctrl+Enter+Shift:{{keysecpost}}
  • +
  • Alt+Enter:{{secondary}}
  • Ctrl+E:{{keyunread}}
  • Esc:{{keyesc}}
  • F5:{{keyf5}}
  • diff --git a/app/view/ps/acct.html b/app/view/ps/acct.html index fccd94a1..7e4687bc 100644 --- a/app/view/ps/acct.html +++ b/app/view/ps/acct.html @@ -20,13 +20,13 @@ body,html{overflow-y: scroll;} .card .colorsel div.exc{width:40px;height:20px;} -{{comment-start}} + -{{comment-end}} + diff --git a/app/view/ps/index.html b/app/view/ps/index.html index ab7b9ed5..c22ec521 100644 --- a/app/view/ps/index.html +++ b/app/view/ps/index.html @@ -13,13 +13,13 @@ - {{comment-start}} + - {{comment-end}} + @@ -125,7 +125,6 @@ var tlid=0; Markdownエディタを表示 -
    visibility_off @@ -202,6 +201,7 @@ var tlid=0;
    +
    crwdns409:0crwdne409:0 @@ -879,4 +879,5 @@ var tlid=0; - \ No newline at end of file + + \ No newline at end of file diff --git a/app/view/ps/setting.html b/app/view/ps/setting.html index 446807b2..c2ae626c 100644 --- a/app/view/ps/setting.html +++ b/app/view/ps/setting.html @@ -2,13 +2,13 @@ Settings - TheDesk - {{comment-start}} + - {{comment-end}} + @@ -255,6 +255,11 @@ +
    +
    {{actionBtns}}
    +
    + {{actionBtnsDesc}}
    + {{alltoots}}{{icons}}
  • @@ -320,8 +325,9 @@ - + + +
    crwdns607:0crwdne607:0
    crwdns608:0crwdne608:0
    @@ -462,6 +468,7 @@
  • X:crwdns650:0crwdne650:0
  • Ctrl+Enter:crwdns651:0crwdne651:0
  • Ctrl+Enter+Shift:crwdns1924:0crwdne1924:0
  • +
  • Alt+Enter:crwdns1916:0crwdne1916:0
  • Ctrl+E:crwdns652:0crwdne652:0
  • Esc:crwdns653:0crwdne653:0
  • F5:crwdns654:0crwdne654:0
  • diff --git a/app/view/ps/update.html b/app/view/ps/update.html index bbc0993a..fb23456b 100644 --- a/app/view/ps/update.html +++ b/app/view/ps/update.html @@ -6,13 +6,13 @@ -{{comment-start}} + -{{comment-end}} +