tampermonkey-script/tieba page.js

596 lines
23 KiB
JavaScript
Raw Normal View History

2020-02-15 14:04:31 +00:00
// ==UserScript==
// @name tieba page
2020-03-25 03:09:35 +00:00
// @namespace https://github.com/fthvgb1/tampermonkey-script
2020-03-26 07:59:52 +00:00
// @version 0.96
2020-02-15 14:04:31 +00:00
// @author fthvgb1
2020-02-15 15:39:37 +00:00
// @match https://tieba.baidu.com/*
2020-03-26 03:02:46 +00:00
// @match https://tiebac.baidu.com/*
2020-03-25 03:09:35 +00:00
// @match http://tieba.baidu.com/*
2020-02-28 03:58:51 +00:00
// @grant GM.openInTab
2020-03-04 03:52:55 +00:00
// @grant GM_xmlhttpRequest
2020-03-25 03:09:35 +00:00
// @description 显示手机版贴吧里被隐藏的楼层与翻页按钮,回贴,顺便拦点儿广告
2020-02-15 14:04:31 +00:00
// ==/UserScript==
2020-02-20 07:02:06 +00:00
(function () {
'use strict';
2020-03-22 08:41:10 +00:00
let obs;
2020-02-20 10:28:17 +00:00
function gif3(v) {
2020-02-21 01:57:52 +00:00
let imgs = v.querySelectorAll('img.BDE_Image');
2020-02-20 10:28:17 +00:00
if (imgs.length > 0) {
imgs.forEach(img => {
2020-02-21 01:57:52 +00:00
let src = img.src;
let s = /&src=(.*)/.exec(src);
2020-02-20 10:28:17 +00:00
if (s != null) {
2020-02-21 01:57:52 +00:00
let x = s.length > 0 ? s[1] : src;
2020-02-20 10:28:17 +00:00
img.src = decodeURIComponent(x);
2020-03-22 08:41:10 +00:00
img.setAttribute('data-ss', img.src);
img.setAttribute('data-src', src)
2020-02-20 10:28:17 +00:00
}
})
}
}
function gif(v) {
2020-02-21 01:57:52 +00:00
let imgs = v.querySelectorAll('div[data-class="BDE_Image"]');
2020-02-20 10:28:17 +00:00
if (imgs.length > 0) {
imgs.forEach(value => {
2020-02-21 01:57:52 +00:00
let src = decodeURIComponent(value.getAttribute('data-url'));
let s = /&src=(.*)/.exec(src);
2020-02-20 10:28:17 +00:00
if (s != null) {
2020-02-21 01:57:52 +00:00
let ss = s[1];
let img = document.createElement('img');
2020-02-20 10:28:17 +00:00
img.src = (ss);
img.className = 'BDE_Image';
2020-03-22 08:41:10 +00:00
img.setAttribute('data-src', src);
img.setAttribute('data-ss', ss);
value.outerHTML = `<div class="pb_img_item" data-url="${ss}">${img.outerHTML}</div>`;
2020-02-20 10:28:17 +00:00
}
})
}
gif3(v)
}
2020-03-02 16:35:56 +00:00
function delElement(selectors) {
selectors.forEach(value => {
let x = document.querySelector(value);
if (x) {
x.parentNode.removeChild(x)
}
});
}
2020-03-22 12:37:56 +00:00
function gp() {
let tttid = '';
let xxjj = $('html').html();
let pp = /tid: (\d+)/.exec(xxjj);
tttid = pp[1];
let fo_name = /forum_name: "(.*?)"/.exec(xxjj)[1];
document.querySelector('#pblist').addEventListener('click', event => {
let t = event.target;
if (t.nodeName !== 'IMG') {
return
}
if (t.classList.contains('BDE_Image')) {
t.src = t.dataset.src;
obs = t
}
let imgs = $(t).parents('#pb_imgs_div');
if (imgs.length > 0) {
let ff = decodeURIComponent(t.src).split('/');
let c = ff[ff.length - 1].split('.')[0];
location.href = `https://tieba.baidu.com/mo/q/album?word=${fo_name}&tid=${tttid}}&template=slide_image&img_quality=100&click_url=${c}`;
event.stopPropagation();
event.preventDefault();
}
}, true);
}
2020-02-20 07:02:06 +00:00
function t() {
lz();
2020-03-22 12:37:56 +00:00
gp();
2020-02-20 10:28:17 +00:00
$("ul#pblist>li").forEach(function (e, iii) {
2020-02-20 07:02:06 +00:00
f(e);
2020-02-20 10:28:17 +00:00
if (iii === 0) {
2020-02-21 01:57:52 +00:00
let oo = e.querySelectorAll('.pb_img_item');
2020-02-20 10:28:17 +00:00
if (oo.length > 0) {
oo.forEach(value => {
if (value.getAttribute('data-url')) {
value.setAttribute('data-class', 'BDE_Image');
value.setAttribute('src', value.getAttribute('data-url'));
}
});
//oo[0].parentElement.outerHTML=`<span class="wrap pbimgwapper">${oo[0].parentElement.innerHTML}</span>`
}
}
2020-03-02 14:53:20 +00:00
let videos = e.querySelectorAll('.video');
if (videos.length > 0) {
videos.forEach(video => {
let src = video.getAttribute('data-vhsrc');
let img = video.querySelector('img');
video.outerHTML = `<video poster="${img.src}" src="${src}" controls="controls" style="max-width:100%;min-width:100%"></video>`;
});
}
2020-03-02 16:35:56 +00:00
delElement(['#diversBanner', '.j_videoFootDownBtn']);
2020-02-20 10:28:17 +00:00
gif(e);
2020-03-22 08:41:10 +00:00
2020-02-21 01:57:52 +00:00
let ee = $(e);
2020-03-04 03:52:55 +00:00
let bt = e.querySelector('.j_nreply_btn');
if (bt) {
}
2020-02-21 01:57:52 +00:00
let tid = ee.attr("tid");
let content = ee.find(".list_item_top");
let x = ee.find('.list_item_top a.j_report_btn');
2020-02-21 12:22:52 +00:00
let kz = 0;
2020-02-20 07:02:06 +00:00
if (x && x.length > 0) {
2020-02-21 12:22:52 +00:00
kz = x[0].href.match(/tid=(\d+)&/);
2020-02-20 07:02:06 +00:00
kz = kz[1];
}
2020-02-21 01:57:52 +00:00
let floor = e.getElementsByClassName('pb_floow_load');
2020-02-20 07:02:06 +00:00
if (floor.length > 0) {
2020-02-21 01:57:52 +00:00
let text = floor[0].textContent;
let url = `https://tieba.baidu.com/t/p/${tid}`;
let num = parseInt(text.match(/\d+/));
2020-03-25 08:43:52 +00:00
content.append(`<div style="text-align:center;background-color: #eee;width: 50%;margin-left: 30%;"><a style="padding:12px;display:block;" href="javascript:void(0)" data-url="${url}" class="reply">还有${num}条回复</a></div>`);
2020-02-21 01:57:52 +00:00
let res = content.find('a.reply');
let orgnum = num;
2020-02-20 07:02:06 +00:00
//console.log(content,res);
if (res) {
res.forEach(function (v, i) {
2020-02-21 01:57:52 +00:00
let page = 2;
2020-02-20 07:02:06 +00:00
v.addEventListener('click', function () {
2020-02-21 01:57:52 +00:00
let that = this;
2020-02-20 07:02:06 +00:00
if (num === orgnum) {
2020-02-21 01:57:52 +00:00
let url = this.getAttribute('data-url');
2020-02-20 07:02:06 +00:00
$.get(url, function (rst) {
2020-02-21 01:57:52 +00:00
let dom = (new DOMParser()).parseFromString(rst, 'text/html');
let r = dom.querySelector('.j_floor_panel');
let lii = r.querySelectorAll('li');
2020-02-20 07:02:06 +00:00
lii.forEach(function (li, index) {
if (index < 2) {
return;
}
2020-03-25 08:43:52 +00:00
let uuu = li.querySelector('.left>div .user_name');
2020-03-25 15:03:19 +00:00
let ct = li.querySelector('.user_name + p').innerText;
2020-03-25 08:43:52 +00:00
let username = uuu.outerHTML;
2020-03-25 15:03:19 +00:00
username = username.replace('</a>', `</a> : <span style="color: #8fa391">${ct}</span>`).replace('javascript:;', `/home/main?un=${uuu.innerText.replace(/ /g, '')}`);
2020-02-21 01:57:52 +00:00
let s = li.querySelector('.content span');
2020-02-20 07:02:06 +00:00
s.className = 'floor_content';
2020-02-21 01:57:52 +00:00
let c = li.querySelector('.content').innerHTML;
let div = `
2020-02-15 14:04:31 +00:00
<div class="fmain j_floor_main">
<div class="floor_footer_item">
${username}
${c}
</div>
</div>`;
2020-02-20 07:02:06 +00:00
li.innerHTML = div;
2020-02-21 01:57:52 +00:00
let ll = document.createElement('li');
2020-02-20 07:02:06 +00:00
ll.classList.add('list_item_floor');
ll.classList.add('j_list_item_floor');
ll.innerHTML = div;
2020-03-25 08:43:52 +00:00
ll.setAttribute('data-info', li.dataset.info);
2020-02-20 07:02:06 +00:00
//console.log(content.find('.flist'))
content.find('.flist')[0].appendChild(ll)
});
if (num <= 8) {
that.parentNode.removeChild(that);
} else {
num -= 8;
2020-03-04 03:52:55 +00:00
that.innerText = `还有${num}条回复`;
2020-02-20 07:02:06 +00:00
}
2020-02-15 14:04:31 +00:00
});
2020-02-20 07:02:06 +00:00
} else {
2020-02-21 01:57:52 +00:00
let url = `https://tieba.baidu.com/mo/q//flr?fpn=${page}&kz=${kz}&pid=${tid}&is_ajax=1&has_url_param=0&template=lzl`;
2020-02-20 07:02:06 +00:00
$.get(url, function (res) {
2020-02-21 01:57:52 +00:00
let ht = (new DOMParser()).parseFromString(res.data.floor_html, 'text/html');
let lii = ht.querySelectorAll('li');
2020-02-20 07:02:06 +00:00
lii.forEach(function (li, index) {
2020-03-25 08:43:52 +00:00
let uuu = li.querySelector('.left>div .user_name');
2020-03-25 15:03:19 +00:00
let ct = li.querySelector('.user_name + p').innerText;
2020-03-25 08:43:52 +00:00
let username = uuu.outerHTML;
2020-03-25 15:03:19 +00:00
username = username.replace('</a>', `</a> : <span style="color: #8fa391">${ct}</span>`).replace('javascript:;', `/home/main?un=${uuu.innerText.replace(/ /g, '')}`);
2020-02-21 01:57:52 +00:00
let s = li.querySelector('.content span');
2020-02-20 07:02:06 +00:00
s.className = 'floor_content';
2020-02-21 01:57:52 +00:00
let c = li.querySelector('.content').innerHTML;
let div = `
2020-02-15 14:04:31 +00:00
<div class="fmain j_floor_main">
<div class="floor_footer_item">
${username}
${c}
</div>
</div>`;
2020-02-20 07:02:06 +00:00
li.innerHTML = div;
2020-02-21 01:57:52 +00:00
let ll = document.createElement('li');
2020-02-20 07:02:06 +00:00
ll.classList.add('list_item_floor');
ll.classList.add('j_list_item_floor');
ll.innerHTML = div;
2020-03-25 08:43:52 +00:00
ll.setAttribute('data-info', li.dataset.info);
2020-02-20 07:02:06 +00:00
//console.log(content.find('.flist'))
content.find('.flist')[0].appendChild(ll)
});
++page;
if (num > 10) {
num -= 10;
2020-03-04 03:52:55 +00:00
that.innerText = `还有${num}条回复`;
2020-02-20 07:02:06 +00:00
} else {
that.parentNode.removeChild(that);
}
})
}
2020-02-15 14:04:31 +00:00
2020-02-20 07:02:06 +00:00
})
2020-02-15 14:04:31 +00:00
})
2020-02-20 07:02:06 +00:00
}
floor[0].parentNode.removeChild(floor[0])
2020-02-15 14:04:31 +00:00
}
2020-02-20 07:02:06 +00:00
});
}
2020-02-15 14:04:31 +00:00
2020-02-20 07:02:06 +00:00
function lz() {
2020-02-21 01:57:52 +00:00
let lz = document.querySelector('span.poster_only');
2020-02-20 07:02:06 +00:00
if (lz) {
lz.onclick = null;
2020-02-21 01:57:52 +00:00
let h = location.href;
let ff = 0;
2020-02-20 07:02:06 +00:00
if (h.indexOf('see_lz=1') > -1) {
lz.textContent = '取消只看楼主';
h = h.replace('see_lz=1', 'see_lz=0');
ff = 1;
2020-02-15 14:04:31 +00:00
}
2020-02-20 07:02:06 +00:00
lz.addEventListener('click', () => {
2020-02-15 14:04:31 +00:00
2020-02-20 07:02:06 +00:00
if (ff === 0) {
h = h.indexOf('?') < 0 ? h + '?see_lz=1' : h + '&see_lz=1';
}
location.href = h;
});
2020-02-15 14:04:31 +00:00
}
}
2020-02-20 07:02:06 +00:00
function f(value) {
2020-02-21 01:57:52 +00:00
let dt = JSON.parse(value.getAttribute('data-info'));
2020-02-20 07:02:06 +00:00
if (dt) {
2020-02-21 01:57:52 +00:00
let fl = dt.floor_num;
let l = document.createElement('span');
2020-02-20 07:02:06 +00:00
l.style.color = 'green';
l.textContent = fl + '楼';
if (fl === 1) {
l.textContent = '楼主';
} else if (fl === 2) {
l.textContent = '沙发';
} else if (fl === 3) {
l.textContent = '板凳';
}
value.querySelector('.list_item_time').parentNode.appendChild(l);
2020-02-15 15:56:55 +00:00
}
}
2020-02-20 07:02:06 +00:00
function check() {
2020-02-21 01:57:52 +00:00
let userAgentInfo = navigator.userAgent;
let Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
let flag = 0;
for (let v = 0; v < Agents.length; v++) {
2020-02-20 07:02:06 +00:00
if (userAgentInfo.indexOf(Agents[v]) > -1) {
flag = 1;
break;
}
2020-02-15 15:39:37 +00:00
}
2020-02-20 07:02:06 +00:00
return flag;
2020-02-15 15:39:37 +00:00
}
2020-03-04 03:52:55 +00:00
function createTime() {
let url = location.href.replace('&mo_device=1', '');
2020-03-24 16:38:38 +00:00
if (url[url.length - 1] === '&') {
url = url + 'tab=main&'
}
2020-03-04 03:52:55 +00:00
url = decodeURIComponent(url);
2020-03-04 08:39:39 +00:00
if (url.indexOf('/mo/') > -1) {
let word = /word=(.*?)&/.exec(url)[1];
url = url.replace('mo/q/m', 'f').replace(/word=(.*?)&/, 'kw=' + word + '&');
}
2020-03-04 03:52:55 +00:00
GM_xmlhttpRequest({
method: 'GET',
url: url,
headers: {
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'
},
//responseType: obj.responseType,
onload: function (res) {
2020-03-04 08:39:39 +00:00
2020-03-04 03:52:55 +00:00
let r = (new DOMParser()).parseFromString(res.responseText, 'text/html');
let w = r.getElementById('pagelet_html_frs-list/pagelet/thread_list').innerHTML;
let ul = w.replace('<!--', '').replace('-->', '');
let u = document.createElement('div');
u.innerHTML = ul;
let lis = u.querySelectorAll('li.j_thread_list');
2020-03-24 16:38:38 +00:00
2020-03-04 03:52:55 +00:00
if (lis.length > 0) {
lis.forEach(li => {
//debugger
let time = li.querySelector('.is_show_create_time');
if (!time) {
return
}
time = time.textContent;
let tid = li.dataset.tid;
if (tid !== null || tid !== 'null') {
let tar = document.querySelector('li[data-tid="' + tid + '"] .ti_author_icons');
if (!tar) {
return;
}
let d = document.createElement('span');
d.style.marginLeft = '1rem';
d.innerHTML = `<span style="color: #9999b3">${time}</span>`;
tar.appendChild(d)
}
})
}
},
});
}
2020-03-24 16:38:38 +00:00
2020-02-20 07:02:06 +00:00
function list() {
2020-03-02 16:35:56 +00:00
delElement([
2020-03-22 06:15:38 +00:00
'.frs_daoliu_for_app', '.tl_shadow_for_app_modle', '.footer_logo', '.footer_link_highlight',
'.appBottomPromote', '.appPromote',
2020-03-02 16:35:56 +00:00
]);
2020-02-21 01:57:52 +00:00
let ads = document.querySelectorAll('li.tl_shadow_for_app');
2020-02-20 07:02:06 +00:00
if (ads.length > 0) {
2020-02-21 01:57:52 +00:00
let url = document.querySelector('.tl_shadow_for_app').parentNode.querySelector('a.j_common').href;
2020-02-20 07:02:06 +00:00
ads.forEach(v => {
//v.classList.remove('tl_shadow_for_app');
2020-02-21 01:57:52 +00:00
let a = v.querySelector('a.j_enter_for_app');
let tid = v.getAttribute('data-tid');
2020-02-20 07:02:06 +00:00
a.href = url.replace(/\/(\d+)\?/.exec(url)[1], tid);
a.classList.remove('tl_shadow_for_app');
})
2020-02-15 14:04:31 +00:00
}
2020-03-04 03:52:55 +00:00
createTime();
let list = document.querySelector('#tlist');
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
let observer = new MutationObserver((mutations) => {
if (mutations.length > 0) {
createTime();
}
});
observer.observe(list, {
attributes: true,
childList: true,
characterData: true
});
2020-02-28 02:03:34 +00:00
let lis = document.querySelectorAll('li.tl_shadow>a[data-thread-type="0"]');
if (lis.length > 0) {
lis.forEach(value => {
2020-02-28 03:58:51 +00:00
let url = value.href;
value.href = 'javascript:void(0);';
value.onclick = (v) => {
GM.openInTab(url, true);
}
2020-02-28 02:03:34 +00:00
})
}
2020-02-15 14:04:31 +00:00
2020-02-20 07:02:06 +00:00
}
2020-02-15 14:04:31 +00:00
2020-02-20 07:02:06 +00:00
function detail() {
2020-03-22 08:41:10 +00:00
document.querySelector('a[class="ui_button ui_back j_span_back"]').addEventListener('click', event => {
obs.src = obs.dataset.ss
});
2020-03-24 16:38:38 +00:00
reply();
2020-03-22 08:41:10 +00:00
2020-03-22 13:14:26 +00:00
2020-02-20 07:02:06 +00:00
document.querySelectorAll('ul#pblist>li').forEach(value => {
if (value.classList.contains('class_hide_flag')) {
value.classList.remove('class_hide_flag');
}
});
t();
2020-03-02 16:35:56 +00:00
delElement([
2020-02-20 07:02:06 +00:00
'.img_desc', '.father-cut-recommend-normal-box', '.father-cut-daoliu-normal-box',
2020-03-02 14:53:20 +00:00
'#diversBanner', '.footer_logo', '.j_footer_link', '.frs_daoliu_for_app',
2020-03-22 06:15:38 +00:00
'.j_videoFootDownBtn', '.appBottomPromote', '.appPromote',
2020-03-02 16:35:56 +00:00
]);
2020-02-15 14:04:31 +00:00
2020-02-20 07:02:06 +00:00
document.querySelector('.father-cut-pager-class-no-page').classList.remove('father-cut-pager-class-no-page');
2020-02-15 15:39:37 +00:00
2020-03-02 15:54:38 +00:00
let list = document.querySelector('ul#pblist');
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
let observer = new MutationObserver((mutations) => {
if (mutations.length > 0) {
t();
}
});
2020-02-15 15:39:37 +00:00
2020-03-02 15:54:38 +00:00
observer.observe(list, {
attributes: true,
childList: true,
characterData: true
2020-02-20 07:02:06 +00:00
});
2020-03-02 15:54:38 +00:00
2020-02-15 15:39:37 +00:00
}
2020-02-15 14:04:31 +00:00
2020-03-24 16:38:38 +00:00
function clickControl() {
2020-03-25 03:09:35 +00:00
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'];
2020-03-24 16:38:38 +00:00
document.querySelector('body').addEventListener('click', ev => {
for (let i in el) {
if (ev.target.classList.contains(el[i])) {
ev.stopPropagation();
ev.preventDefault();
}
}
2020-03-25 03:09:35 +00:00
if (ev.target.classList.contains('j_postor_blue_kit_btn_return') || ev.target.classList.contains('j_submit_btn') || ev.target.classList.contains('close-btn')) {
2020-03-24 16:38:38 +00:00
let pages = document.querySelectorAll('#list_pager');
if (pages.length > 1) {
let count = pages.length;
pages.forEach(el => {
if (count !== 1) {
--count;
el.parentNode.removeChild(el);
}
})
}
}
if (ev.target.tagName === 'svg') {
ev.stopPropagation();
ev.preventDefault();
if (ev.target.innerHTML.indexOf('remind_on') > -1) {
location.href = '/mo/q/msg'
}
if (ev.target.innerHTML.indexOf('topbar_search') > -1) {
location.href = '/mo/q/searchpage'
}
}
if (ev.target.tagName === 'A' && ev.target.classList.contains('notice')) {
ev.stopPropagation();
ev.preventDefault();
location.href = '/mo/q/msg';
}
2020-03-24 16:53:34 +00:00
if (ev.target.tagName === 'A' && ev.target.className === 'item comment itemonly') {
ev.stopPropagation();
ev.preventDefault();
}
2020-03-24 16:38:38 +00:00
if (ev.target.classList.contains('j_new_header_reply')) {
F.use('spb/widget/normal_post_list', function (threadList) {
let x = new threadList(window.conxx);
x.floorReply(ev);
});
}
if (ev.target.classList.contains('user_img')) {
2020-03-26 07:59:52 +00:00
ev.stopPropagation();
ev.preventDefault();
2020-03-24 16:38:38 +00:00
let name = $(ev.target).parents('li').find('span.user_name').text();
2020-03-25 03:09:35 +00:00
location.href = `/home/main?un=${name}`;
}
let ii;
if (ev.target.tagName === 'IMG' && (ii = ev.target.parentNode, ii.classList.contains('ti_avatar'))) {
2020-03-26 07:59:52 +00:00
ev.stopPropagation();
ev.preventDefault();
2020-03-25 03:09:35 +00:00
location.href = ii.dataset.url;
2020-03-24 16:38:38 +00:00
}
2020-03-25 03:09:35 +00:00
2020-03-24 16:38:38 +00:00
if (ev.target.classList.contains('user_name')) {
2020-03-26 07:59:52 +00:00
ev.stopPropagation();
ev.preventDefault();
2020-03-25 03:09:35 +00:00
location.href = `/home/main?un=${ev.target.innerText}`;
2020-03-24 16:38:38 +00:00
}
2020-03-24 16:53:34 +00:00
if (ev.target.tagName === 'SPAN' && ev.target.classList.contains('forumname')) {
2020-03-26 07:59:52 +00:00
ev.preventDefault(), ev.stopPropagation();
if (ev.target.innerText.lastIndexOf('吧') === ev.target.innerText.length - 1) {
ev.target.innerText = ev.target.innerText.substring(0, ev.target.innerText.length - 1)
}
2020-03-25 03:09:35 +00:00
location.href = `/f?kw=${ev.target.innerText}&pn=0&`;
2020-03-26 07:59:52 +00:00
2020-03-25 03:09:35 +00:00
}
if (ev.target.tagName === 'SPAN' && (ev.target.classList.contains('createtime') || ev.target.classList.contains('ti_time') || ev.target.classList.contains('ti_author'))) {
ev.stopPropagation();
ev.preventDefault();
2020-03-24 16:53:34 +00:00
}
2020-03-25 03:09:35 +00:00
if (ev.target.tagName === 'SPAN' && ev.target.classList.contains('btn_icon')) {
2020-03-24 16:53:34 +00:00
ev.stopPropagation();
ev.preventDefault();
}
if (ev.target.tagName === 'H4' && ev.target.classList.contains('title')) {
2020-03-26 07:59:52 +00:00
ev.stopPropagation();
ev.preventDefault();
2020-03-25 03:09:35 +00:00
location.href = `/home/main?un=${ev.target.innerText}`;
2020-03-24 16:53:34 +00:00
}
2020-03-24 16:38:38 +00:00
if (ev.target.classList.contains('icon_tieba_edit')) {
//todo 发帖 似乎没相关的调用模块???
}
//console.log(ev.target,ev.target.tagName)
}, true);
}
function reply() {
let h = document.querySelector('html').innerHTML;
let co = /spb\/widget\/normal_post_list', function \(threadList\) \{ new threadList\((.*?)\}\);/.exec(h);
let con = co[1] + '}';
let conf = (new Function("return " + con))();
window.conxx = conf;
document.querySelectorAll('.j_nreply_btn').forEach(value => {
value.addEventListener('click', evt => {
evt.preventDefault();
evt.stopPropagation();
F.use('spb/widget/normal_post_list', function (threadList) {
let x = new threadList(conf);
x.floorReply(evt);
});
})
})
}
2020-02-21 01:57:52 +00:00
try {
if (!check()) {
return;
}
2020-03-24 16:38:38 +00:00
clickControl();
2020-03-22 13:14:26 +00:00
let css = document.createElement('style');
2020-03-24 16:41:16 +00:00
css.textContent = `
2020-03-26 07:59:52 +00:00
.class_hide_flag{display:block!important;}.father-cut-pager-class-no-page>#list_pager{visibility: visible!important;height: 44px!important;}#glob,body{margin-top: 0px!important;}.father_cut_list_class{padding-bottom: 0px!important;}.father-cut-recommend-normal-box,.father-cut-daoliu-normal-box,.fixed_bar,.pb,.frs,.no_mean,.addbodybottom,.img_desc,.tl_shadow_for_app,.top-guide-wrap,.open-style,.index-feed-cards .hot-topic,.appPromote_wrapper,.ui_image_header_bottom,.videoFooter,#diversBanner,.tb-footer-wrap,.interest-bar,.footer-wrap,.client-btn,.daoliu{display:none!important;}.tl_shadow:not([data-tid]),#pblist>li:not([data-tid]){display:none!important;}.navbar-view{top:24px!important;}.navbar-box{top:44px!important;}
2020-03-22 13:14:26 +00:00
`;
document.querySelector('head').append(css);
2020-02-20 07:02:06 +00:00
2020-03-22 12:37:56 +00:00
delElement(['.ui_image_header_bottom']);
2020-03-04 08:46:19 +00:00
if (document.querySelector('#pblist')) {
2020-02-20 07:02:06 +00:00
detail();
}
2020-03-04 08:46:19 +00:00
if (document.querySelector('#tlist')) {
2020-02-20 07:02:06 +00:00
list();
}
2020-02-15 14:04:31 +00:00
2020-02-21 01:57:52 +00:00
} catch (e) {
console.log(e)
}
2020-02-15 14:04:31 +00:00
})();