This commit is contained in:
xing 2020-07-10 18:15:16 +08:00
parent 26ecb8c293
commit 8538e36633

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name tieba page // @name tieba page
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 1.008 // @version 1.009
// @author fthvgb1 // @author fthvgb1
// @match https://tieba.baidu.com/* // @match https://tieba.baidu.com/*
// @match https://tiebac.baidu.com/* // @match https://tiebac.baidu.com/*
@ -370,6 +370,7 @@
let tot = Math.ceil(orgnum / 10); let tot = Math.ceil(orgnum / 10);
let el = a.previousElementSibling; let el = a.previousElementSibling;
a.addEventListener('click', function () { a.addEventListener('click', function () {
let that = this; let that = this;
if (num === orgnum) { if (num === orgnum) {
let url = this.getAttribute('data-url'); let url = this.getAttribute('data-url');
@ -385,7 +386,8 @@
if (GM_xmlhttpRequest) { if (GM_xmlhttpRequest) {
const tt = Math.ceil((new Date()).getTime()); const tt = Math.ceil((new Date()).getTime());
url = `/p/comment?tid=${kz}&pid=${tid}&pn=1&t=${tt}`; url = `/p/comment?tid=${kz}&pid=${tid}&pn=1&t=${tt}`;
gmPage(url, el, 1) gmPage(url, el, 1, () => {
num -= 8; num -= 8;
that.innerText = `还有${num}条回复`; that.innerText = `还有${num}条回复`;
if (orgnum > 10) { if (orgnum > 10) {
@ -402,6 +404,7 @@
}); });
}); });
} }
})
} else { } else {
$.get(url, function (rst) { $.get(url, function (rst) {
replayPage({data: {floor_html: rst}}, el, ls => { replayPage({data: {floor_html: rst}}, el, ls => {
@ -431,6 +434,25 @@
} }
} else {
if (GM_xmlhttpRequest) {
const tt = Math.ceil((new Date()).getTime());
url = `/p/comment?tid=${kz}&pid=${tid}&pn=${page}&t=${tt}`;
gmPage(url, el, page, () => {
let i = el.parentNode.querySelector('.pagexx input');
if (i) {
i.dataset.r = `${page}`;
i.type = 'text';
i.value = page + '/' + tot;
}
++page;
if (num > 10) {
num -= 10;
that.innerText = `还有${num}条回复`;
} else {
that.parentNode.removeChild(that);
}
})
} else { } else {
let url = `/mo/q//flr?fpn=${page}&kz=${kz}&pid=${tid}&is_ajax=1&has_url_param=0&template=lzl`; let url = `/mo/q//flr?fpn=${page}&kz=${kz}&pid=${tid}&is_ajax=1&has_url_param=0&template=lzl`;
$.get(url, function (res) { $.get(url, function (res) {
@ -450,6 +472,7 @@
} }
}) })
} }
}
}); });
} }