// ==UserScript==
// @name Bugzilla Script
// @namespace xiwenge
// @version 0.61.0
// @description 美化增强 Bugzilla 页面
// @author xiwenge
// @icon https://www.bugzilla.org/assets/img/logo-header.svg
// @match *://192.168.1.31/bugzilla*
// @match *://192.168.1.31/bugzilla/show_bug.cgi*
// @match *://192.168.1.31/bugzilla/buglist.cgi*
// @match *://192.168.1.31/bugzilla/query.cgi*
// @match *://192.168.1.31/bugzilla/summarize_time.cgi*
// @match *://192.168.1.31/bugzilla/attachment.cgi*
// @match *://192.168.1.31/bugzilla/enter_bug.cgi*
// @match *://192.168.1.31/bugzilla/describecomponents.cgi*
// @match *://192.168.1.31/bugzilla/show_activity.cgi*
// @match *://192.168.1.31/bugzilla/process_bug.cgi*
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @run-at document-end
// ==/UserScript==
(function () {
"use strict";
const kt = `
/**
* 全局样式
* 在这里书写的样式会被编译为 style/index.ts,成为一个 js 模块
*/
body {
margin: 0 !important;
padding: 13px !important;
--primaryColor: #18A058;
--primaryColorHover: #15904e;
--textGrayColor: #b1b1b1;
}
/* 滚动条整体样式 */
::-webkit-scrollbar {
width: 12px;
/* 滚动条宽度 */
}
/* 滚动条轨道样式 */
::-webkit-scrollbar-track {
background: #f1f1f1;
/* 轨道背景色 */
border-radius: 12px;
/* 轨道圆角 */
}
/* 滚动条滑块样式 */
::-webkit-scrollbar-thumb {
background: #b9bbbd;
/* 滑块背景色 */
border-radius: 12px;
/* 滑块圆角 */
}
/* 滑块在悬停时的样式 */
::-webkit-scrollbar-thumb:hover {
cursor: pointer;
background: #a6a9ac;
/* 悬停时的背景色 */
transform: scale(1.2);
/* 悬停时放大 */
}
/* 横向滚动条整体样式 */
::-webkit-scrollbar:horizontal {
height: 12px;
/* 横向滚动条高度 */
}
/* 横向滚动条轨道样式 */
::-webkit-scrollbar-track:horizontal {
background: #f1f1f1;
/* 轨道背景色 */
border-radius: 12px;
/* 轨道圆角 */
}
/* 横向滚动条滑块样式 */
::-webkit-scrollbar-thumb:horizontal {
background: #b9bbbd;
/* 滑块背景色 */
border-radius: 12px;
/* 滑块圆角 */
}
/* 横向滑块在悬停时的样式 */
::-webkit-scrollbar-thumb:hover:horizontal {
cursor: pointer;
background: #a6a9ac;
/* 悬停时的背景色 */
transform: scale(1.2);
/* 悬停时放大 */
}
#header .links .form form,
#footer .links .form form {
display: inline-flex !important;
align-items: center;
}
#header {
position: sticky;
top: 0px;
z-index: 1999;
}
#header #title {
display: block;
width: 270px;
}
.monaco-editor {
width: 100% !important;
height: 100% !important;
}
.navigation {
padding: 2px;
display: flex;
align-items: center;
}
.bz_query_buttons[valign='middle'] {
display: flex;
}
.bz_query_buttons[valign='middle'] form:not(:last-child) {
margin-right: 10px;
}
.custom-button {
display: inline-flex;
align-items: center !important;
width: fit-content !important;
height: 28px;
background-color: var(--primaryColor);
border-radius: 4px !important;
color: #fff;
inset: 0;
opacity: 1;
transition-duration: 0.3s;
transition-property: box-shadow, opacity, color, border;
padding: 4px 12px !important;
font-weight: 400;
font-size: 12px;
margin: 0 5px;
box-sizing: border-box;
text-decoration: none;
line-height: 18px;
border: 1px solid transparent;
user-select: none;
}
.custom-button:hover {
height: 28px;
cursor: pointer;
color: #fff !important;
background-color: var(--primaryColorHover);
}
.custom-button:visited {
color: #fff;
}
.plain-button {
background: #ffffff !important;
color: #757575 !important;
border: 1px solid #cccccc !important;
text-decoration: none !important;
}
.plain-button:hover {
height: 28px;
color: var(--primaryColor) !important;
border: 1px solid var(--primaryColor) !important;
}
.text-button {
background: transparent !important;
color: #4a4a4a !important;
border: none !important;
text-decoration: none !important;
}
.text-button:hover {
cursor: pointer;
color: #4a4a4a !important;
box-shadow: none !important;
}
.disabled-button {
cursor: not-allowed !important;
border-color: #d9d9d9 !important;
color: rgba(0, 0, 0, 0.25) !important;
background: rgba(0, 0, 0, 0.04) !important;
box-shadow: none !important;
pointer-events: none !important;
}
.disabled-button:hover {
cursor: not-allowed !important;
border-color: #d9d9d9 !important;
color: rgba(0, 0, 0, 0.25) !important;
box-shadow: none !important;
}
.field_label {
vertical-align: middle !important;
}
select {
height: 28px;
border-radius: 4px;
padding: 4px;
border-color: #d9d9d9;
box-sizing: border-box;
}
select:hover {
cursor: pointer;
}
select:focus-visible {
outline: #d9d9d9;
}
#available_columns,
#selected_columns {
height: 300px;
display: block;
margin-right: 4px;
}
#assigned_to_list_vue_app {
height: 28px;
}
#assigned_to_list_vue_app .n-base-selection-label {
height: 28px;
}
input:not([class="n-input__input-el"])[type='checkbox']:hover {
cursor: pointer;
}
input:not([class="n-input__input-el"])[type='radio']:hover {
cursor: pointer;
}
input:not([class="n-input__input-el"]):not([type='radio']):not([type='checkbox']):not([type='range']):not([type='color']):not([type='hidden']):not([type='reset']):not([type='file']) {
height: 28px !important;
border-radius: 4px;
padding: 0 6px;
outline: 0px solid transparent;
border: 1px solid #d9d9d9;
box-sizing: border-box;
}
textarea {
border-radius: 4px;
padding: 4px;
outline: 0px solid transparent;
border: 1px solid #d9d9d9;
}
#status {
margin-bottom: unset;
align-items: center;
display: flex;
margin-top: 3px;
}
.knob-buttons:has(input[id='commit']) {
margin-top: 4px;
}
#bug_status {
margin: 0 6px;
}
.bz_section_spacer {
display: none;
}
#bz_assignee_input {
width: 543px;
}
#set_default_assignee_label {
display: none;
}
#set_default_assignee {
display: none;
}
.bz_assignee_td {
display: flex;
align-items: center;
width: 598px;
}
#bz_show_bug_column_1 tr th {
min-height: 34px !important;
}
#bz_show_bug_column_1 tr:has(th[id='field_label_tag']) {
transform: translateY(2px);
}
#bz_show_bug_column_1 tr:has(th[id='field_label_dependson']) {
transform: translateY(4px);
}
#bz_show_bug_column_1 tr:has(th[id='field_label_blocked']) {
transform: translateY(6px);
}
#bz_show_bug_column_1 tr:has(td[id='show_dependency_tree_or_graph']) {
display: none;
}
#bz_show_bug_column_1 tr td {
min-height: 34px !important;
}
#bz_show_bug_column_2 .field_label {
vertical-align: middle !important;
max-width: 200px;
}
#bz_show_bug_column_2 table tr td {
max-width: 100%;
}
#cf_newfeatureid {
width: 100%;
}
.global-message {
width: fit-content;
height: fit-content;
padding: 8px 24px;
box-sizing: border-box;
display: inline-flex;
align-items: center;
position: fixed;
left: 50%;
transform: translate(-50%, -50%);
z-index: 99999999;
background-color: #ffffff;
border-radius: 4px;
transition: opacity 0.5s ease-in-out, top 0.5s ease-in-out;
animation: message-fadein 0.5s ease-in-out forwards;
box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2);
}
.global-message_text {
margin-left: 8px;
font-size: 14px;
}
@keyframes message-fadein {
0% {
opacity: 0.5;
top: 10px;
}
100% {
opacity: 1;
top: 30px;
}
}
@keyframes dialog-fadein {
0% {
opacity: 0.5;
top: 46%;
}
100% {
opacity: 1;
top: 50%;
}
}
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.global-dialog {
height: fit-content;
max-width: 100vw;
max-height: 100vh;
z-index: 9999;
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
background-color: #ffffff;
border-radius: 4px;
transition: opacity 0.5s ease-in-out, top 0.5s ease-in-out;
animation: dialog-fadein 0.5s ease-in-out forwards;
}
.global-dialog .control-btn:hover {
cursor: pointer;
}
.global-dialog .control-btn:not(:last-child) {
margin-right: 8px;
}
.global-dialog .close-btn:hover {
filter: drop-shadow(0px 0px 2px #ff5953);
}
.global-dialog .exit-full-screen-btn:hover {
filter: drop-shadow(0px 0px 2px #fabe33);
}
.global-dialog .full-screen-btn:hover {
filter: drop-shadow(0px 0px 2px #53c32b);
}
.global-dialog-header {
padding: 6px 12px;
background-color: #f5f5f5;
border-radius: 4px 4px 0 0;
}
.global-dialog-footer {
padding: 6px 12px;
background-color: #f5f5f5;
border-radius: 0 0 4px 4px;
display: flex;
justify-content: flex-end;
box-sizing: border-box;
}
.global-dialog-body {
max-width: 100%;
max-height: calc(100% - 68px);
height: 100%;
padding: 12px 24px;
overflow-y: auto;
overflow-x: auto;
box-sizing: border-box;
}
.global-dialog-mask {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.global-dialog-mask-transparent {
background-color: transparent;
}
.global-loading {
width: 100%;
height: 100%;
position: relative;
}
.global-loading::after {
content: "";
width: 20px;
height: 20px;
border: 2px solid var(--primaryColor);
border-left: 2px solid transparent;
border-radius: 50%;
position: absolute;
top: calc(50% - 10px);
left: calc(50% - 10px);
transform: translate(-50%, -50%);
animation: loading 1.5s infinite linear;
background-color: transparent;
}
.self-rotate {
animation: loading 1.5s infinite linear;
}
.attachment-container {
width: 100%;
height: 100%;
overflow-y: auto;
overflow-x: auto;
}
.flex {
display: flex;
}
.flex-wrap {
flex-wrap: wrap;
}
.flex-center {
display: flex;
justify-content: center;
align-items: center;
}
.flex-align-center {
display: flex;
align-items: center;
}
.flex-justify-center {
display: flex;
justify-content: center;
}
.flex-justify-space-between {
display: flex;
justify-content: space-between;
}
.flex-justify-end {
display: flex;
justify-content: flex-end;
}
.show {
display: block;
}
.hide {
display: none;
}
.cursor-pointer:hover {
cursor: pointer;
}
.text-underline {
text-decoration: underline;
}
.font-size-16px {
font-size: 16px;
}
.font-bold {
font-weight: bold;
}
.margin-right-8px {
margin-right: 8px;
}
.margin-left-8px {
margin-left: 8px;
}
.margin-bottom-8px {
margin-bottom: 8px;
}
.margin-top-8px {
margin-top: 8px;
}
.link-title {
font-weight: bold;
transition: all 0.3s ease-in-out;
}
.link-title:hover {
color: var(--primaryColor) !important;
text-decoration: unset !important;
}
.separator {
margin: 0 6px 0 4px;
color: #cccccc;
}
.links .form a[title="Quicksearch Help"] {
margin-left: 6px;
}
#attachment_table {
border: 1px solid #d9d9d9;
}
#attachment_table td {
border: 1px solid #d9d9d9;
}
#attachment_table tr td[valign="top"]:nth-child(2):has(a) {
display: flex;
justify-content: center;
align-items: center;
}
.bz_short_desc_column a {
color: #595959;
font-weight: bold;
}
#summary_field.search_field_row input {
padding-bottom: unset !important;
vertical-align: middle;
}
#short_desc {
padding-bottom: unset !important;
}
#summary_field.search_field_row select {
padding-bottom: 4px;
vertical-align: middle;
}
.bz_quip {
display: block;
color: var(--textGrayColor);
font-weight: bold;
font-size: 12px;
font-style: italic;
margin-top: 8px;
font-family: '黑体';
}
.bz_query_timestamp {
color: var(--textGrayColor);
font-style: normal;
font-size: 14px;
display: inline-block;
font-family: '黑体';
}
.n-base-selection__border,
.n-base-selection__state-border {
display: none;
}
.n-checkbox .n-checkbox-box .n-checkbox-icon {
transform: rotate(-12deg) translate(0.5px, 1px);
}
#setting-city {
display: inline-block;
color: var(--primaryColor);
}
#setting-city:hover {
cursor: pointer;
}
#setting-city svg {
transition: all 0.3s;
transform: translateY(3px);
font-size: 16px;
}
#component_list_vue_app {
height: 28px;
width: 400px;
}
#component_list_vue_app .n-base-selection-label {
height: 28px;
}
#version_list_vue_app {
height: 28px;
width: 400px;
}
#version_list_vue_app .n-base-selection-label {
height: 28px;
}
#cc_list_vue_app {
height: 28px;
width: 400px;
}
#cc_list_vue_app .n-base-selection-label {
height: 28px;
}
#newcc_list_vue_app {
height: 28px;
width: 400px;
}
#newcc_list_vue_app .n-base-selection-label {
height: 28px;
}
#feature_list_vue_app {
height: 28px;
min-width: 200px;
max-width: 800px;
width: 100%;
}
#feature_list_vue_app .n-base-selection-label {
height: 28px;
}
#search_history_list_vue_app_top,
#search_history_list_vue_app_bottom {
height: 28px;
width: 120px;
max-width: 200px;
}
#search_history_list_vue_app_top .n-base-selection-label,
#search_history_list_vue_app_bottom .n-base-selection-label {
height: 28px;
border-radius: 4px;
}
#comp_desc_container {
display: none;
}
#comp_desc {
height: fit-content;
}
.validation_error_text {
font-size: 12px;
color: #e80505;
font-weight: 400;
}
.bug-new_filename {
color: grey;
font-weight: 600;
margin-left: 6px;
}
.collection-list-title:hover {
cursor: pointer;
color: var(--primaryColor);
}
#titles #subtitle {
font-weight: 600;
}
.bz_alias_short_desc_container.edit_form {
padding: 10px;
}
.margin-0 {
margin: 0;
}
.mt-5 {
margin-top: 5px;
}
.ml-5 {
margin-left: 5px;
}
.mr-5 {
margin-right: 5px;
}
.mb-5 {
margin-bottom: 5px;
}
.n-base-selection-placeholder {
font-size: 12px;
}
`;
var S = ((e) => ((e.SUCCESS = "success"), (e.ERROR = "error"), e))(S || {});
const ue = (e, ...n) => {
if (e && typeof e == "function") return e(...n);
};
var pe = ((e) => (
(e.MONACO =
"https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs/loader.min.js"),
(e.VUE =
"https://cdnjs.cloudflare.com/ajax/libs/vue/3.5.13/vue.global.prod.min.js"),
(e.NAIVE_UI =
"https://cdnjs.cloudflare.com/ajax/libs/naive-ui/2.40.1/index.prod.js"),
(e.CRYPTO_JS =
"https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js"),
e
))(pe || {});
const J = ({
title: e = "",
body: n,
footer: t,
maskTransparent: o = !1,
okText: a = "确定",
cancelText: l = "取消",
onOk: i,
onCancel: c,
hideOk: r = !1,
hideCancel: s = !1,
className: d = "",
bodyClassName: u = "",
style: m = "",
bodyStyle: b = "",
onMount: h = () => {},
onDestroy: y = () => {},
}) => {
let E = 0,
T = 0,
N;
const B = 9999 + document.querySelectorAll(".global-dialog").length,
C = document.createElement("div");
o && C.classList.add("global-dialog-mask-transparent");
const L = document.createElement("div"),
I = document.createElement("div");
(I.style.display = "flex"), (I.style.alignItems = "center");
const q = document.createElement("div"),
G = document.createElement("div");
G.style.display = "inline-block";
const O = document.createElement("div"),
W = document.createElement("div");
O.classList.add("flex-center"),
(O.style.width = "calc(100% - 64px)"),
O.appendChild(W),
(W.style.transform = "translateX(-32px)"),
(W.innerText = e);
const U = document.createElement("span");
U.title = "关闭弹窗(Esc)";
const P = document.createElement("span");
P.title = "退出全屏";
const K = document.createElement("span");
K.title = "全屏显示";
const Ae = ``,
ne = ``,
oe = ``;
(U.innerHTML = Ae),
U.classList.add("control-btn"),
U.classList.add("close-btn"),
(P.innerHTML = ne),
P.classList.add("control-btn"),
P.classList.add("exit-full-screen-btn"),
(K.innerHTML = oe),
K.classList.add("control-btn"),
K.classList.add("full-screen-btn");
const xe = new ResizeObserver((z) => {
for (const ae of z)
if (!N) (E = ae.contentRect.width), (T = ae.contentRect.height);
else if (((q.style.width = "100%"), q != null && q.firstChild)) {
const se = q.firstChild;
(se.style = se.style ?? ""),
(se.style.width = "100%"),
(se.style.height = "100%");
}
});
xe.observe(L);
const X = () => {
document.removeEventListener("keydown", $),
document.removeEventListener("keydown", Se);
const z = L.animate(
[
{ opacity: 1, top: "50%" },
{ opacity: 0, top: "46%" },
],
{ duration: 500, easing: "ease-in-out", fill: "forwards" },
);
z.onfinish = () => {
z.cancel(),
document.body.removeChild(C),
document.querySelectorAll(".global-dialog").length === 0 &&
(document.body.style.overflow = "auto"),
(N = !1),
xe.disconnect(),
y();
};
};
U.addEventListener("click", () => {
X();
}),
P.addEventListener("click", () => {
N &&
((N = !1),
(L.style.width = `${Math.ceil(E)}px`),
(L.style.height = `${Math.ceil(T)}px`));
}),
K.addEventListener("click", () => {
N ||
((N = !0),
(L.style.width = "100%"),
(L.style.height = "99.6%"),
(L.style.transform = "translate(-50%, -50.4%)"),
(q.style.width = "100%"),
(q.style.height = "100%"));
}),
G.appendChild(U),
G.appendChild(P),
G.appendChild(K),
I.appendChild(G),
I.appendChild(O),
I.classList.add("global-dialog-header"),
q.classList.add("global-dialog-body");
const Q = document.createElement("div");
if (
(C.classList.add("global-dialog-mask"),
L.classList.add("global-dialog"),
d && L.classList.add(d),
m && (L.style = m),
u && q.classList.add(u),
b && (q.style = b),
typeof t == "string")
)
Q.innerHTML = t;
else if (t) Q.appendChild(t);
else if (t !== !1 && t !== null) {
if ((Q.classList.add("global-dialog-footer"), !r)) {
const z = document.createElement("div");
z.classList.add("custom-button"),
(z.innerText = a + " (Enter)"),
z.addEventListener("click", () => {
ue(i, X);
}),
Q.appendChild(z);
}
if (!s) {
const z = document.createElement("div");
z.classList.add("custom-button"),
z.classList.add("plain-button"),
(z.innerText = l + " (Esc)"),
z.addEventListener("click", async () => {
((await ue(c)) ?? !0) && X();
}),
Q.appendChild(z);
}
}
typeof n == "string" ? (q.innerHTML = n) : q.appendChild(n),
L.appendChild(I),
L.appendChild(q),
L.appendChild(Q),
(C.style.zIndex = `${B}`),
C.appendChild(L),
document.body.appendChild(C),
(document.body.style.overflow = "hidden");
const Se = (z) => {
z.key === "Escape" && X();
},
$ = (z) => {
z.key === "Enter" && ue(i, X);
};
document.addEventListener("keydown", $),
document.addEventListener("keydown", Se),
h();
},
Re = (e = "width: 400px; height: 225px;") => {
const n = document.createElement("div");
return n.classList.add("global-loading"), (n.style = e), n;
},
Le = (e) =>
new Promise((n, t) => {
GM_xmlhttpRequest({
method: "GET",
url: e,
onload: (o) => {
const a = document.createElement("script");
(a.textContent = o.responseText),
document.head.appendChild(a),
n(!0);
},
onerror: t,
});
}),
Ct = (e = {}) =>
new Promise(async (n) => {
const t = Re("width: 100%; height: 100%"),
o = document.createElement("div");
(o.style.width = "100%"), (o.style.height = "100%");
const a = document.createElement("div");
a.classList.add("attachment-container"),
a.classList.add("hide"),
o.appendChild(t),
o.appendChild(a),
J({
body: o,
bodyStyle: "width: 80vw; height: 80vh;",
okText: "保存",
...e,
});
const l = () => {
require.config({
paths: {
vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs",
},
}),
require(["vs/editor/editor.main"], () => {
t.classList.add("hide"),
a.classList.remove("hide"),
a.classList.add("show"),
n({ monaco, editorNode: a });
});
};
await Le(pe.MONACO), l();
}),
w = (e, n, t = 2e3) => {
const o = document.querySelector(".global-message");
o && document.body.removeChild(o);
const a =
'',
l =
'',
c = `
${new Map([
["success", a],
["error", l],
]).get(e)}
`,
r = document.createElement("div");
let s = null;
return (
r.classList.add("global-message"),
(r.innerHTML = c),
document.body.appendChild(r),
(s = setTimeout(() => {
const d = r.animate(
[
{ opacity: 1, top: "30px" },
{ opacity: 0, top: "10px" },
],
{ duration: 500, easing: "ease-in-out", fill: "forwards" },
);
d.onfinish = () => {
var u;
d.cancel(),
r && ((u = document.body) == null || u.removeChild(r)),
clearTimeout(s);
};
}, t)),
() => {
var d;
r && ((d = document.body) == null || d.removeChild(r)),
clearTimeout(s);
}
);
},
Bt = {
anbin: "安斌",
anna: "柏红梅",
annabai: "柏红梅",
BrukcalLi: "李林浩",
lilinhao: "李林浩",
cehn: "王笑晨",
cehnwang: "王笑晨",
cesar: "陈述",
cesarchen: "陈述",
cherry: "兰春花",
Cherrylan: "兰春花",
chuwanting: "储婉婷",
chenxiaoxia: "陈晓霞",
dizizhao: "狄子钊",
dingjiaju: "丁佳驹",
fiona: "牟卫灵",
fionam: "牟卫灵",
frank: "席小丁",
frankxi: "席小丁",
xiwenge: "郗文革",
fuge: "付戈",
harehe: "何小波",
huanglin: "黄林",
huangqing: "黄青",
huangxudong: "黄旭东",
huangyifei: "黄一非",
huangyueqi: "黄月琪",
huangyou: "黄友",
humming: "马云",
hummingma: "马云",
huqing: "胡青",
jenny: "王亮",
jennywang: "王亮",
jiangqianqian: "姜倩倩",
jiangjiacheng: "蒋佳成",
jizeyu: "纪泽宇",
joe: "周强",
zhouqiang: "周强",
jose: "赖振海",
joselai: "赖振海",
kevin: "张亚峰",
lidehua: "李德华",
lifuyi: "李福一",
lihaichuan: "李海川",
liju: "李桔",
lilei: "李雷",
linchao: "林超",
lisa: "姚艳丽",
lisayao: "姚艳丽",
liubowen: "刘博文",
liuxu: "刘旭",
liuyicheng: "刘伊铖",
lixianxiang: "李先祥",
lixiaoyi: "李小益",
liyandong: "李彦东",
lucy: "赵亚兰",
lucyzhao: "赵亚兰",
luoshengming: "罗圣明",
magina: "刘松平",
maginaliu: "刘松平",
Majun: "马军",
majun: "马军",
mandyyang: "杨曼",
maqingbin: "马庆宾",
mijie: "米杰",
sandywang: "王硕",
shenbei: "申倍",
demanshen: "申倍",
shenfangshuai: "申方帅",
shenxiang: "沈祥",
shikun: "石坤",
larryshi: "石坤",
liutianrui: "刘添瑞",
sunfeng: "孙丰",
stevensun: "孙丰",
shizhipeng: "石志鹏",
songjie: "宋杰",
steven: "刘洋",
stevenliu: "刘洋",
talk: "陈涛",
talkchen: "陈涛",
tangshuangxiao: "唐霜晓",
tianmaosheng: "田茂生",
una: "高秋涵",
Unagao: "高秋涵",
vern: "张超",
Vernzhang: "张超",
wangdandan: "王丹丹",
wangfeiyan: "王飞燕",
wanghairong: "王海容",
wuguangmin: "吴光敏",
wangshijie: "王世杰",
wangyi: "王屹",
weiliangpeng: "韦良鹏",
wendy: "吴红省",
wuhaidong: "吴海东",
wuhongsheng: "吴红省",
wendywu: "吴红省",
xuhang: "徐航",
yanghuanhuan: "杨欢欢",
yangmingxuan: "杨明轩",
yanieye: "叶伟",
yafengzhang: "张亚峰",
yihuan: "王义欢",
yihuanwang: "王义欢",
zengchenglong: "曾成龙",
zhangrunsheng: "张润生",
gausszhang: "张润生",
zhangyingqi: "张莹琦",
zhangzheyi: "张喆懿",
zhaozuwen: "赵祖雯",
zhengsong: "郑松",
"zhengsong.ext": "郑松",
zhoulin: "周林",
zhuhewei: "朱赫伟",
test: "永洪测试",
yonghong: "永洪测试",
yonghongcode: "永洪测试",
yonghongdoc: "永洪测试",
},
It = [
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_1 tr:has(td[id='bz_field_status'])",
label: "Status",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_1 tr:has(td[id='field_container_product'])",
label: "Product",
},
{
show: !0,
disabled: !1,
value:
"#bz_show_bug_column_1 tr:has(td[id='field_container_component'])",
label: "Component",
},
{
show: !0,
disabled: !0,
value: "#bz_show_bug_column_1 tr:has(th[id='field_label_version'])",
label: "Version",
},
{
show: !0,
disabled: !1,
value:
"#bz_show_bug_column_1 tr:has(th[id='field_label_rep_platform'])",
label: "Hardware",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_1 tr:has(label[for='priority'])",
label: "Importance",
},
{
show: !0,
disabled: !0,
value: "#bz_show_bug_column_1 tr:has(td[class='bz_assignee_td'])",
label: "Assigned To",
},
{
show: !0,
disabled: !1,
value:
"#bz_show_bug_column_1 tr:has(th[id='field_label_bug_file_loc'])",
label: "URL",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_1 tr:has(th[id='field_label_tag'])",
label: "Tags",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_1 tr:has(th[id='field_label_dependson'])",
label: "Depends on",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_1 tr:has(th[id='field_label_blocked'])",
label: "Blocks",
},
],
At = [
{
show: !0,
disabled: !0,
value: "#bz_show_bug_column_2 table tr:first-child",
label: "Reported",
},
{
show: !0,
disabled: !0,
value: "#bz_show_bug_column_2 table tr:nth-child(2)",
label: "Modified",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(3)",
label: "CC List",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(5)",
label: "See Also",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(6)",
label: "Bug类型1",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(7)",
label: "Bug类型2",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(8)",
label: "请选择Feature号",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(9)",
label: "是否有Matrix/Case覆盖",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(10)",
label: "TestCase类型",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(11)",
label: "客户是否也发现了这个问题",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(12)",
label: "公司名称",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(13)",
label: "问题复杂度",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(14)",
label: "Bug提报时的版本状态",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(15)",
label: "Bug产生原因(开发人员填写)",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(16)",
label: "Bug产生细节原因(开发人员填写)",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(17)",
label: "如果是改出来的Bug,填入是谁改出来的(开发人员填写)",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(18)",
label: "如果是改出来的Bug,填入Bug号或Feature号(开发人员填写)",
},
{
show: !0,
disabled: !0,
value: "#bz_show_bug_column_2 table tr:nth-child(19)",
label: "影响范围和测试建议(开发人员填写)",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(20)",
label: "Bug被Reopen原因",
},
{
show: !0,
disabled: !1,
value: "#bz_show_bug_column_2 table tr:nth-child(21)",
label: "对应testlink用例编号",
},
],
Te = {
NEW: "NEW",
ASSIGNED: "ASSIGNED",
REOPENED: "REOPENED",
VERIFIED: "VERIFIED",
RESOLVED: "RESOLVED",
CLOSED: "CLOSED",
},
Ke = {
FIXED: "FIXED",
INVALID: "INVALID",
WONTFIX: "WONTFIX",
DUPLICATE: "DUPLICATE",
WORKSFORME: "WORKSFORME",
MOVED: "MOVED",
FIX_NEXT_VER: "FIX_NEXT_VER",
},
_ = {
COLLECTED_BUGS: "collectedBugs",
PERSONS_MAP: "personsMap",
QUIP_TYPE: "quipType",
COMPLETED_BUGS: "completedBugs",
CITY: "city",
FORM_ITEM_CONTROL: "formItemControl",
CUSTOM_BRANCHES: "customBranches",
NEW_BUG_COMMENT_TEMPLATE: "newBugCommentTemplate",
LIST_PAGE_ACTION_BTNS: "listPageActionBtns",
HASCLEAR_COMPLETED_BUGS: "hasClearCompletedBugs",
SEARCH_HISTORY: "searchHistory",
QUICK_SUMMARY: "quickSummary",
GITLAB_CONFIG: "gitlabConfig",
HAS_AUTO_SYNC_PERSON_MAP: "hasAutoSyncPersonMap",
},
Qe = "http://192.168.1.180:8888",
me = () => {
var e;
return (
((e = JSON.parse(localStorage.getItem(_.COLLECTED_BUGS) ?? "{}")) ==
null
? void 0
: e.list) ?? []
);
},
he = (e) => {
const n = me(),
t = n.length && n.some((o) => o.id.includes(e));
return { collectedBugs: n, hasCollected: t };
},
zt = (e) => {
const t = me().filter((o) => !o.id.includes(e));
localStorage.setItem(_.COLLECTED_BUGS, JSON.stringify({ list: t }));
},
Rt = (e, n, t) => {
const { collectedBugs: o = [], hasCollected: a } = he(e);
if (a) {
w(S.ERROR, "此bug已收藏");
return;
}
o.push({ id: e, title: n, url: t }),
localStorage.setItem(_.COLLECTED_BUGS, JSON.stringify({ list: o })),
w(S.SUCCESS, "收藏成功");
},
Ze = (e, n) => {
e &&
(e.innerHTML = he(n).hasCollected
? `
`
: `
`);
},
ie = (e, n = !1) => {
if (!e) {
w(S.ERROR, "没有可复制的内容");
return;
}
if (typeof GM_setClipboard != "function") {
w(S.ERROR, "当前环境不支持复制功能");
return;
}
if (!n) {
GM_setClipboard(e, "text", () => {
w(S.SUCCESS, "复制成功");
});
return;
}
Nt(e, (t) => {
J({
title: "内容详情",
body: t,
okText: "确定复制",
onOk: (o) => {
GM_setClipboard(e, "text", () => {
w(S.SUCCESS, "复制成功"), o();
});
},
});
});
},
Nt = (e, n) => {
const t = document.createElement("div"),
o = document.createElement("div");
e
.split(
`
`,
)
.forEach((l) => {
const i = document.createElement("span");
(i.textContent = l),
o.appendChild(i),
o.appendChild(document.createElement("br"));
}),
o.style.setProperty("width", "98%"),
o.style.setProperty("height", "96%"),
o.style.setProperty("border", "1px solid #d9d9d9"),
o.style.setProperty("outline", "0px solid transparent"),
o.style.setProperty("padding", "6px"),
o.style.setProperty("border-radius", "4px"),
o.style.setProperty("overflow-y", "scroll"),
t.appendChild(o),
t.style.setProperty("width", "30vw"),
t.style.setProperty("height", "30vh"),
ue(n, t);
},
M = window.location.pathname,
Ne = {
SUNDAY: "周日",
MONDAY: "周一",
TUESDAY: "周二",
WEDNESDAY: "周三",
THURSDAY: "周四",
FRIDAY: "周五",
SATURDAY: "周六",
},
Ot = {
SUNDAY: "星期日",
MONDAY: "星期一",
TUESDAY: "星期二",
WEDNESDAY: "星期三",
THURSDAY: "星期四",
FRIDAY: "星期五",
SATURDAY: "星期六",
},
Z = () => new Date().toISOString().split("T")[0],
Oe = (e) => {
const n = new Date();
return n.setDate(n.getDate() + e), n.toISOString().split("T")[0];
},
ge = (e, n) => {
const t = new Date(e);
t.setDate(t.getDate() - n);
const o = t.getFullYear(),
a = String(t.getMonth() + 1).padStart(2, "0"),
l = String(t.getDate()).padStart(2, "0");
return `${o}-${a}-${l}`;
},
ke = (e, n) => {
const t = [],
o = new Date(e);
for (let a = 0; a < n; a++) t.push(ge(o, a + 1));
return t;
},
qe = (e, n) => {
const t = { zhou: Object.values(Ne), xingqi: Object.values(Ot) },
a = new Date(n || Z()).getDay();
return t[e][a];
};
function fe(e = Z()) {
return JSON.parse(localStorage.getItem(e) ?? "[]");
}
function be(e, n = Z()) {
return fe(n).some((o) => o.id === e);
}
const Pe = (e, n = Z()) => {
if (be(e.id, n)) return w(S.ERROR, "该BUG已在日报中"), !1;
const t = fe(n);
return (
t.push(e),
localStorage.setItem(n, JSON.stringify(t)),
w(S.SUCCESS, "添加日报成功"),
!0
);
},
Me = (e, n = Z()) => {
const t = fe(n),
o = t.findIndex((a) => a.id === e);
return o === -1
? (w(S.ERROR, "该BUG不存在"), !1)
: (t.splice(o, 1),
localStorage.setItem(n, JSON.stringify(t)),
w(S.SUCCESS, "移除成功"),
!0);
},
qt = () => {
const e = document.createElement("div");
(e.id = "bug_history_vue_app"), document.body.appendChild(e);
const n = ke(Oe(1), 14),
t = [];
for (let r = 0; r < n.length; r++) {
const s = n[r],
d = fe(s);
if (d.length > 0) {
const u = [],
m = d;
for (let b = 0; b < m.length; b++) {
const h = m[b];
u.includes(h.id) ||
(u.push(h.id),
t.push({ date: s, bugId: h.id, bugName: h.name, bugUrl: h.url }));
}
}
}
const { createApp: o, ref: a, reactive: l, h: i } = Vue,
c = o({
template: `
]*>)([\s\S]*?)(<\/pre>)/g,
(l, i, c, r) => {
const s = a(c);
return `${i}${s}${r}`;
},
);
if (e instanceof HTMLElement) {
let l = [];
["PRE", "DIV"].includes(e.tagName)
? (l = [e])
: ((l = Array.from(e.querySelectorAll("pre"))),
l.length === 0 && (l = Array.from(e.querySelectorAll("div")))),
l.forEach((i) => {
const c = i.innerHTML,
r = a(c);
(i.innerHTML = r),
i.querySelectorAll(".commit-hash-link").forEach((d) => {
d.addEventListener("click", (u) => {
u.preventDefault();
const m = d.dataset.hash || "",
b = d.dataset.project || "";
n(u, m, b);
});
});
});
return;
}
throw new Error("target 必须是 HTML 字符串或 HTMLElement 类型");
},
wn = () => {
var ae, se, Et, Lt;
localStorage.getItem(_.PERSONS_MAP) ||
localStorage.setItem(_.PERSONS_MAP, JSON.stringify(Bt));
const e = re(),
n = document.querySelector("#bz_show_bug_column_1"),
t = document.querySelector("#bz_show_bug_column_2"),
o = document.querySelector("#bz_show_bug_column_2 .vcard .email"),
a = Array.from(document.querySelectorAll("#bz_show_bug_column_2 tr")),
l = Ge((o == null ? void 0 : o.href) ?? ""),
i = Array.from(document.querySelectorAll(".vcard .email .fn")),
c = document.querySelector("#bz_show_bug_column_2 tr:nth-child(2) a"),
r = document.querySelector("#editme_action"),
s = document.querySelector("#bz_assignee_edit_action"),
d = document.querySelector("#bz_assignee_take_action"),
u = document.querySelector("#dup_id_discoverable_action"),
m = document.querySelector("#dup_id_discoverable"),
b = document.querySelector("#duplicate_settings"),
h = document.querySelector("#summary_alias_input"),
y = document.querySelector("#comment"),
E = document.querySelector("#add_comment"),
T = document.querySelector("#add_comment label"),
N = Array.from(
document.querySelectorAll(
"#attachment_table td[valign='top']:nth-child(2) a",
),
),
f = document.querySelector(
".bz_alias_short_desc_container .knob-buttons input",
),
k = document.querySelector("#add_comment .knob-buttons input"),
B = document.querySelector("#bug_status"),
C = document.querySelector("#resolution"),
L = document.querySelector("#resolution_settings"),
I = document.querySelector("#bz_assignee_input"),
q = document.querySelector("#bz_assignee_edit_container"),
G = document.querySelector("#assigned_to"),
O = document.querySelector("#summary_alias_container"),
W = document.querySelector("#short_desc_nonedit_display"),
U = document.querySelector(".bz_alias_short_desc_container a b"),
P = (ae = U.innerText.match(/(\d+)$/)) == null ? void 0 : ae[1],
K = document.querySelector("#cf_effect"),
Ae = Array.from(
document.querySelectorAll(
"#bz_show_bug_column_1 tr:has(td[class='bz_section_spacer'])",
),
),
ne = document.querySelector(".navigation"),
oe = document.querySelector(
"#attachment_table .bz_attach_footer a:not(a[id='view_all'])",
),
xe = document.querySelector(
"#attachment_table .bz_attach_footer a[id='view_all']",
),
X = Array.from(
document.querySelectorAll("#bugzilla-body .navigation a"),
),
Q = Array.from(
document.querySelectorAll("#bugzilla-body .navigation i font"),
),
Se = Array.from(
document.querySelectorAll(
"#comments .bz_comment_table .bz_comment:not(.bz_first_comment) .bz_comment_text",
),
);
let $ = null;
if (n && t) {
const g = n.clientWidth;
t.style.setProperty(
"width",
Math.round(document.body.clientWidth - g) + "px",
);
}
if (
(c &&
((c.innerText = "历史记录"),
c.classList.add("custom-button"),
c.classList.add("plain-button"),
(c.style.margin = "0 6px"),
c.addEventListener("click", (g) => {
g.preventDefault(),
J({
title: "历史记录",
hideOk: !0,
cancelText: "关闭",
bodyStyle: "width: 60vw; height: 60vh;",
body: `
`,
onMount: () => {
ut("history-iframe", (p) => {
const v = p.querySelector("#header"),
x = p.querySelector("#footer");
v && v.remove(), x && x.remove();
});
},
});
})),
i.forEach((g) => {
if (Object.keys(e).includes(g.innerText))
g.innerText = e[g.innerText];
else if (g.innerText.includes("-")) {
const p = g.innerText.split("-"),
v = p[0],
x = p[1];
/^[a-zA-Z0-9]+$/.test(v) && (g.innerText = e[v]),
/^[a-zA-Z0-9]+$/.test(x) && (g.innerText = e[x]);
}
}),
V(
"复制报告人姓名",
(g) => {
var p;
g.classList.add("plain-button"),
(p = o == null ? void 0 : o.parentNode) == null ||
p.insertBefore(g, o.nextSibling);
},
() => {
ie(o.innerText);
},
),
Ae.length &&
Ae.forEach((g) => {
g.style.display = "none";
}),
K && !K.value && (K.value = "本 case"),
O && W && U)
) {
V(
"配置一键填写",
(p) => {
p.classList.add("plain-button"),
O.parentNode.insertBefore(p, O.nextSibling);
},
() => {
ft();
},
),
V(
"自定义快捷分支",
(p) => {
p.classList.add("plain-button"),
O.parentNode.insertBefore(p, O.nextSibling);
},
() => mn(),
);
const g = V(
"日报/移除",
(p) => {
p.classList.add("custom-button"),
be(P)
? (p.classList.add("plain-button"),
(p.innerText = "移除日报"),
p.style.setProperty("border", "1px solid #cccccc"))
: ((p.innerText = "添加日报"),
p.style.setProperty(
"border",
"1px solid rgb(200, 200, 200)",
)),
O.parentNode.insertBefore(p, O.nextSibling);
},
() => {
be(P)
? (Me(P),
g.classList.remove("plain-button"),
(g.innerText = "添加日报"))
: (Pe({ id: P, name: W.innerText, url: window.location.href }),
g.classList.add("plain-button"),
(g.innerText = "移除日报"));
},
);
V(
"复制 COMMIT",
(p) => {
p.classList.add("plain-button"),
O.parentNode.insertBefore(p, O.nextSibling);
},
() => {
ie(`git commit -m "bug: ${P} 修复:${W.innerText}"`);
},
),
V(
"复制 ID",
(p) => {
p.classList.add("plain-button"),
O.parentNode.insertBefore(p, O.nextSibling);
},
() => {
ie(P);
},
);
}
if (I) {
I.parentNode.classList.add("bz_assignee_td");
const g = V(
"取消",
(p) => {
p.classList.add("plain-button"),
(p.style.display = "none"),
(p.style.marginRight = "0"),
I.parentNode.appendChild(p);
},
(p, v) => {
if (
(I.classList.add("bz_default_hidden"),
q.classList.remove("bz_default_hidden"),
v.style.display === "block")
) {
v.style.display = "none";
const x = document.querySelector(
"#bz_assignee_edit_container .email",
);
if (x) {
const A = Ge(x.href);
if (A) {
G.value = A;
const R = document.querySelector("#assigned_to_list_vue_app");
R && (R.remove(), $e());
}
}
}
},
);
if (
(r &&
(O.classList.remove("bz_default_hidden"),
h.classList.add("bz_default_hidden"),
(r.innerText = "编辑标题"),
r.classList.add("custom-button"),
r.classList.add("plain-button"),
r.addEventListener("click", (p) => {
p.preventDefault(),
O.classList.remove("bz_default_hidden"),
h.classList.add("bz_default_hidden");
const v = h.querySelector("#alias"),
x = h.querySelector("#short_desc"),
A = h.cloneNode(!0);
A.classList.remove("bz_default_hidden");
const R = A.querySelector("#alias"),
j = A.querySelector("#short_desc");
R &&
R.addEventListener("input", (Y) => {
v.value = Y.target.value;
}),
j &&
j.addEventListener("input", (Y) => {
x.value = Y.target.value;
}),
J({
title: "更改标题",
body: A,
okText: "保存",
onOk: (Y) => {
Ie(f.form, !1), Y();
},
});
})),
s &&
((s.innerText = "加载资源中..."),
s.classList.add("custom-button"),
s.classList.add("plain-button"),
s.classList.add("disabled-button"),
s.addEventListener("click", () => {
var p;
I.classList.remove("bz_default_hidden"),
q.classList.add("bz_default_hidden"),
G.nextElementSibling.tagName === "BR" &&
((p = G.nextElementSibling) == null || p.remove()),
g.style.display === "none" && (g.style.display = "block");
})),
d)
) {
d.classList.add("bz_default_hidden");
const p = document.createElement("span");
(p.innerText = "转给自己"),
p.classList.add("custom-button"),
p.classList.add("plain-button");
const v = G.value;
(se = d.parentNode) == null || se.insertBefore(p, d.nextSibling),
p.addEventListener("click", () => {
J({
body: "确定将此任务转给自己?",
bodyStyle: "width: 400px; height: 50px;",
okText: "确定",
onOk: (x) => {
var A;
d.click(),
x(),
(A = I.querySelector("br")) == null || A.remove(),
Ie(f.form, !1);
},
onDestroy: () => {
I.classList.add("bz_default_hidden"),
q.classList.remove("bz_default_hidden"),
(G.value = v);
},
});
});
}
}
if (B && C && m) {
const g = B.value,
p = C.value;
$ = V(
"标记完成",
(x) => {
var A;
x.classList.add("custom-button"),
x.classList.add("plain-button"),
(A = b.parentNode) == null || A.insertBefore(x, m);
},
async () => {
L.classList.remove("bz_default_hidden"),
(C.value = Ke.FIXED),
(B.value = Te.RESOLVED),
v.classList.remove("hide"),
$ && $.classList.add("hide"),
m.classList.add("hide");
},
);
const v = V(
"取消",
(x) => {
var A;
x.classList.add("plain-button"),
x.classList.add("hide"),
(A = b.parentNode) == null || A.appendChild(x);
},
() => {
b.classList.add("bz_default_hidden"),
m.classList.remove("bz_default_hidden"),
v.classList.add("hide"),
$ && $.classList.remove("hide"),
m.classList.remove("hide"),
(B.value = g),
p ? (C.value = Ke.FIXED) : L.classList.add("bz_default_hidden");
},
);
u &&
(u.classList.add("custom-button"),
u.classList.add("plain-button"),
(u.innerText = "标记重复"),
u.addEventListener("click", (x) => {
x.preventDefault(),
b.classList.remove("bz_default_hidden"),
m.classList.add("bz_default_hidden"),
v.classList.remove("hide"),
$ && $.classList.add("hide");
}));
}
if (E) {
pn(E);
const g = document.createElement("div");
g.style.setProperty("max-width", "610px"),
g.style.setProperty("display", "flex"),
g.style.setProperty("flex-wrap", "wrap"),
ve().length === 0 &&
Fe([
{ title: ": " },
{ title: "develop" },
{ title: "v10.x" },
{ title: "v11.x" },
{ title: "custom_v11.0.1_huaweiDIS" },
{ title: "_R4" },
]),
ve().forEach((p) => {
V(
p.title,
(v) => {
v.classList.add("custom-button"),
v.classList.add("plain-button"),
v.classList.add("mb-5"),
g.appendChild(v);
},
() => {
y.value = y.value + p.title;
},
);
}),
(Et = E == null ? void 0 : E.parentElement) == null ||
Et.insertBefore(g, E),
T && T.classList.add("hide"),
y &&
(y.style.setProperty("min-width", "760px"),
y.addEventListener("focus", () => {
y.rows = 10;
}));
}
if (N.length) {
const g = Array.from(
document.querySelectorAll(
"#attachment_table td[valign='top']:nth-child(0) b",
),
),
p = Array.from(
document.querySelectorAll(
"#attachment_table td[valign='top']:nth-child(1) .bz_attach_extra_info",
),
);
N.forEach((v, x) => {
var Y, le, ze, ce, de;
v.classList.add("custom-button"),
v.classList.add("plain-button"),
(v.style.margin = "6px 16px");
const A = (Y = v.href.split("&")) == null ? void 0 : Y[0],
R =
((de =
(ce =
(ze = (le = p[x]) == null ? void 0 : le.innerText) == null
? void 0
: ze.trim().match(/\(([^)]+)\)/)) == null
? void 0
: ce[1].split(", ")) == null
? void 0
: de[1]) ?? "",
j =
R.includes("image") ||
(R.includes("video") && !R.includes("wmv"));
j ? (v.innerText = "查看") : (v.innerText = "下载"),
v.addEventListener("click", (we) => {
var Tt;
if ((we.preventDefault(), R.includes("image"))) {
const Ee = Re(),
H = document.createElement("div");
H.classList.add("attachment-container"),
H.classList.add("hide");
const F = document.createElement("img");
(F.src = A),
(F.style = "width: 100%; height: auto;"),
F.addEventListener("load", () => {
H.classList.remove("hide"),
H.classList.add("show"),
Ee.classList.add("hide");
}),
H.appendChild(F);
const ee = document.createElement("div");
ee.appendChild(Ee),
ee.appendChild(H),
J({
title: "图片详情",
hideOk: !0,
cancelText: "关闭",
body: ee,
});
} else if (R.includes("video") && !R.includes("wmv")) {
const Ee = Re(),
H = document.createElement("div");
H.classList.add("attachment-container"),
H.classList.add("hide");
const F = document.createElement("video");
(F.controls = !0),
(F.autoplay = !0),
(F.loop = !0),
(F.style = "width: 100%; height: auto;");
const ee = document.createElement("source");
(ee.src = A),
(ee.type = R),
(ee.style = "width: 100%; height: auto;"),
F.addEventListener("canplaythrough", () => {
H.classList.remove("hide"),
H.classList.add("show"),
Ee.classList.add("hide");
}),
F.appendChild(ee),
H.appendChild(F);
const We = document.createElement("div");
We.appendChild(Ee),
We.appendChild(H),
J({
title: "视频详情",
hideOk: !0,
cancelText: "关闭",
body: We,
});
} else
j
? w(S.ERROR, "文件不存在,或者不支持从此处" + v.innerText)
: cn(A, (Tt = g[x]) == null ? void 0 : Tt.innerText);
});
});
}
const z = (g, p) => {
g.preventDefault();
const v = [];
G.value !== l && v.push("bug 没有指给报告人"),
y.value || v.push("bug 没有填写备注"),
[Te.RESOLVED, Te.VERIFIED, Te.CLOSED].includes(B.value) ||
v.push("bug 状态不是 RESOLVED, VERIFIED, CLOSED 其中一个"),
v.length
? J({
title: "请确认",
body: `
确定提交表单?
${v.map((x, A) => `${A + 1}. ${x}`).join("")}
`,
style: "transform: translate(-50%, -70%)",
bodyStyle: "width: 500px;",
okText: "确定提交",
onOk: () => {
Ie(p.form, !0, P, W.innerText);
},
})
: Ie(p.form, !0, P, W.innerText);
};
if (
(f &&
(f.classList.add("custom-button"),
(f.value = "保存表单"),
f.addEventListener("click", (g) => z(g, f))),
k)
) {
k.classList.add("custom-button"),
(k.value = "保存表单"),
k.addEventListener("click", (p) => z(p, k)),
k.parentElement.style.setProperty("width", "170px"),
k.parentElement.style.setProperty("display", "flex"),
k.parentElement.style.setProperty("align-items", "center");
const g = document.createElement("span");
g.classList.add("custom-button"),
(g.innerText = "一键填写"),
(g.title = "自动获取 commit 信息,仅限开发人员使用"),
g.addEventListener("click", async (p) => {
const v = document.querySelector("#assign_to_tester_btn");
v && v.click(), $ && $.click();
const x = Ye();
if (!x) {
w(S.ERROR, "请先配置 GitLab 信息"), ft();
return;
}
const A = w(
S.SUCCESS,
"正在查询相关的 commit 记录...",
1e3 * 60 * 60,
),
R = await yn(P);
if ((A(), !R.length)) {
w(
S.ERROR,
"没有找到相关的 commit 记录,请检查 Personal Access Token 是否正确,或者修改查询范围",
5e3,
);
return;
}
(y.value = ""),
R.forEach((j) => {
y.value +=
vn(j.projectId) +
": " +
j.targetBranch +
": " +
j.commitHash +
" " +
j.commitMessage +
`
`;
}),
x.autoSaveForm && z(p, k);
}),
k.parentElement &&
((Lt = k.parentElement) == null || Lt.insertBefore(g, k));
}
if (ne) {
const g = document.createElement("div");
g.classList.add("flex-justify-space-between"),
ne.parentNode.insertBefore(g, ne.nextSibling),
g.appendChild(ne);
const v = document.createElement("a");
(v.href = "#footer"),
(v.innerText = "快速沉底"),
v.classList.add("custom-button"),
v.classList.add("plain-button"),
ne.appendChild(v);
const x = document.createElement("div");
x.classList.add("flex-center"), Ze(x, U.innerText), g.appendChild(x);
const A = document.getElementById("collect-bug");
if (A) {
const R = (j, Y) => {
const { collectedBugs: le, hasCollected: ze } = he(U.innerText);
let ce = { list: le };
if (ze) {
if (
((ce = {
list:
le.length > 0 && le.filter((we) => we.id !== U.innerText),
}),
Y.dataset.type !== "collected")
) {
w(S.ERROR, "数据与页面状态不一致,页面刷新后重试"),
setTimeout(() => {
window.location.reload();
}, 1e3);
return;
}
w(S.SUCCESS, "已取消收藏");
} else {
if (
((ce = {
list: [
...le,
{
id: U.innerText,
title: W.innerText,
url: window.location.href,
},
],
}),
Y.dataset.type !== "no-collected")
) {
w(S.ERROR, "数据与页面状态不一致,页面刷新后重试"),
setTimeout(() => {
window.location.reload();
}, 1e3);
return;
}
w(S.SUCCESS, "收藏成功");
}
localStorage.setItem(_.COLLECTED_BUGS, JSON.stringify(ce)),
Ze(x, U.innerText);
const de = document.getElementById("collect-bug");
de && de.addEventListener("click", (we) => R(we, de));
};
A.addEventListener("click", (j) => R(j, A));
}
}
oe &&
(oe.classList.add("custom-button"),
(oe.innerText = "添加附件"),
oe.addEventListener("click", (g) => {
g.preventDefault(),
J({
title: "上传附件",
okText: "关闭弹窗 & 刷新页面",
cancelText: "关闭",
bodyStyle: "width: 60vw; height: 70vh;",
body: `
备注:点击 Submit 按钮上传,上传后点击右下角关闭并刷新按钮刷新整个页面,查看上传结果
`,
onMount: () => {
ut("attachment-iframe", (p) => {
const v = p.querySelector("#header"),
x = p.querySelector("#footer");
v && v.remove(), x && x.remove();
});
},
onOk: () => {
window.location.reload();
},
});
})),
xe && xe.remove(),
a != null &&
a.length &&
a.forEach((g) => {
var p;
g.firstElementChild &&
g.firstElementChild.classList.contains("bz_hidden_field") &&
g.firstElementChild.classList.remove("bz_hidden_field"),
(p = g.firstElementChild) != null &&
p.nextElementSibling &&
g.firstElementChild.nextElementSibling.classList.contains(
"bz_hidden_field",
) &&
g.firstElementChild.nextElementSibling.classList.remove(
"bz_hidden_field",
);
}),
X.length &&
X.forEach((g) => {
bt(g);
}),
Q.length &&
Q.forEach((g) => {
bt(g, !0);
}),
dn(),
Se.length &&
Se.forEach((g) => {
Sn(g, (p, v, x) => {
window.open(`${Qe}/project/${x}/-/commit/${v}`, "_blank");
});
});
},
En = () => {
const e = document.createElement("div");
(e.id = "show_hide_formitem_vue_app"), document.body.appendChild(e);
const {
createApp: n,
ref: t,
reactive: o,
onUnmounted: a,
watch: l,
} = Vue,
i = n({
template: `
控制表单项显示隐藏
mouseenterHandler(item)"
@mouseleave="() => mouseleaveHandler(item)"
@update:checked="updateHandler(item)"
:checked="item.show"
:disabled="item.disabled"
v-if="item.value"
:value="item.value"
:label="item.label"
/>
mouseenterHandler(item)"
@mouseleave="() => mouseleaveHandler(item)"
@update:checked="updateHandler(item)"
:checked="item.show"
:disabled="item.disabled"
:value="item.value"
:label="item.label"
/>
`,
setup() {
const c = t(!0),
r = t({ width: "700px", opacity: "1" }),
s = () => {
r.value.opacity = "1";
const h = document.querySelector(
"#show_hide_formitem_vue_app_rect",
);
h && h.remove();
},
{ list1: d, list2: u } = dt(),
m = o(d),
b = o(u);
return (
a(() => {
s();
}),
l(c, (h, y) => {
y !== h && s();
}),
{
showModal: c,
modalStyle: r,
checkboxOptions1: m,
checkboxOptions2: b,
mouseleaveHandler: s,
updateHandler: (h) => {
h.show = !h.show;
const y = document.querySelector(h.value);
h.show
? (y.style.display = "table-row")
: (y.style.display = "none"),
s(),
localStorage.setItem(
_.FORM_ITEM_CONTROL,
JSON.stringify({ list1: m, list2: b }),
),
(r.value.opacity = "0.5");
},
mouseenterHandler: (h) => {
r.value.opacity = "0.5";
const E = document
.querySelector(h.value)
.getBoundingClientRect(),
T = document.createElement("div");
(T.id = "show_hide_formitem_vue_app_rect"),
(T.style.position = "fixed"),
(T.style.top = `${E.top}px`),
(T.style.left = `${E.left}px`),
(T.style.width = `${E.width}px`),
(T.style.height = `${E.height}px`),
(T.style.backgroundColor = "#9bc0e3"),
(T.style.zIndex = "9"),
(T.style.opacity = "0.8"),
document.body.appendChild(T);
},
}
);
},
});
return i.use(naive), i.mount("#show_hide_formitem_vue_app");
},
Ln = () => {
const e = document.querySelector("#summary_alias_container");
V(
"隐藏表单项",
(n) => {
n.classList.add("plain-button"), e.parentNode.appendChild(n);
},
() => {
En();
},
);
},
Tn = () => {
const e = re(),
n = document.querySelector("#newcc"),
t = Array.from(document.querySelectorAll("#newcc > option")),
o = document.createElement("div");
(o.id = "cc_list_vue_app"),
n.parentNode.insertBefore(o, n),
n.classList.add("bz_default_hidden"),
t.forEach((r) => {
const s = r.innerText.match(
/<([^]+)@(yonghongtech|test|sina).(com|cn)>/,
),
d = s ? s[1] : "";
r.innerText =
d && e[d]
? e[d] + " - " + r.innerText.replace("-", "").replace(e[d], "")
: r.innerText;
});
const { createApp: a, ref: l, reactive: i } = Vue,
c = a({
template: `
`,
setup() {
const r = l(n.value),
s = i(t.map((d) => ({ label: d.innerText, value: d.value })));
return {
selectedValue: r,
options: s,
handleUpdateValue(d) {
n.value = d;
},
};
},
});
return c.use(naive), c.mount("#cc_list_vue_app");
},
yt = () => {
const e = document.querySelector("#component");
if (!e) return;
const n = Array.from(document.querySelectorAll("#component > option")),
t = document.createElement("div");
(t.id = "component_list_vue_app"),
e.parentNode.insertBefore(t, e),
e.classList.add("bz_default_hidden");
const { createApp: o, ref: a, reactive: l } = Vue,
i = o({
template: `
`,
setup() {
const c = a(e.value),
r = l(n.map((s) => ({ label: s.innerText, value: s.value })));
return {
selectedValue: c,
options: r,
handleUpdateValue(s) {
(e.value = s),
Array.from(
document.querySelectorAll(".validation_error_text"),
).forEach((u) => {
u.innerText ===
"You must select a Component for this bug." &&
u.classList.add("bz_default_hidden");
});
},
};
},
});
return i.use(naive), i.mount("#component_list_vue_app");
},
vt = () => {
const e = document.querySelector("#cf_newfeatureid"),
n = Array.from(document.querySelectorAll("#cf_newfeatureid > option")),
t = document.createElement("div");
(t.id = "feature_list_vue_app"),
e.parentNode.insertBefore(t, e),
e.classList.add("bz_default_hidden");
const { createApp: o, ref: a, reactive: l } = Vue,
i = o({
template: `
`,
setup() {
const c = a(e.value),
r = l(n.map((s) => ({ label: s.innerText, value: s.value })));
return {
selectedValue: c,
options: r,
handleUpdateValue(s) {
e.value = s;
},
};
},
});
return i.use(naive), i.mount("#feature_list_vue_app");
},
_t = () => {
const e = document.querySelector("#version");
if (!e) return;
const n = Array.from(document.querySelectorAll("#version > option")),
t = document.createElement("div");
(t.id = "version_list_vue_app"),
e.parentNode.insertBefore(t, e),
e.classList.add("bz_default_hidden");
const { createApp: o, ref: a, reactive: l } = Vue,
i = o({
template: `
`,
setup() {
const c = a(e.value),
r = l(n.map((s) => ({ label: s.innerText, value: s.value })));
return {
selectedValue: c,
options: r,
handleUpdateValue(s) {
e.value = s;
},
};
},
});
return i.use(naive), i.mount("#version_list_vue_app");
},
kn = () => {
M === D.BUG_DETAIL && (wn(), $e(), Ln(), Tn(), vt(), yt(), _t(), Ue());
},
xt = () => {
const e = Array.from(
document.querySelectorAll("table th[valign='top'] a"),
),
n = Array.from(document.querySelectorAll("table td[valign='top']"));
e.length &&
e.forEach((t) => {
t.classList.add("custom-button"),
t.addEventListener("click", (o) => {
o.preventDefault(), window.open(t.href, "_blank");
});
}),
n.length &&
n.forEach((t) => {
t.vAlign = "center";
});
},
St = (e, n, t = !0) => {
let o = _e();
if (n) {
if (o.some((a) => a.title === e)) {
t && w(S.ERROR, "快捷短语已存在");
return;
}
o.push({ title: e }), t && w(S.SUCCESS, "添加成功");
} else
(o = o.filter((a) => a.title !== e)), t && w(S.SUCCESS, "删除成功");
localStorage.setItem(_.QUICK_SUMMARY, JSON.stringify(o));
},
_e = () => JSON.parse(localStorage.getItem(_.QUICK_SUMMARY) ?? "[]"),
Je = (e) => {
localStorage.setItem(_.QUICK_SUMMARY, JSON.stringify(e));
},
Cn = () => {
const e = document.createElement("div");
(e.id = "quick_summary_vue_app"), document.body.appendChild(e);
const n = _e(),
{ createApp: t, ref: o, h: a } = Vue,
l = t({
template: `
自定义快捷短语(更改后刷新页面才生效)
搜索:
新增
`,
setup() {
const i = o(!0),
c = o(""),
r = o(""),
s = o(n),
d = o([
{
title: "名称",
dataIndex: "title",
key: "title",
width: "calc(60vw - 380px)",
ellipsis: { tooltip: !0 },
},
{
title: "排序",
dataIndex: "sort",
key: "sort",
width: 200,
render: (b, h) =>
a(
naive.NSpace,
{ horizontal: !0 },
{
default: () => [
a(naive.NButton, {
strong: !0,
tertiary: !0,
size: "small",
textContent: "↑",
disabled: h === 0,
onClick: () => {
(s.value = mt(s.value, h)), Je(s.value);
},
}),
a(naive.NButton, {
strong: !0,
tertiary: !0,
size: "small",
textContent: "↓",
disabled: h === s.value.length - 1,
onClick: () => {
(s.value = ht(s.value, h)), Je(s.value);
},
}),
],
},
),
},
{
title: "操作",
key: "actions",
width: 180,
render: (b) =>
a(
naive.NSpace,
{ horizontal: !0 },
{
default: () => [
a(naive.NButton, {
strong: !0,
tertiary: !0,
size: "small",
textContent: "删除",
onClick: () => {
(s.value = s.value.filter(
(h) => h.title !== b.title,
)),
St(b.title, !1);
},
}),
],
},
),
},
]),
u = ye((b) => {
b
? (s.value = s.value.filter((h) => h.title.includes(b)))
: (s.value = _e());
}, 500),
m = ye(() => {
r.value &&
((s.value = [...s.value, { title: r.value }]),
St(r.value, !0),
(r.value = ""));
}, 500);
return {
showModal: i,
searchValue: c,
quickSummaryText: r,
data: s,
columns: d,
onSearch: u,
addQuickSummary: m,
onPositiveClick: () => {
window.location.reload();
},
};
},
});
return l.use(naive), l.mount("#quick_summary_vue_app");
},
wt = (e) => {
const n = Array.from(document.querySelectorAll(".validation_error_text"));
e
? n.forEach((t) => {
t.innerText === "You must enter a Summary for this bug." &&
t.classList.add("bz_default_hidden");
})
: n.forEach((t) => {
t.innerText === "You must enter a Summary for this bug." &&
t.classList.remove("bz_default_hidden");
});
},
Bn = () => {
var b, h, y, E, T, N;
const e = document.querySelector("#Create"),
n = e ? Array.from(e.querySelectorAll("table tr td")) : null,
t = document.querySelector("#field_label_version"),
o = document.querySelector("#os_guess_note"),
a = document.querySelector("#commit"),
l = document.querySelector("#short_desc"),
i = document.querySelector("#attachment_false input"),
c = document.querySelector("#attachment_true input"),
r = document.querySelector("#attachment_true .attachment_entry input"),
s = document.querySelector("#field_label_priority"),
d = document.querySelector("form table tr"),
u = document.querySelector("#possible_duplicates_container"),
m = document.querySelector("#field_label_assigned_to .field_help_link");
if (
(Array.isArray(n) &&
n.forEach((f) => {
var B;
const k =
((B = f == null ? void 0 : f.textContent) == null
? void 0
: B.trim().replace(/\s+/g, "")) || "";
(f.colSpan === 4 || f.colSpan === 3) &&
f.childElementCount === 0 &&
k === "" &&
f.remove();
}),
t && ((t.rowSpan = 1), (t.nextElementSibling.rowSpan = 1)),
o &&
((((b = o.parentNode) == null
? void 0
: b.firstElementChild
).colSpan = 1),
(o.firstElementChild.innerText =
"已经预填部分字段,请自行检查正确与否")),
a &&
(a.classList.add("custom-button"),
a.classList.add("margin-0"),
(a.value = "提交 bug"),
a.addEventListener("mouseup", () => {
const f = setTimeout(() => {
Array.from(
document.querySelectorAll(".validation_error_text"),
).forEach((B) => {
B.innerText === "You must enter a Summary for this bug." &&
(B.style.setProperty("position", "absolute"),
B.style.setProperty("top", "8px"),
B.style.setProperty("right", "160px"));
}),
clearTimeout(f);
}, 50);
})),
l)
) {
const f = document.createElement("tr"),
k = document.createElement("th"),
B = document.createElement("td");
(B.colSpan = 3),
f.appendChild(k),
f.appendChild(B),
B.style.setProperty("width", "650px"),
B.style.setProperty("display", "flex"),
B.style.setProperty("flex-wrap", "wrap"),
_e().length === 0 && Je([{ title: "" }]),
_e().forEach((L) => {
V(
L.title,
(I) => {
I.classList.add("custom-button"),
I.classList.add("plain-button"),
I.classList.add("margin-0"),
I.classList.add("mr-5"),
I.classList.add("mb-5"),
B.appendChild(I);
},
() => {
const I = l.value + L.title;
(l.value = I), wt(I);
},
);
}),
(h = u == null ? void 0 : u.parentElement) == null ||
h.insertBefore(f, u),
l.parentElement.style.setProperty("display", "flex"),
l.parentElement.style.setProperty("align-items", "center"),
l.parentElement.style.setProperty("width", "800px"),
l.parentElement.style.setProperty("position", "relative"),
l.addEventListener("input", (L) => {
var I;
return wt(
(I = L == null ? void 0 : L.target) == null ? void 0 : I.value,
);
});
const C = document.createElement("div");
C.classList.add("custom-button"),
(C.innerText = "自定义快捷短语"),
C.addEventListener("click", () => {
Cn();
}),
l.parentElement.insertBefore(C, l.nextElementSibling);
}
if (i && c && r) {
(i.value = "上传附件"),
(c.value = "取消上传"),
i.classList.add("custom-button"),
i.classList.add("margin-0"),
i.classList.add("plain-button"),
c.classList.add("custom-button"),
c.classList.add("margin-0"),
c.classList.add("plain-button");
const f = document.createElement("span"),
k = document.createElement("span");
f.classList.add("custom-button"),
f.classList.add("margin-0"),
f.classList.add("plain-button"),
(f.innerText = "重新上传"),
k.classList.add("bug-new_filename"),
r.classList.add("bz_default_hidden"),
(y = r.parentNode) == null || y.insertBefore(k, r.nextElementSibling),
(E = r.parentNode) == null || E.insertBefore(f, r.nextElementSibling),
i.addEventListener("click", () => {
r.click();
}),
f.addEventListener("click", () => {
r.click();
}),
r.addEventListener("change", (B) => {
const C = B.target.value.split("\\"),
L = B.target.files[0].size / 1024;
k.innerText =
"文件名:" + C[C.length - 1] + " 大小:" + L.toFixed(2) + "kb";
});
}
d && d.remove(),
s &&
((N = (T = s.parentElement) == null ? void 0 : T.firstElementChild) ==
null ||
N.remove()),
m && m.style.setProperty("color", "var(--primaryColor)");
},
In = () => {
const e = re(),
n = document.querySelector("#cc");
if (!n) return;
const t = Array.from(document.querySelectorAll("#cc > option")),
o = document.createElement("div");
(o.id = "cc_list_vue_app"),
n.parentNode.insertBefore(o, n),
n.classList.add("bz_default_hidden"),
t.forEach((r) => {
const s = r.innerText.match(
/<([^]+)@(yonghongtech|test|sina).(com|cn)>/,
),
d = s ? s[1] : "";
r.innerText =
d && e[d]
? e[d] + " - " + r.innerText.replace("-", "").replace(e[d], "")
: r.innerText;
});
const { createApp: a, ref: l, reactive: i } = Vue,
c = a({
template: `
`,
setup() {
const r = l(n.value),
s = i(t.map((d) => ({ label: d.innerText, value: d.value })));
return {
selectedValue: r,
options: s,
handleUpdateValue(d) {
n.value = d;
},
};
},
});
return c.use(naive), c.mount("#cc_list_vue_app");
},
An = () => {
M === D.BUG_NEW &&
(Zt() && (Bn(), yt(), $e(), _t(), vt(), In(), Ue()), He() && xt());
},
zn = () => {
M === D.BUG_NEW_ENTRY && xt();
},
Rn = () => {
const e = document.querySelector(
".attachment_entry input[value='Submit']",
);
e && e.classList.add("custom-button");
},
Nn = () => {
M === D.BUG_ATTACHMENT && Rn();
},
On = () => {
const e = document.querySelector("#bugzilla-body table"),
n = Array.from(document.querySelectorAll("#bugzilla-body table td")),
t = Array.from(
document.querySelectorAll("#bugzilla-body .bz_bug_link"),
);
if (e) {
e.style = "border-collapse: collapse";
const o = re();
Array.isArray(n) &&
n.forEach((a) => {
a.innerText = Ve(o, a.innerText);
});
}
t.length > 0 &&
t.forEach((o) => {
o.classList.add("hide");
});
},
qn = () => {
M === D.BUG_HISTORY && On();
},
Pn = (e) => {
const n = document.createElement("style");
(n.type = "text/css"),
(n.innerHTML = e),
document.getElementsByTagName("head")[0].appendChild(n);
},
Mn = () => {
const e = document.querySelector("#bugzilla-body .bz_bug_link");
e &&
((e.innerText = "返回 " + e.innerText),
e.classList.add("custom-button"));
},
Dn = () => {
M === D.BUG_PROCESS && Mn();
};
try {
async function e() {
Pn(kt),
await Le(pe.VUE),
await Le(pe.NAIVE_UI),
nn(),
rn(),
kn(),
An(),
zn(),
Nn(),
qn(),
Dn();
}
e();
} catch (e) {
console.error(e);
}
})();