From 26b431f1f86c97b787718e99eb68099d3f836617 Mon Sep 17 00:00:00 2001 From: xing Date: Fri, 9 Oct 2020 17:38:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A5=BC=E4=B8=AD=E6=A5=BC=E6=A5=BC=E4=B8=BB?= =?UTF-8?q?=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tieba page.js | 88 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 3 deletions(-) diff --git a/tieba page.js b/tieba page.js index fde8519..ec3fe9b 100644 --- a/tieba page.js +++ b/tieba page.js @@ -1,7 +1,7 @@ // ==UserScript== // @name tieba page // @namespace http://tampermonkey.net/ -// @version 1.010 +// @version 1.011 // @author fthvgb1 // @match https://tieba.baidu.com/* // @match https://tiebac.baidu.com/* @@ -82,6 +82,7 @@ ll.classList.add('j_list_item_floor'); ll.innerHTML = div; ll.setAttribute('data-info', li.dataset.info); + llxx(ll) x.push(ll); }); if (call) { @@ -317,6 +318,8 @@ `; + + llxx(ell) el.append(ell) }) @@ -327,12 +330,58 @@ }); } + 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 = ` 楼主` + let y = ':' + if (window.lz.un === info.un) { + x = i + } + rep.outerHTML = `${xx}` + x + y; + let c = li.querySelector('.floor_content a[href*="/home/main?un="]') + if (c) { + let un = c.href.split('un=')[1]; + un = decodeURI(un); + if (window.lz.un === un) { + c.outerHTML += ` 楼主` + } + } + } + function t() { lz(); $("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'); @@ -341,14 +390,19 @@ let src = video.getAttribute('data-vhsrc'); let img = video.querySelector('img'); let hr = video.getAttribute('data-vsrc'); + if (src) { video.outerHTML = ``; + } else if (hr && hr.indexOf('bilibili.com') > -1) { + let av = hr.match(/av(\d+)/)[1] + video.outerHTML = `` + } else if (hr && hr.indexOf('youku.com') > -1) { let r = hr.split('id_')[1].replace('.html', '') video.outerHTML = `` - } else { - + } else if (hr && hr.indexOf('tudou.com') > -1) { + // 土豆已死,有事请烧纸 悲伤的故事 ......... } }); @@ -365,6 +419,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]; @@ -616,6 +678,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, @@ -772,6 +838,22 @@ } + function lzl() { + let kz = document.querySelector('html').innerHTML.match(/kz: "(\d+)"/)[1]; + let url = `/p/${kz}`; + $.ajax({ + url: url, + async: false, + type: 'get', + success: (res) => { + let html = (new DOMParser()).parseFromString(res, 'text/html'); + let lz = html.querySelector('#pblist li') + window.lz = JSON.parse(lz.dataset.info) + } + }) + + } + function detail() { god(); p();