From 5d9327d3d388355df742a2b42ddb907143c61f8d Mon Sep 17 00:00:00 2001 From: cutls Date: Sat, 8 Feb 2020 23:48:31 +0900 Subject: [PATCH] Add: lang --- app/js/tl/src.js | 10 +++++++++- app/view/make/language/en/index.json | 2 ++ app/view/make/language/en/setting.json | 2 ++ app/view/make/language/ja-KS/index.json | 2 ++ app/view/make/language/ja-KS/setting.json | 2 ++ app/view/make/language/ja/index.json | 2 ++ app/view/make/language/ja/setting.json | 2 ++ app/view/make/setting.sample.js | 13 +++++++++++++ 8 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/js/tl/src.js b/app/js/tl/src.js index f63b6d70..658cdef8 100644 --- a/app/js/tl/src.js +++ b/app/js/tl/src.js @@ -317,6 +317,7 @@ function srcBox(mode) { } else if (mode == 'close') { if(!selectedText) { $('#pageSrc').addClass('hide') + $('#pageSrc').removeClass('keep') } } else { $('#pageSrc').toggleClass('hide') @@ -340,9 +341,16 @@ document.addEventListener('selectionchange', function() { } }) function doSrc(type) { + $('#pageSrc').addClass('hide') + $('#pageSrc').removeClass('keep') var q = $('#pageSrcInput').val() if(type == 'web') { - postMessage(["openUrl", 'https://google.com/search?q=' + q], "*") + var start = localStorage.getItem('srcUrl') + if(!start) { + start = 'https://google.com/search?q={q}' + } + start = start.replace(/{q}/, q) + postMessage(["openUrl", start], "*") } else if(type == 'ts') { tsAdd(q) } diff --git a/app/view/make/language/en/index.json b/app/view/make/language/en/index.json index 014d6665..206b848c 100644 --- a/app/view/make/language/en/index.json +++ b/app/view/make/language/en/index.json @@ -1,6 +1,8 @@ { "draghere":"Drag here to upload", "close":"Close", + "webSrc": "Search on Web", + "tsSrc": "Search on tootsearch", "showSelectProf":"Show profile of the selecting account", "closethisbox":"Close this box", "toot":"Toot", diff --git a/app/view/make/language/en/setting.json b/app/view/make/language/en/setting.json index e809e088..b4448f33 100644 --- a/app/view/make/language/en/setting.json +++ b/app/view/make/language/en/setting.json @@ -35,6 +35,8 @@ "useragent":"User agent", "useragentWarn":"Restart when changed", "absolute": "absolute value", + "srcUrl": "Search engine", + "srcUrlWarn": "{q} will be replaced to query.", "themeSel": "Select theme", "customtheme": "Edit and add custom themes", "customthemeDirection": "Color scheme", diff --git a/app/view/make/language/ja-KS/index.json b/app/view/make/language/ja-KS/index.json index 41337de4..58527267 100644 --- a/app/view/make/language/ja-KS/index.json +++ b/app/view/make/language/ja-KS/index.json @@ -1,6 +1,8 @@ { "draghere":"ドラッグしてみ?(ドラッグしたらすぐアップロードされるで)", "close":"Close", + "webSrc": "Webでさがす", + "tsSrc": "tootsearchでさがす", "showSelectProf":"このアカウントのプロフィール出す", "closethisbox":"このボックスなおす", "post-new":"投稿", diff --git a/app/view/make/language/ja-KS/setting.json b/app/view/make/language/ja-KS/setting.json index bf9546b3..77715d19 100644 --- a/app/view/make/language/ja-KS/setting.json +++ b/app/view/make/language/ja-KS/setting.json @@ -34,6 +34,8 @@ "useragent":"ユーザーエージェント", "useragentWarn":"再起動すんで。", "absolute": "絶対指定", + "srcUrl": "検索エンジン", + "srcUrlWarn": "{q}が検索文字列になるで。", "themeSel": "テーマの選択", "customtheme": "カスタムテーマの作成・編集", "customthemeDirection": "色の系統", diff --git a/app/view/make/language/ja/index.json b/app/view/make/language/ja/index.json index d13b6c94..f6962af8 100644 --- a/app/view/make/language/ja/index.json +++ b/app/view/make/language/ja/index.json @@ -1,5 +1,7 @@ { "draghere":"ここにドラッグして添付(ドラッグと同時にアップロードされます)", + "webSrc": "Webで検索", + "tsSrc": "tootsearchで検索", "close":"Close", "showSelectProf":"選択したアカウントのプロフィールを表示", "closethisbox":"このボックスを閉じる", diff --git a/app/view/make/language/ja/setting.json b/app/view/make/language/ja/setting.json index 44cef7d1..1be2437f 100644 --- a/app/view/make/language/ja/setting.json +++ b/app/view/make/language/ja/setting.json @@ -35,6 +35,8 @@ "useragent":"ユーザーエージェント", "useragentWarn":"再起動します。", "absolute": "絶対指定", + "srcUrl": "検索エンジン", + "srcUrlWarn": "{q}が検索文字列に置換されます。", "themeSel": "テーマの選択", "customtheme": "カスタムテーマの作成・編集", "customthemeDirection": "色の系統", diff --git a/app/view/make/setting.sample.js b/app/view/make/setting.sample.js index 0ea74504..e8bfe470 100644 --- a/app/view/make/setting.sample.js +++ b/app/view/make/setting.sample.js @@ -129,6 +129,19 @@ var envConstruction = [ head: '@@useragent@@', desc: '@@useragentWarn@@' } + }, + { + id: 'srcUrl', + storage: 'srcUrl', + checkbox: false, + doubleText: false, + width: 200, + setValue: 'https://google.com/search?q={q}', + text: { + head: '@@srcUrl@@', + desc: '@@srcUrlWarn@@', + after: '' + } } ] var tlConstruction = [