30 lines
460 B
JavaScript
30 lines
460 B
JavaScript
//延迟函数解决魔鬼定时器问题
|
|
function delay(n) {
|
|
return new Promise(function (resolve) {
|
|
setTimeout(resolve, n * 1000);
|
|
});
|
|
}
|
|
|
|
//naver使用函数
|
|
const naver = async (r, id) => {
|
|
$("#kw").val("docker");
|
|
await delay(1);
|
|
$("#su").click();
|
|
};
|
|
|
|
chrome.runtime.sendMessage(
|
|
{
|
|
ty: "get",
|
|
},
|
|
function (r, id) {
|
|
switch (r) {
|
|
case "naver":
|
|
naver(r, id);
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
);
|