增加一些功能

This commit is contained in:
lingling 2024-08-19 18:02:42 +08:00
parent a3125fdc8c
commit b74e21ed7b
2 changed files with 33 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* @Author: lingling 1077478963@qq.com * @Author: lingling 1077478963@qq.com
* @Date: 2024-08-19 09:47:04 * @Date: 2024-08-19 09:47:04
* @LastEditors: lingling 1077478963@qq.com * @LastEditors: lingling 1077478963@qq.com
* @LastEditTime: 2024-08-19 16:48:39 * @LastEditTime: 2024-08-19 17:53:29
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js * @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
@ -30,8 +30,13 @@ $(function () {
) { ) {
// 判断是产生一个新页面是 // 判断是产生一个新页面是
if (request.ty == "get") { if (request.ty == "get") {
sendResponse(name,id); console.log(id)
sendResponse({name,id});
} }
// if (request.ty == "remove") {
// sendResponse({name,id});
// }
return true; return true;
}); });
}); });

View File

@ -4,19 +4,44 @@ function delay(n) {
setTimeout(resolve, n * 1000); setTimeout(resolve, n * 1000);
}); });
} }
//随机数生成器
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
//随机滑动函数
function RandomIntscrollBy(y=0){
let rand = getRandomInt(100,600)
scrollBy(0,y==0?rand:y);
console.log("随机滑动"+rand);
}
//naver使用函数 //naver使用函数
const naver = async (r, id) => { const naver = async (r, id) => {
$("#kw").val("docker"); $("#kw").val("docker");
await delay(1); await delay(1);
$("#su").click(); $("#su").click();
await delay(3);
for (let index = 0; index < 4; index++) {
RandomIntscrollBy()
await delay(3);
}
await delay(3);
}; };
function send_close(){}
chrome.runtime.sendMessage( chrome.runtime.sendMessage(
{ {
ty: "get", ty: "get",
}, },
function (r, id) { function (obj) {
let r=obj.name
let id=obj.id
switch (r) { switch (r) {
case "naver": case "naver":
naver(r, id); naver(r, id);