您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add floating button to show/hide issue comments of GitHub Issues, to see discussion events / references easier.
- // ==UserScript==
- // @name Show/Hide issue comments for GitHub Issues
- // @namespace http://kyanny.me/
- // @version 1.0.0
- // @description Add floating button to show/hide issue comments of GitHub Issues, to see discussion events / references easier.
- // @author Kensuke Nagae
- // @match https://github.com/*/*/issues/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var button = document.createElement('button');
- button.setAttribute('style', 'position: fixed; top: 10px; right: 5px;');
- button.setAttribute('data-display', "block");
- var text = document.createTextNode('Show/Hide comments');
- button.appendChild(text);
- button.onclick = function() {
- var display = button.getAttribute('data-display');
- var comments = Array.prototype.slice.call(document.querySelectorAll('.js-comment-container'));
- if (display === "hidden") {
- // Show
- Array.forEach(comments, function(comment) {
- comment.style = 'display: block';
- });
- button.setAttribute('data-display', "block");
- } else {
- // Hide
- Array.forEach(comments, function(comment) {
- comment.style = 'display: none';
- });
- button.setAttribute('data-display', "hidden");
- }
- };
- document.body.appendChild(button);
- })();