// ==UserScript== // @name Stage1st 临时搜索 // @namespace http://tampermonkey.net/ // @version 2.0 // @description 给s1加个临时搜索框 // @author Youmiya Hina // @match https://stage1st.com/2b/*.html // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; const searchContainer = document.createElement('div'); searchContainer.style.cssText = ` margin: 20px auto; padding: 15px; background: #f5f5f5; border-radius: 4px; max-width: 800px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); `; searchContainer.innerHTML = `
`; const targetNode = document.querySelector('.bm.wp.cl') || document.body; targetNode.insertAdjacentElement('afterbegin', searchContainer); const performSearch = () => { const keyword = document.getElementById('s1SearchInput').value.trim(); if (!keyword) return; const encodedQuery = encodeURIComponent(`allintitle: ${keyword} site:stage1st.com`); const searchUrl = `https://www.google.com/search?q=${encodedQuery}`; window.open(searchUrl, '_blank'); }; document.getElementById('s1SearchBtn').addEventListener('click', performSearch); document.getElementById('s1SearchInput').addEventListener('keypress', e => { if (e.key === 'Enter') performSearch(); }); })();