完成谷歌日历脚本编写

This commit is contained in:
lingling 2024-08-22 14:06:42 +08:00
parent 28a6a62935
commit 970c8ba445
4 changed files with 46 additions and 19 deletions

View File

@ -1,4 +1,4 @@
setTimeout(function(){
chrome.tabs.create({ url: "popup.html" }, function () {
})
},3500);
},3500);

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-21 17:16:36
* @LastEditTime: 2024-08-22 14:03:43
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@ -92,13 +92,18 @@ $(function () {
let a = await createTab("https://mail.google.com/mail/", "mail");
return a;
}
async function calendar() {
let a = await createTab("https://calendar.google.com/calendar", "calendar");
return a;
}
//函数队列
let queue = [];
queue.push(mail);
queue.push(calendar);
// queue.push(mail);
// queue.push(play_finance);//好像js注入不进去
queue.push(play_google);
// queue.push(play_google);
// queue.push(news_google);
queue.push(text2);
// queue.push(text2);
//当前执行的队列索引
let closed_index = 0;

View File

@ -182,6 +182,25 @@ async function youtube_shorts(r, id) {
send_close(id);
}
async function calendar(r, id) {
await delay(3);
let number = getRandomInt(2, 5);
console.log($)
for (let index = 0; index < number; index++) {
//上一页
// $$('.T5GQA >span')[1].querySelectorAll('button')[0].click()
$(".T5GQA > span").eq(1).find("button").eq(0).click();
await delay(getRandomInt(2, 5));
//今天
$(".L09ZLe >div >div >span >div >button").click();
await delay(getRandomInt(2, 5));
}
//下一页
$(".T5GQA > span").eq(2).find("button").eq(0).click();
await delay(getRandomInt(2, 5));
send_close(id);
}
async function news_google(r, id) {
console.log("加在完成开始等待8秒");
//等待五秒怕加载速度过慢
@ -257,18 +276,17 @@ async function mail(r, id) {
await delay(getRandomInt(1, 5));
//邮箱回复
if (getRandomInt(0, 1) == 0) {
$('.amn >.ams.bkH').click()
$(".amn >.ams.bkH").click();
await delay(getRandomInt(1, 5));
console.log("开始注入")
let text=emailReply[getRandomInt(0, emailReply.length-1)]
console.log("注入内容为"+text)
$('.Ar.Au >div >div').textContent =text;
let text = emailReply[getRandomInt(0, emailReply.length - 1)];
console.log("注入内容为" + text);
$(".Ar.Au >div >div").textContent = text;
await delay(3);
$('.dC >div').click();
$(".dC >div").click();
await delay(getRandomInt(1, 5));
}
//返回
$('.aim.ain >div >div >div + div').click();
$(".aim.ain >div >div >div + div").click();
await delay(getRandomInt(5, 10));
}
send_close(id);
@ -293,17 +311,17 @@ async function youtube_shorts2(r, id) {
//点赞
if (getRandomInt(0, 5) == 3) {
//点赞
//点赞
document.querySelector("#like-button > yt-button-shape > label").click();
}
if (getRandomInt(0, 5) == 2) {
if (getRandomInt(0, 5) == 2) {
//不爱看
document
.querySelector("#dislike-button > yt-button-shape > label")
.click();
}
//论区操作
//论区操作
if (getRandomInt(0, 1) == 0) {
//打开评论区
$(
@ -317,7 +335,7 @@ 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));
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"
@ -401,6 +419,7 @@ chrome.runtime.sendMessage(
ty: "get",
},
function (obj) {
let r = obj.name;
let id = obj.id;
console.log("传递过来的obj" + JSON.stringify(obj));
@ -432,6 +451,9 @@ chrome.runtime.sendMessage(
case "mail":
mail(r, id);
break;
case "calendar":
calendar(r, id);
break;
default:
break;
}

View File

@ -10,12 +10,12 @@
"128": "icon64.png"
},
"background": {
"scripts": ["js/background.js"]
"scripts": ["lib/jquery-3.3.1.min.js","js/background.js"]
},
"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://play.google.com/*"
"<all_urls>"
],
"js": [
"lib/jquery-3.3.1.min.js",