[Auto.js]掌阅F1打卡代码
只要是让你充钱的100%都是骗子,切记不要充1分钱!
//等待无障碍服务开启
auto.waitFor();
//启动掌阅精选
app.startActivity({
packageName: 'com.zhangyue.read.iReader',
data: 'zyireaderpro://home'
});
//打开书籍
var bookList = selector().id('bookshelf_all_recyclerview').findOne()
var book0 = bookList.child(1); // child0是空白的view,跳过。
book0.click();
//进度展示
var readMinutes = 0;
var tipWindow = floaty.window(
<frame gravity="center">
<text id="text">本次已阅读0分钟</text>
</frame>
);
tipWindow.setPosition(360,10);
function updateTip(){
tipWindow.text.setText('本次已阅读'+readMinutes+'分钟');
}
//定时翻页
const width = device.width;
const height = device.height;
function nextPage(){
var random = (Math.random()*2 + 7)/10;
var x = width*random;
var y = height*random;
click(x,y);
}
var count = 30;
var stopAfter31m = true;
while (count > 0){
var random123 = Math.floor(Math.random() * 3);
sleep(1000 * 61 * random123);
nextPage();
count -= 1;
readMinutes += random123;
ui.run(updateTip);
if (stopAfter31m && readMinutes > 31){
break;
}
}
//关闭书籍
back();//不需要退出掌阅精选,H5Bridge需要向它获取数据。
//启动打卡应用H5Bridge
app.startActivity({
action: 'hmct.intent.action.H5BRIDGE'
});
sleep(5000);
click(677,810);//刷新时长
sleep(5000);
var button = selector().className('android.widget.Button')
.text('立即打卡');
if (button.exists()){
button.findOne().click();
} else {
log('button not found');
}