修复乱序执行错误 增加谷歌新闻阅读

This commit is contained in:
lingling 2024-08-26 11:01:59 +08:00
parent 95e3a23feb
commit 499c1bd27c
3 changed files with 37 additions and 37 deletions

View File

@ -1,3 +1,4 @@
95e3a23 删除用不上的代码 增加注释 增加乱序执行
aa4f2a6 修复邮箱回复 会回复谷歌官方邮件
720df83 增加标准注释
006d6bb 重命名打包文件根据时间生成 删除不需要的代码

View File

@ -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 09:19:35
* @LastEditTime: 2024-08-26 10:59:53
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@ -57,12 +57,7 @@ $(function () {
sendResponse({ name, id });
}
if (request.ty == "remove") {
// chrome.tabs.query({}, function(tabs) {
// // 遍历每个标签页并关闭它们
// for (var i = 0; i < tabs.length; i++) {
// chrome.tabs.remove(tabs[i].id);
// }
// });
chrome.tabs.remove(request.id);
}
return true;
@ -106,14 +101,14 @@ $(function () {
//函数队列
let queue = [];
// queue.push(play_finance);//好像js注入不进去
queue.push(shopping);
queue.push(calendar);
// queue.push(shopping);
// queue.push(calendar);
queue.push(mail);
queue.push(play_google);
queue.push(news_google);
queue.push(youtube_shorts);
//乱序执行
queue=shuffleArray(queue)
// queue.push(play_google);
// queue.push(news_google);
// queue.push(youtube_shorts);
//乱序执行 此处有问题
// queue=shuffleArray(queue)
//当前执行的队列索引
let closed_index = 0;

View File

@ -94,29 +94,33 @@ async function calendar(r, id) {
* @param {*} id
*/
async function news_google(r, id) {
console.log("加在完成开始等待8秒");
//等待五秒怕加载速度过慢
await delay(10);
console.log("等待8秒完成");
//焦点新闻 数量
let new_length = $(".KDoq1").length;
//点击会创建新标签暂时没办法控制
// let rand_new_index=getRandomInt(0,new_length)
//点击焦点新闻
$("#i10").click();
$(".KDoq1")[0].click();
// console.log( $("#i10"))
// await delay(10);
// let the_number_of_swipes = getRandomInt(3, 6);
// for (let index = 0; index < the_number_of_swipes; index++) {
// RandomIntscrollBy();
// await delay(getRandomInt(10, 30));
// }
let x = $(".WwrzSb").length,
y = 1,
shu = parseInt(Math.random() * (x - y + 1) + y);
$(".WwrzSb").eq(shu)[0].click();
scrollBy(0, 153);
await delay(3);
//点击完整报道
try {
$('.jKHa4e')[0].click()
for (let index = 0; index < getRandomInt(3,5); index++) {
RandomIntscrollBy()
await delay(3)
}
let new_array=$('.VDXfz')
let new_array_href=[]
for (let index = 0; index < new_array.length; index++) {
const element = new_array[index];
console.log(element.getAttribute("href"))
let url = element.getAttribute("href").replace(/\./g, '');
new_array_href.push(`https://news.google.com${url}`)
}
for (let index = 0; index < new_array_href.length; index++) {
const element = new_array_href[index];
let a= open(element)
await delay(3)
a.close()
}
} catch (error) {
console.log(error)
}
send_close(id);
}
//谷歌商店浏览
@ -208,7 +212,7 @@ async function mail(r, id) {
mails[index].click();
RandomIntscrollBy();
await delay(getRandomInt(1, 5));
// console.log(mails_is_google[index].children[4].children[1].children[0].children[0].getAttribute("email"))
console.log(mails_is_google[index].children[4].children[1].children[0].children[0].getAttribute("email"))
//获取邮件发送人
let mail_for = mails_is_google[index].children[4].children[1].children[0].children[0].getAttribute("email")
//是否回复