回复楼层点击去跳转

This commit is contained in:
xing 2025-03-29 20:06:21 +08:00
parent a6c3d9a96d
commit 5745a51a21

View File

@ -342,6 +342,16 @@
function llxx(li) { function llxx(li) {
[...li.querySelectorAll('.floor_footer_item')].forEach(el => {
el.onclick = (e) => {
e.stopPropagation();
}
});
[...li.querySelectorAll('a.user_name')].forEach(a => {
if (a.href.indexOf(' ') > -1) {
a.href = a.href.replaceAll(' ', '');
}
});
let info = JSON.parse(li.dataset.info); let info = JSON.parse(li.dataset.info);
if (!window.lz) { if (!window.lz) {
lzl(); lzl();
@ -366,7 +376,7 @@
if (window.lz.un === info.un || window.lz.name_show === info.un) { if (window.lz.un === info.un || window.lz.name_show === info.un) {
x = i x = i
} }
rep.outerHTML = `<a href="/home/main?un=${info.un}" class="user_name">${xx}</a>` + x + y; rep.outerHTML = `<a href="/home/main?un=${info.un}" target="_blank" class="user_name">${xx}</a>` + x + y;
let c = li.querySelector('.floor_content a[href*="/home/main?un="]') let c = li.querySelector('.floor_content a[href*="/home/main?un="]')
if (!c) { if (!c) {
c = li.querySelector('.floor_content a[href*="jump?un="]'); c = li.querySelector('.floor_content a[href*="jump?un="]');
@ -464,7 +474,7 @@
let url = this.getAttribute('data-url'); let url = this.getAttribute('data-url');
if (num <= 8) { if (num <= 8) {
$.get(url, function (rst) { $.get(url, function (rst) {
replayPage({data: {floor_html: rst}}, el, ls => { replayPage({ data: { floor_html: rst } }, el, ls => {
ls.splice(0, 2) ls.splice(0, 2)
that.parentNode.removeChild(that); that.parentNode.removeChild(that);
}); });
@ -488,14 +498,14 @@
let url = `/p/comment?tid=${kz}&pid=${tid}&pn=${page}&t=${tt}`; let url = `/p/comment?tid=${kz}&pid=${tid}&pn=${page}&t=${tt}`;
gmPage(url, el, page, function () { gmPage(url, el, page, function () {
let l = lo(document, el); let l = lo(document, el);
window.scrollTo({top: l.top - 20, left: 0, behavior: "smooth"}); window.scrollTo({ top: l.top - 20, left: 0, behavior: "smooth" });
}); });
}); });
} }
}) })
} else { } else {
$.get(url, function (rst) { $.get(url, function (rst) {
replayPage({data: {floor_html: rst}}, el, ls => { replayPage({ data: { floor_html: rst } }, el, ls => {
ls.splice(0, 2) ls.splice(0, 2)
}); });
if (num <= 8) { if (num <= 8) {
@ -513,7 +523,7 @@
$.get(url, res => { $.get(url, res => {
replayPage(res, el); replayPage(res, el);
let l = lo(document, el); let l = lo(document, el);
window.scrollTo({top: l.top - 20, left: 0, behavior: "smooth"}); window.scrollTo({ top: l.top - 20, left: 0, behavior: "smooth" });
}) })
}); });
} }
@ -912,6 +922,11 @@
u.searchParams.set('pn', '0'); u.searchParams.set('pn', '0');
title.href = u.toString() title.href = u.toString()
} }
[...document.querySelectorAll('.flist a.user_name')].forEach(a => {
if (a.href.indexOf(' ') > -1) {
a.href = a.href.replaceAll(' ', '');
}
});
god(); god();
p(); p();
reply(); reply();
@ -930,7 +945,7 @@
let lxf = document.querySelector('.father-cut-pager-class-no-page') let lxf = document.querySelector('.father-cut-pager-class-no-page')
if(lxf){ if (lxf) {
lxf.classList.remove('father-cut-pager-class-no-page'); lxf.classList.remove('father-cut-pager-class-no-page');
} }
@ -968,7 +983,7 @@
function clickControl() { function clickControl() {
let el = ['list_item_top_name', 'j_new_header_reply', 'list_item_user_wrap', 'user_img', 'user_name', 'icon_tieba_edit', 'reply_num', 'for_app_label_text_tag']; let el = ['list_item_top_name', 'floor_footer_item', 'j_new_header_reply', 'list_item_user_wrap', 'user_img', 'user_name', 'icon_tieba_edit', 'reply_num', 'for_app_label_text_tag'];
document.querySelector('body').addEventListener('click', ev => { document.querySelector('body').addEventListener('click', ev => {
for (let i in el) { for (let i in el) {
if (ev.target.classList.contains(el[i])) { if (ev.target.classList.contains(el[i])) {
@ -1215,11 +1230,11 @@
location.href = '/mo/q/searchpage'; location.href = '/mo/q/searchpage';
break; break;
case 1: case 1:
window.scrollTo({top: 0, left: 0, behavior: "smooth"}); window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
dd(); dd();
break; break;
case 2: case 2:
window.scrollTo({top: document.documentElement.scrollHeight, left: 0, behavior: "smooth"}); window.scrollTo({ top: document.documentElement.scrollHeight, left: 0, behavior: "smooth" });
dd(); dd();
break; break;
case 3: case 3: