mirror of
https://gitee.com/bitdance-team/chrome-extension
synced 2025-10-08 00:45:13 +08:00
添加地图搜索模块;添加360百科;优化自动搜索模块控制台打印
This commit is contained in:
@@ -559,6 +559,7 @@ var omniboxSearchModes = [
|
|||||||
suggest([
|
suggest([
|
||||||
{ content: "baike: [百度] " + text, description: "使用 <url>[百度百科]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
{ content: "baike: [百度] " + text, description: "使用 <url>[百度百科]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
{ content: "baike: [搜狗] " + text, description: "使用 <url>[搜狗百科]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
{ content: "baike: [搜狗] " + text, description: "使用 <url>[搜狗百科]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
|
{ content: "baike: [360] " + text, description: "使用 <url>[360百科]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
]);
|
]);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
@@ -600,11 +601,73 @@ var omniboxSearchModes = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "[360]":
|
||||||
|
navigate("https://baike.so.com/doc/search?word=" + encodeURIComponent(searchText), true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
console.log("[百科搜索结束]");
|
console.log("[百科搜索结束]");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// #############################################################################################################
|
// #############################################################################################################
|
||||||
|
{
|
||||||
|
key: "map",
|
||||||
|
// 显示文字
|
||||||
|
showText: "地图",
|
||||||
|
// 搜索模式匹配
|
||||||
|
match: function (text) {
|
||||||
|
return /^map( |:|\uff1a)?/i.test(text)
|
||||||
|
},
|
||||||
|
// 获取输入文字
|
||||||
|
getInputText: function (text, encodeText = true) {
|
||||||
|
let returnText = /^map(:| |\uff1a)?(.*)$/i.exec(text)[2].trim()
|
||||||
|
return encodeText ? encodeXML(returnText) : returnText
|
||||||
|
},
|
||||||
|
// 搜索建议
|
||||||
|
getSuggestions: async function (text, suggest) {
|
||||||
|
// 如果前面已经有了 【[xx] 】,则先去掉
|
||||||
|
text = text.replace(/^\[.*?\]\s*/, "");
|
||||||
|
suggest([
|
||||||
|
{ content: "map: [百度] " + text, description: "使用 <url>[百度地图]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
|
{ content: "map: [高德] " + text, description: "使用 <url>[高德地图]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
|
{ content: "map: [必应] " + text, description: "使用 <url>[必应地图]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
|
{ content: "map: [360] " + text, description: "使用 <url>[360地图]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
|
{ content: "map: [搜狗] " + text, description: "使用 <url>[搜狗地图]</url> 搜索 <match>" + text + "</match>", deletable: false },
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
// 执行搜索
|
||||||
|
search: function (text) {
|
||||||
|
let searchInput = /^(\[.*?\])?( )?(.*)$/.exec(text)
|
||||||
|
let searchType = /^\[(.*?)\]$/.exec((searchInput[1] ?? "[百度]"/* 默认百度图片搜索 */).trim())[0].trim()
|
||||||
|
let searchText = searchInput[3].trim()
|
||||||
|
console.log("[地图搜索开始]");
|
||||||
|
console.log(" 传入参数为:", text);
|
||||||
|
console.log(" searchInput为:", searchInput);
|
||||||
|
console.log(" searchType为:", searchType);
|
||||||
|
console.log(" searchText为:", searchText);
|
||||||
|
switch (searchType) {
|
||||||
|
default:
|
||||||
|
case "[百度]":
|
||||||
|
navigate("https://map.baidu.com/search?querytype=s&wd=" + encodeURIComponent(searchText), true);
|
||||||
|
break;
|
||||||
|
case "[高德]":
|
||||||
|
navigate("https://www.amap.com/search?query=" + encodeURIComponent(searchText), true);
|
||||||
|
break;
|
||||||
|
case "[必应]":
|
||||||
|
navigate("https://cn.bing.com/maps?q=" + encodeURIComponent(searchText), true);
|
||||||
|
break;
|
||||||
|
case "[360]":
|
||||||
|
navigate("https://ditu.so.com/?k=" + encodeURIComponent(searchText), true);
|
||||||
|
break;
|
||||||
|
case "[搜狗]":
|
||||||
|
navigate("http://map.sogou.com/#lq=" + encodeURIComponent(searchText), true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
console.log("[地图搜索结束]");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 购物:https://s.taobao.com/search?q=搜索关键词
|
||||||
|
// #############################################################################################################
|
||||||
// {
|
// {
|
||||||
// key: "jk",
|
// key: "jk",
|
||||||
// // 显示文字
|
// // 显示文字
|
||||||
|
@@ -20,8 +20,9 @@ $.extend({
|
|||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
let transText = $.getUrlVar('__bitdance_extension__');
|
let transText = $.getUrlVar('__bitdance_extension__');
|
||||||
if (!transText || transText.trim() == "") return
|
if (!transText || transText.trim() == "") return
|
||||||
|
transText = decodeURIComponent(transText)
|
||||||
console.log("[BitDance extension] 学生助手插件 - 百度百科自动搜索模块 - 模块文本为:", transText);
|
console.log("[BitDance extension] 学生助手插件 - 百度百科自动搜索模块 - 模块文本为:", transText);
|
||||||
|
|
||||||
document.getElementById("query").value = decodeURIComponent(transText)
|
document.getElementById("query").value = transText
|
||||||
document.getElementById("search").click()
|
document.getElementById("search").click()
|
||||||
}
|
}
|
||||||
|
@@ -20,9 +20,10 @@ $.extend({
|
|||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
let transText = $.getUrlVar('__bitdance_extension__');
|
let transText = $.getUrlVar('__bitdance_extension__');
|
||||||
if (!transText || transText.trim() == "") return
|
if (!transText || transText.trim() == "") return
|
||||||
|
transText = decodeURIComponent(transText)
|
||||||
console.log("[BitDance extension] 学生助手插件 - 有道翻译自动填入模块 - 翻译文本为:", transText);
|
console.log("[BitDance extension] 学生助手插件 - 有道翻译自动填入模块 - 翻译文本为:", transText);
|
||||||
|
|
||||||
document.getElementsByTagName("textarea")[0].value = decodeURIComponent(transText)
|
document.getElementsByTagName("textarea")[0].value = transText
|
||||||
document.getElementById("transMachine").click()
|
document.getElementById("transMachine").click()
|
||||||
|
|
||||||
// 参数获取完成后,清除掉页面参数
|
// 参数获取完成后,清除掉页面参数
|
||||||
|
@@ -20,8 +20,9 @@ $.extend({
|
|||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
let transText = $.getUrlVar('__bitdance_extension__');
|
let transText = $.getUrlVar('__bitdance_extension__');
|
||||||
if (!transText || transText.trim() == "") return
|
if (!transText || transText.trim() == "") return
|
||||||
|
transText = decodeURIComponent(transText)
|
||||||
console.log("[BitDance extension] 学生助手插件 - 维普期刊自动搜索模块 - 模块文本为:", transText);
|
console.log("[BitDance extension] 学生助手插件 - 维普期刊自动搜索模块 - 模块文本为:", transText);
|
||||||
|
|
||||||
document.getElementById("searchKeywords").value = decodeURIComponent(transText)
|
document.getElementById("searchKeywords").value = transText
|
||||||
document.getElementById("btnSearch").click()
|
document.getElementById("btnSearch").click()
|
||||||
}
|
}
|
||||||
|
@@ -20,8 +20,9 @@ $.extend({
|
|||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
let transText = $.getUrlVar('__bitdance_extension__');
|
let transText = $.getUrlVar('__bitdance_extension__');
|
||||||
if (!transText || transText.trim() == "") return
|
if (!transText || transText.trim() == "") return
|
||||||
|
transText = decodeURIComponent(transText)
|
||||||
console.log("[BitDance extension] 学生助手插件 - 中国知网自动搜索模块 - 模块文本为:", transText);
|
console.log("[BitDance extension] 学生助手插件 - 中国知网自动搜索模块 - 模块文本为:", transText);
|
||||||
|
|
||||||
document.getElementById("txt_SearchText").value = decodeURIComponent(transText)
|
document.getElementById("txt_SearchText").value = transText
|
||||||
document.querySelector(".search-btn").click()
|
document.querySelector(".search-btn").click()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user