Skip to content

Commit

Permalink
增加谷歌转发去标签翻译
Browse files Browse the repository at this point in the history
  • Loading branch information
yunzlp committed Mar 13, 2024
1 parent fcd68df commit 0b3b2e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hotkey.struct
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
,"1"=//if(!$('.input:focus').length)$(".layui-layer button:contains('腾讯交互(带标签)')").click()
,"2"=//if(!$('.input:focus').length)$(".layui-layer button:contains('腾讯交互(去标签)')").click()
,"3"=//if(!$('.input:focus').length)$(".layui-layer button:contains('谷歌翻译(转发)')").click()
//,"4"=//if(!$('.input:focus').length)$(".layui-layer button:contains('AWS')").click()
,"4"=//if(!$('.input:focus').length)$(".layui-layer button:contains('谷歌翻译(去标签转发)')").click()
//,"5"=//if(!$('.input:focus').length)$(".layui-layer button:contains('阿里')").click()
//,"6"=//if(!$('.input:focus').length)$(".layui-layer button:contains('新译')").click()
//,"7"=//if(!$('.input:focus').length)$(".layui-layer button:contains('讯飞')").click()
Expand Down
12 changes: 10 additions & 2 deletions patch/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ qqq_translate_patch=function(str){
str=str.replace(/& ?/g,"&")

//修正&
str=str.replaceAll('& amp;',"&")
str=str.replaceAll("&","&")

return str
Expand Down Expand Up @@ -164,8 +165,13 @@ qqq_translate_tts=async function (is_filt){
}

//谷歌转发翻译
qqq_translate_googleR=async function(){
qqq_translate_googleR=async function(is_filt){
var old=$(".qqq_menu .old").html()

if( is_filt ){
old=old.replaceAll('{}'," ")
}

old=qqq_translate_form_path(old)


Expand Down Expand Up @@ -326,7 +332,9 @@ html=`<div class="hide">
old(content)
<button class="layui-btn layui-btn-primary layui-btn-xs" onclick=qqq_translate_tts()>腾讯交互(带标签)</button>
<button class="layui-btn layui-btn-primary layui-btn-xs" onclick=qqq_translate_tts(1)>腾讯交互(去标签)</button>
<br>
<button class="layui-btn layui-btn-primary layui-btn-xs" onclick=qqq_translate_googleR()>谷歌翻译(转发)</button>
<button class="layui-btn layui-btn-primary layui-btn-xs" onclick=qqq_translate_googleR(1)>谷歌翻译(去标签转发)</button>
</div>
<div class="layui-col-md6">
Expand Down Expand Up @@ -531,5 +539,5 @@ window.setInterval(function(){
add_translate($(this),file,"title")
})

},500)
},300)

8 changes: 4 additions & 4 deletions patch/template.htm
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@
<button style="
float: right;
font-size: 20px;
font-size: 16px;
padding: 4px 12px;
"
onclick="
window.location.replace('gmmt://'+document.location.hash)
"
>F</button>
>打开编辑器</button>
<button style="
float: right;
font-size: 20px;
font-size: 16px;
padding: 4px 12px;
"
onclick="
noTranslationStateToggle();
location.reload();
event.stopPropagation();
"
>T</button>
>切换翻译</button>
`

//意味着触发这段代码的地方处于主页
Expand Down

0 comments on commit 0b3b2e3

Please sign in to comment.