diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e5ff78 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.vscode/* +/dist/* \ No newline at end of file diff --git a/js/popup.js b/js/popup.js index fa1a077..ffc7082 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-21 11:27:44 + * @LastEditTime: 2024-08-21 17:16:36 * @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -50,6 +50,12 @@ $(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; @@ -74,11 +80,25 @@ $(function () { let a = await createTab("https://news.google.com/", "news_google"); return a; } + async function play_google() { + let a = await createTab("https://play.google.com/", "play_google"); + return a; + } + async function play_finance() { + let a = await createTab("https://www.google.com/finance/", "play_finance"); + return a; + } + async function mail() { + let a = await createTab("https://mail.google.com/mail/", "mail"); + return a; + } //函数队列 let queue = []; - // queue.push(text2) - queue.push(news_google); - queue.push(text2) + queue.push(mail); + // queue.push(play_finance);//好像js注入不进去 + queue.push(play_google); + // queue.push(news_google); + queue.push(text2); //当前执行的队列索引 let closed_index = 0; @@ -99,22 +119,30 @@ $(function () { sendMsg(tmp); closed_index++; // sendResponse({ name, id }); + } else { + //运行完成关闭所有窗口 + chrome.tabs.query({}, function (tabs) { + // 遍历每个标签页并关闭它们 + for (var i = 0; i < tabs.length; i++) { + chrome.tabs.remove(tabs[i].id); + } + }); } }); -function sed_cont(id){ - let message = { - info: '来自popup的情书💌' - } - chrome.tabs.sendMessage(id, message, res => { - console.log('popup=>content') - console.log(res) - }) -} + function sed_cont(id) { + let message = { + info: "来自popup的情书💌", + }; + chrome.tabs.sendMessage(id, message, (res) => { + // console.log("popup=>content"); + console.log(res); + }); + } chrome.tabs.onCreated.addListener((e) => { - sed_cont(id); + sed_cont(id); console.log(e); - console.log("创建了一个新的浏览器窗口") + console.log("创建了一个新的浏览器窗口"); }); }); diff --git a/lib/content.js b/lib/content.js index a5ae35e..cee16f7 100644 --- a/lib/content.js +++ b/lib/content.js @@ -183,10 +183,10 @@ async function youtube_shorts(r, id) { } async function news_google(r, id) { - console.log("加在完成开始等待8秒") + console.log("加在完成开始等待8秒"); //等待五秒怕加载速度过慢 await delay(10); - console.log("等待8秒完成") + console.log("等待8秒完成"); //焦点新闻 数量 let new_length = $(".KDoq1").length; //点击会创建新标签暂时没办法控制 @@ -194,16 +194,79 @@ async function news_google(r, id) { //点击焦点新闻 $("#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); + // 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); + send_close(id); +} +//谷歌商店浏览 +async function play_google(r, id) { + //等待五秒怕加载速度过慢 + await delay(5); + //滑动次数 + let a = getRandomInt(3, 5); + for (let index = 0; index < a; index++) { + RandomIntscrollBy(); + await delay(getRandomInt(0, 5)); + } + //点击推荐 + if (getRandomInt(0, 1) == 0) { + $(".Pdcv8e").click(); + await delay(getRandomInt(5, 10)); + //返回主页 + $("#kO001e > header > nav > a").click(); + } + + //热门游戏随机列表 直接触发点击事件就行 + let popular_games = $( + "#yDmH0d > c-wiz.SSPGKf.glB9Ve > div > div > div.N4FjMb.Z97G4e > c-wiz > div > c-wiz > c-wiz:nth-child(4) > c-wiz > section > div > div > div > div > div.aoJE7e.b0ZfVe" + ).children; + await delay(getRandomInt(5, 10)); + // + send_close(id); +} + +async function play_finance(r, id) { + send_close(id); +} + +async function mail(r, id) { + let emailReply = [ + "우리 실장님이 승진을 축하하기 위해서 다음주 금요일에 (1월 21일에) 오후 5시에 XX 호텔에서 회식이 있습니다 첨부 파일에서 구체적이 정보을 참고하세요. ", + "회장님의 회의 잘료을 준비위해서 16년에 상품 기획부의 목표 달성 상황을 필요합니다. 다음주 화요일전에 첨부 파일에 형식으로 준비 됬으면 좋겠습니다.많이 감사 드립니다", + "좋은 하루 지내세요.", + "연휴에 잘 지내세요.", + "감사합니다", + "이번주의 판매 보고을 보내드립니다. 세해 세일때문에 판매 목표를 잘 달성했슴니다. 첨부 파일을 참고하세요. ", + ]; + await delay(3); + let mails = document.querySelectorAll(".zA"); + for (let index = 0; index < mails.length; index++) { + //挨个查看 + mails[index].click(); + RandomIntscrollBy(); + await delay(getRandomInt(1, 5)); + //邮箱回复 + if (getRandomInt(0, 1) == 0) { + $('.amn >span').click() + await delay(getRandomInt(1, 5)); + $('.Ar.Au >div >div').textContent = + emailReply[getRandomInt(0, emailReply.length)]; + $('.dC >div').click(); + } + //返回 + $('.aim.ain >div >div >div + div').click(); + await delay(getRandomInt(5, 10)); + } send_close(id); } @@ -214,7 +277,7 @@ async function youtube_shorts2(r, id) { let views = getRandomInt(50, 100); for (let index = 0; index < views; index++) { //观看多少秒 - let watch_time = getRandomInt(10, 30); + let watch_time = getRandomInt(30, 60); await delay(getRandomInt(2, 5)); //随机暂停播放 if (getRandomInt(0, 1) == 0) { @@ -225,8 +288,18 @@ async function youtube_shorts2(r, id) { } //点赞 - // $('.yt-spec-button-shape-next.yt-spec-button-shape-next--tonal.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-l.yt-spec-button-shape-next--icon-button').click() - //评论区操作 + if (getRandomInt(0, 5) == 3) { + //点赞 + document.querySelector("#like-button > yt-button-shape > label").click(); + } + if (getRandomInt(0, 5) == 2) { + //不爱看 + document + .querySelector("#dislike-button > yt-button-shape > label") + .click(); + } + + //论区操作 if (getRandomInt(0, 1) == 0) { //打开评论区 $( @@ -240,8 +313,11 @@ async function youtube_shorts2(r, id) { "#visibility-button > ytd-button-renderer > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__stroke" ).click(); } + await delay(getRandomInt(3, 5)); //下一个视频 - $('#navigation-button-down > ytd-button-renderer > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__stroke').click() + $( + "#navigation-button-down > ytd-button-renderer > yt-button-shape > button > yt-touch-feedback-shape > div > div.yt-spec-touch-feedback-shape__stroke" + ).click(); } //看完关闭窗口 send_close(id); @@ -252,18 +328,43 @@ async function youtube(r, id) { // 点击长视频观看 await delay(10); //点击订阅 如果已经订阅过了就不用点 - if($('div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button').eq(0).is('.yt-spec-button-shape-next--filled')) - $('div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button').eq(0).click(); + if ( + $( + "div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button" + ) + .eq(0) + .is(".yt-spec-button-shape-next--filled") + ) + $( + "div ytd-subscribe-button-renderer yt-smartimation yt-button-shape button" + ) + .eq(0) + .click(); // 点赞 - if($('div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button').is('.yt-spec-button-shape-next--tonal')) - $('div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button').eq(0).click(); - - $('button .yt-spec-button-shape-next--size-m').click(); - next_vido=Math.round(Math.random()*$('contents ytd-compact-video-renderer div ytd-thumbnail a').length); - if (next_vido == $('contents ytd-compact-video-renderer div ytd-thumbnail a').length) - next_vido=next_vido-1; - $('#contents ytd-compact-video-renderer div ytd-thumbnail a').eq(next_vido)[0].click(); + if ( + $( + "div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button" + ).is(".yt-spec-button-shape-next--tonal") + ) + $( + "div ytd-segmented-like-dislike-button-renderer div ytd-toggle-button-renderer yt-button-shape button" + ) + .eq(0) + .click(); + $("button .yt-spec-button-shape-next--size-m").click(); + next_vido = Math.round( + Math.random() * + $("contents ytd-compact-video-renderer div ytd-thumbnail a").length + ); + if ( + next_vido == + $("contents ytd-compact-video-renderer div ytd-thumbnail a").length + ) + next_vido = next_vido - 1; + $("#contents ytd-compact-video-renderer div ytd-thumbnail a") + .eq(next_vido)[0] + .click(); } function ServiceLogin(r, id) { @@ -303,7 +404,6 @@ chrome.runtime.sendMessage( case "naver": naver(r, id); break; - case "360": sll360(r, id); break; @@ -319,6 +419,15 @@ chrome.runtime.sendMessage( case "news_google": news_google(r, id); break; + case "play_google": + play_google(r, id); + break; + case "play_finance": + play_finance(r, id); + break; + case "mail": + mail(r, id); + break; default: break; } diff --git a/manifest.json b/manifest.json index 9b5300e..946c3da 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "content_scripts": [ { "matches": [ - "https://www.naver.com/*","https://www.baidu.com/*","https://www.so.com/*","https://www.youtube.com/*","https://www.youtube.com/shorts/*","https://www.google.com.hk/","https://www.google.com.hk/search?q=*","https://www.google.com/","https://www.google.com/search?q=*","https://mail.google.com/*","https://accounts.google.com/ServiceLogin*","https://news.google.com/*" + "https://www.naver.com/*","https://www.baidu.com/*","https://www.so.com/*","https://www.youtube.com/*","https://www.youtube.com/shorts/*","https://www.google.com.hk/","https://www.google.com.hk/search?q=*","https://www.google.com/","https://www.google.com/search?q=*","https://mail.google.com/*","https://accounts.google.com/ServiceLogin*","https://news.google.com/*","https://play.google.com/*" ], "js": [ "lib/jquery-3.3.1.min.js",