diff --git a/js/popup.js b/js/popup.js index 2588641..76fc97c 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-23 08:17:05 + * @LastEditTime: 2024-08-24 09:25:13 * @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -98,7 +98,7 @@ $(function () { } //函数队列 let queue = []; - queue.push(play_finance);//好像js注入不进去 + // queue.push(play_finance);//好像js注入不进去 // queue.push(shopping); // queue.push(calendar); // queue.push(mail); diff --git a/lib/content.js b/lib/content.js index ed3b72c..0f81e23 100644 --- a/lib/content.js +++ b/lib/content.js @@ -1,17 +1,29 @@ -//延迟函数解决魔鬼定时器问题 +/** + * 阻塞代码运行 + * @param {*} n 秒数 + * @returns + */ function delay(n) { return new Promise(function (resolve) { setTimeout(resolve, n * 1000); }); } -//随机数生成器 +/** + * 随机数生成 + * @param {*} min 最小值 + * @param {*} max 最大值 + * @returns + */ function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; } -//随机滑动函数 +/** + * 随机滑动函数 + * @param {*} y 滑动像素 不传递默认随机 + */ function RandomIntscrollBy(y = 0) { let rand = getRandomInt(100, 600); scrollBy(0, y == 0 ? rand : y); @@ -23,7 +35,20 @@ const naver = async (r, id) => { // await delay(1); send_close(id); }; - +/** + * + * @param {*} str 字符串 + * @param {*} arr 需要匹配的字符串数组 + * @returns boole + */ +function searchStringContainsArrayKeywords(str, arr) { + for (let i = 0; i < arr.length; i++) { + if (str.includes(arr[i])) { + return true; + } + } + return false; +} //youto短视频 async function youtube_shorts(r, id) { @@ -273,13 +298,20 @@ async function mail(r, id) { ]; await delay(8); let mails = document.querySelectorAll(".zA"); + let mails_is_google = $(".zA"); for (let index = 0; index < mails.length; index++) { //挨个查看 mails[index].click(); RandomIntscrollBy(); await delay(getRandomInt(1, 5)); + + //获取邮件发送人 + let mail_for = mails_is_google[index].find('.yP')[0].attr("email") + //是否回复 + let whether_or_not_to_reply_to= searchStringContainsArrayKeywords(mail_for,['google','youtube']) + console.log(`当前邮件发送人:${mail_for} 是否回复${whether_or_not_to_reply_to}`) //邮箱回复 - if (getRandomInt(0, 1) == 0) { + if (getRandomInt(0, 1) == 0&&whether_or_not_to_reply_to) { $(".amn >.ams.bkH").click(); await delay(getRandomInt(1, 5)); let text = emailReply[getRandomInt(0, emailReply.length - 1)];