票夹、消费按书过滤
javascript: var title = prompt('书名', '天醒之路');
var delay = Number(prompt('翻页延时(ms)', 500));
$('.icon-close').click();
var temp = [];
function run(temp) {
var page = Number($('.ui-page-current')[0].innerText);
setTimeout(function() {
Array.from($('.checked .wbba')).forEach(function(e) {
if (!e.innerText.includes(title))
e.parentNode.style.display = 'none';
else
temp.push(e.parentNode);
});
}, delay);
setTimeout(function() {
if ($('a.ui-page-next')[0]) {
$('a.ui-page-next').click();
run(temp)
} else {
$('.checked .table-size')[0].style.height = (41 + 51 * temp.length) + 'px';
temp.sum = temp.reduce(function(s, e) {
$('.checked tbody')[0].appendChild(e);
return s + Number(/\d+/.exec(e.getElementsByTagName('td')[Array.from($('.checked th')).findIndex(function(e) {
return ['数', '金'].some(function(ee) {
return e.innerText.includes(ee)
})
})].innerText)[0])
}, 0);
var a = [['月票', '张'], ['推荐', '张'], [$('.ui-select-text')[0] ? $('.ui-select-text')[0].innerText : '', '点']].find(function(e, n) {
return $('a.checked')[0].innerText.includes(n > 1 ? '消费' : e[0])
});
a.splice(1, 0, temp.sum);
var ee = setInterval(function() {
if ($('.checked .table-size')[0].style.height == (41 + 51 * temp.length) + 'px') {
clearInterval(ee);
var e = setInterval(function() {
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "https://github.com/niklasvh/html2canvas/releases/download/0.4.1/html2canvas.js";
$('head')[0].appendChild(script);
if (html2canvas) {
clearInterval(e);
html2canvas(document.body, {
onrendered: function(canvas) {
var context = canvas.getContext('2d');
var link = document.createElement('a');
link.href = canvas.toDataURL();
link.download = [g_data.user.nickName, title, a.join(''), new Date().toLocaleDateString()].join('-') + '.png';
link.click();
}
})
}
}, 500);
}
}, 200);
}
}, 2 * delay);
}
run(temp);