您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add code of badge markdown to CI result pages in pre-commit.ci
// ==UserScript== // @name Add badge markdown to pre-commit.ci // @namespace http://tampermonkey.net/ // @version 0.1 // @description Add code of badge markdown to CI result pages in pre-commit.ci // @author eggplants // @homepage https://github.com/eggplants // @match *://results.pre-commit.ci/run/github/* // @grant none // @license MIT // ==/UserScript== /*jshint esversion: 6 */ (function() { "use strict"; const badge_base = "https://results.pre-commit.ci"; const result_pathes = document.querySelectorAll("h2.pc-header.mb-3>a"); const owner = result_pathes[0].innerText; const project = result_pathes[1].innerText; const branch = result_pathes[2].innerText; const badge_src = `${badge_base}/badge/github/${owner}/${project}/${branch}.svg`; const badge_href = `${badge_base}/latest/github/${owner}/${project}/${branch}`; const badge_area = document.createElement("div"); const badge_img = document.createElement("img"); badge_img.src = badge_src; const p_img = document.createElement("p"); p_img.textContent = "badge preview: "; p_img.appendChild(badge_img); badge_area.appendChild(p_img); const badge_clip = document.createElement("input"); badge_clip.value += `[](${badge_href})`; badge_clip.readOnly = true; const p_clip = document.createElement("p"); p_clip.textContent = "markdown badge: "; p_clip.appendChild(badge_clip); badge_area.appendChild(p_clip); const target_parent = document.querySelector("div.container.bg-light.text-dark.py-5"); const target = document.querySelector("div.pc-results.border.rounded.p-2"); target_parent.insertBefore(badge_area, target); })();