From 7da7d706dff635c23b07382f6d4752d1a959755e Mon Sep 17 00:00:00 2001 From: xing Date: Mon, 27 Jun 2022 05:03:35 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'tiba.user.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tiba.user.js | 69 ---------------------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 tiba.user.js diff --git a/tiba.user.js b/tiba.user.js deleted file mode 100644 index c4c5d33..0000000 --- a/tiba.user.js +++ /dev/null @@ -1,69 +0,0 @@ -// ==UserScript== -// @name tiba -// @namespace http://tampermonkey.net/ -// @version 0.2 -// @description try to take over the world! -// @author You -// @match https://tieba.baidu.com/* -// @match https://jump2.bdimg.com/* -// @match https://tiebac.baidu.com/* -// @exclude https://*/index -// @exclude https://*/index* -// @match https://*/f?*kw=* -// @connect https://tieba.baidu.com/mg/o/getFloorData -// @connect https://jump2.bdimg.com/mg/o/getFloorData -// @connect https://tiebac.baidu.com/mg/o/getFloorData -// @icon https://tieba.baidu.com/favicon.ico -// @grant GM_addStyle -// ==/UserScript== - -(function() { - '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 = `
`; - 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 - }) - } -})(); \ No newline at end of file