为授权做准备
This commit is contained in:
parent
0a57ec1259
commit
46fc343e76
|
@ -1,3 +1,4 @@
|
|||
0a57ec1 修改任务启动顺序
|
||||
2177638 修改打包逻辑
|
||||
07b66a0 增加youtube函数
|
||||
1d1789d 修复邮箱卡住问题
|
||||
|
|
|
@ -1,4 +1,36 @@
|
|||
//记录谷歌账户
|
||||
let google_mail='';
|
||||
//记录是否有运行权限
|
||||
let executionAuthority=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'){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 监听消息
|
||||
* @param {*} req 发送过来的消息
|
||||
* @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);
|
||||
|
||||
|
|
16
js/popup.js
16
js/popup.js
|
@ -7,7 +7,13 @@
|
|||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
$(function () {
|
||||
// var id = 0, due = ['Dell', ' Lenovo ', "ASUS"], kme = 0 , name="";
|
||||
function shuffleArray(array) {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
var id = 0;
|
||||
var name = "";
|
||||
setTimeout(function () {
|
||||
|
@ -38,13 +44,6 @@ $(function () {
|
|||
}
|
||||
);
|
||||
});
|
||||
function shuffleArray(array) {
|
||||
for (let i = array.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[array[i], array[j]] = [array[j], array[i]];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
// 浏览器监听事件 每当有新页面生成就会执行
|
||||
chrome.runtime.onMessage.addListener(function (
|
||||
|
@ -112,6 +111,7 @@ $(function () {
|
|||
queue.push(play_google);
|
||||
queue.push(youtube_shorts);
|
||||
queue.push(news_google);
|
||||
|
||||
//乱序执行 此处有问题
|
||||
// queue=shuffleArray(queue)
|
||||
//当前执行的队列索引
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -32,8 +32,14 @@ function RandomIntscrollBy(y = 0) {
|
|||
|
||||
//naver使用函数
|
||||
const naver = async (r, id) => {
|
||||
// await delay(1);
|
||||
send_close(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}`);
|
||||
// send_close(id);
|
||||
};
|
||||
/**
|
||||
*
|
||||
|
@ -369,6 +375,23 @@ function send_close(id) {
|
|||
id: id,
|
||||
});
|
||||
}
|
||||
async function to_background(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
chrome.runtime.sendMessage(
|
||||
{
|
||||
info: params,
|
||||
},
|
||||
(res) => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
resolve(res);
|
||||
} else {
|
||||
reject(new Error("No response from background script"));
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
chrome.runtime.sendMessage(
|
||||
{
|
||||
|
@ -414,6 +437,7 @@ chrome.runtime.sendMessage(
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
console.log(request);
|
||||
sendResponse("我收到了你的情书,popup~");
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"128": "icon64.png"
|
||||
},
|
||||
"background": {
|
||||
"scripts": ["lib/jquery-3.3.1.min.js","js/background.js"]
|
||||
"scripts": ["lib/jquery-3.3.1.min.js","lib/axios.min.js","js/background.js"]
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
|||
"<all_urls>"
|
||||
],
|
||||
"js": [
|
||||
"lib/axios.min.js",
|
||||
"lib/jquery-3.3.1.min.js",
|
||||
"lib/content.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-22 19:03:16
|
||||
* @LastEditTime: 2024-09-24 14:55:12
|
||||
* @FilePath: \谷歌自动搜索邮箱自动点击v3\popup.html
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
-->
|
||||
|
|
Loading…
Reference in New Issue