From 52c65afce6a3506f892a7e0240326841fa4802bc Mon Sep 17 00:00:00 2001 From: Cutls Date: Sat, 5 Oct 2019 02:23:47 +0900 Subject: [PATCH] Add: boost with visibility --- app/js/post/status.js | 13 ++++++- app/js/tl/datails.js | 1 + app/js/tl/parse.js | 4 +- app/view/make/index.sample.html | 55 ++++++++++++++++------------ app/view/make/language/en/index.json | 1 + app/view/make/language/ja/index.json | 1 + 6 files changed, 48 insertions(+), 27 deletions(-) diff --git a/app/js/post/status.js b/app/js/post/status.js index 445bf75f..82e0b749 100644 --- a/app/js/post/status.js +++ b/app/js/post/status.js @@ -50,7 +50,7 @@ function fav(id, acct_id, remote) { } //ブースト -function rt(id, acct_id, remote) { +function rt(id, acct_id, remote, vis) { if ($("#pub_" + id).hasClass("rted")) { var flag = "unreblog"; } else { @@ -64,7 +64,11 @@ function rt(id, acct_id, remote) { httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Authorization', 'Bearer ' + at); httpreq.responseType = "json"; - httpreq.send(); + if(vis){ + httpreq.send(JSON.stringify({visibility: vis})); + }else{ + httpreq.send(); + } httpreq.onreadystatechange = function () { if (httpreq.readyState === 4) { var json = httpreq.response; @@ -95,6 +99,11 @@ function rt(id, acct_id, remote) { } } } +function boostWith(vis){ + var id = $("#tootmodal").attr("data-id"); + var acct_id = $("#tootmodal").attr("data-acct"); + rt(id, acct_id, false, vis) +} //フォロー function follow(acct_id, remote) { diff --git a/app/js/tl/datails.js b/app/js/tl/datails.js index b9bddb5e..ceeabc6e 100644 --- a/app/js/tl/datails.js +++ b/app/js/tl/datails.js @@ -77,6 +77,7 @@ function details(id, acct_id, tlid, mode) { $("#toot-this .rt_ct").text(json.reblogs_count); $("#tootmodal").attr("data-url", url); $("#tootmodal").attr("data-id", json.id); + $("#tootmodal").attr("data-acct", acct_id); if (local) { $("#tootmodal").attr("data-user", scn + "@" + domain); } else { diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 2c16b5cf..c4dad209 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -656,7 +656,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { } else if (visen == "private") { var vis = 'lock'; - var can_rt = "unvisible"; + + var can_rt = "unvisible"; } else if (visen == "direct") { var vis = 'mail'; @@ -665,6 +666,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) { if (toot.account.acct == localStorage.getItem("user_" + acct_id)) { var if_mine = ""; var mine_via = "type-b"; + var can_rt = ""; } else { var if_mine = "hide"; var mine_via = ""; diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index cf471e37..1d3f25f2 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -38,34 +38,39 @@
-

@@demoBottomBtns@@

+
+

@@demoBottomBtns@@

@@lookAtBottom@@
- -
- account_circle: @@acctMan@@
  @@acctManDesc@@
- settings: @@setting@@
  @@settingDesc@@
- remove_from_queue: TheDesk Nano @@nanoDes@@
  @@nanoDescPlus@@
+ account_circle: @@acctMan@@
  @@acctManDesc@@ +
+ settings: @@setting@@
  @@settingDesc@@ +
+ remove_from_queue: TheDesk Nano @@nanoDes@@
  @@nanoDescPlus@@ +
apps: @@menu@@
  @@menuDesc@@

@@ -438,6 +443,10 @@ onclick="staEx('fav')">
+ @@btWithVis@@
+ + +
@@ -806,8 +815,7 @@
people_outline
@@local@@
-
perm_media +
perm_media
@@localMedia@@
@@ -817,8 +825,7 @@
language
@@fed@@
-
perm_media
+
perm_media
@@fedMedia@@
diff --git a/app/view/make/language/en/index.json b/app/view/make/language/en/index.json index 9d5518a4..207f4d06 100644 --- a/app/view/make/language/en/index.json +++ b/app/view/make/language/en/index.json @@ -62,6 +62,7 @@ "btedPeople":"People who boosted it", "useOtherAcct1":"Use other account", "useOtherAcct2":":unfav and unBT are disabled.", + "btWithVis": "Boost with visibility", "reply":"Reply", "bt":"Boost", "favRegist":"Favourite", diff --git a/app/view/make/language/ja/index.json b/app/view/make/language/ja/index.json index 7c0f10b4..b1ac9533 100644 --- a/app/view/make/language/ja/index.json +++ b/app/view/make/language/ja/index.json @@ -62,6 +62,7 @@ "btedPeople":"このトゥートをブーストした人", "useOtherAcct1":"他のアカウントを使用", "useOtherAcct2":"の解除はできません", + "btWithVis": "公開範囲を指定してブースト", "reply":"返信", "bt":"ブースト", "favRegist":"お気に入り",