This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Immersive Translate | |
// @description Web bilingual translation, completely free to use, supports Deepl/Google/Bing/Tencent/Youdao, etc. it also works on iOS Safari. | |
// @version 0.4.4 | |
// @namespace https://immersive-translate.owenyoung.com/ | |
// @author Owen Young | |
// @homepageURL https://immersive-translate.owenyoung.com/ | |
// @supportURL https://github.com/immersive-translate/immersive-translate/ | |
// @match *://*/* | |
// @include * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var search = () => { | |
let searchterm = draft.processTemplate("[[selection_only]]"); | |
if (searchterm.length == 0) { | |
searchterm = draft.processTemplate("[[draft]]"); | |
} | |
let regex = /\[([^\[]+)\]\(([^\)]+)\)|([a-zA-Z]+:\/\/[^\s]+)|([a-zA-Z]+:\/\/\s*)/ig; | |
let match; | |
let urls = []; | |
while ((match = regex.exec(searchterm)) !== null) { | |
if (match[2]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var search = () => { | |
let searchterm = draft.processTemplate("[[selection_only]]"); | |
if (searchterm.length == 0) { | |
searchterm = draft.processTemplate("[[draft]]"); | |
} | |
let regex = /\[([^\[]+)\]\(([^\)]+)\)|([a-zA-Z]+:\/\/[^\s]+)|([a-zA-Z]+:\/\/\s*)/ig; | |
let match; | |
let urls = []; | |
while ((match = regex.exec(searchterm)) !== null) { | |
if (match[2]) { |