Skip to content

Commit

Permalink
修复 收藏评论转发 模块
Browse files Browse the repository at this point in the history
  • Loading branch information
lgpersonal committed Dec 12, 2019
1 parent 0c78e81 commit cc8c6e9
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 14 deletions.
31 changes: 26 additions & 5 deletions floating.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let window = floaty.window(
<button id="move" text=" 移动 " w="90" h="35" bg="#77ffffff" textSize="10sp" />
<button id="switchXX" text=" 切到 学习强国 " w="90" h="35" bg="#77ffffff" textSize="10sp" />
<button id="startLL" text=" 开始浏览 " w="90" h="35" bg="#77ffffff" textSize="10sp" />
<button id="startSPZ" text=" 收藏评转 " w="90" h="35" bg="#77ffffff" textSize="10sp" />
<button id="switchST" text=" 切到 搜题 " w="90" h="35" bg="#77ffffff" textSize="10sp" />
<button id="startDT" text=" 挑战答题 " w="90" h="35" bg="#77ffffff" textSize="10sp" />
<button id="startMR" text=" 每日答题 " w="90" h="35" bg="#77ffffff" textSize="10sp" />
Expand Down Expand Up @@ -64,7 +65,7 @@ window.exit.click(() => {


let th = null;

//切到 搜题
window.switchST.click(() => {
let ss = "./souti.js";
if (th == null) {
Expand All @@ -84,7 +85,7 @@ window.switchST.click(() => {
}
}
});

//浏览
window.startLL.click(() => {
let ss = "./liulan.js";
if (th == null) {
Expand All @@ -104,7 +105,27 @@ window.startLL.click(() => {
}
}
});

//收藏评论转发
window.startSPZ.click(() => {
let ss = "./shouCangPingZhuan.js";
if (th == null) {
th = threads.start(function () {
toastLog(" 开启线程");
let begin = require(ss);
begin();
});
} else {
if (th.isAlive()) {
toastLog(" 脚本都在运行了你还点!?");
} else {
th = threads.start(function () {
let begin = require(ss);
begin();
});
}
}
});
//挑战答题
window.startDT.click(() => {
let ss = "./dati.js";
if (th == null) {
Expand All @@ -124,7 +145,7 @@ window.startDT.click(() => {
}
}
});

//每日答题
window.startMR.click(() => {
let ss = "./meiridati.js";
if (th == null) {
Expand All @@ -144,7 +165,7 @@ window.startMR.click(() => {
}
}
});

//停止
window.stop.click(() => {
if (th == null) {
toastLog(" 没有进行中的脚本 ");
Expand Down
19 changes: 10 additions & 9 deletions liulan.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ function articleStudy()
console.log("正在学习第"+(i+1)+"篇文章...");
fail=0;
var wave=random(-5,5);//上下随机波动5秒
article_timing(i,aTime+wave);
if(i<cCount)//收藏分享2篇文章
{
CollectAndShare(i);//收藏+分享。若运行到此报错请注释本行!
comment(i);//评论
}
// article_timing(i,aTime+wave);
// if(i<cCount)//收藏分享2篇文章
// {
// CollectAndShare(i);//收藏+分享。若运行到此报错请注释本行!
// comment(i);//评论
// }
back();//返回主界面
while(!desc("学习").exists());//等待加载出主页
delay(2);
Expand Down Expand Up @@ -342,12 +342,13 @@ function listenToRadio()
function CollectAndShare(i)
{
console.log("正在进行第"+(i+1)+"次收藏和分享...");

var collectIcon = classNameContains("ImageView").depth(2).findOnce(2);//右下角收藏按钮
var collectIcon = className("com.uc.webview.export.WebView").findOnce().parent().child(7);//右下角收藏按钮
//var collectIcon = classNameContains("ImageView").depth(2).findOnce(2);//右下角收藏按钮
collectIcon.click();//点击收藏
delay(2);
console.info("收藏成功!");
var shareIcon = classNameContains("ImageView").depth(2).findOnce(3);//右下角分享按钮
var shareIcon = className("com.uc.webview.export.WebView").findOnce().parent().child(8);//右下角分享按钮
//var shareIcon = classNameContains("ImageView").depth(2).findOnce(3);//右下角分享按钮
shareIcon.click();//点击分享

while(!textContains("分享到学习强").exists());//等待弹出分享选项界面
Expand Down
50 changes: 50 additions & 0 deletions shouCangPingZhuan.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* @description: 延时函数
* @param: seconds-延迟秒数
* @return: null
*/
var commentText=["支持党,支持国家!","为实现中华民族伟大复兴而不懈奋斗!","紧跟党走,毫不动摇!","不忘初心,牢记使命","努力奋斗,回报祖国!"];//评论内容,可自行修改,大于5个字便计分

function delay(seconds)
{
sleep(1000*seconds);//sleep函数参数单位为毫秒所以乘1000
}

function begin()
{
toastLog("正在进行收藏分享评论...");
//收藏
var collectIcon = className("com.uc.webview.export.WebView").findOnce().parent().child(7);//右下角收藏按钮
collectIcon.click();//点击收藏
delay(2);
toastLog("收藏成功!");
//分享
var shareIcon = className("com.uc.webview.export.WebView").findOnce().parent().child(8);//右下角分享按钮
shareIcon.click();//点击分享
while(!textContains("分享到学习强").exists());//等待弹出分享选项界面
delay(2);
click("分享到学习强国");
delay(2);
toastLog("分享成功!");
delay(2);
back();//返回文章界面
delay(2);
//评论

var num=random(0,commentText.length-1)//随机数
click("欢迎发表你的观点");
setText(commentText[num]);//输入评论内容
delay(1);
click("发布");//点击右上角发布按钮
toastLog("评论成功!");
delay(2);
click("删除");//删除该评论
delay(2);
click("确认");//确认删除
toastLog("评论删除成功!");
delay(2);
toastLog("运行结束");
}

//begin();
module.exports=begin;

0 comments on commit cc8c6e9

Please sign in to comment.