修复bug吧

This commit is contained in:
xing 2020-03-22 16:41:10 +08:00
parent cbf3e24daa
commit 34ae79688e

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name tieba page // @name tieba page
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 0.74 // @version 0.76
// @author fthvgb1 // @author fthvgb1
// @match https://tieba.baidu.com/* // @match https://tieba.baidu.com/*
// @grant GM.openInTab // @grant GM.openInTab
@ -12,7 +12,7 @@
(function () { (function () {
'use strict'; 'use strict';
let obs;
function gif3(v) { function gif3(v) {
let imgs = v.querySelectorAll('img.BDE_Image'); let imgs = v.querySelectorAll('img.BDE_Image');
@ -23,6 +23,9 @@
if (s != null) { if (s != null) {
let x = s.length > 0 ? s[1] : src; let x = s.length > 0 ? s[1] : src;
img.src = decodeURIComponent(x); img.src = decodeURIComponent(x);
img.setAttribute('data-ss', img.src);
img.setAttribute('data-src', src)
} }
}) })
@ -40,7 +43,9 @@
let img = document.createElement('img'); let img = document.createElement('img');
img.src = (ss); img.src = (ss);
img.className = 'BDE_Image'; img.className = 'BDE_Image';
value.outerHTML = img.outerHTML; img.setAttribute('data-src', src);
img.setAttribute('data-ss', ss);
value.outerHTML = `<div class="pb_img_item" data-url="${ss}">${img.outerHTML}</div>`;
} }
}) })
} }
@ -84,6 +89,14 @@
delElement(['#diversBanner', '.j_videoFootDownBtn']); delElement(['#diversBanner', '.j_videoFootDownBtn']);
gif(e); gif(e);
document.querySelector('#pblist').addEventListener('click', event => {
let t = event.target;
if (t.classList.contains('BDE_Image')) {
t.src = t.dataset.src;
obs = t
}
});
let ee = $(e); let ee = $(e);
let bt = e.querySelector('.j_nreply_btn'); let bt = e.querySelector('.j_nreply_btn');
if (bt) { if (bt) {
@ -357,10 +370,15 @@
} }
function detail() { function detail() {
document.querySelector('a[class="ui_button ui_back j_span_back"]').addEventListener('click', event => {
obs.src = obs.dataset.ss
});
let css = document.createElement('style'); let css = document.createElement('style');
css.innerText = ` css.innerText = `#pblist>li:not(.list_item) { display:none; } .ui_image_header_bottom { display:none !important; }`;
#pblist>li:not(.list_item) { display:none; }
`;
document.querySelector('head').append(css); document.querySelector('head').append(css);
document.querySelectorAll('ul#pblist>li').forEach(value => { document.querySelectorAll('ul#pblist>li').forEach(value => {
if (value.classList.contains('class_hide_flag')) { if (value.classList.contains('class_hide_flag')) {
@ -400,7 +418,6 @@
if (!check()) { if (!check()) {
return; return;
} }
let url = location.href;
if (document.querySelector('#pblist')) { if (document.querySelector('#pblist')) {
detail(); detail();