您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
// ==UserScript== // @name add copy text to jira // @namespace http://tampermonkey.net/ // @version 0.3 // @description try to take over the world! // @author You // @match https://jira.reflex-systems.nl/jira/secure/* // @icon https://www.google.com/s2/favicons?sz=64&domain=reflex-systems.nl // @grant none // ==/UserScript== window.addEventListener('load', function() { 'use strict'; function copy() { var titleText = document.querySelectorAll('[data-field-id="issuekey"]')[0].children[0].text; var summaryText = document.querySelectorAll('[data-field-id="summary"]')[0].textContent; navigator.clipboard.writeText(`${titleText} ${summaryText}`); } function createCopyButton() { let btn = document.createElement("button"); btn.innerHTML = "Copy"; btn.className = 'aui-button ghx-actions aui-button-compact'; btn.id = 'copy-button'; btn.addEventListener("click", copy); return btn; } const observer = new MutationObserver(mutations => { var x = document.querySelectorAll('#copy-button'); if(x.length <= 0){ var btn = createCopyButton(); let z = document.getElementsByClassName('ghx-controls')[0]; z.prepend(btn); console.log('hi'); } }); observer.observe(document.body, { childList: true, subtree: true }); })