From 8f185deff819f4bb5f87f6595d6f24f56a773905 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih Date: Mon, 4 Dec 2023 22:47:06 +0900 Subject: [PATCH] =?UTF-8?q?feat(tools):=20=E5=85=B1=E6=9C=89=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E3=82=B8=E3=82=A7=E3=83=8D=E3=83=AC=E3=83=BC?= =?UTF-8?q?=E3=82=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .nuxtignore | 1 + assets/data/toolsNav.ts | 11 +- assets/js/misc/index.ts | 36 ++++++ components/g/BsCopyButton.vue | 30 +++++ layouts/tools.vue | 1 + locales/ja-JP.yml | 24 ++++ pages/tools/share-link-generator.vue | 161 ++++++++++++++++++++++++++ pages/tools/tools-template-ignore.vue | 33 ++++++ 8 files changed, 294 insertions(+), 3 deletions(-) create mode 100644 .nuxtignore create mode 100644 components/g/BsCopyButton.vue create mode 100644 pages/tools/share-link-generator.vue create mode 100644 pages/tools/tools-template-ignore.vue diff --git a/.nuxtignore b/.nuxtignore new file mode 100644 index 00000000..4970bb95 --- /dev/null +++ b/.nuxtignore @@ -0,0 +1 @@ +pages/**/*-ignore.vue \ No newline at end of file diff --git a/assets/data/toolsNav.ts b/assets/data/toolsNav.ts index aaafe2a9..51e34f1e 100644 --- a/assets/data/toolsNav.ts +++ b/assets/data/toolsNav.ts @@ -13,7 +13,12 @@ export default [ i18n: "_aidConverter.title", description: "_aidConverter.description", to: "/tools/aid-converter/", - } - ] - } + }, + { + i18n: "_shareLinkGenerator.title", + description: "_shareLinkGenerator.description", + to: "/tools/share-link-generator/", + }, + ], + }, ]; \ No newline at end of file diff --git a/assets/js/misc/index.ts b/assets/js/misc/index.ts index 091c85ef..bc2dce00 100644 --- a/assets/js/misc/index.ts +++ b/assets/js/misc/index.ts @@ -73,3 +73,39 @@ export const findDeepObject = (obj: NavItem, condition: (v: NavItem) => boolean) return null; }; + +/** + * Clipboardに値をコピー(TODO: 文字列以外も対応) + */ +export function copyText(val: string) { + if (!process.client) return; + + // 空div 生成 + const tmp = document.createElement('div'); + // 選択用のタグ生成 + const pre = document.createElement('pre'); + + // 親要素のCSSで user-select: none だとコピーできないので書き換える + pre.style.webkitUserSelect = 'auto'; + pre.style.userSelect = 'auto'; + + tmp.appendChild(pre).textContent = val; + + // 要素を画面外へ + const s = tmp.style; + s.position = 'fixed'; + s.right = '200%'; + + // body に追加 + document.body.appendChild(tmp); + // 要素を選択 + document.getSelection()?.selectAllChildren(tmp); + + // クリップボードにコピー + const result = document.execCommand('copy'); + + // 要素削除 + document.body.removeChild(tmp); + + return result; +} \ No newline at end of file diff --git a/components/g/BsCopyButton.vue b/components/g/BsCopyButton.vue new file mode 100644 index 00000000..3ade8059 --- /dev/null +++ b/components/g/BsCopyButton.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/layouts/tools.vue b/layouts/tools.vue index 3f62eb66..c13c8f0f 100644 --- a/layouts/tools.vue +++ b/layouts/tools.vue @@ -53,6 +53,7 @@ const route = useRoute();
+ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 0e818ef7..4a441988 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2,6 +2,7 @@ noScript: "現在Javascriptが無効になっています。サイトの表示 learnMore: "詳しく知る" loading: "読み込み中…" clickToExpand: "(クリックして展開)" +copy: "コピー" _seo: siteName: "Misskey Hub" @@ -238,6 +239,29 @@ _share: domain: "サーバーのドメイン" compatibleWith: "Misskeyと、一部のMisskeyフォークに対応しています。" +_noteVisibility: + public: "パブリック" + home: "ホーム" + followers: "フォロワー" + specified: "ダイレクト" + localOnly: "連合なし" + +_shareLinkGenerator: + title: "共有ボタンジェネレーター" + description: "Misskey Hubの共有ボタン中継サービスを利用して、Misskey用の共有ボタンを作成できます。" + body: "本文" + bodyWarning: "どのサーバーでも共有できるようにするため、カスタム絵文字は使用できません。" + url: "URL" + urlCaption: "任意。本文の後ろに挿入されます。" + settings: "詳細設定" + visibility: "公開範囲" + recipents: "ダイレクトを受け取る人のacct(改行区切り)" + resultLink: "リンク生成結果" + resultButton: "共有ボタンのサンプル" + testLink: "共有リンクを試す" + typeSomethingToGetLink: "本文を入力するとリンクが生成されます。" + typeSomethingToGetButton: "本文を入力するとボタンが生成されます。" + _api: _permissions: title: "権限" diff --git a/pages/tools/share-link-generator.vue b/pages/tools/share-link-generator.vue new file mode 100644 index 00000000..11153bab --- /dev/null +++ b/pages/tools/share-link-generator.vue @@ -0,0 +1,161 @@ + + + + + diff --git a/pages/tools/tools-template-ignore.vue b/pages/tools/tools-template-ignore.vue new file mode 100644 index 00000000..274299ff --- /dev/null +++ b/pages/tools/tools-template-ignore.vue @@ -0,0 +1,33 @@ + + + + + + +