From 57079a7b9383ae4fb675032289219ded5517dc2c Mon Sep 17 00:00:00 2001 From: cutls Date: Sat, 7 Apr 2018 13:31:09 +0900 Subject: [PATCH] TheDesk Mizuki (ver.4) --- LATEST.md | 26 ++++---- app/acct.html | 4 +- app/css/tl.css | 10 +-- app/index.html | 11 ++-- app/js/common/keyshortcut.js | 5 +- app/js/emoji/default-emoji.js | 3 + app/js/login/login.js | 3 + app/js/login/manager.js | 12 +++- app/js/platform/end.js | 9 ++- app/js/post/reply.js | 19 ------ app/js/post/use-txtbox.js | 46 ++++++++++++++ app/js/tl/datails.js | 40 ++++++++++++ app/js/tl/parse.js | 3 + app/js/ui/img.js | 36 +++++++++++ app/js/ui/layout.js | 115 +++++++++++++++++++++++++++++----- app/js/ui/scroll.js | 6 ++ app/js/ui/settings.js | 13 ++++ app/js/ui/sort.js | 17 ++++- app/package-lock.json | 2 +- app/package.json | 2 +- app/setting.html | 9 +++ ver.json | 2 +- 22 files changed, 321 insertions(+), 72 deletions(-) delete mode 100644 app/js/post/reply.js create mode 100644 app/js/post/use-txtbox.js diff --git a/LATEST.md b/LATEST.md index b540e2b1..3ffc8f93 100644 --- a/LATEST.md +++ b/LATEST.md @@ -1,24 +1,22 @@ ## For Astarte(kirishima.cloud), My Primary Instance -TheDesk :thedesk: Mizuki (ver.1) -・トゥート翻訳(By Google翻訳) -・ネイティブ通知 -・faiconピッカー -・画像貼り付け -・他アカウントでプロフを開く -・誤爆防止措置 +TheDesk :thedesk: Mizuki (ver.4) +・カラムヘッダーにの色変更(21色+デフォルト) +・画像読み込み進捗表示 +・引用トゥートボタン +・トゥート詳細をブラウザで開くボタン +・トゥート内のトゥートへのリンクをTheDesk内で開く ほか https://thedesk.top :github: https://github.com/cutls/TheDesk #Desk #DeskUpdate ## For Vanilla Instances - Windows/LinuxクライアントTheDesk Mizuki (ver.1)リリース -・トゥート翻訳(By Google翻訳) -・ネイティブ通知 -・faiconピッカー -・画像貼り付け -・他アカウントでプロフを開く -・誤爆防止措置 + Windows/LinuxクライアントTheDesk Mizuki (ver.4)リリース +・カラムヘッダーにの色変更(21色+デフォルト) +・画像読み込み進捗表示 +・引用トゥートボタン +・トゥート詳細をブラウザで開くボタン +・トゥート内のトゥートへのリンクをTheDesk内で開く TheDeskはマルチカラム,マルチアカウントはもちろんのこと,なにかとマストドンライフをシンプルに効率化するクライアントです。 https://thedesk.top \ No newline at end of file diff --git a/app/acct.html b/app/acct.html index c421d496..beb5e85e 100644 --- a/app/acct.html +++ b/app/acct.html @@ -32,10 +32,10 @@ body,html{overflow-y: scroll;}
-
Windows以外でご使用の方やPleromaにログインされる方はチェックを入れて下さい。

+
Supports @@ -52,7 +52,7 @@ body,html{overflow-y: scroll;} 現在ログイン中のインスタンス情報 by instances.social API

現在
-ドメイン名:
+ドメイン名:
接続済みインスタンス:
トゥート数:
ユーザー数:
diff --git a/app/css/tl.css b/app/css/tl.css index ce93770b..8d18d2af 100644 --- a/app/css/tl.css +++ b/app/css/tl.css @@ -185,6 +185,7 @@ font-size:1rem; .cbadge { display: inline-block; min-width: 10px; + max-width:100px; padding: 3px 7px; font-size: 0.8em; margin-right: 5px; @@ -225,9 +226,9 @@ p:not(:last-child){ z-index:500; padding:5px; display: grid; - grid-template-columns: 40px 1fr 1fr 1fr 1fr; + grid-template-columns: 40px 1fr 1fr 1fr; grid-template-rows: 30px 30px; - grid-template-areas: 'notice notice_name notice_name notice_name notice_name' 'notice a1 a2 a3 a4' 'notf-box notf-box notf-box notf-box notf-box'; + grid-template-areas: 'notice notice_name notice_name notice_name' 'notice a1 a2 a3' 'notf-box notf-box notf-box notf-box'; } .emp{ font-weight: bold; @@ -260,11 +261,6 @@ p:not(:last-child){ text-align: center; grid-area: a3; } - -.area-a4 { - text-align: center; - grid-area: a4; -} .tl-title { font-family: Open Sans; } diff --git a/app/index.html b/app/index.html index e9cbf187..31ed0f28 100644 --- a/app/index.html +++ b/app/index.html @@ -26,7 +26,7 @@ - + diff --git a/app/js/common/keyshortcut.js b/app/js/common/keyshortcut.js index 7b296d29..f33920c6 100644 --- a/app/js/common/keyshortcut.js +++ b/app/js/common/keyshortcut.js @@ -113,10 +113,7 @@ $(function($) { if (event.ctrlKey) { if (e.keyCode >= 49 && e.keyCode <= 57) { var kz=e.keyCode-49; - if($('[tlid='+kz+']').length){ - console.log($('[tlid='+kz+']').offset().left); - $("#timeline-container").animate({scrollLeft:$("#timeline-container").scrollLeft()+$('[tlid='+kz+']').offset().left}); - } + goColumn(kz); return false; } } diff --git a/app/js/emoji/default-emoji.js b/app/js/emoji/default-emoji.js index 9f58483b..69c7befc 100644 --- a/app/js/emoji/default-emoji.js +++ b/app/js/emoji/default-emoji.js @@ -36,6 +36,9 @@ function customEmoji(){ emojiList('home') } function defEmoji(target){ + if(target=="thinking_face"){ + target="thinking"; + } var emoji=emojione.shortnameToUnicode(":"+target+":"); var now = $("#textarea").val(); var selin = localStorage.getItem("cursor"); diff --git a/app/js/login/login.js b/app/js/login/login.js index 68b87e63..ec751cb5 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -388,6 +388,9 @@ function multi() { sel = "selected"; var profimg=localStorage.getItem("prof_"+key); var domain=localStorage.getItem("domain_"+key); + if(!profimg){ + profimg="./img/missing.svg"; + } $("#acct-sel-prof").attr("src",profimg); $("#toot-post-btn").text("トゥート("+domain+")"); if(domain=="kirishima.cloud"){ diff --git a/app/js/login/manager.js b/app/js/login/manager.js index 5d37a70c..84216cca 100644 --- a/app/js/login/manager.js +++ b/app/js/login/manager.js @@ -46,6 +46,14 @@ function load() { localStorage.setItem("acct", 0); var acctN = 0; } + var electron = require("electron"); + var remote=electron.remote; + var platform=remote.process.platform; + if(platform=="win32"){ + + }else{ + $("#linux").prop("checked", true); + } } //最初に読む @@ -62,6 +70,7 @@ function data(domain) { $("#ins-per").text("Loading..."); $("#ins-user").text("Loading..."); $("#ins-ver").text("Loading..."); + $("#ins-name").text("Loading..."); $("#ins-prof").attr('src', "./img/loading.svg"); var start = "https://instances.social/api/1.0/instances/show?name=" + domain; fetch(start, { @@ -78,6 +87,7 @@ function data(domain) { }).then(function(json) { console.log(json); if (!json.error) { + $("#ins-name").text(json.name); $("#ins-upd").text(date(json.checked_at, 'full')); $("#ins-add").text(date(json.added_at, 'full')); $("#ins-connect").text(json.connections); @@ -305,7 +315,7 @@ function refresh(target) { } var avatar=json["avatar"]; //missingがmissingなやつ - if(avatar=="/avatars/original/missing.png"){ + if(avatar=="/avatars/original/missing.png" || !avatar){ avatar="./img/missing.svg"; } var ref = { diff --git a/app/js/platform/end.js b/app/js/platform/end.js index 6a20dfca..1362284c 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -9,6 +9,13 @@ var urls=[]; if(url){ urls = url.match(/https?:\/\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/); + //トゥートのURLぽかったら + toot = url.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/); + if(toot){ + if(toot[1]){ + detEx(url); + } + }else{ //hrefがhttp/httpsならブラウザで if(urls){ if (urls[0]) { @@ -25,6 +32,7 @@ location.href = url; } } + } return false; }); @@ -88,7 +96,6 @@ return result; } //Nano - //Nano function nano(){ var electron = require("electron"); var ipc = electron.ipcRenderer; diff --git a/app/js/post/reply.js b/app/js/post/reply.js deleted file mode 100644 index c084f05f..00000000 --- a/app/js/post/reply.js +++ /dev/null @@ -1,19 +0,0 @@ -/*リプライ*/ -function re(id,at,acct_id,mode){ - show(); - $("#reply").val(id); - var te=$("#textarea").val(); - $("#textarea").val("@"+at+" "+te); - $("#rec").text("はい"); - $("#post-acct-sel").val(acct_id); - $('select').material_select(); - $("#textarea").attr("placeholder","返信モードです。クリアするときはShift+Cを押してください。"); - vis(mode); -} -function reEx(id){ - $('#tootmodal').modal('close'); - var at=$("#tootmodal").attr("data-user"); - var acct_id = $("#status-acct-sel").val(); - var mode=$("#tootmodal .vis-data").attr("data-vis"); - re(id,at,acct_id,mode); -} \ No newline at end of file diff --git a/app/js/post/use-txtbox.js b/app/js/post/use-txtbox.js new file mode 100644 index 00000000..1ef001a5 --- /dev/null +++ b/app/js/post/use-txtbox.js @@ -0,0 +1,46 @@ +/*リプライ*/ +function re(id,at,acct_id,mode){ + show(); + $("#reply").val(id); + var te=$("#textarea").val(); + $("#textarea").val("@"+at+" "+te); + $("#rec").text("はい"); + $("#post-acct-sel").val(acct_id); + $('select').material_select(); + $("#textarea").attr("placeholder","返信モードです。クリアするときはCtrl+Shift+Cを押してください。"); + $("#textarea").focus(); + vis(mode); +} +function reEx(id){ + $('#tootmodal').modal('close'); + var at=$("#tootmodal").attr("data-user"); + var acct_id = $("#status-acct-sel").val(); + var mode=$("#tootmodal .vis-data").attr("data-vis"); + re(id,at,acct_id,mode); +} +//引用 +function qt(id,acct_id,at,url){ + var qt = localStorage.getItem("quote"); + if(!qt){ + var qt="simple"; + } + if(qt=="simple"){ + show(); + $("#textarea").val("\n"+url); + }else if(qt=="mention"){ + show(); + $("#textarea").val("\n"+url+" From:@"+at); + }else if(qt=="full"){ + show(); + var html=$("[toot-id="+id+"] .toot").html(); + html = html.match(/^

(.+)<\/p>$/)[1]; + html = html.replace(//, "\n"); + html = html.replace(/

/, "\n"); + html = html.replace(/<\/p>/, "\n"); + html=$.strip_tags(html); + $("#textarea").val("\n"+"@"+at+" "+html+"\n"+url); + } + $("#textarea").focus(); + $("#post-acct-sel").val(acct_id); + $('select').material_select(); +} \ No newline at end of file diff --git a/app/js/tl/datails.js b/app/js/tl/datails.js index 1f18d2b5..851dc976 100644 --- a/app/js/tl/datails.js +++ b/app/js/tl/datails.js @@ -226,4 +226,44 @@ function trans(tar){ }).then(function(text) { $("#toot-this .additional").html(''+text+''); }); +} +//ブラウザで開く +function brws(){ + var url=$("#tootmodal").attr("data-url"); + const { + shell + } = require('electron'); + + shell.openExternal(url); +} +//外部からトゥート開く +function detEx(url){ + var domain = localStorage.getItem("domain_0"); + var at = localStorage.getItem(domain + "_at"); + var start = "https://" + domain + "/api/v1/search?resolve=true&q="+url + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json', + 'Authorization': 'Bearer ' + at + } + }).then(function(response) { + return response.json(); + }).catch(function(error) { + todo(error); + console.error(error); + }).then(function(json) { + if(!json.statuses){ + const { + shell + } = require('electron'); + + shell.openExternal(url); + }else{ + var id=json.statuses[0].id; + details(id, 0, 0) + } + + }); + return; } \ No newline at end of file diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index af6d7304..cc4972a1 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -442,6 +442,9 @@ function parse(obj, mix, acct_id, tlid, popup) { '\')" class="waves-effect waves-dark btn-flat" style="padding:0" title="このトゥートをブースト">' + toot.reblogs_count + '

' + + '
' + '
'+ '
perm_mediaOnメディアフィルター
linkOnリンク解析
TLヘッダーの色
[ここにトゥートはありません。]
F5で再読込できます。
'; $("#timeline-container").append(html); localStorage.removeItem("pool_" + key); @@ -135,11 +153,19 @@ function addColumn() { }; var multi = localStorage.getItem("column"); var obj = JSON.parse(multi); - console.log(obj.length) - localStorage.setItem("card_" + obj.length,"true"); - obj.push(add); - var json = JSON.stringify(obj); - localStorage.setItem("column", json); + if(!obj){ + var leng=0; + localStorage.setItem("card_" + leng,"true"); + var json = JSON.stringify([add]); + localStorage.setItem("column", json); + }else{ + var leng=obj.length; + localStorage.setItem("card_" + leng,"true"); + obj.push(add); + var json = JSON.stringify(obj); + localStorage.setItem("column", json); + } + parseColumn(); } function addselCk(){ @@ -171,4 +197,61 @@ function removeColumn(tlid) { sortload() } }) +} + +//設定トグル +function setToggle(tlid) { + colorpicker(tlid); + $("#util-box_" + tlid).toggleClass("hide"); + $("#util-box_" + tlid).toggleClass("show"); +} +function colorpicker(key){ + temp= + '
Default
'+ + '
Red
'+ + '
Pink
'+ + '
Purple
'+ + '
Deep-purple
'+ + '
Indigo
'+ + '
Blue
'+ + '
Light-blue
'+ + '
Cyan
'+ + '
Teal
'+ + '
Green
'+ + '
Light-green
'+ + '
Lime
'+ + '
Yellow
'+ + '
Amber
'+ + '
Orange
'+ + '
Deep-orange
'+ + '
Brown
'+ + '
Grey
'+ + '
Blue-grey
'+ + '
Black
'+ + '
White
'; + $("#picker_"+key).html(temp); +} +function coloradd(key,bg,txt){ + var col = localStorage.getItem("column"); + var o = JSON.parse(col); + var obj=o[key]; + obj.background=bg; + obj.text=txt; + o[key]=obj; + var json = JSON.stringify(o); + localStorage.setItem("column", json); + if(txt=="def"){ + $("#menu_"+key).attr("style","") + }else{ + $("#menu_"+key).css('background-color','#'+bg); + if(txt=="black"){ + var bghex="000000"; + var ichex="9e9e9e" + }else if(txt=="white"){ + var bghex="ffffff"; + var ichex="eeeeee" + } + $("#menu_"+key+" .nex").css('color','#'+ichex); + $("#menu_"+key).css('color','#'+bghex); + } } \ No newline at end of file diff --git a/app/js/ui/scroll.js b/app/js/ui/scroll.js index d112d532..1cdd1e41 100644 --- a/app/js/ui/scroll.js +++ b/app/js/ui/scroll.js @@ -38,4 +38,10 @@ function goTop(id){ $("#timeline_box_"+id+"_box .tl-box").scrollTop(500) } $("#timeline_box_"+id+"_box .tl-box").animate({scrollTop:0}); +} +function goColumn(key){ + if($('[tlid='+key+']').length){ + console.log($('[tlid='+key+']').offset().left); + $("#timeline-container").animate({scrollLeft:$("#timeline-container").scrollLeft()+$('[tlid='+key+']').offset().left}); + } } \ No newline at end of file diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index 8c7bedf1..4ee37cd1 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -119,6 +119,13 @@ function settings() { Materialize.toast("ネイティブ通知を" + ntt + "に設定しました。", 3000); } localStorage.setItem("nativenotf", ntd); + + var qtd = $("[name=quote]:checked").val(); + var qtt = $("[for=q_"+qtd+"]").text(); + if (qtd != localStorage.getItem("quote")) { + Materialize.toast("引用形式を" + qtt + "に設定しました。", 3000); + } + localStorage.setItem("quote", qtd); } //読み込み時の設定ロード @@ -231,6 +238,12 @@ function load() { var nnd = "yes"; } $("#ntf_" + nnd).prop("checked", true); + + var qt = localStorage.getItem("quote"); + if (!qt) { + var qt = "simple"; + } + $("#q_" + qt).prop("checked", true); } //最初に読む load(); diff --git a/app/js/ui/sort.js b/app/js/ui/sort.js index 078fa8c8..c5043a27 100644 --- a/app/js/ui/sort.js +++ b/app/js/ui/sort.js @@ -10,7 +10,22 @@ function sortload(){ if(localStorage.getItem("card_" + key)=="true"){ flag="true" } - var html='
  • '+localStorage.getItem("user_" + acct.domain)+"@"+localStorage.getItem("domain_" + acct.domain)+" "+cap(acct.type, acct.data)+' TL forward'+localStorage.getItem("user_" + acct.domain)+"@"+localStorage.getItem("domain_" + acct.domain)+" "+cap(acct.type, acct.data)+' TL cancel
  • '; $("#sort").append(html); }); diff --git a/app/package-lock.json b/app/package-lock.json index d98f081d..66a41b47 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "TheDesk", - "version": "13.9.0", + "version": "14.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/app/package.json b/app/package.json index 752390db..deb0404e 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "TheDesk", - "version": "14.3.0", + "version": "14.3.1", "description": "TheDesk on Mastodonはシンプルと多機能を両立したデスクトップ向けクライアントです", "main": "main.js", "scripts": { diff --git a/app/setting.html b/app/setting.html index 93695bfa..5e184da2 100644 --- a/app/setting.html +++ b/app/setting.html @@ -152,6 +152,15 @@
    +
    引用形式
    + + + + + + +
  • diff --git a/ver.json b/ver.json index 80d8a23c..355d1758 100644 --- a/ver.json +++ b/ver.json @@ -1 +1 @@ -{"warn":"これはGCPにアップして下さい!!","warn2":"これはGCPにアップして下さい!!","warn3":"これはGCPにアップして下さい!!","desk":"Mizuki (ver.3)","date":"2018-04-01","detail":"内部V:14.3.0|リスト機能実装・SpotifyNowPlayingのプラットフォーム拡充・翻訳バグ修正ほか"} \ No newline at end of file +{"warn":"これはGCPにアップして下さい!!","warn2":"これはGCPにアップして下さい!!","warn3":"これはGCPにアップして下さい!!","desk":"Mizuki (ver.3[fixed])","date":"2018-04-07","detail":"内部V:14.4.0|・カラムヘッダーの色変更・引用トゥートボタンほか"} \ No newline at end of file