您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Filter model cards by name on electricunicycles.eu and focus input automatically
当前为
// ==UserScript== // @name ElectricUnicycles.eu Filter Models + Focus // @namespace Violentmonkey Scripts // @version 1.1 // @description Filter model cards by name on electricunicycles.eu and focus input automatically // @author You // @match https://www.electricunicycles.eu/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function addFilterInput() { const sortButton = document.getElementById('button_catalog_sort'); if (!sortButton) return; // Create input element const input = document.createElement('input'); input.type = 'text'; input.placeholder = 'Filter models...'; input.style.marginLeft = '10px'; input.style.padding = '5px'; input.style.fontSize = '14px'; input.style.border = '1px solid #ccc'; input.style.borderRadius = '4px'; // Insert the input after the button sortButton.parentNode.insertBefore(input, sortButton.nextSibling); // Focus the input automatically input.focus(); // Listen to input events input.addEventListener('input', function() { const filterText = input.value.trim().toLowerCase(); const modelTitles = document.querySelectorAll('.model-name h4'); modelTitles.forEach(h4 => { const card = h4.closest('.box-store-item'); if (!card) return; const modelName = h4.textContent.trim().toLowerCase(); if (filterText === '' || modelName.includes(filterText)) { card.style.display = ''; } else { card.style.display = 'none'; } }); }); } // Wait for the page to fully load window.addEventListener('load', function() { addFilterInput(); }); })();