From 499c1bd27c9f9aa88c2a286ac91ca9a1ba21b056 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Mon, 26 Aug 2024 11:01:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B9=B1=E5=BA=8F=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E9=94=99=E8=AF=AF=20=E5=A2=9E=E5=8A=A0=E8=B0=B7?= =?UTF-8?q?=E6=AD=8C=E6=96=B0=E9=97=BB=E9=98=85=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.txt | 1 + js/popup.js | 23 +++++++++-------------- lib/content.js | 50 +++++++++++++++++++++++++++----------------------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/README.txt b/README.txt index e38533d..d05409c 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,4 @@ +95e3a23 删除用不上的代码 增加注释 增加乱序执行 aa4f2a6 修复邮箱回复 会回复谷歌官方邮件 720df83 增加标准注释 006d6bb 重命名打包文件根据时间生成 删除不需要的代码 diff --git a/js/popup.js b/js/popup.js index 3ad03ac..46b8e01 100644 --- a/js/popup.js +++ b/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 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; diff --git a/lib/content.js b/lib/content.js index ab8f79a..39c66ef 100644 --- a/lib/content.js +++ b/lib/content.js @@ -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") //是否回复