init
This commit is contained in:
parent
1ebd75bbad
commit
c8aaee364f
48
贴吧辅助脚本.user.js
Normal file
48
贴吧辅助脚本.user.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
'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