真*倒序看帖

This commit is contained in:
xing 2020-05-06 21:54:02 +08:00
parent cd44602efa
commit d4141828c0

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name tieba page // @name tieba page
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 1.003 // @version 1.004
// @author fthvgb1 // @author fthvgb1
// @match https://tieba.baidu.com/* // @match https://tieba.baidu.com/*
// @match https://tiebac.baidu.com/* // @match https://tiebac.baidu.com/*
@ -269,8 +269,8 @@
lz(); lz();
$("ul#pblist>li").forEach(function (e, iii) { $("ul#pblist>li").forEach(function (e, iii) {
f(e); let ff = f(e);
if (iii === 0) { if (ff === 1) {
ab(e); ab(e);
} }
let videos = e.querySelectorAll('.video'); let videos = e.querySelectorAll('.video');
@ -388,6 +388,7 @@
r.addEventListener('click', (e) => { r.addEventListener('click', (e) => {
if (rr === 0) { if (rr === 0) {
h = h.indexOf('?') < 0 ? h + '?r=1' : (h[h.length - 1] === '&' ? (h + 'r=1&') : (h + '&r=1')); h = h.indexOf('?') < 0 ? h + '?r=1' : (h[h.length - 1] === '&' ? (h + 'r=1&') : (h + '&r=1'));
h = h.replace(/pn=\d+/, 'pn=' + (totalPage - 1) * 30);
} }
location.href = h; location.href = h;
e.stopPropagation(); e.stopPropagation();
@ -404,8 +405,9 @@
function f(value) { function f(value) {
let dt = JSON.parse(value.getAttribute('data-info')); let dt = JSON.parse(value.getAttribute('data-info'));
let fl = 0;
if (dt) { if (dt) {
let fl = dt.floor_num; fl = dt.floor_num;
let l = document.createElement('span'); let l = document.createElement('span');
l.style.color = 'green'; l.style.color = 'green';
l.textContent = fl + '楼'; l.textContent = fl + '楼';
@ -418,6 +420,7 @@
} }
value.querySelector('.list_item_time').parentNode.appendChild(l); value.querySelector('.list_item_time').parentNode.appendChild(l);
} }
return fl;
} }
function check() { function check() {
@ -578,10 +581,7 @@
a.classList.remove('tl_shadow_for_app'); a.classList.remove('tl_shadow_for_app');
}) })
} }
createTime(); createTime();
let list = document.querySelector('#tlist'); let list = document.querySelector('#tlist');
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
let observer = new MutationObserver((mutations) => { let observer = new MutationObserver((mutations) => {
@ -590,7 +590,6 @@
slio(document.querySelectorAll('#frslistcontent>li')); slio(document.querySelectorAll('#frslistcontent>li'));
} }
}); });
observer.observe(list, { observer.observe(list, {
childList: true, childList: true,
}); });
@ -825,17 +824,23 @@
window.conxx = conf; window.conxx = conf;
window.xxLL = null; window.xxLL = null;
let pa = document.querySelector('#list_pager');
pa.parentNode.removeChild(pa);
F.use('spb/widget/normal_post_list', function (threadList) {
if (!window.xxLL) {
window.xxLL = new threadList(conf)
}
window.totalPage = xxLL.pager._conf.totalPage;
if (location.href.indexOf('r=1') > -1) {
xxLL.pager._conf.url += '&r=1';
}
});
document.querySelectorAll('.j_nreply_btn').forEach(value => { document.querySelectorAll('.j_nreply_btn').forEach(value => {
value.addEventListener('click', evt => { value.addEventListener('click', evt => {
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation(); evt.stopPropagation();
F.use('spb/widget/normal_post_list', function (threadList) { window.xxLL.floorReply(evt);
if (!window.xxLL) {
window.xxLL = new threadList(conf)
}
window.xxLL.floorReply(evt);
});
}) })
}) })
} }