let gl = getEventListeners;
// 全自动设置所有文章为【粉丝可读】
let autoChangePage = (pageNum = 1) => {
let pageNums = document.querySelectorAll(`.el-pagination .number`);//页码数组
pageNums.forEach(v => {
v.innerText == pageNum && v.click();
});
let pageCount = pageNums[pageNums.length - 1].innerText;//页码总数
setTimeout(() => {
let arr = document.querySelectorAll(`.item-info-oper .el-dropdown .item-move`);//省略号数组
let texts = document.querySelectorAll(`.list-item-mp-right`);//每条记录的element
let autoSetFansCanRead = (arr, i = 0) => {
// 超出当前页面数量就执行下一页
if (i >= arr.length) {
pageNum++;
pageNum <= pageCount && autoChangePage(pageNum);
return
}
//触发移入列表中的“...”
gl(arr[i]).mouseenter[0].listener();
setTimeout(() => {
//点击设置【粉丝可读】
let dropdown = document.querySelector(`body>.el-dropdown-menu:last-of-type`);
dropdown && dropdown.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });//缓慢滚动
let fansCanReadBtn = dropdown.querySelector(`.el-dropdown-menu__item:nth-of-type(3) .item-info-oper-text:first-of-type`);//粉丝可读
// 不是【VIP文章】才设置【粉丝可读】
if (fansCanReadBtn && fansCanReadBtn.innerText == '粉丝可读' && !texts[i].innerText.includes(`VIP文章`)) {
fansCanReadBtn.click();
setTimeout(() => {
//点击弹窗【确认】
document.querySelector(`body>.el-message-box__wrapper .el-button--primary`).click();
setTimeout(() => {
autoSetFansCanRead(arr, ++i); // 递归执行
}, 1000);
}, 500);
} else {
gl(arr[i]).mouseleave[0].listener();
autoSetFansCanRead(arr, ++i); // 递归执行
}
}, 500);
}
autoSetFansCanRead(arr);
}, 1000);
}
autoChangePage();
全自动设置所有文章为【粉丝可见】
猜你喜欢
转载自blog.csdn.net/qq_37860634/article/details/134199452
今日推荐
周排行