您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add two button to copy the jira id and summary
当前为
// ==UserScript== // @name Copy motorola jira id and summary // @name:zh-CN 快速复制jira id和summary // @namespace http://tampermonkey.net/ // @description Add two button to copy the jira id and summary // @description:zh-cn 添加两个按钮用于快速复制motorola jira的id和summary // @author Andy // @version 0.1 // @include https://idart.mot.com/browse/* // @grant GM_addStyle // @run-at document-end // ==/UserScript== (function () { 'use strict'; GM_addStyle(` #snackbar { visibility: hidden; min-width: 250px; margin-left: -125px; background-color: #333; color: #fff; text-align: center; border-radius: 2px; padding: 16px; position: fixed; z-index: 1; left: 50%; top: 50px; font-size: 17px; } #snackbar.show { visibility: visible; -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; animation: fadein 0.5s, fadeout 0.5s 2.5s; } @-webkit-keyframes fadein { from {top: 0; opacity: 0;} to {top: 50px; opacity: 1;} } @keyframes fadein { from {top: 0; opacity: 0;} to {top: 50px; opacity: 1;} } @-webkit-keyframes fadeout { from {top: 50px; opacity: 1;} to {top: 0; opacity: 0;} } @keyframes fadeout { from {top: 50px; opacity: 1;} to {top: 0; opacity: 0;} } `); var observeDOM = (function () { var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; var eventListenerSupported = window.addEventListener; return function (obj, onAddCallback, onRemoveCallback) { if (MutationObserver) { // define a new observer var mutationObserver = new MutationObserver(function (mutations, observer) { if (mutations[0].addedNodes.length && onAddCallback != undefined) { onAddCallback(); } }); // have the observer observe foo for changes in children mutationObserver.observe(obj, { childList: true }); } else if (eventListenerSupported) { obj.addEventListener('DOMNodeInserted', onAddCallback, false); } }; })(); var ff = function () { setTimeout(function () { if (document.getElementById("copy_id") == null) { addCopyBtn(); } }, 0); } var target = document.getElementsByTagName('body')[0]; observeDOM(target, /*onAdd*/ ff, /*onRemove*/ ff); })(); function addCopyBtn() { const body = document.getElementById('stalker'); const issueKey = document.getElementById("key-val"); const issueName = document.getElementById("summary-val"); const divE = document.createElement("div"); divE.id="snackbar"; divE.innerHTML="Copied succesfully" body.appendChild(divE); const newElement = document.createElement("li"); const idE = document.createElement("a"); idE.innerHTML="Copy id"; idE.className="aui-button aui-button-primary aui-style"; idE.id="copy_id"; idE.onclick= (e) => { var snackbar = document.getElementById("snackbar"); snackbar.className = "show"; navigator.clipboard.writeText(issueKey.childNodes[0].data); //console.log("CopyId_"+ issueKey.childNodes[0].data); setTimeout(function(){ snackbar.className = snackbar.className.replace("show", ""); }, 1500); }; newElement.appendChild(idE); issueKey.parentNode.parentNode.appendChild(newElement); const newElement2 = document.createElement("li"); const summaryE = document.createElement("a"); summaryE.className="aui-button aui-button-primary aui-style"; summaryE.innerHTML="Copy summary"; summaryE.id="copy_summary"; summaryE.onclick= (e) => { var snackbar = document.getElementById("snackbar"); snackbar.className = "show"; navigator.clipboard.writeText(issueName.childNodes[0].data); //console.log("CopySummary_"+ issueName.childNodes[0].data); setTimeout(function(){ snackbar.className = snackbar.className.replace("show", ""); }, 1500); }; newElement2.appendChild(summaryE); issueKey.parentNode.parentNode.appendChild(newElement2); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址