您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Support search owners while creating repos on Forgejo/Gogs pages.
// ==UserScript== // @name Forgejo owner search support // @namespace http://tampermonkey.net/ // @version 0.1.4 // @description Support search owners while creating repos on Forgejo/Gogs pages. // @author Scruel Tao // @match http*://*/repo/create // @match http*://*/repo/migrate* // @grant none // ==/UserScript== (function() { 'use strict'; if (document.querySelector('footer').textContent.indexOf('Powered by Gitea') !== -1) { alert('Gitea is a commercial project and has the worst open-source community now, use Forgejo instead.'); return; } const ownerMenuElement = document.querySelector('div.ui.selection.owner.dropdown div.menu'); const itemElements = Array.from(ownerMenuElement.querySelectorAll('div.item')); const inputElement = document.createElement('input'); inputElement.setAttribute("type", "search"); inputElement.setAttribute("placeholder", "Search..."); inputElement.setAttribute("aria-label", "Search"); inputElement.style.setProperty("width", "100%", "important"); inputElement.style.setProperty("position", "sticky"); inputElement.style.setProperty("top", "0"); inputElement.style.setProperty("z-index", "16"); ownerMenuElement.prepend(inputElement); function filterItems() { itemElements.forEach(item => { const itemText = item.innerText.trim().toLowerCase(); if (itemText.indexOf(inputElement.value) == -1) { item.style.setProperty("display", "none", "important"); return; } item.style.removeProperty("display"); }); } inputElement.onkeydown = (e) => { e.stopPropagation(); return true; } inputElement.addEventListener('input', filterItems); })();