Compare commits
2 Commits
46fc343e76
...
7a67c00bee
Author | SHA1 | Date |
---|---|---|
lingling | 7a67c00bee | |
lingling | 9003b60c47 |
|
@ -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
|
||||
*/
|
||||
async function viewPermission(google_mail){
|
||||
let data =await axios.get('https://api.giaogiao.uk/api.php?type=list');
|
||||
console.log(data)
|
||||
if(google_mail=='qq2392025971@gmail.com'){
|
||||
//TODO 授权没写完
|
||||
async function viewPermission(google_mail) {
|
||||
let tmp = await axios.post(
|
||||
"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;
|
||||
}
|
||||
haveYouChecked = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
|
@ -22,15 +37,21 @@ async function viewPermission(google_mail){
|
|||
* @param {*} sendResponse 返回消息
|
||||
*/
|
||||
chrome.runtime.onMessage.addListener(async (req, sender, sendResponse) => {
|
||||
const res = req.info
|
||||
let data=await viewPermission(res);
|
||||
sendResponse(data);
|
||||
console.log(res)
|
||||
})
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
chrome.tabs.create({ url: "popup.html" }, function () {
|
||||
})
|
||||
},3500);
|
||||
if (haveYouChecked) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
chrome.tabs.create({ url: "popup.html" }, function () {});
|
||||
}, 3500);
|
||||
|
|
26
js/popup.js
26
js/popup.js
|
@ -2,7 +2,7 @@
|
|||
* @Author: lingling 1077478963@qq.com
|
||||
* @Date: 2024-08-19 09:47:04
|
||||
* @LastEditors: lingling 1077478963@qq.com
|
||||
* @LastEditTime: 2024-08-26 14:50:09
|
||||
* @LastEditTime: 2024-09-27 16:04:40
|
||||
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
|
@ -51,21 +51,22 @@ $(function () {
|
|||
sender,
|
||||
sendResponse
|
||||
) {
|
||||
console.log(request)
|
||||
// 判断是产生一个新页面是
|
||||
if (request.ty == "get") {
|
||||
sendResponse({ name, id });
|
||||
}
|
||||
if (request.ty == "remove") {
|
||||
|
||||
chrome.tabs.remove(request.id);
|
||||
chrome.tabs.remove(id);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// async function text() {
|
||||
// let a = await createTab("https://www.youtube.com/", "youtube");
|
||||
// return a;
|
||||
// }
|
||||
async function google() {
|
||||
let a = await createTab("https://www.google.com", "naver");
|
||||
return a;
|
||||
}
|
||||
async function youtube_shorts() {
|
||||
let a = await createTab(
|
||||
"https://www.youtube.com/shorts/",
|
||||
|
@ -103,13 +104,14 @@ $(function () {
|
|||
}
|
||||
//函数队列
|
||||
let queue = [];
|
||||
queue.push(google);
|
||||
// queue.push(play_finance);//好像js注入不进去
|
||||
queue.push(shopping);
|
||||
queue.push(calendar);
|
||||
queue.push(mail);
|
||||
// queue.push(shopping);
|
||||
// queue.push(calendar);
|
||||
// queue.push(mail);
|
||||
// queue.push(youtube);
|
||||
queue.push(play_google);
|
||||
queue.push(youtube_shorts);
|
||||
// queue.push(play_google);
|
||||
// queue.push(youtube_shorts);
|
||||
queue.push(news_google);
|
||||
|
||||
//乱序执行 此处有问题
|
||||
|
@ -156,7 +158,7 @@ $(function () {
|
|||
}
|
||||
|
||||
chrome.tabs.onCreated.addListener((e) => {
|
||||
sed_cont(id);
|
||||
// sed_cont(id);
|
||||
console.log(e);
|
||||
console.log("创建了一个新的浏览器窗口");
|
||||
});
|
||||
|
|
|
@ -30,15 +30,24 @@ function RandomIntscrollBy(y = 0) {
|
|||
console.log("随机滑动" + rand);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断打开的浏览器页面是PC端还是移动端
|
||||
* @returns mobile_web:手机,PC:PC
|
||||
*/
|
||||
function is_mobile_web(){
|
||||
return /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false
|
||||
}
|
||||
|
||||
//naver使用函数
|
||||
const naver = async (r, id) => {
|
||||
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 match = googelid_str.match(emailRegex);
|
||||
const email = match ? match[0] : null;
|
||||
console.log(email)
|
||||
let res = await to_background(email);
|
||||
console.log(`res:${res} emall:${email}`);
|
||||
console.log(`email:${email} r:${r} id${id}`)
|
||||
// let res = await to_background(email);
|
||||
// console.log(`res:${res} emall:${email}`);
|
||||
// await delay(10)
|
||||
// send_close(id);
|
||||
};
|
||||
/**
|
||||
|
@ -380,6 +389,7 @@ async function to_background(params) {
|
|||
chrome.runtime.sendMessage(
|
||||
{
|
||||
info: params,
|
||||
ty: "viewPermission",
|
||||
},
|
||||
(res) => {
|
||||
console.log(res);
|
||||
|
@ -438,7 +448,7 @@ chrome.runtime.sendMessage(
|
|||
}
|
||||
);
|
||||
|
||||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
console.log(request);
|
||||
sendResponse("我收到了你的情书,popup~");
|
||||
});
|
||||
// chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
// console.log(request);
|
||||
// sendResponse("我收到了你的情书,popup~");
|
||||
// });
|
||||
|
|
Loading…
Reference in New Issue