Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
ee38a89b09 | |||
67dc71da23 | |||
2524162988 | |||
9e33b23c14 | |||
37cf14b5e3 | |||
3bd0682c78 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
.idea
|
||||
new tieba.js
|
211
tieba page.js
211
tieba page.js
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name tieba page
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.025
|
||||
// @namespace https://github.com/fthvgb1/tampermonkey-script
|
||||
// @version 1.007
|
||||
// @author fthvgb1
|
||||
// @match https://tieba.baidu.com/*
|
||||
// @match https://tiebac.baidu.com/*
|
||||
@ -14,7 +14,6 @@
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function jpg(v) {
|
||||
let fimgs = v.querySelectorAll('span[class="wrap pbimgwapper"]>img.BDE_Image');
|
||||
if (fimgs.length > 0) {
|
||||
@ -26,9 +25,6 @@
|
||||
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>`;
|
||||
@ -68,7 +64,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;
|
||||
@ -85,7 +81,6 @@
|
||||
ll.classList.add('j_list_item_floor');
|
||||
ll.innerHTML = div;
|
||||
ll.setAttribute('data-info', li.dataset.info);
|
||||
llxx(ll)
|
||||
x.push(ll);
|
||||
});
|
||||
if (call) {
|
||||
@ -284,7 +279,7 @@
|
||||
let tmp = lis.querySelectorAll('li');
|
||||
let arr = [...tmp];
|
||||
arr.splice(tmp.length - 1, 1);
|
||||
if (page === 1 && el.childElementCount > 0) {
|
||||
if (page === 1 && el.length > 0) {
|
||||
arr.splice(0, 2);
|
||||
}
|
||||
arr.forEach(li => {
|
||||
@ -310,26 +305,17 @@
|
||||
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;
|
||||
}
|
||||
|
||||
rrrxx += re.innerHTML
|
||||
ell.innerHTML = `
|
||||
<div class="fmain j_floor_main">
|
||||
<div class="floor_footer_item">
|
||||
${he} <span style="color: #8fa391">${time}</span>
|
||||
${he}: <span style="color: #8fa391">${time}</span>
|
||||
<span class="floor_content">
|
||||
${rrrxx}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
llxx(ell)
|
||||
el.append(ell)
|
||||
|
||||
})
|
||||
@ -340,61 +326,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
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 = ` <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) {
|
||||
let ff = f(e);
|
||||
if (ff === 1) {
|
||||
if (!window.lz) {
|
||||
window.lz = JSON.parse(e.dataset.info)
|
||||
}
|
||||
ab(e);
|
||||
}
|
||||
let videos = e.querySelectorAll('.video');
|
||||
@ -402,25 +339,7 @@
|
||||
videos.forEach(video => {
|
||||
let src = video.getAttribute('data-vhsrc');
|
||||
let img = video.querySelector('img');
|
||||
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);
|
||||
@ -435,14 +354,6 @@
|
||||
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];
|
||||
@ -565,7 +476,6 @@
|
||||
}
|
||||
|
||||
});
|
||||
killCheckUrl();
|
||||
}
|
||||
|
||||
function lz() {
|
||||
@ -695,10 +605,6 @@
|
||||
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,
|
||||
@ -713,6 +619,7 @@
|
||||
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');
|
||||
@ -724,11 +631,10 @@
|
||||
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('.tb_icon_author_rely');
|
||||
let ki = li.querySelector('span[class="tb_icon_author_rely j_replyer"]');
|
||||
if (!ki) {
|
||||
return;
|
||||
}
|
||||
@ -766,11 +672,11 @@
|
||||
|
||||
li.addEventListener('touchend', evt => {
|
||||
if ((endX - startX) > 100 && Math.abs(endY - startY) <= 100) {
|
||||
let url = li.querySelector('li.tl_shadow>a.ti_item').href;
|
||||
let url = li.querySelector('li.tl_shadow>a.ti_item').dataset.url;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
if ((startX - endX) > 100 && Math.abs(endY - startY) <= 100) {
|
||||
GM.openInTab(li.querySelector('li.tl_shadow>a.ti_item').href, true);
|
||||
location.href = li.querySelector('li.tl_shadow>a.ti_item').dataset.url;
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -802,6 +708,7 @@
|
||||
slio(document.querySelectorAll('#frslistcontent>li'));
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(list, {
|
||||
childList: true,
|
||||
});
|
||||
@ -810,12 +717,12 @@
|
||||
let lis = document.querySelectorAll('li.tl_shadow>a.ti_item');
|
||||
if (lis.length > 0) {
|
||||
lis.forEach(value => {
|
||||
let url = `mo/q/m?kz=${value.dataset.tid}`;
|
||||
let w = value.querySelector('.ti_icon_huati');
|
||||
if (w) {
|
||||
url += '&post_type=normal&'
|
||||
let url = value.href;
|
||||
value.href = 'javascript:void(0);';
|
||||
value.dataset.url = url;
|
||||
value.onclick = (v) => {
|
||||
GM.openInTab(url, true);
|
||||
}
|
||||
value.href = url;
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -872,46 +779,7 @@
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
@ -929,10 +797,7 @@
|
||||
]);
|
||||
|
||||
|
||||
let lxf = document.querySelector('.father-cut-pager-class-no-page')
|
||||
if(lxf){
|
||||
lxf.classList.remove('father-cut-pager-class-no-page');
|
||||
}
|
||||
document.querySelector('.father-cut-pager-class-no-page').classList.remove('father-cut-pager-class-no-page');
|
||||
|
||||
let list = document.querySelector('ul#pblist');
|
||||
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
||||
@ -947,23 +812,6 @@
|
||||
|
||||
}
|
||||
|
||||
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() {
|
||||
@ -1104,13 +952,24 @@
|
||||
|
||||
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;
|
||||
|
||||
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 => {
|
||||
value.addEventListener('click', evt => {
|
||||
@ -1159,7 +1018,6 @@
|
||||
}
|
||||
|
||||
let flag = 0;
|
||||
|
||||
function drop(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -1232,17 +1090,11 @@
|
||||
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');
|
||||
@ -1259,13 +1111,8 @@
|
||||
.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']);
|
||||
|
||||
|
@ -1,48 +0,0 @@
|
||||
// ==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);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})();
|
@ -1,66 +0,0 @@
|
||||
// ==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
|
||||
})
|
||||
}
|
||||
})();
|
Loading…
Reference in New Issue
Block a user