You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
import * as until from "./until.js";
|
|
import * as components from "./components.js"
|
|
import * as searchEngine from "./search-engine.js"
|
|
|
|
let goToSearchPronounce = (word) => {
|
|
|
|
let search_engine_name = "gotToGoogleSearch"
|
|
// search_engine_name='gotToYouDaoSearch'
|
|
let tab = "current_tab"
|
|
|
|
let opener = components.getSearchEngineOpener();
|
|
if (opener && opener.expired_date) {
|
|
if(opener.expired_date > (new Date()).getTime()) {
|
|
if (opener.search_engine_name) {
|
|
search_engine_name = opener.search_engine_name;
|
|
}
|
|
if (opener.tab) {
|
|
tab = opener.tab;
|
|
}
|
|
}
|
|
}
|
|
if (search_engine_name && searchEngine[search_engine_name]) {
|
|
console.log(word)
|
|
let url = searchEngine[search_engine_name](word);
|
|
console.log(url)
|
|
if (tab === 'new_tab') {
|
|
window.open(url, '_blank')
|
|
} else {
|
|
let iframe = components.getIframe();
|
|
iframe.setAttribute('src', url);
|
|
}
|
|
} else {
|
|
console.log('search engine no found !')
|
|
}
|
|
|
|
}
|
|
|
|
let box = {...until, ...components,...searchEngine, goToSearchPronounce};
|
|
export default box |