diff --git a/js/popup.js b/js/popup.js index 38d8eb1..f65a75a 100644 --- a/js/popup.js +++ b/js/popup.js @@ -2,23 +2,23 @@ * @Author: lingling 1077478963@qq.com * @Date: 2024-08-19 09:47:04 * @LastEditors: lingling 1077478963@qq.com - * @LastEditTime: 2024-09-30 09:38:57 + * @LastEditTime: 2024-09-30 09:40:14 * @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ $(function () { /** * 数组打乱随机执行 - * @param {*} array - * @returns + * @param {*} array + * @returns */ 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]]; + 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 () { @@ -61,15 +61,13 @@ $(function () { sendResponse({ name, id }); } if (request.ty == "remove") { - chrome.tabs.remove(sender.tab.id); } - if(request.ty == "get"||request.ty == "remove"){ + if (request.ty == "get" || request.ty == "remove") { return true; - }else{ + } else { return false; } - }); //乱序执行 此处有问题 @@ -77,12 +75,13 @@ $(function () { //当前执行的队列索引 //函数队列 let queue = [ - { url: "https://www.youtube.com/shorts/", tip: "youtube_shorts" }, + { url: "https://www.google.com", tip: "naver" }, + // { url: "https://www.youtube.com/shorts/", tip: "youtube_shorts" }, // { url: "https://www.youtube.com/watch?v=LZ7DMB6h-hs", tip: "youtube" }, - { url: "https://play.google.com/", tip: "play_google" }, - { url: "https://shopping.google.com/", tip: "shopping" }, - { url: "https://calendar.google.com/calendar", tip: "calendar" }, - { url: "https://mail.google.com/mail/", tip: "mail" }, + // { url: "https://play.google.com/", tip: "play_google" }, + // { url: "https://shopping.google.com/", tip: "shopping" }, + // { url: "https://calendar.google.com/calendar", tip: "calendar" }, + // { url: "https://mail.google.com/mail/", tip: "mail" }, // { url: "https://www.google.com/finance/", tip: "play_finance" }, ]; let closed_index = 0; diff --git a/lib/content.js b/lib/content.js index 2383fdc..9766e7b 100644 --- a/lib/content.js +++ b/lib/content.js @@ -347,6 +347,147 @@ async function youtube(r, id) { .click(); } +/** + * 谷歌商城手机版 + * @param {*} r + * @param {*} id + */ +async function shopping_phone(r, id) { + let number = getRandomInt(2, 10); + for (let index = 0; index < number; index++) { + for (let index = 0; index < getRandomInt(2, 5); index++) { + RandomIntscrollBy(); + await delay(getRandomInt(5, 10)); + } + //获取所有的商品链接 + let sp = document.getElementsByClassName( + "gkQHve RmEs5b zypKDd aKoISd RycMEf" + ); + //触发点击事件 + sp[getRandomInt(0, sp.length - 1)].click(); + await delay(getRandomInt(10, 20)); + //获取关闭按钮 + let close = document.getElementsByClassName( + "ioQ39e wv9iH MjJqGe cd29Sd" + )[0]; + close.click(); + await delay(getRandomInt(2, 5)); + } + send_close(id); +} + + + +/** + * 谷歌新闻手机版本 + * @param {*} r + * @param {*} id + */ +async function news_google_phone(r, id) { + //等待五秒怕加载速度过慢 + await delay(3); + //滑动次数 + let sum = getRandomInt(5, 9); + for (let index = 0; index < sum; index++) { + RandomIntscrollBy(); + await delay(getRandomInt(5, 10)); + } + let news_array = $(".cDgn2c"); + //随机点击模块 + news_array[getRandomInt(0, news_array.length - 1)].click(); + for (let index = 0; index < getRandomInt(3, 8); index++) { + RandomIntscrollBy(); + await delay(getRandomInt(3, 8)); + } + 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++) { + //这里只打开4个链接太多了有毒 + for (let index = 0; index < 4; index++) { + const element = new_array_href[index]; + let a = open(element); + // console.log(JSON.stringify(a)) + await delay(3); + a.close(); + } + send_close(id); +} + + +/** + * 谷歌商店手机版 + * @param {*} r + * @param {*} id + */ +async function play_google_phone(r, id) { + //等待五秒怕加载速度过慢 + await delay(5); + //滑动次数 + let a = getRandomInt(3, 5); + for (let index = 0; index < a; index++) { + RandomIntscrollBy(); + await delay(getRandomInt(0, 5)); + } + + //热门游戏随机列表 直接触发点击事件就行 + let popular_games = document.querySelectorAll("a.Si6A0c.itIJzb"); + for (let index = 0; index < getRandomInt(3, 5); index++) { + try { + popular_games[getRandomInt(0, popular_games.length - 1)].click(); + } catch (error) { + console.log(error); + } + let a = getRandomInt(3, 5); + for (let index = 0; index < a; index++) { + RandomIntscrollBy(); + await delay(getRandomInt(0, 5)); + } + $(".f0UV3d").click(); + await delay(getRandomInt(5, 10)); + } + await delay(getRandomInt(5, 10)); + // + send_close(id); +} +/** + * youtube手机版本 + * @param {*} r + * @param {*} id + */ +async function youtube(r, id) { + async function whict() { + await delay(5); + for (let index = 0; index < getRandomInt(5, 10); index++) { + RandomIntscrollBy(); + } + let all_video = $(".media-item-thumbnail-container"); + all_video[getRandomInt(0, all_video.length - 1)].click(); + // if(getRandomInt(0,1)==0){ + // //点赞 + // document.getElementsByClassName('yt-spec-touch-feedback-shape__fill')[3].click() + // //订阅 + // document.getElementsByClassName('yt-spec-touch-feedback-shape__fill')[2].click() + // } + await delay(getRandomInt(300, 1800)); + } + for (let index = 0; index < getRandomInt(5, 10); index++) { + await whict(); + } + //看完关闭窗口 + send_close(id); +} + +/** + * 不知道什么东西 + * @param {*} r + * @param {*} id + */ function ServiceLogin(r, id) { let mkeww = 0, mue = setInterval(function () { @@ -395,6 +536,11 @@ chrome.runtime.sendMessage( ty: "get", }, function (obj) { + if(obj){ + + }else{ + return + } let r = obj.name; let id = obj.id; console.log("传递过来的obj" + JSON.stringify(obj)); @@ -404,7 +550,7 @@ chrome.runtime.sendMessage( { name: "youtube_shorts", funct: youtube_shorts2 }, { name: "news_google", funct: news_google }, { name: "play_google", funct: play_google }, - { name: "play_finance", funct: play_finance }, + // { name: "play_finance", funct: play_finance }, { name: "mail", funct: mail }, { name: "calendar", funct: calendar }, { name: "shopping", funct: shopping }, @@ -419,6 +565,9 @@ chrome.runtime.sendMessage( funct(r, id); } } + if(!is_Match){ + all(r,id) + } } );