From f42f6e2572fbb0dbc2c0c9ffafcfa38128ae3d74 Mon Sep 17 00:00:00 2001 From: cutls Date: Sun, 17 Jun 2018 23:26:45 +0900 Subject: [PATCH] TheDesk Mio (15.7.0) --- LATEST.md | 34 +++++---- app/acct.html | 5 +- app/css/master.css | 2 +- app/index.html | 51 +++++--------- app/js/common/keyshortcut.js | 2 +- app/js/login/instance.js | 126 ++++++++++++++++++++------------- app/js/login/login.js | 78 +++------------------ app/js/login/manager.js | 127 +++++++++++++++++++++++++++++++--- app/js/platform/screenshot.js | 7 +- app/js/post/bb-md.js | 18 ++++- app/js/post/post.js | 33 +++++---- app/js/post/secure.js | 37 ++++++++-- app/js/tl/datails.js | 51 ++++++++++++-- app/js/tl/mix.js | 26 ++++--- app/js/tl/parse.js | 10 +-- app/js/ui/layout.js | 11 ++- app/main.js | 26 +++---- app/oss.html | 37 ++++++---- app/package.json | 2 +- app/setting.html | 8 ++- ver.json | 2 +- 21 files changed, 426 insertions(+), 267 deletions(-) diff --git a/LATEST.md b/LATEST.md index 3598e91d..2aad7774 100644 --- a/LATEST.md +++ b/LATEST.md @@ -1,23 +1,29 @@ ## For Astarte(kirishima.cloud), My Primary Instance -TheDesk :thedesk: Mio (ver.6) -・ウィンドウの最大化を記憶するように -・v2.4.0/1対応(bot表示/v2-search/rc時のトレンドタグ) -・NanoウィンドウのUI改善 -・キーボードショートカット追加(Ctrl+Shift+1/2/3で特定文字を入力) -・Spotifyのアートワーク投稿を任意に -・さまざまなバグを修正 +TheDesk :thedesk: Mio (ver.7) +・公開範囲情報の記録がインスタンスごとに(これにより一度記録がリセットされます。) +・インスタンスのユーザー設定に従った公開範囲指定(アカウント設定より情報更新をしてください。) +・インスタンスカラーを設定できるように(アカウント設定から) +・スクリーンショット(魚拓)機能の高速化 +・Integrated TLのバグ修正 +・キーボードショートカットのバグ修正 +・コピペのバグ改善(ただし、ワンクリックコピーで複数の絵文字があるトゥートをコピーするとバグが発生します) +・CWのバグ改善 +・[b]DTP鯖(dtp-mstdn.jp)( #dtp )とtheboss.tech( #theboss_tech )をサポート[/b]タグ付きトゥート時、デフォルトタグがないとき確認ダイアログが表示されます。 ほか https://thedesk.top :github: https://github.com/cutls/TheDesk #Desk #DeskUpdate ## For Other Instances -PCクライアントTheDesk Mio (ver.3) -・ウィンドウの最大化を記憶するように -・v2.4.0/1対応(bot表示/v2-search/rc時のトレンドタグ) -・NanoウィンドウのUI改善 -・キーボードショートカット追加(Ctrl+Shift+1/2/3で特定文字を入力) -・Spotifyのアートワーク投稿を任意に -・さまざまなバグを修正 +PCクライアントTheDesk Mio (ver.7) +・公開範囲情報の記録がインスタンスごとに(これにより一度記録がリセットされます。) +・インスタンスのユーザー設定に従った公開範囲指定(アカウント設定より情報更新をしてください。) +・インスタンスカラーを設定できるように(アカウント設定から) +・スクリーンショット(魚拓)機能の高速化 +・Integrated TLのバグ修正 +・キーボードショートカットのバグ修正 +・コピペのバグ改善(ただし、ワンクリックコピーで複数の絵文字があるトゥートをコピーするとバグが発生します) +・CWのバグ改善 +・DTP鯖(dtp-mstdn.jp)( #dtp )とtheboss.tech( #theboss_tech )をサポート。タグ付きトゥート時、デフォルトタグがないとき確認ダイアログが表示されます。 https://thedesk.top \ No newline at end of file diff --git a/app/acct.html b/app/acct.html index 31d6603e..477d0b26 100644 --- a/app/acct.html +++ b/app/acct.html @@ -15,6 +15,9 @@ body,html{overflow-y: scroll;} #acct-list{display:flex; flex-wrap:wrap; color:white; align-items: flex-start} .lts{font-size:150%} +.colorsel{ display:flex; } +.card .colorsel div:not(.exc){width:20px;height:20px;} +.card .colorsel div.exc{width:40px;height:20px;} @@ -68,6 +71,6 @@ body,html{overflow-y: scroll;} マストドンバージョン:
- + \ No newline at end of file diff --git a/app/css/master.css b/app/css/master.css index 35cad694..860df449 100644 --- a/app/css/master.css +++ b/app/css/master.css @@ -254,7 +254,7 @@ blockquote:before, .quote:before { /*スクロールバー*/ ::-webkit-scrollbar { width: 5px; - height: 5px; + height: 10px; background: rgba(0, 0, 0, 0.05); } ::-webkit-scrollbar-track { diff --git a/app/index.html b/app/index.html index c390ce47..a124ad0d 100644 --- a/app/index.html +++ b/app/index.html @@ -24,7 +24,7 @@ + diff --git a/app/js/common/keyshortcut.js b/app/js/common/keyshortcut.js index a226df1d..e819d8bf 100644 --- a/app/js/common/keyshortcut.js +++ b/app/js/common/keyshortcut.js @@ -145,7 +145,7 @@ $(function($) { if (event.ctrlKey && event.shiftKey) { if (e.keyCode >= 49 && e.keyCode <= 51) { var no=e.keyCode-48; - if(localStorage.getItem("oks-"+no)){$("#textarea").val(localStorage.getItem("oks-"+no))} + if(localStorage.getItem("oks-"+no)){$("#textarea").val($("#textarea").val()+localStorage.getItem("oks-"+no))} return false; } } diff --git a/app/js/login/instance.js b/app/js/login/instance.js index d993189d..0eb7d723 100644 --- a/app/js/login/instance.js +++ b/app/js/login/instance.js @@ -1,51 +1,77 @@ -//入力時にハッシュタグと@をサジェスト -var timer = null; +//インスタンスリスト +var idata={ + "kirishima.cloud":"instance", + "kirishima.cloud_name":"アスタルテ", + "kirishima.cloud_letters":"6229", + "kirishima.cloud_bbcode":"enabled", + "kirishima.cloud_markdown":"enabled", + "minohdon.jp":"instance", + "minohdon.jp_name":"箕面丼", + "minohdon.jp_letters":"500", + "minohdon.jp_bbcode":"disabled", + "minohdon.jp_markdown":"disabled", + "knzk.me":"instance", + "knzk.me_name":"神崎丼", + "knzk.me_letters":"5000", + "knzk.me_bbcode":"disabled", + "knzk.me_markdown":"disabled", + "mastodos.com":"instance", + "mastodos.com_name":"マストどす", + "mastodos.com_letters":"500", + "mastodos.com_bbcode":"disabled", + "mastodos.com_markdown":"disabled", + "dev.kirishima.cloud":"hidden", + "dev.kirishima.cloud_name":"アスタルテ(Dev)", + "dev.kirishima.cloud_letters":"6229", + "dev.kirishima.cloud_bbcode":"enabled", + "dev.kirishima.cloud_markdown":"enabled", + "mstdn.y-zu.org":"instance", + "mstdn.y-zu.org_name":"Yづドン!(502 BadGateway)", + "mstdn.y-zu.org_letters":"500", + "mstdn.y-zu.org_bbcode":"disabled", + "mstdn.y-zu.org_markdown":"disabled", + "imastodon.net":"instance", + "imastodon.net_name":"im@stodon", + "imastodon.net_letters":"500", + "imastodon.net_bbcode":"disabled", + "imastodon.net_markdown":"disabled", + "imastodon.net_home":"オフィス", + "imastodon.net_local":"楽屋", + "imastodon.net_notification":"ホワイトボード", + "imastodon.net_public":"ライブステージ", + "mstdn.osaka":"instance", + "mstdn.osaka_name":"大阪丼", + "mstdn.osaka_letters":"500", + "mstdn.osaka_bbcode":"disabled", + "mstdn.osaka_markdown":"disabled", + "mstdn.osaka_home":"ウチ", + "mstdn.osaka_local":"近所", + "mstdn.osaka_notification":"あめちゃん", + "mstdn.osaka_public":"新世界", + "mstdn.kemono-friends.info":"instance", + "mstdn.kemono-friends.info_name":"ますとどんちほー", + "mstdn.kemono-friends.info_letters":"1024", + "mstdn.kemono-friends.info_bbcode":"disabled", + "mstdn.kemono-friends.info_markdown":"disabled", + "mstdn.kemono-friends.info_home":"なわばり", + "mstdn.kemono-friends.info_local":"ますとどんちほー", + "mstdn.kemono-friends.info_notification":"ねえねえ!", + "mstdn.kemono-friends.info_public":"ジャパリパーク", + "itabashi.0j0.jp":"instance", + "itabashi.0j0.jp_name":"板橋丼", + "itabashi.0j0.jp_letters":"1024", + "itabashi.0j0.jp_bbcode":"disabled", + "itabashi.0j0.jp_markdown":"disabled", + "theboss.tech":"instance", + "theboss.tech_name":"theboss.tech", + "theboss.tech_letters":"1000", + "theboss.tech_bbcode":"disabled", + "theboss.tech_markdown":"disabled", + "dtp-mstdn.jp":"instance", + "dtp-mstdn.jp_name":"DTP鯖", + "dtp-mstdn.jp_letters":"500", + "dtp-mstdn.jp_bbcode":"disabled", + "dtp-mstdn.jp_markdown":"disabled" +}; -var input = document.getElementById("url"); - -var prev_val = input.value; -var oldSuggest; -var suggest; -input.addEventListener("focus", function() { - $("#ins-suggest").html(""); - window.clearInterval(timer); - timer = window.setInterval(function() { - var new_val = input.value; - if (prev_val != new_val) { - if (new_val.length > 3) { - var start = "https://instances.social/api/1.0/instances/search?q=" + - new_val; - fetch(start, { - method: 'GET', - headers: { - 'content-type': 'application/json', - 'Authorization': 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M' - }, - }).then(function(response) { - return response.json(); - }).catch(function(error) { - todo(error); - console.error(error); - }).then(function(json) { - console.log(json); - if (!json.error) { - - var urls = "もしかして:"; - Object.keys(json.instances).forEach(function(key) { - var url = json.instances[key]; - urls = urls + ' ' + url.name + ' '; - }); - $("#ins-suggest").html(urls); - } - }); - } - oldSuggest = suggest; - prev_value = new_val; - } - }, 1000); -}, false); - -input.addEventListener("blur", function() { - window.clearInterval(timer); -}, false); +localStorage.setItem("instance", JSON.stringify(idata)); diff --git a/app/js/login/login.js b/app/js/login/login.js index a58a46be..a7fea708 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -5,71 +5,6 @@ localStorage.removeItem("kirishima") localStorage.removeItem("imas") localStorage.removeItem("image"); -var idata={ - "kirishima.cloud":"instance", - "kirishima.cloud_name":"アスタルテ", - "kirishima.cloud_letters":"6229", - "kirishima.cloud_bbcode":"enabled", - "kirishima.cloud_markdown":"enabled", - "minohdon.jp":"instance", - "minohdon.jp_name":"箕面丼", - "minohdon.jp_letters":"500", - "minohdon.jp_bbcode":"disabled", - "minohdon.jp_markdown":"disabled", - "knzk.me":"instance", - "knzk.me_name":"神崎丼", - "knzk.me_letters":"5000", - "knzk.me_bbcode":"disabled", - "knzk.me_markdown":"disabled", - "mastodos.com":"instance", - "mastodos.com_name":"マストどす", - "mastodos.com_letters":"500", - "mastodos.com_bbcode":"disabled", - "mastodos.com_markdown":"disabled", - "dev.kirishima.cloud":"hidden", - "dev.kirishima.cloud_name":"アスタルテ(Dev)", - "dev.kirishima.cloud_letters":"6229", - "dev.kirishima.cloud_bbcode":"enabled", - "dev.kirishima.cloud_markdown":"enabled", - "mstdn.y-zu.org":"instance", - "mstdn.y-zu.org_name":"Yづドン!(502 BadGateway)", - "mstdn.y-zu.org_letters":"500", - "mstdn.y-zu.org_bbcode":"disabled", - "mstdn.y-zu.org_markdown":"disabled", - "imastodon.net":"instance", - "imastodon.net_name":"im@stodon", - "imastodon.net_letters":"500", - "imastodon.net_bbcode":"disabled", - "imastodon.net_markdown":"disabled", - "imastodon.net_home":"オフィス", - "imastodon.net_local":"楽屋", - "imastodon.net_notification":"ホワイトボード", - "imastodon.net_public":"ライブステージ", - "mstdn.osaka":"instance", - "mstdn.osaka_name":"大阪丼", - "mstdn.osaka_letters":"500", - "mstdn.osaka_bbcode":"disabled", - "mstdn.osaka_markdown":"disabled", - "mstdn.osaka_home":"ウチ", - "mstdn.osaka_local":"近所", - "mstdn.osaka_notification":"あめちゃん", - "mstdn.osaka_public":"新世界", - "mstdn.kemono-friends.info":"instance", - "mstdn.kemono-friends.info_name":"ますとどんちほー", - "mstdn.kemono-friends.info_letters":"1024", - "mstdn.kemono-friends.info_bbcode":"disabled", - "mstdn.kemono-friends.info_markdown":"disabled", - "mstdn.kemono-friends.info_home":"なわばり", - "mstdn.kemono-friends.info_local":"ますとどんちほー", - "mstdn.kemono-friends.info_notification":"ねえねえ!", - "mstdn.kemono-friends.info_public":"ジャパリパーク", - "itabashi.0j0.jp":"instance", - "itabashi.0j0.jp_name":"板橋丼", - "itabashi.0j0.jp_letters":"1024", - "itabashi.0j0.jp_bbcode":"disabled", - "itabashi.0j0.jp_markdown":"disabled", -}; -localStorage.setItem("instance", JSON.stringify(idata)); function ck() { var main = localStorage.getItem("main"); @@ -236,7 +171,9 @@ function getdata() { name: json["display_name"], domain: domain, user: json["acct"], - prof: avatar + prof: avatar, + id: json["id"], + vis: json["source"]["privacy"] }]; var json = JSON.stringify(obj); console.log(obj); @@ -285,7 +222,8 @@ function getdataAdv(domain, at) { domain: domain, user: json["acct"], prof: avatar, - id: json["id"] + id: json["id"], + vis: json["source"]["privacy"] }; var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); @@ -408,6 +346,12 @@ function multi() { } $("#acct-sel-prof").attr("src",profimg); $("#toot-post-btn").text("トゥート("+domain+")"); + if(acct.background && acct.background!="def" && acct.text && acct.text!="def"){ + $("#toot-post-btn").removeClass("indigo"); + $("#toot-post-btn").css("background-color","#"+acct.background); + $("#toot-post-btn").css("color",acct.text); + }else{ + } if(domain=="kirishima.cloud"){ $("#faicon-btn").show(); }else{ diff --git a/app/js/login/manager.js b/app/js/login/manager.js index b5159956..ac90970c 100644 --- a/app/js/login/manager.js +++ b/app/js/login/manager.js @@ -30,7 +30,12 @@ function load() { Object.keys(obj).forEach(function(key) { var acct = obj[key]; var list = key * 1 + 1; - templete = '
' + list + + if(acct.background!="def" && acct.text!="def"){ + var style='style="background-color:#'+acct.background+'; color:'+acct.text+';"' + }else{ + var style="" + } + templete = '
' + list + '.' + acct.name + '' + escapeHTML(acct.user) + '@' + acct.domain + '
'; + ')">delete削除
アカウントカラーの選択
'; $("#acct-list").append(templete); + colorpicker(key) }); multisel(); var acctN = localStorage.getItem("acct"); @@ -120,13 +126,11 @@ function multiDel(target) { //サポートインスタンス function support() { - var json=JSON.parse(localStorage.getItem("instance")); - console.log(json); - Object.keys(json).forEach(function(key) { - var instance = json[key]; + Object.keys(idata).forEach(function(key) { + var instance = idata[key]; if (instance == "instance") { templete = '' + json[key + "_name"] + '(' + key + ')'; + '\')" class="collection-item pointer transparent">' + idata[key + "_name"] + '(' + key + ')'; $("#support").append(templete); } }); @@ -268,7 +272,8 @@ function getdata(domain, at) { domain: domain, user: json["acct"], prof: avatar, - id: json["id"] + id: json["id"], + vis: json["source"]["privacy"] }; var multi = localStorage.getItem("multi"); var obj = JSON.parse(multi); @@ -322,7 +327,8 @@ function refresh(target) { domain: obj[target].domain, user: json["acct"], prof: avatar, - id: json["id"] + id: json["id"], + vis: json["source"]["privacy"] }; localStorage.setItem("name_" + target, json["display_name"]); localStorage.setItem("user_" + target, json["acct"]); @@ -385,4 +391,105 @@ function mainacct(){ var acct_id = $("#main-acct-sel").val(); localStorage.setItem("main", acct_id); Materialize.toast("メインアカウントを設定しました。", 3000); -} \ No newline at end of file +} +function colorpicker(key){ + temp= + '
なし
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'; + $("#colorsel_"+key).html(temp); +} +function coloradd(key,bg,txt){ + var col = localStorage.getItem("multi"); + 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("multi", json); + if(txt=="def"){ + $("#acct_"+key).attr("style","") + }else{ + $("#acct_"+key).css('background-color','#'+bg); + if(txt=="black"){ + var bghex="000000"; + var ichex="9e9e9e" + }else if(txt=="white"){ + var bghex="ffffff"; + var ichex="eeeeee" + } + $("#acct_"+key+" .nex").css('color','#'+ichex); + $("#acct_"+key).css('color','#'+bghex); + } +} +//入力時にハッシュタグと@をサジェスト +var timer = null; + +var input = document.getElementById("url"); + +var prev_val = input.value; +var oldSuggest; +var suggest; +input.addEventListener("focus", function() { + $("#ins-suggest").html(""); + window.clearInterval(timer); + timer = window.setInterval(function() { + var new_val = input.value; + if (prev_val != new_val) { + if (new_val.length > 3) { + var start = "https://instances.social/api/1.0/instances/search?q=" + + new_val; + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json', + 'Authorization': 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M' + }, + }).then(function(response) { + return response.json(); + }).catch(function(error) { + todo(error); + console.error(error); + }).then(function(json) { + console.log(json); + if (!json.error) { + + var urls = "もしかして:"; + Object.keys(json.instances).forEach(function(key) { + var url = json.instances[key]; + urls = urls + ' ' + url.name + ' '; + }); + $("#ins-suggest").html(urls); + } + }); + } + oldSuggest = suggest; + prev_value = new_val; + } + }, 1000); +}, false); + +input.addEventListener("blur", function() { + window.clearInterval(timer); +}, false); diff --git a/app/js/platform/screenshot.js b/app/js/platform/screenshot.js index b58e15a8..da43e630 100644 --- a/app/js/platform/screenshot.js +++ b/app/js/platform/screenshot.js @@ -48,9 +48,4 @@ function shot(){ } }) }) - } - $(window).load(function(){ - setTimeout(function(){ - shot(); - },2000); - }); \ No newline at end of file + } \ No newline at end of file diff --git a/app/js/post/bb-md.js b/app/js/post/bb-md.js index 05f7f8f4..696e772c 100644 --- a/app/js/post/bb-md.js +++ b/app/js/post/bb-md.js @@ -9,8 +9,7 @@ function mdCheck(){ $(".markdown").addClass("hide"); $(".anti-markdown").addClass("hide"); }else{ - $(".markdown").removeClass("hide"); - $(".anti-markdown").addClass("hide"); + $(".anti-markdown").removeClass("hide"); } if($(".markdown").hasClass("hide")){ localStorage.setItem("md","hide"); @@ -38,6 +37,21 @@ function mdCheck(){ }else{ $("#textarea").attr("data-length", 500) } + var multi = localStorage.getItem("multi"); + if (multi) { + var obj = JSON.parse(multi); + if(obj[acct_id].background && obj[acct_id].background!="def" && obj[acct_id].text && obj[acct_id].text!="def"){ + $("#toot-post-btn").removeClass("indigo"); + $("#toot-post-btn").css("background-color","#"+obj[acct_id].background); + $("#toot-post-btn").css("color",obj[acct_id].text); + }else{ + $("#toot-post-btn").css("background-color",""); + $("#toot-post-btn").css("color",""); + $("#toot-post-btn").addClass("indigo"); + + } + } + loadVis(); } //BOXのトグルボタン function mdToggle(){ diff --git a/app/js/post/post.js b/app/js/post/post.js index 858bae53..89f73b2c 100644 --- a/app/js/post/post.js +++ b/app/js/post/post.js @@ -6,10 +6,28 @@ function post() { } var str = $("#textarea").val(); var acct_id = $("#post-acct-sel").val(); - $("#toot-post-btn").prop("disabled", true); localStorage.setItem("last-use", acct_id); - todo("Posting"); var domain = localStorage.getItem("domain_" + acct_id); + if(domain=="theboss.tech"){ + if(~str.indexOf("#")){ + if(str.indexOf("#theboss_tech")=="-1"){ + if(!confirm("デフォルトタグが挿入されていません。このまま投稿するとローカルには表示されません。")){ + return false; + } + } + } + } + if(domain=="dtp-mstdn.jp"){ + if(~str.indexOf("#")){ + if(str.indexOf("#dtp")=="-1"){ + if(!confirm("デフォルトタグが挿入されていません。このまま投稿するとローカルには表示されません。")){ + return false; + } + } + } + } + $("#toot-post-btn").prop("disabled", true); + todo("Posting"); var at = localStorage.getItem(domain + "_at"); var start = "https://" + domain + "/api/v1/statuses"; var reply = $("#reply").val(); @@ -80,16 +98,7 @@ function clear() { $("#cw").removeClass("cw-avail"); $("#rec").text("いいえ"); $("#mec").text("なし"); - var vist = localStorage.getItem("vis"); - if (!vist) { - vis("public"); - } else { - if (vist == "memory") { - localStorage.setItem("vis-memory", $("#vis").text()); - } else { - vis(vist); - } - } + loadVis(); $("#nsfw").removeClass("yellow-text"); $("#nsfw").html("visibility_off"); $("#nsfw").removeClass("nsfw-avail"); diff --git a/app/js/post/secure.js b/app/js/post/secure.js index da35d968..f47d3486 100644 --- a/app/js/post/secure.js +++ b/app/js/post/secure.js @@ -37,16 +37,28 @@ function vis(set){ } var vis=localStorage.getItem("vis"); if(vis=="memory"){ - localStorage.setItem("vis-memory",set); + var acct_id = $("#post-acct-sel").val(); + localStorage.setItem("vis-memory-"+acct_id,set); } } function loadVis(){ var vist = localStorage.getItem("vis"); + console.log(vist); if (!vist) { vis("public"); } else { if (vist == "memory") { - var memory = localStorage.getItem("vis-memory"); + var acct_id = $("#post-acct-sel").val(); + var memory = localStorage.getItem("vis-memory-"+acct_id); + if (!memory) { + memory = "public"; + } + vis(memory); + } else if(vist == "server") { + var acct_id = $("#post-acct-sel").val(); + var multi = localStorage.getItem("multi"); + var obj = JSON.parse(multi); + var memory = obj[acct_id]["vis"]; if (!memory) { memory = "public"; } @@ -58,7 +70,7 @@ function loadVis(){ } loadVis(); -//コンテンツワーニング +//コンテントワーニング function cw(){ if($("#cw").hasClass("cw-avail")){ $("#cw-text").val(); @@ -75,8 +87,23 @@ function cw(){ } } } -//TLでコンテンツワーニングを表示トグル +//TLでコンテントワーニングを表示トグル function cw_show(id){ $(".cw_hide_"+id).toggleClass("cw"); $(".cw-long-"+id).toggleClass("hide"); -} \ No newline at end of file +} +$(function() { + $('#cw-text').on('change', function(event) { + var acct_id = $("#post-acct-sel").val(); + var domain = localStorage.getItem("domain_" + acct_id); + var cwlen=$('#cw-text').val().length; + + if(idata[domain+"_letters"]){ + $("#textarea").attr("data-length", idata[domain+"_letters"]-cwlen) + }else{ + $("#textarea").attr("data-length", 500-cwlen) + } + + + }); + }); \ No newline at end of file diff --git a/app/js/tl/datails.js b/app/js/tl/datails.js index 5be23c3b..9413f43b 100644 --- a/app/js/tl/datails.js +++ b/app/js/tl/datails.js @@ -210,10 +210,12 @@ function cbCopy(mode){ //本文のコピー function staCopy(id){ var html=$("[toot-id="+id+"] .toot").html(); - html = html.match(/^

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

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

/, "\n"); html = html.replace(/<\/p>/, "\n"); + console.log(html); + html = html.replace(//g, "$1"); html=$.strip_tags(html); if(execCopy(html)){ Materialize.toast("トゥート本文をコピーしました", 1500); @@ -222,14 +224,49 @@ function staCopy(id){ } //魚拓 function shot(){ - var id=$("#tootmodal").attr("data-id"); - var w=$("#toot-this").width(); - var h=$("#toot-this").height()+150; - var text=$("#toot-this").html(); - localStorage.setItem("sc-text",text) + var title=$("#tootmodal").attr("data-id"); + var off = $('#toot-this').offset(); + var w=$("#toot-this").width()+50; + var h=$("#toot-this").height()+50; var electron = require("electron"); + const fs = require("fs"); + const os = require('os') + const shell = electron.shell; + const path = require('path') var ipc = electron.ipcRenderer; - ipc.send('screen', [w,h,id]); + let options = { + types: ['screen'], + thumbnailSize: { + width: window.parent.screen.width, + height: window.parent.screen.height + } + } + const desktopCapturer = electron.desktopCapturer; + desktopCapturer.getSources(options, function(error, sources) { + if (error) return console.log(error) + + sources.forEach(function(source) { + if (source.name === 'Screen 1' || source.name === 'TheDesk') { + var durl=source.thumbnail.toDataURL(); + var b64 = durl.match( + /data:image\/png;base64,(.+)/ + ); + const screenshotPath = path.join(os.tmpdir(), 'screenshot.png'); + const savePath = path.join(os.tmpdir(), 'screenshot.png'); + var ipc = electron.ipcRenderer; + ipc.send('shot', ['file://' + screenshotPath,w,h,b64[1],title,off.top+50,off.left]); + if($("#toot-this .img-parsed").length>0){ + for(i=0;i<$("#toot-this .img-parsed").length;i++){ + var url=$("#toot-this .img-parsed").eq(i).attr("data-url"); + ipc.send('shot-img-dl', [url,title+"_img"+i+".png"]); + } + } + return; + const message = `Saved screenshot to: ${screenshotPath}` + //screenshotMsg.textContent = message + } + }) + }) } //翻訳 function trans(tar){ diff --git a/app/js/tl/mix.js b/app/js/tl/mix.js index 1e7efcda..c7c774c9 100644 --- a/app/js/tl/mix.js +++ b/app/js/tl/mix.js @@ -36,7 +36,7 @@ function mixtl(acct_id, tlid, type) { var homearr=[]; var timeline = jsonL.concat(jsonH); timeline.sort(function(a,b){ - if(date(a.created_at,"unix")>date(b.created_at,"unix")) return -1; + if(date(a.created_at,"unix")>=date(b.created_at,"unix")) return -1; if(date(a.created_at,"unix")'; + '" class="emoji-img" data-emoji="'+shortcode+'" alt=" :'+shortcode+': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); dis_name = dis_name.replace(regExp, emoji_url); @@ -208,7 +208,7 @@ function parse(obj, mix, acct_id, tlid, popup) { var emoji = toot.account.emojis[key5]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="'+shortcode+'" alt=" :'+shortcode+': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); dis_name = dis_name.replace(regExp, emoji_url); }); @@ -239,7 +239,7 @@ function parse(obj, mix, acct_id, tlid, popup) { var emoji = toot.account.emojis[key5]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="'+shortcode+'" alt=" :'+shortcode+': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); dis_name = dis_name.replace(regExp, emoji_url); }); @@ -345,7 +345,7 @@ function parse(obj, mix, acct_id, tlid, popup) { var emoji = toot.emojis[key5]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="'+shortcode+'" alt=" :'+shortcode+': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); content = content.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url); @@ -623,7 +623,7 @@ function userparse(obj, auth, acct_id, tlid, popup) { var emoji = toot.emojis[key5]; var shortcode = emoji.shortcode; var emoji_url = ''; + '" class="emoji-img" data-emoji="'+shortcode+'" alt=" :'+shortcode+': ">'; var regExp = new RegExp(":" + shortcode + ":", "g"); dis_name = dis_name.replace(regExp, emoji_url); }); diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js index f361b0aa..a9c741a5 100644 --- a/app/js/ui/layout.js +++ b/app/js/ui/layout.js @@ -44,6 +44,7 @@ function parseColumn() { ckdb(key); }); } + var acctlist=obj; var xed=localStorage.getItem("xed"); if(xed){ xpand(); @@ -88,12 +89,15 @@ function parseColumn() { var txhex="ffffff"; var ichex="eeeeee" } - insert=' style="background-color:#'+acct.background+'; color: #'+txhex+'" '; + insert='background-color:#'+acct.background+'; color: #'+txhex+'; '; icnsert=' style="color: #'+ichex+'" '; } } + if(acctlist[acct.domain].background!="def"){ + insert=insert+" border-bottom:medium solid #"+acctlist[acct.domain].background; + } var html = '