增加判断是否是手机端的功能

This commit is contained in:
lingling 2024-09-29 10:41:06 +08:00
parent 9003b60c47
commit 7a67c00bee
3 changed files with 57 additions and 40 deletions

View File

@ -1,21 +1,35 @@
/*
* @Author: lingling 1077478963@qq.com
* @Date: 2024-08-19 09:47:04
* @LastEditors: lingling 1077478963@qq.com
* @LastEditTime: 2024-09-27 15:57:31
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\background.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
//记录谷歌账户 //记录谷歌账户
let google_mail=''; let Ggoogle_mail = "";
//记录是否有运行权限 //记录是否有运行权限
let executionAuthority=false; let executionAuthority = false;
//是否查询过 //是否查询过
let haveYouChecked=false; let haveYouChecked = false;
/** /**
* 查看是否有权限运行 * 查看是否有权限运行
* @param {*} google_mail 谷歌id * @param {*} google_mail 谷歌id
*/ */
//TODO 授权没写完 //TODO 授权没写完
async function viewPermission(google_mail){ async function viewPermission(google_mail) {
let data =await axios.get('https://api.giaogiao.uk/api.php?type=list'); let tmp = await axios.post(
if(google_mail=='qq2392025971@gmail.com'){ "http://149.129.107.38:8787/index/queryauthorization",
executionAuthority=true { google_account: google_mail }
);
if (tmp.data.code == 200) {
executionAuthority = true;
Ggoogle_mail = google_mail;
return true; return true;
} }
return true; haveYouChecked = true;
return false;
} }
/** /**
* 监听消息 * 监听消息
@ -23,22 +37,21 @@ async function viewPermission(google_mail){
* @param {*} sendResponse 返回消息 * @param {*} sendResponse 返回消息
*/ */
chrome.runtime.onMessage.addListener(async (req, sender, sendResponse) => { chrome.runtime.onMessage.addListener(async (req, sender, sendResponse) => {
if(executionAuthority){ if (haveYouChecked) {
sendResponse(executionAuthority); sendResponse(executionAuthority);
return true return true;
} }
if(req.ty=="viewPermission"){ if (req.ty == "viewPermission") {
const res = req.info const res = req.info;
let data=await viewPermission(res); if (res&&!haveYouChecked) {
console.log(data) let data = await viewPermission(res);
console.log(data);
sendResponse(data); sendResponse(data);
} }
return true }
}) return true;
});
setTimeout(function(){
chrome.tabs.create({ url: "popup.html" }, function () {
})
},3500);
setTimeout(function () {
chrome.tabs.create({ url: "popup.html" }, function () {});
}, 3500);

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-09-25 10:55:38 * @LastEditTime: 2024-09-27 16:04:40
* @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
*/ */
@ -58,7 +58,7 @@ $(function () {
} }
if (request.ty == "remove") { if (request.ty == "remove") {
chrome.tabs.remove(request.id); chrome.tabs.remove(id);
} }
return true; return true;
}); });
@ -106,12 +106,12 @@ $(function () {
let queue = []; let queue = [];
queue.push(google); queue.push(google);
// queue.push(play_finance);//好像js注入不进去 // queue.push(play_finance);//好像js注入不进去
queue.push(shopping); // queue.push(shopping);
queue.push(calendar); // queue.push(calendar);
queue.push(mail); // queue.push(mail);
// queue.push(youtube); // queue.push(youtube);
queue.push(play_google); // queue.push(play_google);
queue.push(youtube_shorts); // queue.push(youtube_shorts);
queue.push(news_google); queue.push(news_google);
//乱序执行 此处有问题 //乱序执行 此处有问题

View File

@ -30,6 +30,14 @@ function RandomIntscrollBy(y = 0) {
console.log("随机滑动" + rand); console.log("随机滑动" + rand);
} }
/**
* 判断打开的浏览器页面是PC端还是移动端
* @returns mobile_web:手机PCPC
*/
function is_mobile_web(){
return /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false
}
//naver使用函数 //naver使用函数
const naver = async (r, id) => { const naver = async (r, id) => {
let googelid_str = (elements = $(".gb_A.gb_Za.gb_0").attr("aria-label")); let googelid_str = (elements = $(".gb_A.gb_Za.gb_0").attr("aria-label"));
@ -37,14 +45,10 @@ const naver = async (r, id) => {
const match = googelid_str.match(emailRegex); const match = googelid_str.match(emailRegex);
const email = match ? match[0] : null; const email = match ? match[0] : null;
console.log(`email:${email} r:${r} id${id}`) console.log(`email:${email} r:${r} id${id}`)
try { // let res = await to_background(email);
let res = await to_background(email); // console.log(`res:${res} emall:${email}`);
console.log(`res:${res} emall:${email}`); // await delay(10)
await delay(5) // send_close(id);
} catch (error) {
}
send_close(id);
}; };
/** /**
* *