您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This script calls the Jira user API, resolves user IDs in the Jira audit log and replaces them with the display names.
- // ==UserScript==
- // @name Resolve audit log user IDs
- // @namespace http://schuppentier.org/
- // @version 2024-02-19
- // @description This script calls the Jira user API, resolves user IDs in the Jira audit log and replaces them with the display names.
- // @author You
- // @match https://*.atlassian.net/auditing/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=atlassian.net
- // @grant none
- // @require https://bowercdn.net/c/arrive-2.4.1/minified/arrive.min.js
- // @license MIT
- // ==/UserScript==
- /* jshint esversion: 8 */
- (function() {
- 'use strict';
- const resolveUserId = async (userId) => {
- const userResponse = await fetch(`/rest/api/3/user?accountId=${userId}`);
- const userObject = await userResponse.json();
- const userDisplayName = userObject.displayName;
- return userDisplayName;
- };
- document.arrive("span.delta-from, span.delta-to", async (elem) => {
- const detailsRow = elem.closest("tr.record-row-details");
- const recordRow = detailsRow.previousElementSibling;
- const summary = recordRow.querySelector("td.summary").innerText;
- if (summary != "Project roles changed") {
- return;
- }
- const fromElem = detailsRow.querySelector("span.delta-from");
- const toElem = detailsRow.querySelector("span.delta-to");
- var fromUserIds = new Set(fromElem.innerText.split(",").map(item => item.trim()));
- var toUserIds = new Set(toElem.innerText.split(",").map(item => item.trim()));
- const duplicateUserIds = fromUserIds.intersection(toUserIds);
- fromUserIds = fromUserIds.difference(duplicateUserIds);
- toUserIds = toUserIds.difference(duplicateUserIds);
- const fromUserNames = await Promise.all(fromUserIds.map(resolveUserId));
- const toUserNames = await Promise.all(toUserIds.map(resolveUserId));
- fromElem.innerText = fromUserNames.join(", ");
- toElem.innerText = toUserNames.join(", ");
- });
- })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址