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 513 additions and 77 deletions

2
.gitignore vendored Normal file
View File

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

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name tieba page
// @namespace https://github.com/fthvgb1/tampermonkey-script
// @version 1.000
// @namespace http://tampermonkey.net/
// @version 1.025
// @author fthvgb1
// @match https://tieba.baidu.com/*
// @match https://tiebac.baidu.com/*
@ -14,6 +14,7 @@
(function () {
'use strict';
function jpg(v) {
let fimgs = v.querySelectorAll('span[class="wrap pbimgwapper"]>img.BDE_Image');
if (fimgs.length > 0) {
@ -25,6 +26,9 @@
if (imgs.length > 0) {
imgs.forEach(value => {
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('/');
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>`;
@ -64,7 +68,7 @@
let ct = li.querySelector('.user_name + p').innerText;
let info = JSON.parse(li.dataset.info);
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');
s.className = 'floor_content';
let c = li.querySelector('.content').innerHTML;
@ -81,12 +85,14 @@
ll.classList.add('j_list_item_floor');
ll.innerHTML = div;
ll.setAttribute('data-info', li.dataset.info);
llxx(ll)
x.push(ll);
});
if (call) {
call(x);
}
x.forEach(v => {
url(v);
el.appendChild(v);
});
@ -96,7 +102,7 @@
tot = parseInt(tot);
let d = document.createElement('div');
d.classList.add('pagexx');
d.style.cssText = 'text-align: center;';
d.style.cssText = 'text-align: center;margin:5px 0 2px';
let a = document.createElement('a');
a.href = 'javascript:void(0)';
a.innerText = '<';
@ -250,12 +256,145 @@
}
}
function url(li) {
let as = li.querySelectorAll('a');
as.forEach(a => {
let src = a.href;
if (src.search(/(fr=share)|(client_type=2)/) > -1) {
let href = src.match(/(https?:\/\/tieba\.baidu\.com\/p\/\d+)/);
if (href && href.length > 0) {
a.href = href[1];
a.innerText = a.href;
}
}
})
}
function gmPage(url, el, page, call) {
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'
},
onload: function (res) {
let lis = (new DOMParser()).parseFromString(res.responseText, 'text/html');
let tmp = lis.querySelectorAll('li');
let arr = [...tmp];
arr.splice(tmp.length - 1, 1);
if (page === 1 && el.childElementCount > 0) {
arr.splice(0, 2);
}
arr.forEach(li => {
let o = JSON.parse(li.getAttribute('data-field'));
let n = {
pid: o.spid,
un: o.user_name
}
let ell = document.createElement('li');
ell.className = 'list_item_floor j_list_item_floor';
ell.setAttribute('data-info', JSON.stringify(n))
ell.setAttribute('pid', o.spid);
let time = li.querySelector('.lzl_time').innerHTML;
let h = li.querySelector('a[class="at j_user_card "]');
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 rrr = re.querySelector('.at');
let rrrxx = '';
if (rrr) {
rrrxx += `回复 <a href="${rrr.href}">${rrr.innerText}</a> : `
re.removeChild(rrr)
}
let ly = re.innerHTML.trim();
if (ly.indexOf('回复') === 0) {
rrrxx += re.innerHTML.replace('回复', '').replace(':', '');
} else {
rrrxx += re.innerHTML;
}
ell.innerHTML = `
<div class="fmain j_floor_main">
<div class="floor_footer_item">
${he} <span style="color: #8fa391">${time}</span>
<span class="floor_content">
${rrrxx}
</span>
</div>
</div>
`;
llxx(ell)
el.append(ell)
})
if (call) {
call()
}
}
});
}
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() {
lz();
fixHeadImages();
$("ul#pblist>li").forEach(function (e, iii) {
f(e);
if (iii === 0) {
let ff = f(e);
if (ff === 1) {
if (!window.lz) {
window.lz = JSON.parse(e.dataset.info)
}
ab(e);
}
let videos = e.querySelectorAll('.video');
@ -263,9 +402,28 @@
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>`;
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);
delElement(['#diversBanner', '.j_videoFootDownBtn']);
gif(e);
jpg(e);
@ -277,6 +435,14 @@
kz = x[0].href.match(/tid=(\d+)&/);
kz = kz[1];
}
let lzll = e.querySelector('.flist');
if (lzll) {
[...lzll.children].forEach(li => {
llxx(li)
})
}
let floor = e.getElementsByClassName('pb_floow_load');
if (floor.length > 0) {
let a = floor[0];
@ -292,84 +458,163 @@
let tot = Math.ceil(orgnum / 10);
let el = a.previousElementSibling;
a.addEventListener('click', function () {
let that = this;
if (num === orgnum) {
let url = this.getAttribute('data-url');
$.get(url, function (rst) {
replayPage({data: {floor_html: rst}}, el, ls => {
ls.splice(0, 2)
if (num <= 8) {
$.get(url, function (rst) {
replayPage({data: {floor_html: rst}}, el, ls => {
ls.splice(0, 2)
that.parentNode.removeChild(that);
});
});
if (num <= 8) {
that.parentNode.removeChild(that);
} else {
return
}
if (GM_xmlhttpRequest) {
const tt = Math.ceil((new Date()).getTime());
url = `/p/comment?tid=${kz}&pid=${tid}&pn=1&t=${tt}`;
gmPage(url, el, 1, () => {
num -= 8;
that.innerText = `还有${num}条回复`;
if (orgnum > 20) {
if (orgnum > 10) {
a.style.display = 'none';
tpage(tot, el, (page) => {
if (a.style.display !== 'none') {
a.style.display = 'none';
}
let url = `/mo/q//flr?fpn=${page}&kz=${kz}&pid=${tid}&is_ajax=1&has_url_param=0&template=lzl`;
$.get(url, res => {
replayPage(res, el);
let tt = Math.ceil((new Date()).getTime());
let url = `/p/comment?tid=${kz}&pid=${tid}&pn=${page}&t=${tt}`;
gmPage(url, el, page, function () {
let l = lo(document, el);
window.scrollTo({top: l.top - 20, left: 0, behavior: "smooth"});
})
});
});
}
}
});
})
} else {
$.get(url, function (rst) {
replayPage({data: {floor_html: rst}}, el, ls => {
ls.splice(0, 2)
});
if (num <= 8) {
that.parentNode.removeChild(that);
} else {
num -= 8;
that.innerText = `还有${num}条回复`;
if (orgnum > 18) {
a.style.display = 'none';
tpage(tot, el, (page) => {
if (a.style.display !== 'none') {
a.style.display = 'none';
}
let url = `/mo/q//flr?fpn=${page}&kz=${kz}&pid=${tid}&is_ajax=1&has_url_param=0&template=lzl`;
$.get(url, res => {
replayPage(res, el);
let l = lo(document, el);
window.scrollTo({top: l.top - 20, left: 0, behavior: "smooth"});
})
});
}
}
});
}
} else {
let url = `/mo/q//flr?fpn=${page}&kz=${kz}&pid=${tid}&is_ajax=1&has_url_param=0&template=lzl`;
$.get(url, function (res) {
replayPage(res, el);
let i = el.parentNode.querySelector('.pagexx input');
if (i) {
i.dataset.r = `${page}`;
i.type = 'text';
i.value = page + '/' + tot;
}
++page;
if (num > 10) {
num -= 10;
that.innerText = `还有${num}条回复`;
} else {
that.parentNode.removeChild(that);
}
})
if (GM_xmlhttpRequest) {
const tt = Math.ceil((new Date()).getTime());
url = `/p/comment?tid=${kz}&pid=${tid}&pn=${page}&t=${tt}`;
gmPage(url, el, page, () => {
let i = el.parentNode.querySelector('.pagexx input');
if (i) {
i.dataset.r = `${page}`;
i.type = 'text';
i.value = page + '/' + tot;
}
++page;
if (num > 10) {
num -= 10;
that.innerText = `还有${num}条回复`;
} else {
that.parentNode.removeChild(that);
}
})
} else {
let url = `/mo/q//flr?fpn=${page}&kz=${kz}&pid=${tid}&is_ajax=1&has_url_param=0&template=lzl`;
$.get(url, function (res) {
replayPage(res, el);
let i = el.parentNode.querySelector('.pagexx input');
if (i) {
i.dataset.r = `${page}`;
i.type = 'text';
i.value = page + '/' + tot;
}
++page;
if (num > 10) {
num -= 10;
that.innerText = `还有${num}条回复`;
} else {
that.parentNode.removeChild(that);
}
})
}
}
});
}
});
killCheckUrl();
}
function lz() {
let lz = document.querySelector('span.poster_only');
if (lz) {
let r = document.createElement('span');
r.classList.add('poster_only');
r.style.marginLeft = '5px';
r.innerText = '倒序看帖';
lz.parentNode.insertBefore(r, lz);
lz.onclick = null;
let h = location.href;
let ff = 0;
let rr = 0;
if (h.indexOf('see_lz=1') > -1) {
lz.textContent = '取消只看楼主';
h = h.replace('see_lz=1', 'see_lz=0');
ff = 1;
}
lz.addEventListener('click', () => {
if (h.indexOf('r=1') > -1) {
r.textContent = '取消倒序看帖';
h = h.replace('r=1', 'r=0');
rr = 1;
}
r.addEventListener('click', (e) => {
if (rr === 0) {
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;
e.stopPropagation();
}, true);
lz.addEventListener('click', (e) => {
if (ff === 0) {
h = h.indexOf('?') < 0 ? h + '?see_lz=1' : h + '&see_lz=1';
}
location.href = h;
});
e.stopPropagation();
}, true);
}
}
function f(value) {
let dt = JSON.parse(value.getAttribute('data-info'));
let fl = 0;
if (dt) {
let fl = dt.floor_num;
fl = dt.floor_num;
let l = document.createElement('span');
l.style.color = 'green';
l.textContent = fl + '楼';
@ -382,6 +627,7 @@
}
value.querySelector('.list_item_time').parentNode.appendChild(l);
}
return fl;
}
function check() {
@ -449,6 +695,10 @@
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({
method: 'GET',
url: url,
@ -463,7 +713,6 @@
let u = document.createElement('div');
u.innerHTML = ul;
let lis = u.querySelectorAll('li.j_thread_list');
if (lis.length > 0) {
lis.forEach(li => {
let time = li.querySelector('.is_show_create_time');
@ -475,10 +724,11 @@
if (tid !== null || tid !== 'null') {
let tar = document.querySelector('li[data-tid="' + tid + '"] .ti_author_icons');
let ttt = document.querySelector('li[data-tid="' + tid + '"] .ti_time');
if (!tar) {
return;
}
let ki = li.querySelector('span[class="tb_icon_author_rely j_replyer"]');
let ki = li.querySelector('.tb_icon_author_rely');
if (!ki) {
return;
}
@ -516,11 +766,11 @@
li.addEventListener('touchend', evt => {
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');
}
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);
}
})
})
@ -542,10 +792,7 @@
a.classList.remove('tl_shadow_for_app');
})
}
createTime();
let list = document.querySelector('#tlist');
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
let observer = new MutationObserver((mutations) => {
@ -555,7 +802,6 @@
slio(document.querySelectorAll('#frslistcontent>li'));
}
});
observer.observe(list, {
childList: true,
});
@ -564,12 +810,12 @@
let lis = document.querySelectorAll('li.tl_shadow>a.ti_item');
if (lis.length > 0) {
lis.forEach(value => {
let url = value.href;
value.href = 'javascript:void(0);';
value.dataset.url = url;
value.onclick = (v) => {
GM.openInTab(url, true);
let url = `mo/q/m?kz=${value.dataset.tid}`;
let w = value.querySelector('.ti_icon_huati');
if (w) {
url += '&post_type=normal&'
}
value.href = url;
})
}
}
@ -626,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() {
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();
p();
reply();
@ -644,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 MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
@ -659,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;
function clickControl() {
@ -799,24 +1104,19 @@
function reply() {
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 conf = (new Function("return " + con))();
window.conxx = conf;
window.xxLL = null;
document.querySelectorAll('.j_nreply_btn').forEach(value => {
value.addEventListener('click', evt => {
evt.preventDefault();
evt.stopPropagation();
F.use('spb/widget/normal_post_list', function (threadList) {
if (!window.xxLL) {
window.xxLL = new threadList(conf)
}
window.xxLL.floorReply(evt);
});
window.xxLL.floorReply(evt);
})
})
}
@ -858,9 +1158,14 @@
f = f === 1 ? 2 : 1;
}
let flag = 0;
function drop(e) {
e.preventDefault();
e.stopPropagation();
if (!flag) {
return;
}
let touches = e.touches[0];
let svg = d;
endX = sx - touches.clientX - Math.ceil(svg.offsetWidth / 2);
@ -885,25 +1190,22 @@
value.style.display = 'none';
} else {
value.addEventListener('touchstart', ev => {
startX = ev.touches[0].clientX - (value.offsetLeft ? value.offsetLeft : 0);
startY = ev.touches[0].clientY - (value.offsetTop ? value.offsetTop : 0);
startX = ev.touches[0].clientX - d.offsetLeft;
startY = ev.touches[0].clientY - d.offsetLeft;
timer = setTimeout(() => {
//value.style.touchAction='none';
value.style.fill = 'rgba(210,74,195,0.3)';
value.addEventListener('touchmove', drop, {
passive: false
});
flag = 1;
}, 600);
});
value.addEventListener('touchmove', drop, {
passive: false
});
value.addEventListener('touchend', ev => {
clearTimeout(timer);
localStorage.setItem('tiebaPageX', endX);
localStorage.setItem('tiebaPageY', endY);
value.style.fill = 'rgba(77, 74, 210,.3)';
//value.style.touchAction='default';
//document.querySelector('body').style.touchAction=null;
//console.log('end');
value.removeEventListener('touchmove', drop);
flag = 0;
})
}
value.style.fill = 'rgba(77, 74, 210,.3)';
@ -930,22 +1232,40 @@
document.querySelector('body').appendChild(d);
}
try {
if (!check()) {
return;
}
let x = location.href.match(/\/p\/(\d+)(\?|\#)?/);
if (x) {
location.href = `/mo/q/m?kz=${x[1]}`;
return;
}
fnav();
clickControl();
let css = document.createElement('style');
css.textContent = `
.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,.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;}
.footer_logo,.footer-version { display:none!important}
.fr_list .list_item_floor { padding-top:6px;}
.floor_footer_item .user_name { color:#125bc7; }
.floor_content a { color:#498bef; }
.fr_list .list_item_floor { 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);}
.floor_footer_item .user_name,.floor_footer_item .user_name:visited { color:#125bc7; }
.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(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);
//debugger
delElement(['.ui_image_header_bottom']);
@ -959,4 +1279,4 @@
} catch (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
})
}
})();