修复回复之类的位置变化

This commit is contained in:
xing 2020-03-29 17:06:59 +08:00
parent ae211c0bd8
commit 119f0b6274

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name tieba page // @name tieba page
// @namespace https://github.com/fthvgb1/tampermonkey-script // @namespace https://github.com/fthvgb1/tampermonkey-script
// @version 0.97 // @version 0.98
// @author fthvgb1 // @author fthvgb1
// @match https://tieba.baidu.com/* // @match https://tieba.baidu.com/*
// @match https://tiebac.baidu.com/* // @match https://tiebac.baidu.com/*
@ -405,11 +405,29 @@
} }
}
function god() {
let targetNode = document.querySelector("#glob");
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
let observer = new MutationObserver((mutations) => {
let m = mutations[0];
if (m.type === 'attributes' && m.attributeName === 'style' && m.target.style.display === 'none') {
m.target.style.display = 'block';
}
});
let observerOptions = {
attributes: true,
attributeFilter: ['style']
};
observer.observe(targetNode, observerOptions);
} }
function detail() { function detail() {
god();
document.querySelector('a[class="ui_button ui_back j_span_back"]').addEventListener('click', event => { document.querySelector('a[class="ui_button ui_back j_span_back"]').addEventListener('click', event => {
obs.src = obs.dataset.ss obs.src = obs.dataset.ss
}); });