添加部分url

This commit is contained in:
fthvgb1 2020-02-20 15:02:06 +08:00
parent 0d4166cacc
commit c794a4543c

View File

@ -1,14 +1,19 @@
// ==UserScript==
// @name tieba page
// @namespace http://tampermonkey.net/
// @version 0.52
// @version 0.53
// @author fthvgb1
// @match https://tieba.baidu.com/*
// @grant unsafeWindow
// @grant none
// @description 显示手机版贴吧里被隐藏的楼层与翻页按钮
// ==/UserScript==
(function () {
'use strict';
function t() {
lz();
$("ul#pblist>li").forEach(function (e) {
@ -18,7 +23,7 @@ function t() {
var content = ee.find(".list_item_top");
var x = ee.find('.list_item_top a.j_report_btn');
if (x && x.length > 0) {
var kz = x[0].href.match(/tid=(\d+)\&/);
var kz = x[0].href.match(/tid=(\d+)&/);
kz = kz[1];
}
@ -39,17 +44,14 @@ function t() {
if (num === orgnum) {
var url = this.getAttribute('data-url');
//console.log();
$.get(url, function (rst) {
var dom = (new DOMParser()).parseFromString(rst, 'text/html');
var r = dom.querySelector('.j_floor_panel');
var lii = r.querySelectorAll('li');
lii.forEach(function (li, index) {
//console.log(li.className)
if (index < 2) {
return;
}
var username = li.querySelector('.left>div .user_name').outerHTML;
username = username.replace('</a>', ':</a>');
var s = li.querySelector('.content span');
@ -132,10 +134,10 @@ function lz() {
var ff = 0;
if (h.indexOf('see_lz=1') > -1) {
lz.textContent = '取消只看楼主';
h = h.replace('see_lz=1', 'see_lz=0')
h = h.replace('see_lz=1', 'see_lz=0');
ff = 1;
}
lz.addEventListener('click', evt => {
lz.addEventListener('click', () => {
if (ff === 0) {
h = h.indexOf('?') < 0 ? h + '?see_lz=1' : h + '&see_lz=1';
@ -165,10 +167,10 @@ function f(value) {
}
function check() {
let userAgentInfo = navigator.userAgent;
let Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
let flag = 0;
for (let v = 0; v < Agents.length; v++) {
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var flag = 0;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > -1) {
flag = 1;
break;
@ -181,18 +183,18 @@ function list() {
[
'.frs_daoliu_for_app', '.tl_shadow_for_app_modle', '.footer_logo', '.footer_link_highlight'
].forEach(value => {
let x = document.querySelector(value);
var x = document.querySelector(value);
if (x) {
x.parentNode.removeChild(x)
}
});
let ads = document.querySelectorAll('li.tl_shadow_for_app');
var ads = document.querySelectorAll('li.tl_shadow_for_app');
if (ads.length > 0) {
let url = document.querySelector('.tl_shadow_for_app').parentNode.querySelector('a.j_common').href;
var url = document.querySelector('.tl_shadow_for_app').parentNode.querySelector('a.j_common').href;
ads.forEach(v => {
//v.classList.remove('tl_shadow_for_app');
let a = v.querySelector('a.j_enter_for_app');
let tid = v.getAttribute('data-tid');
var a = v.querySelector('a.j_enter_for_app');
var tid = v.getAttribute('data-tid');
a.href = url.replace(/\/(\d+)\?/.exec(url)[1], tid);
a.classList.remove('tl_shadow_for_app');
})
@ -232,16 +234,15 @@ function detail() {
})
}
(function () {
'use strict';
let url = location.href;
if (check()) {
var url = location.href;
if (/\/p\/\d+/.test(url)) {
if (/\/p\/\d+/.test(url) || /\/mo\/(.*)\/m\?kz=\d+/.test(url)) {
detail();
}
if (/f\?kw=.+/.test(url) || /mo\/q\/m\?word=.+/.test(url)) {
if (/f\?kw=.+/.test(url) || /mo\/q\/m\?word=.+/.test(url) || /\/mo\/(.*)\/m\?kw=/.test(url)) {
list();
}
}
})();