您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add border to directory icons with Material Icons chrome extension and make them clickable
当前为
// ==UserScript== // @name Directory Buttons for GitHub Material Icons // @namespace https://github.com/DenverCoder1 // @match https://github.com/* // @grant none // @version 1.0.0 // @author Jonah Lawrence // @license MIT // @description Add border to directory icons with Material Icons chrome extension and make them clickable // ==/UserScript== /*jshint esversion: 11 */ (function () { // add directory icon border styling const styles = ` img[aria-label="Directory"] { box-shadow: 0px 0px 0px 2px var(--color-canvas-default), 0px 0px 0px 3px var(--color-border-default); border-radius: 1px; transform: scale(1.15); background: var(--color-canvas-default); cursor: pointer; } img[aria-label="Directory"]:hover { filter: brightness(1.25); } `; document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", "<style>" + styles + "</style>"); // detect click on directory icons document.addEventListener("click", (el) => { // if the click is in a directory icon, get the href of the first link in the containing row and redirect to it const link = el.target.closest('img[aria-label="Directory"]')?.closest(".Box-row")?.querySelector("a")?.href; if (link) { window.location.href = link; } }); })();