您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hide github fork button for some reason.
当前为
- // ==UserScript==
- // @name Hide github fork button
- // @namespace https://github.com/mozillazg/hide-github-fork-button.user.js
- // @description Hide github fork button for some reason.
- // @version 0.1.0
- // @author mozillazg
- // @include https://github.com/test/*
- // @run-at document-end
- // ==/UserScript==
- (function () {
- "use strict";
- function isContainFork() {
- return (document.querySelectorAll("#fork-destination-box").length !== 0);
- }
- function hideFork() {
- var buttons = document.querySelectorAll(".experiment-repo-nav .pagehead-actions li");
- if (buttons.length > 2) {
- var forkButton = buttons[2];
- forkButton.remove();
- }
- }
- // run
- function run() {
- if (isContainFork()) {
- hideFork();
- }
- }
- // DOM targets - to detect GitHub dynamic ajax page loading
- var targets = document.querySelectorAll([
- "#js-repo-pjax-container",
- "#js-pjax-container"
- ].join(","));
- Array.prototype.forEach.call(targets, function(target) {
- // detect DOM change
- new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- run();
- });
- }).observe(target, {
- childList: true,
- subtree: true
- });
- });
- run();
- })();