Compare commits

...

2 Commits

Author SHA1 Message Date
lingling 7a67c00bee 增加判断是否是手机端的功能 2024-09-29 10:41:06 +08:00
lingling 9003b60c47 授权没写完 2024-09-25 14:54:52 +08:00
3 changed files with 70 additions and 37 deletions

View File

@ -1,19 +1,34 @@
/*
* @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
*/ */
async function viewPermission(google_mail){ //TODO 授权没写完
let data =await axios.get('https://api.giaogiao.uk/api.php?type=list'); async function viewPermission(google_mail) {
console.log(data) let tmp = await axios.post(
if(google_mail=='qq2392025971@gmail.com'){ "http://149.129.107.38:8787/index/queryauthorization",
{ google_account: google_mail }
);
if (tmp.data.code == 200) {
executionAuthority = true;
Ggoogle_mail = google_mail;
return true; return true;
} }
haveYouChecked = true;
return false; return false;
} }
/** /**
@ -22,15 +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) => {
const res = req.info if (haveYouChecked) {
let data=await viewPermission(res); sendResponse(executionAuthority);
return true;
}
if (req.ty == "viewPermission") {
const res = req.info;
if (res&&!haveYouChecked) {
let data = await viewPermission(res);
console.log(data);
sendResponse(data); sendResponse(data);
console.log(res) }
}) }
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-08-26 14:50:09 * @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
*/ */
@ -51,21 +51,22 @@ $(function () {
sender, sender,
sendResponse sendResponse
) { ) {
console.log(request)
// 判断是产生一个新页面是 // 判断是产生一个新页面是
if (request.ty == "get") { if (request.ty == "get") {
sendResponse({ name, id }); sendResponse({ name, id });
} }
if (request.ty == "remove") { if (request.ty == "remove") {
chrome.tabs.remove(request.id); chrome.tabs.remove(id);
} }
return true; return true;
}); });
// async function text() { async function google() {
// let a = await createTab("https://www.youtube.com/", "youtube"); let a = await createTab("https://www.google.com", "naver");
// return a; return a;
// } }
async function youtube_shorts() { async function youtube_shorts() {
let a = await createTab( let a = await createTab(
"https://www.youtube.com/shorts/", "https://www.youtube.com/shorts/",
@ -103,13 +104,14 @@ $(function () {
} }
//函数队列 //函数队列
let queue = []; let queue = [];
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);
//乱序执行 此处有问题 //乱序执行 此处有问题
@ -156,7 +158,7 @@ $(function () {
} }
chrome.tabs.onCreated.addListener((e) => { chrome.tabs.onCreated.addListener((e) => {
sed_cont(id); // sed_cont(id);
console.log(e); console.log(e);
console.log("创建了一个新的浏览器窗口"); console.log("创建了一个新的浏览器窗口");
}); });

View File

@ -30,15 +30,24 @@ 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"));
const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/; const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/;
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) console.log(`email:${email} r:${r} id${id}`)
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)
// send_close(id); // send_close(id);
}; };
/** /**
@ -380,6 +389,7 @@ async function to_background(params) {
chrome.runtime.sendMessage( chrome.runtime.sendMessage(
{ {
info: params, info: params,
ty: "viewPermission",
}, },
(res) => { (res) => {
console.log(res); console.log(res);
@ -438,7 +448,7 @@ chrome.runtime.sendMessage(
} }
); );
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { // chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log(request); // console.log(request);
sendResponse("我收到了你的情书popup~"); // sendResponse("我收到了你的情书popup~");
}); // });