您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
更便捷地使用搜索引擎语法,以实现一些过滤功能
当前为
// ==UserScript== // @namespace https://greasyfork.org/zh-CN/users/106222-qxin-i // @name 搜索语法插件 // @name:en search engine grammer plugins // @name:zh 搜索语法插件 // @description 更便捷地使用搜索引擎语法,以实现一些过滤功能 // @description:en More convenient use of search engine syntax to achieve some filtering functions // @description:zh 更便捷地使用搜索引擎语法,以实现一些过滤功能 // @license MIT // @match *://*/* // @exclude *www.bilibili.com/video* // @exclude *www.bilibili.com/v* // @exclude *www.bilibili.com/s/* // @exclude *www.bilibili.com/bangumi* // @exclude https://www.bilibili.com/medialist/play/* // @exclude *www.youtube.com/watch* // @exclude *www.panda.tv* // @exclude *www.github.com* // @exclude https://lanhuapp.com/* // @exclude https://www.douyu.com/* // @exclude https://www.zhihu.com/signin?* // @exclude https://tieba.baidu.com/* // @exclude https://v.qq.com/* // @exclude *.taobao.com/* // @exclude *tmall.com* // @exclude *signin* // @version 0.0.1.20240830092019 // ==/UserScript== (function(){ /** 搜索框输入元素 */ const getBingInputElement = () => document.querySelector("#sb_form_q") /** * 搜索引擎语法 的文本 * TODO 准备通过 UI 来接收用户输入 */ let textPatch = "" /** 基本功能测试 */ class Test{ appendText = " 我" static testGetText() { document.body.onkeyup = (ev) => { let code = ev.code console.log(code); if (code == "F1") { alert(getBingInputElement().value) } } } /** * 输入内容时,添加搜索语法 */ static modifyText() { getBingInputElement().oninput = (ev) => { let e = getBingInputElement() let v = e.value if (!v.endsWith(appendText)) { e.value += appendText console.log("appended! ", e.value); }else{ console.log(e.value) } } } } /** * 双向触发的输入值修改 * 双向:输入内容 与 搜索选项文本补丁 */ class Main { static start(){ textPatch = " " textPatch += "site:-cndn.net" Main.addInputListener(getBingInputElement) } /** * 输入内容 触发的输入值修改 */ static addInputListener(getElementFunc){ getElementFunc().oninput = (ev) => { let e = getBingInputElement() let v = e.value if (!v.endsWith(textPatch)) { e.value += textPatch console.log("appended! ", e.value); }else{ // console.log(e.value) } } } } Main.start() })();