楼中楼翻页 完善
This commit is contained in:
parent
ac5065de8c
commit
22927ff4af
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name tieba page
|
// @name tieba page
|
||||||
// @namespace http://tampermonkey.net/
|
// @namespace http://tampermonkey.net/
|
||||||
// @version 1.007
|
// @version 1.008
|
||||||
// @author fthvgb1
|
// @author fthvgb1
|
||||||
// @match https://tieba.baidu.com/*
|
// @match https://tieba.baidu.com/*
|
||||||
// @match https://tiebac.baidu.com/*
|
// @match https://tiebac.baidu.com/*
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function jpg(v) {
|
function jpg(v) {
|
||||||
let fimgs = v.querySelectorAll('span[class="wrap pbimgwapper"]>img.BDE_Image');
|
let fimgs = v.querySelectorAll('span[class="wrap pbimgwapper"]>img.BDE_Image');
|
||||||
if (fimgs.length > 0) {
|
if (fimgs.length > 0) {
|
||||||
|
@ -279,7 +280,7 @@
|
||||||
let tmp = lis.querySelectorAll('li');
|
let tmp = lis.querySelectorAll('li');
|
||||||
let arr = [...tmp];
|
let arr = [...tmp];
|
||||||
arr.splice(tmp.length - 1, 1);
|
arr.splice(tmp.length - 1, 1);
|
||||||
if (page === 1) {
|
if (page === 1 && el.length>0) {
|
||||||
arr.splice(0, 2);
|
arr.splice(0, 2);
|
||||||
}
|
}
|
||||||
arr.forEach(li => {
|
arr.forEach(li => {
|
||||||
|
@ -294,12 +295,11 @@
|
||||||
ell.setAttribute('data-info', JSON.stringify(n))
|
ell.setAttribute('data-info', JSON.stringify(n))
|
||||||
ell.setAttribute('pid', o.spid);
|
ell.setAttribute('pid', o.spid);
|
||||||
let time = li.querySelector('.lzl_time').innerHTML;
|
let time = li.querySelector('.lzl_time').innerHTML;
|
||||||
let h = li.querySelector('.j_user_card');
|
let h = li.querySelector('a[class="at j_user_card "]');
|
||||||
let he = `<a href="${h.href}" class="user_name">${h.getAttribute('username')}</a>`;
|
|
||||||
|
let he = `<a href="${h.href}" target="_blank" class="user_name">${h.getAttribute('username')+(h.innerText!==h.getAttribute('username')?'('+h.innerText+')':'')}</a>`;
|
||||||
let re = li.querySelector('.lzl_content_main');
|
let re = li.querySelector('.lzl_content_main');
|
||||||
if (!re) {
|
|
||||||
debugger
|
|
||||||
}
|
|
||||||
let rrr = re.querySelector('.at');
|
let rrr = re.querySelector('.at');
|
||||||
let rrrxx = '';
|
let rrrxx = '';
|
||||||
if (rrr) {
|
if (rrr) {
|
||||||
|
@ -373,17 +373,22 @@
|
||||||
let that = this;
|
let that = this;
|
||||||
if (num === orgnum) {
|
if (num === orgnum) {
|
||||||
let url = this.getAttribute('data-url');
|
let url = this.getAttribute('data-url');
|
||||||
|
if(num<=8){
|
||||||
|
$.get(url, function (rst) {
|
||||||
|
replayPage({data: {floor_html: rst}}, el, ls => {
|
||||||
|
ls.splice(0, 2)
|
||||||
|
that.parentNode.removeChild(that);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
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=${page}&t=${tt}`;
|
url = `/p/comment?tid=${kz}&pid=${tid}&pn=1&t=${tt}`;
|
||||||
gmPage(url, el, 1)
|
gmPage(url, el, 1)
|
||||||
if (num <= 8) {
|
|
||||||
that.parentNode.removeChild(that);
|
|
||||||
} else {
|
|
||||||
num -= 8;
|
num -= 8;
|
||||||
that.innerText = `还有${num}条回复`;
|
that.innerText = `还有${num}条回复`;
|
||||||
if (orgnum > 18) {
|
if (orgnum > 10) {
|
||||||
a.style.display = 'none';
|
a.style.display = 'none';
|
||||||
tpage(tot, el, (page) => {
|
tpage(tot, el, (page) => {
|
||||||
if (a.style.display !== 'none') {
|
if (a.style.display !== 'none') {
|
||||||
|
@ -397,7 +402,6 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$.get(url, function (rst) {
|
$.get(url, function (rst) {
|
||||||
replayPage({data: {floor_html: rst}}, el, ls => {
|
replayPage({data: {floor_html: rst}}, el, ls => {
|
||||||
|
@ -974,6 +978,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
let flag = 0;
|
let flag = 0;
|
||||||
|
|
||||||
function drop(e) {
|
function drop(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user