Compare commits

..

56 Commits
jap ... tieba

Author SHA1 Message Date
a6c3d9a96d 楼层图片显示 2023-09-25 17:13:24 +08:00
bf45e89dcb 楼层图片显示 2023-09-25 17:13:05 +08:00
fab39732c5 fix头像显示问题 2023-09-24 22:42:05 +08:00
59dd292477 完善主题标题返回该吧和主楼图片显示问题 2023-07-09 13:17:04 +08:00
5679b04222 fix头像 2023-05-30 00:21:17 +08:00
d3f2c7c7c7 fix头像 2023-05-29 20:13:43 +08:00
xing
fcbf640922 v2ex辅助 2023-01-06 21:47:59 +08:00
247f26a000 更新 'tieba page.js' 2022-08-26 04:58:20 +00:00
7da7d706df 删除 'tiba.user.js' 2022-06-27 05:03:35 +00:00
5ad656ec70 添加 '手机贴吧辅助脚本.user.js' 2022-06-27 04:18:08 +00:00
d043ee9bfe 删除 '手机贴吧辅助脚本.user.js' 2022-06-27 04:17:47 +00:00
dd9f518358 删除 'tes.user.js' 2022-06-27 04:11:07 +00:00
be57260c21 添加 'tes.user.js' 2022-06-27 04:10:42 +00:00
baaf65c494 更新 '手机贴吧辅助脚本.user.js' 2022-06-27 04:09:25 +00:00
d2641269b3 添加 '手机贴吧辅助脚本.user.js' 2022-06-27 04:08:28 +00:00
addeea258a 删除 'tieba page.user.js' 2022-06-27 04:05:47 +00:00
fc21efb350 更新 'tiba.user.js' 2022-06-27 04:02:46 +00:00
29a4d711a9 更新 'tiba.user.js' 2022-06-27 04:02:18 +00:00
cf418df708 添加 '手机贴吧辅助脚本.user.js' 2022-06-27 04:01:27 +00:00
438a35a8e9 删除 '贴吧辅助脚本.user.js' 2022-06-27 04:01:08 +00:00
204d585a25 删除 '手机贴吧辅助脚本.user.js' 2022-06-27 04:00:59 +00:00
0a1931a47e 添加 '手机贴吧辅助脚本.user.js' 2022-06-27 03:57:28 +00:00
873c7738d3 添加 2022-06-27 03:50:49 +00:00
e09530f5d8 删除 '贴吧辅助脚本.user.js' 2022-06-27 03:50:41 +00:00
f481b164bc 更新 2022-06-27 03:49:15 +00:00
e57cd8861f 更新 2022-06-27 03:47:45 +00:00
c8aaee364f init 2022-06-27 03:43:57 +00:00
1ebd75bbad page 2022-06-13 18:25:44 +08:00
3181cd607b fix page 2022-06-13 18:18:00 +08:00
b613800eb1 fix page 2022-06-13 18:16:46 +08:00
25f89b0d98 fix 2021-01-26 15:01:55 +08:00
714d360103 fix bug 2020-10-10 20:24:28 +08:00
e75aef4598 fix 2020-10-10 15:41:25 +08:00
e3c145db4c url 2020-10-10 15:30:21 +08:00
78c80baf77 fix 2020-10-10 10:52:05 +08:00
20e3edfbfc fix 2020-10-10 10:48:35 +08:00
116fb83af8 fix 2020-10-10 10:47:22 +08:00
e72dac9792 fix 2020-10-10 10:33:24 +08:00
d31a01b946 version 2020-10-10 10:09:34 +08:00
c07c35ebf4 样式 2020-10-10 10:09:03 +08:00
26b431f1f8 楼中楼楼主标识 2020-10-09 17:38:26 +08:00
3422e43360 优酷视频 2020-10-08 22:50:50 +08:00
14f3ec7dd5 小修bug 2020-07-12 20:26:21 +08:00
8538e36633 完善 2020-07-10 18:15:16 +08:00
26ecb8c293 格式化代码 2020-07-10 17:24:14 +08:00
22927ff4af 楼中楼翻页 完善 2020-07-10 17:20:02 +08:00
ac5065de8c 楼中楼翻页 2020-07-10 16:17:12 +08:00
a950684b16 fix bug 2020-05-07 12:30:55 +08:00
f9c5ad6e7c fix bug 2020-05-07 12:13:53 +08:00
d4141828c0 真*倒序看帖 2020-05-06 21:54:02 +08:00
cd44602efa 倒序看帖,处理app分享的url 2020-05-06 11:05:28 +08:00
f3d0df3f95 版本号 2020-05-05 21:33:55 +08:00
2a7b34cbca 调整楼中楼样式,优化喵的移动 2020-05-05 21:17:53 +08:00
52d2af0a78 楼中楼回复人链接的颜色 2020-04-27 20:21:26 +08:00
e09a9568af version 2020-04-21 22:50:56 +08:00
0f7289139d 组图优化并修复bug 2020-04-21 22:50:14 +08:00
4 changed files with 301 additions and 32 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea
new tieba.js

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name tieba page // @name tieba page
// @namespace https://github.com/fthvgb1/tampermonkey-script // @namespace http://tampermonkey.net/
// @version 1.007 // @version 1.025
// @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) {
@ -25,6 +26,9 @@
if (imgs.length > 0) { if (imgs.length > 0) {
imgs.forEach(value => { imgs.forEach(value => {
let h = value.dataset.url.replace('tiebapic', 'imgsrc').replace('tiebapic', 'imgsrc'); let h = value.dataset.url.replace('tiebapic', 'imgsrc').replace('tiebapic', 'imgsrc');
if (h.indexOf('http://') === 0) {
//h = 'https://image.baidu.com/search/down?url=' + h;
}
let tmp = decodeURIComponent(h.split('&src=')[1]).split('/'); let tmp = decodeURIComponent(h.split('&src=')[1]).split('/');
tmp = tmp[tmp.length - 1]; tmp = tmp[tmp.length - 1];
value.outerHTML = `<div class="pb_img_item" data-url="${h}"><img data-url="${tmp}" class="BDE_Image" src="${h}" alt=""></div>`; value.outerHTML = `<div class="pb_img_item" data-url="${h}"><img data-url="${tmp}" class="BDE_Image" src="${h}" alt=""></div>`;
@ -64,7 +68,7 @@
let ct = li.querySelector('.user_name + p').innerText; let ct = li.querySelector('.user_name + p').innerText;
let info = JSON.parse(li.dataset.info); let info = JSON.parse(li.dataset.info);
let username = uuu.outerHTML; let username = uuu.outerHTML;
username = username.replace('</a>', `</a> : <span style="color: #8fa391">${ct}</span>`).replace('javascript:;', `/home/main?un=${info.un}`); username = username.replace('</a>', `</a> <span style="color: #8fa391">${ct}</span>`).replace('javascript:;', `/home/main?un=${info.un}`);
let s = li.querySelector('.content span'); let s = li.querySelector('.content span');
s.className = 'floor_content'; s.className = 'floor_content';
let c = li.querySelector('.content').innerHTML; let c = li.querySelector('.content').innerHTML;
@ -81,6 +85,7 @@
ll.classList.add('j_list_item_floor'); ll.classList.add('j_list_item_floor');
ll.innerHTML = div; ll.innerHTML = div;
ll.setAttribute('data-info', li.dataset.info); ll.setAttribute('data-info', li.dataset.info);
llxx(ll)
x.push(ll); x.push(ll);
}); });
if (call) { if (call) {
@ -279,7 +284,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 && el.length > 0) { if (page === 1 && el.childElementCount > 0) {
arr.splice(0, 2); arr.splice(0, 2);
} }
arr.forEach(li => { arr.forEach(li => {
@ -305,17 +310,26 @@
rrrxx += `回复 <a href="${rrr.href}">${rrr.innerText}</a> : ` rrrxx += `回复 <a href="${rrr.href}">${rrr.innerText}</a> : `
re.removeChild(rrr) re.removeChild(rrr)
} }
rrrxx += re.innerHTML let ly = re.innerHTML.trim();
if (ly.indexOf('回复') === 0) {
rrrxx += re.innerHTML.replace('回复', '').replace(':', '');
} else {
rrrxx += re.innerHTML;
}
ell.innerHTML = ` ell.innerHTML = `
<div class="fmain j_floor_main"> <div class="fmain j_floor_main">
<div class="floor_footer_item"> <div class="floor_footer_item">
${he}: <span style="color: #8fa391">${time}</span> ${he} <span style="color: #8fa391">${time}</span>
<span class="floor_content"> <span class="floor_content">
${rrrxx} ${rrrxx}
</span> </span>
</div> </div>
</div> </div>
`; `;
llxx(ell)
el.append(ell) el.append(ell)
}) })
@ -326,12 +340,61 @@
}); });
} }
function llxx(li) {
let info = JSON.parse(li.dataset.info);
if (!window.lz) {
lzl();
}
let rep = li.querySelector('a.user_name');
let xx = rep.innerHTML;
if (':' === xx[xx.length - 1]) {
xx = xx.substring(0, xx.length - 1)
}
let x = ''
let i = `&nbsp;<span style="text-align: center;
background: #3381e3;
color: #fff;
padding: 0 4px;
margin: 0 4px 0 0;
border-radius: 2px;
vertical-align: middle;
font-size: 14px;
">楼主</span>`
let y = ':'
if (window.lz.un === info.un || window.lz.name_show === info.un) {
x = i
}
rep.outerHTML = `<a href="/home/main?un=${info.un}" class="user_name">${xx}</a>` + x + y;
let c = li.querySelector('.floor_content a[href*="/home/main?un="]')
if (!c) {
c = li.querySelector('.floor_content a[href*="jump?un="]');
if (c) {
c.href = '/home/main?un=' + c.innerText
}
}
if (c) {
let un = c.href.split('un=')[1];
un = decodeURI(un);
if (window.lz.un === un || window.lz.name_show === un) {
c.outerHTML += i
}
}
}
function t() { function t() {
lz(); lz();
fixHeadImages();
$("ul#pblist>li").forEach(function (e, iii) { $("ul#pblist>li").forEach(function (e, iii) {
let ff = f(e); let ff = f(e);
if (ff === 1) { if (ff === 1) {
if (!window.lz) {
window.lz = JSON.parse(e.dataset.info)
}
ab(e); ab(e);
} }
let videos = e.querySelectorAll('.video'); let videos = e.querySelectorAll('.video');
@ -339,7 +402,25 @@
videos.forEach(video => { videos.forEach(video => {
let src = video.getAttribute('data-vhsrc'); let src = video.getAttribute('data-vhsrc');
let img = video.querySelector('img'); let img = video.querySelector('img');
video.outerHTML = `<video poster="${img.src}" src="${src}" controls="controls" style="max-width:100%;min-width:100%"></video>`; let hr = video.getAttribute('data-vsrc');
if (src) {
let t = video.parentElement.querySelector('.net_search_url');
if (t) {
src = t.dataset.vhsrc
}
video.outerHTML = `<video poster="${img.src}" src="${src}" controls="controls" style="max-width:100%;min-width:100%"></video>`;
} else if (hr && hr.indexOf('bilibili.com') > -1) {
let av = hr.match(/av(\d+)/)[1]
video.outerHTML = `<iframe src="//player.bilibili.com/player.html?aid=${av}&page=1" allowfullscreen="true"> </iframe>`
} else if (hr && hr.indexOf('youku.com') > -1) {
let r = hr.split('id_')[1].replace('.html', '')
video.outerHTML = `<iframe src='https://player.youku.com/embed/${r}' frameborder=0 allowfullscreen="true"></iframe>`
} else if (hr && hr.indexOf('tudou.com') > -1) {
// 土豆已死,有事请烧纸 悲伤的故事 .........
}
}); });
} }
url(e); url(e);
@ -354,6 +435,14 @@
kz = x[0].href.match(/tid=(\d+)&/); kz = x[0].href.match(/tid=(\d+)&/);
kz = kz[1]; kz = kz[1];
} }
let lzll = e.querySelector('.flist');
if (lzll) {
[...lzll.children].forEach(li => {
llxx(li)
})
}
let floor = e.getElementsByClassName('pb_floow_load'); let floor = e.getElementsByClassName('pb_floow_load');
if (floor.length > 0) { if (floor.length > 0) {
let a = floor[0]; let a = floor[0];
@ -476,6 +565,7 @@
} }
}); });
killCheckUrl();
} }
function lz() { function lz() {
@ -605,6 +695,10 @@
url = url.replace('mo/q/m', 'f').replace(/word=(.*?)&/, 'kw=' + word + '&'); url = url.replace('mo/q/m', 'f').replace(/word=(.*?)&/, 'kw=' + word + '&');
} }
if (url.indexOf('lp=sfrs_good_area_link') > -1) {
url += 'tab=good&'
}
//debugger
GM_xmlhttpRequest({ GM_xmlhttpRequest({
method: 'GET', method: 'GET',
url: url, url: url,
@ -619,7 +713,6 @@
let u = document.createElement('div'); let u = document.createElement('div');
u.innerHTML = ul; u.innerHTML = ul;
let lis = u.querySelectorAll('li.j_thread_list'); let lis = u.querySelectorAll('li.j_thread_list');
if (lis.length > 0) { if (lis.length > 0) {
lis.forEach(li => { lis.forEach(li => {
let time = li.querySelector('.is_show_create_time'); let time = li.querySelector('.is_show_create_time');
@ -631,10 +724,11 @@
if (tid !== null || tid !== 'null') { if (tid !== null || tid !== 'null') {
let tar = document.querySelector('li[data-tid="' + tid + '"] .ti_author_icons'); let tar = document.querySelector('li[data-tid="' + tid + '"] .ti_author_icons');
let ttt = document.querySelector('li[data-tid="' + tid + '"] .ti_time'); let ttt = document.querySelector('li[data-tid="' + tid + '"] .ti_time');
if (!tar) { if (!tar) {
return; return;
} }
let ki = li.querySelector('span[class="tb_icon_author_rely j_replyer"]'); let ki = li.querySelector('.tb_icon_author_rely');
if (!ki) { if (!ki) {
return; return;
} }
@ -672,11 +766,11 @@
li.addEventListener('touchend', evt => { li.addEventListener('touchend', evt => {
if ((endX - startX) > 100 && Math.abs(endY - startY) <= 100) { if ((endX - startX) > 100 && Math.abs(endY - startY) <= 100) {
let url = li.querySelector('li.tl_shadow>a.ti_item').dataset.url; let url = li.querySelector('li.tl_shadow>a.ti_item').href;
window.open(url, '_blank'); window.open(url, '_blank');
} }
if ((startX - endX) > 100 && Math.abs(endY - startY) <= 100) { if ((startX - endX) > 100 && Math.abs(endY - startY) <= 100) {
location.href = li.querySelector('li.tl_shadow>a.ti_item').dataset.url; GM.openInTab(li.querySelector('li.tl_shadow>a.ti_item').href, true);
} }
}) })
}) })
@ -708,7 +802,6 @@
slio(document.querySelectorAll('#frslistcontent>li')); slio(document.querySelectorAll('#frslistcontent>li'));
} }
}); });
observer.observe(list, { observer.observe(list, {
childList: true, childList: true,
}); });
@ -717,12 +810,12 @@
let lis = document.querySelectorAll('li.tl_shadow>a.ti_item'); let lis = document.querySelectorAll('li.tl_shadow>a.ti_item');
if (lis.length > 0) { if (lis.length > 0) {
lis.forEach(value => { lis.forEach(value => {
let url = value.href; let url = `mo/q/m?kz=${value.dataset.tid}`;
value.href = 'javascript:void(0);'; let w = value.querySelector('.ti_icon_huati');
value.dataset.url = url; if (w) {
value.onclick = (v) => { url += '&post_type=normal&'
GM.openInTab(url, true);
} }
value.href = url;
}) })
} }
} }
@ -779,7 +872,46 @@
} }
function lzl() {
let kz = document.querySelector('html').innerHTML.match(/kz: "(\d+)"/)[1];
let url = `/mo/q?kz=${kz}`;
$.ajax({
url: url,
async: false,
type: 'get',
success: (res) => {
let html = (new DOMParser()).parseFromString(res, 'text/html');
let lz = html.querySelector('#pblist li')
if (!lz) {
debugger
}
window.lz = JSON.parse(lz.dataset.info)
}
})
}
function killCheckUrl() {
let urls = document.querySelectorAll('a[href*="/mo/q/checkurl"]');
[...urls].forEach(a => {
const url = decodeURIComponent(a.href).split('url=')[1]
a.href = url;
a.target = '_blank';
})
}
function detail() { function detail() {
let title = document.querySelector('#i_head .post_title_text');
if (title !== null) {
const ur = title.href.replace('f?kw=', 'mo/q/m?word=')
const u = new URL(ur);
u.searchParams.set('tn6', 'bdISP');
u.searchParams.set('tn4', 'bdKSW');
u.searchParams.set('tn7', 'bdPSB');
u.searchParams.set('sub4', '进吧');
u.searchParams.set('pn', '0');
title.href = u.toString()
}
god(); god();
p(); p();
reply(); reply();
@ -797,7 +929,10 @@
]); ]);
document.querySelector('.father-cut-pager-class-no-page').classList.remove('father-cut-pager-class-no-page'); let lxf = document.querySelector('.father-cut-pager-class-no-page')
if(lxf){
lxf.classList.remove('father-cut-pager-class-no-page');
}
let list = document.querySelector('ul#pblist'); let list = document.querySelector('ul#pblist');
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
@ -812,6 +947,23 @@
} }
function fixHeadImages() {
const e = document.querySelectorAll("#pblist li .list_item_top_avatar img");
e.forEach(img => {
let src = img.src;
//http://gss3.bdstatic.com/84oSdTum2Q5BphGlnYG/timg?mowebapp&quality=80&size=b72_72&cut_x=0&cut_w=0&cut_y=0&cut_h=0&sec=1369815402&di=d90486ddc230fa80b609654f1ef9491b&wh_rate=null&src=http%3A%2F%2Ftb.himg.baidu.com%2Fsys%2Fportrait%2Fitem%2Ftb.1.a55b4bff.yLhcG9k0TG9vPBPgt_D19A.jpg
if (src.indexOf('http://') === 0) {
const u = new URL(src)
if (u.searchParams.has('src')) {
src = decodeURIComponent(u.searchParams.get('src'));
src = src.replace(/.*\.baidu.com\//, '')
src = 'https://gss0.bdstatic.com/6LZ1dD3d1sgCo2Kml5_Y_D3/' + src;
}
img.src = src;
}
})
}
let book, svgss; let book, svgss;
function clickControl() { function clickControl() {
@ -952,24 +1104,13 @@
function reply() { function reply() {
let h = document.querySelector('html').innerHTML; let h = document.querySelector('html').innerHTML;
let co = /spb\/widget\/normal_post_list', function \(threadList\) \{ new threadList\((.*?)\}\);/.exec(h); let co = /spb\/widget\/normal_post_list', function \(threadList\) \{ new threadList\((.*?)}\);/.exec(h);
let con = co[1] + '}'; let con = co[1] + '}';
let conf = (new Function("return " + con))(); let conf = (new Function("return " + con))();
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 => {
@ -1018,6 +1159,7 @@
} }
let flag = 0; let flag = 0;
function drop(e) { function drop(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -1090,11 +1232,17 @@
document.querySelector('body').appendChild(d); document.querySelector('body').appendChild(d);
} }
try { try {
if (!check()) { if (!check()) {
return; return;
} }
let x = location.href.match(/\/p\/(\d+)(\?|\#)?/);
if (x) {
location.href = `/mo/q/m?kz=${x[1]}`;
return;
}
fnav(); fnav();
clickControl(); clickControl();
let css = document.createElement('style'); let css = document.createElement('style');
@ -1110,9 +1258,14 @@
.floor_footer_item .user_name,.floor_footer_item .user_name:visited { color:#125bc7; } .floor_footer_item .user_name,.floor_footer_item .user_name:visited { color:#125bc7; }
.floor_content a,.floor_content a:visited { color:#498bef; } .floor_content a,.floor_content a:visited { color:#498bef; }
.fr_list .list_item_floor:nth-child(odd){ background-color:rgba(180, 228, 207, 0.2); } .fr_list .list_item_floor:nth-child(odd){ background-color:rgba(180, 228, 207, 0.2); }
.fr_list .list_item_floor:nth-child(even){ background-color:rgba(168, 191, 157, 0.16); } .fr_list .list_item_floor:nth-child(even){ background-color:rgba(168, 191, 157, 0.16); }
.nav-bar-wrapper { display:none; }
.tb-threadlist__item.tb-banner { display:none; }
.tb-threadlist__item.tb-hotthread-wrapper{ display:none; }
`; `;
document.querySelector('head').append(css); document.querySelector('head').append(css);
//debugger
delElement(['.ui_image_header_bottom']); delElement(['.ui_image_header_bottom']);
@ -1126,4 +1279,4 @@
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
})(); })();

48
v2exMobile.user.js Normal file
View File

@ -0,0 +1,48 @@
// ==UserScript==
// @name v2ex h5 辅助脚本
// @namespace http://tampermonkey.net/
// @version 0.5
// @homepage https://code.xloyy.com/xing/tampermonkey-script/
// @description try to take over the world!
// @author xing
// @match https://v2ex.com/*
// @icon https://v2ex.com/static/favicon.ico
// @grant GM_addStyle
// @license MIT
// ==/UserScript==
(function () {
'use strict';
document.body.style.zoom = 1.25;//缩放1.25倍
//左滑后台新标签打开网页 右滑新标签打开网页
slioV2ex(document.querySelectorAll('#Wrapper .content .cell.item'), '.item_title a')
function slioV2ex(els, aquery) {
let startX = 0;
let endX = 0;
let startY = 0;
let endY = 0;
els.forEach(li => {
li.addEventListener('touchstart', e => {
startX = e.changedTouches[0].screenX;
startY = e.changedTouches[0].screenY;
});
li.addEventListener('touchmove', e => {
endX = e.changedTouches[0].screenX;
endY = e.changedTouches[0].screenY;
});
li.addEventListener('touchend', evt => {
if ((endX - startX) > 100 && Math.abs(endY - startY) <= 100) {
let url = li.querySelector(aquery).href;
window.open(url, '_blank');
}
if ((startX - endX) > 100 && Math.abs(endY - startY) <= 100) {
GM.openInTab(li.querySelector(aquery).href, true);
}
})
})
}
})();

View File

@ -0,0 +1,66 @@
// ==UserScript==
// @name 手机贴吧辅助脚本
// @namespace http://tampermonkey.net/
// @version 0.5
// @homepage https://code.xloyy.com/xing/tampermonkey-script/
// @description try to take over the world!
// @author xing
// @match https://tieba.baidu.com/*
// @match https://jump2.bdimg.com/*
// @match https://tiebac.baidu.com/*
// @match https://*/f?*kw=*
// @icon https://tieba.baidu.com/favicon.ico
// @grant GM_addStyle
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const style = `
.lzl-post .lzl-post-item { padding-top: 8px;
letter-spacing: 1px;
border-radius: 8px;
margin-bottom: 2px
border: 1px solid rgba(0,0,0,.1);
box-shadow: 5px 5px 5px rgba(0,0,0,0.2);}
.lzl-post .lzl-post-item:nth-child(odd){ background-color:rgba(180, 228, 207, 0.2); }
.lzl-post .lzl-post-item:nth-child(even){ background-color:rgba(168, 191, 157, 0.16); }
`;
GM_addStyle(style);
let check = 0;
if (location.search.indexOf('kw=') > -1 && location.pathname === '/f' && check === 0) {
let ob = new window.MutationObserver(mutations => {
mutations.forEach(item => {
if (item.type === 'childList' && item.addedNodes.length > 0) {
const logo = document.querySelector('.logo-wrapper');
if (logo) {
const p = logo.parentNode;
const nav = document.createElement('div');
p.insertBefore(nav, logo)
nav.outerHTML = `<div data-v-4e54bd24="" class="logo-wrapper"><svg data-v-4e54bd24="" class="nav-bar-icon-top"><use xlink:href="#icon_logo_top"></use></svg></div>`;
p.removeChild(logo);
check = 1;
document.addEventListener('click',ev => {
if(ev.path[2].classList.contains('logo-wrapper')){
const e=document.createElement('input');
const n=ev.path[2]
n.innerHTML='';
n.append(e)
e.type='text';
e.addEventListener('blur',ev1 => {
if (e.value) {
location.href = '/f?kw=' + e.value;
}
})
ev.stopPropagation();
}
})
}
}
})
});
ob.observe(document.body, {
childList: true
})
}
})();