2022-02-09 13:05:59 +08:00
|
|
|
console.log("[BitDance extension] 学生助手插件 - 百度百科自动搜索模块加载成功");
|
|
|
|
|
|
|
|
// refer: https://www.cnblogs.com/chen-lhx/p/5198612.html
|
|
|
|
$.extend({
|
|
|
|
getUrlVars: function () {
|
|
|
|
var vars = [], hash;
|
|
|
|
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
|
|
|
for (var i = 0; i < hashes.length; i++) {
|
|
|
|
hash = hashes[i].split('=');
|
|
|
|
vars.push(hash[0]);
|
|
|
|
vars[hash[0]] = hash[1];
|
|
|
|
}
|
|
|
|
return vars;
|
|
|
|
},
|
|
|
|
getUrlVar: function (name) {
|
|
|
|
return $.getUrlVars()[name];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
window.onload = () => {
|
|
|
|
let transText = $.getUrlVar('__bitdance_extension__');
|
|
|
|
if (!transText || transText.trim() == "") return
|
2022-02-09 16:53:44 +08:00
|
|
|
transText = decodeURIComponent(transText)
|
2022-02-09 13:05:59 +08:00
|
|
|
console.log("[BitDance extension] 学生助手插件 - 百度百科自动搜索模块 - 模块文本为:", transText);
|
|
|
|
|
2022-02-09 16:53:44 +08:00
|
|
|
document.getElementById("query").value = transText
|
2022-02-09 13:05:59 +08:00
|
|
|
document.getElementById("search").click()
|
|
|
|
}
|