// ==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)} ${n} `, 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: `
搜索:
前一天 后一天 复制当前 复制当天 复制当周 {{data.length}} 条
`, setup() { const r = a(!0), s = a([]), d = a(Z()), u = l( n.map((f) => ({ label: f + " " + qe("zhou", f), value: f })), ); u.unshift({ label: "全部", value: "全部" }); const m = a([ { title: "序号", dataIndex: "index", key: "index", width: 60, render: (f, k) => k + 1, }, { title: "日期", dataIndex: "date", key: "date", width: 120 }, { title: "ID", dataIndex: "bugId", key: "bugId", width: 100 }, { title: "名称", dataIndex: "bugName", key: "bugName", width: "calc(60vw - 760px)", ellipsis: { tooltip: !0 }, }, { title: "URL", dataIndex: "bugUrl", key: "bugUrl", width: 200, ellipsis: { tooltip: !0 }, }, { title: "操作", key: "actions", width: 270, render: (f) => i( naive.NSpace, { horizontal: !0 }, { default: () => [ i(naive.NButton, { strong: !0, tertiary: !0, size: "small", textContent: "打开", onClick: () => window.open(f.bugUrl, "_blank"), }), i(naive.NButton, { strong: !0, tertiary: !0, size: "small", textContent: "收藏", onClick: () => { Rt(f.bugId, f.bugName, f.bugUrl); }, }), i(naive.NButton, { strong: !0, tertiary: !0, size: "small", textContent: "删除", onClick: () => { Me(f.bugId, d.value), (s.value = s.value.filter( (k) => k.bugId !== f.bugId, )); }, }), ], }, ), }, ]), b = (f) => { if (f === "全部") { s.value = t; return; } s.value = t.filter((k) => k.date === f); }, h = () => { (d.value = ge(d.value, 1)), (s.value = t.filter((f) => f.date === d.value)); }, y = () => { (d.value = ge(d.value, -1)), (s.value = t.filter((f) => f.date === d.value)); }, E = () => { const f = d.value, B = t .filter((C) => C.date === f) .map((C, L) => L + 1 + ". " + C.bugId + " " + C.bugName) .join(` `); ie(B, !0); }, T = () => { const f = Z(), B = t .filter((C) => C.date === f) .map((C, L) => L + 1 + ". " + C.bugId + " " + C.bugName) .join(` `); ie(B, !0); }, N = () => { const f = new Date().getDay(), k = ke(Oe(1), f === 0 ? 7 : f), C = t .filter((L) => k.includes(L.date)) .map((L, I) => I + 1 + ". " + L.bugId + " " + L.bugName) .join(` `); ie(C, !0); }; return ( b(d.value), { days: n, showModal: r, selectedValue: d, options: u, data: s, columns: m, handleUpdateValue: b, copyCurrent: E, copyToday: T, copyWeek: N, prevDay: h, nextDay: y, } ); }, }); return c.use(naive), c.mount("#bug_history_vue_app"); }, Pt = () => { const e = ke(Oe(1), 14); for (let n = 0; n < e.length; n++) { const t = e[n], o = fe(t); if (o && !Array.isArray(o) && o.todayReport) { const a = o.todayReport.map((l) => { var s, d, u; const i = (s = /\s+\d+/.exec(l)) == null ? void 0 : s[0], c = (d = /Bug\s+\d+\s+([^()]+)\s+\(/.exec(l)) == null ? void 0 : d[1].trim(), r = (u = /\((http:\/\/.+?)\)/.exec(l)) == null ? void 0 : u[1]; return { id: i, name: c, url: r }; }); localStorage.removeItem(t), localStorage.setItem(t, JSON.stringify(a)); } } }, Mt = () => { const e = "collected-bugs", n = localStorage.getItem(e); localStorage.removeItem(e), n && localStorage.setItem(_.COLLECTED_BUGS, n); }, Dt = () => { const e = "completed_bugs", n = localStorage.getItem(e); localStorage.removeItem(e), n && localStorage.setItem(_.COMPLETED_BUGS, n); }, ye = (e, n) => { let t; return (...o) => { t && clearTimeout(t), (t = setTimeout(() => { e.apply(void 0, o); }, n)); }; }, Ut = () => { const e = document.createElement("div"); (e.id = "bug_collection_vue_app"), document.body.appendChild(e); const n = me(), { createApp: t, ref: o, h: a } = Vue, l = t({ template: `
搜索:
{{data.length}} 条
`, setup() { const i = o(!0), c = o(""), r = o(n), s = o([ { title: "序号", dataIndex: "index", key: "index", width: 60, render: (u, m) => m + 1, }, { title: "ID", dataIndex: "id", key: "id", width: 100, render(u) { var b; return (b = u.id.match(/(\d+)$/)) == null ? void 0 : b[1]; }, }, { title: "名称", dataIndex: "title", key: "title", width: "calc(60vw - 550px)", ellipsis: { tooltip: !0 }, }, { title: "URL", dataIndex: "url", key: "url", width: 200, ellipsis: { tooltip: !0 }, }, { title: "操作", key: "actions", width: 180, render: (u) => a( naive.NSpace, { horizontal: !0 }, { default: () => [ a(naive.NButton, { strong: !0, tertiary: !0, size: "small", textContent: "打开", onClick: () => window.open(u.url, "_blank"), }), a(naive.NButton, { strong: !0, tertiary: !0, size: "small", textContent: "删除", onClick: () => { zt(u.id), (r.value = me()); }, }), ], }, ), }, ]), d = ye((u) => { r.value = n.filter( (m) => m.title.includes(u) || m.id.includes(u), ); }, 500); return { showModal: i, inputValue: c, data: r, columns: s, onInput: d, }; }, }); return l.use(naive), l.mount("#bug_collection_vue_app"); }, jt = () => { const e = document.querySelector("#header .links"), n = document.querySelector("#links-saved"); if (e && n) { const t = n.cloneNode(), o = n.querySelector(".links"); o && (t.style.setProperty("display", "block"), o.style.setProperty("display", "flex"), o.style.setProperty("align-items", "center"), o.style.setProperty("flex-wrap", "wrap"), o.style.setProperty("width", "100%"), o.style.setProperty("border", "none"), o.style.setProperty("border-radius", "0"), o.style.setProperty("padding", "0"), o.style.setProperty("padding-top", "")), t.appendChild(o), e.appendChild(t); } }, De = "zoom: " + M, Xe = () => { const e = localStorage.getItem(De) || "1"; if (document && document.body) { const n = document.body.querySelector("#header"), t = document.body.querySelector("#bugzilla-body"), o = document.body.querySelector("#footer"); n && (n.style.zoom = e), t && (t.style.zoom = e), o && (o.style.zoom = e); } }, Ht = (e) => { localStorage.setItem(De, e.toString()), Xe(); }, Vt = () => typeof localStorage.getItem(De) == "string", Ue = () => { Vt() ? Xe() : et(); }, et = () => { const e = document.createElement("div"); (e.id = "page_zoom_vue_app"), document.body.appendChild(e); const { createApp: n, ref: t } = Vue, o = n({ template: `
设置页面缩放比例,以适配屏幕尺寸及分辨率(仅在当前页面生效,仅需要设置一次)
设置完毕后关闭弹窗,此页面不再弹出此提示
`, setup() { const a = t(!0), l = t(1), i = (r) => { (l.value = r), Ht(r); }; return { showModal: a, zoom: l, updateZoom: i, onPositiveClick: () => { (a.value = !1), i(1); }, }; }, }); return o.use(naive), o.mount("#page_zoom_vue_app"); }, tt = (e) => { const n = "b" + e; let o = (localStorage.getItem(_.COMPLETED_BUGS) ?? "") .split(";") .filter((l) => l), a = !1; return ( o.includes(n) ? (o = o.filter((l) => l !== n)) : (o.push(n), (a = !0)), localStorage.setItem(_.COMPLETED_BUGS, o.join(";")), a ); }, Gt = () => (localStorage.getItem(_.COMPLETED_BUGS) ?? "") .split(";") .filter((t) => t) .some((t) => !/^b\d+$/.test(t)), te = { REPORT: "report", RESOLVED_MARK: "resolvedMark", COLLECTION: "collection", }, $t = [ { name: te.REPORT, title: "添加日报", show: !0 }, { name: te.RESOLVED_MARK, title: "解决/移除", show: !0 }, { name: te.COLLECTION, title: "收藏/移除", show: !0 }, ], je = () => JSON.parse( localStorage.getItem(_.LIST_PAGE_ACTION_BTNS) || JSON.stringify($t), ), Ft = (e, n) => { const t = je(), o = t.findIndex((a) => a.name === e); o !== -1 && (t[o].show = n), localStorage.setItem(_.LIST_PAGE_ACTION_BTNS, JSON.stringify(t)); }, Ce = (e) => { const n = je(), t = n.findIndex((o) => o.name === e); return t === -1 ? !1 : n[t].show; }, Yt = (e, n, t, o) => { if (!Ce(te.REPORT)) return null; const a = document.createElement("span"); return ( be(n) ? (a.classList.add("custom-button"), a.classList.add("plain-button"), (a.innerText = "移除日报")) : (a.classList.add("custom-button"), (a.innerText = "添加日报")), a.addEventListener("click", () => { try { be(n) ? (Me(n), (a.innerText = "添加日报"), a.classList.remove("plain-button")) : (Pe({ id: n, name: t, url: o }), (a.innerText = "移除日报"), a.classList.add("plain-button")); } catch (l) { w(S.ERROR, "操作失败: " + l); } }), e.appendChild(a), a ); }, Jt = (e, n) => { if (!Ce(te.RESOLVED_MARK)) return null; const t = document.createElement("span"); return ( t.classList.add("custom-button"), (t.innerText = "解决/移除"), t.addEventListener("click", () => { try { const o = "b" + n, a = document.querySelector("#" + o); Gt() && (w( S.ERROR, "当前 localStorage: completed_bugs 存储数据遭受污染,之前的数据将被清空", 5e3, ), localStorage.setItem(_.COMPLETED_BUGS, "")), a && (tt(n) ? (a.style.setProperty("background-color", "#c7c7c7ff"), t.classList.add("plain-button")) : (t.classList.remove("plain-button"), a.style.removeProperty("background-color"))); } catch (o) { w(S.ERROR, "标记失败: " + o); } }), e.appendChild(t), t ); }, Wt = (e, n, t, o) => { if (!Ce(te.COLLECTION)) return null; const a = "Bug " + n, l = document.createElement("span"); return ( (l.innerText = "收藏/移除"), he(a).hasCollected ? (l.classList.add("custom-button"), l.classList.add("plain-button")) : l.classList.add("custom-button"), l.addEventListener("click", () => { try { const { collectedBugs: i, hasCollected: c } = he(a); let r = { list: i }; c ? ((r = { list: i.length > 0 && i.filter((s) => s.id !== a) }), l.classList.remove("plain-button")) : ((r = { list: [...i, { id: a, title: t, url: o }] }), l.classList.add("plain-button")), localStorage.setItem(_.COLLECTED_BUGS, JSON.stringify(r)); } catch {} }), e.appendChild(l), l ); }, Kt = () => { const e = document.createElement("div"); (e.id = "page_list_act_btn_control_vue_app"), document.body.appendChild(e); const n = je(), { createApp: t, ref: o, h: a } = Vue, l = t({ template: `
`, setup() { const i = o(!0), c = o(n), r = o([ { title: "按钮名称", dataIndex: "title", key: "title", width: "calc(40vw - 180px)", ellipsis: { tooltip: !0 }, }, { title: "是否显示", key: "actions", width: 180, render: (s) => a(naive.NSwitch, { "default-value": s.show, "checked-value": !0, "unchecked-value": !1, "on-update:value": () => { const d = !s.show; (s.show = d), (c.value = [...c.value]), Ft(s.name, d); }, }), }, ]); return { showModal: i, data: c, columns: r, onPositiveClick: () => { window.location.reload(); }, }; }, }); return l.use(naive), l.mount("#page_list_act_btn_control_vue_app"); }; var D = ((e) => ( (e.BUG_LIST = "/bugzilla/buglist.cgi"), (e.BUG_DETAIL = "/bugzilla/show_bug.cgi"), (e.BUG_NEW = "/bugzilla/enter_bug.cgi"), (e.BUG_NEW_ENTRY = "/bugzilla/describecomponents.cgi"), (e.BUG_ATTACHMENT = "/bugzilla/attachment.cgi"), (e.BUG_HISTORY = "/bugzilla/show_activity.cgi"), (e.BUG_PROCESS = "/bugzilla/process_bug.cgi"), e ))(D || {}); const nt = () => { const e = localStorage.getItem(_.SEARCH_HISTORY); return e ? JSON.parse(e) : []; }, Qt = (e) => { let n = nt(); n.includes(e) ? (n = n.filter((t) => t !== e)) : n.length >= 20 && n.pop(), n.unshift(e), localStorage.setItem(_.SEARCH_HISTORY, JSON.stringify(n)); }, ot = (e) => { /^\d+$/.test(e) ? window.open( `http://192.168.1.31/bugzilla/show_bug.cgi?id=${e}`, "_blank", ) : window.open( `http://192.168.1.31/bugzilla/buglist.cgi?quicksearch=${e}`, "_blank", ), Qt(e); }, at = (e, n) => { if (!e) return; const t = document.createElement("div"); (t.id = n), e.parentNode.insertBefore(t, e.nextSibling); const { createApp: o, ref: a } = Vue, l = o({ template: ` `, setup() { const i = a([]); return { selectedValue: void 0, options: i, handleSearch(c) { c && ot(c); }, handleShow(c) { if (c) { const r = nt(); i.value = r.map((s) => ({ label: s, value: s })); } }, }; }, }); return l.use(naive), l.mount(`#${n}`); }, Zt = () => M === D.BUG_NEW && !He(), He = () => window.location.href === window.location.origin + "/bugzilla/enter_bug.cgi", Xt = async () => { const e = ke(ge(new Date(), 14), 30); for (let n = 0; n < e.length; n++) { const t = e[n]; (localStorage.getItem(t) ?? null) && localStorage.removeItem(t); } }, en = async () => await ( await fetch( "https://mock.mengxuegu.com/mock/60c2f7ae23b1e401b1724c72/example/personMap", ) ).json(), st = async () => { const e = JSON.parse(localStorage.getItem(_.PERSONS_MAP) ?? "{}"); try { const n = await en(); if (n) { const t = { ...n.data, ...e }; return localStorage.setItem(_.PERSONS_MAP, JSON.stringify(t)), t; } return e; } catch { return null; } }, lt = (e, n, t) => { const o = qe("zhou"), a = localStorage.getItem(n) === "true"; o === e && !a ? (t(), localStorage.setItem(n, "true")) : o === e ? localStorage.setItem(n, "true") : localStorage.setItem(n, "false"); }, tn = !window.location.pathname.includes("attachment.cgi") && !window.location.pathname.includes("show_activity.cgi"), nn = () => { const e = document.querySelectorAll(".links a"), n = document.querySelector(".links"), t = Array.from(document.querySelectorAll(".links li")), o = document.querySelector("#quicksearch_top"), a = document.querySelector("#quicksearch_bottom"), l = document.querySelector("#find_top"), i = document.querySelector("#find_bottom"), c = document.querySelectorAll(".links .separator"), r = document.querySelectorAll("input[value='Search']"); Xt(), Pt(), Mt(), Dt(); const s = (u, m) => { (u.value = "查询/刷新"), u.addEventListener("click", (b) => { b.preventDefault(), m.value ? (ot(m.value), (m.value = "")) : window.location.reload(); }); }; l && o && s(l, o), i && a && s(i, a), e && Array.from(e).forEach((u) => { u.classList.add("link-title"); }), c && Array.from(c).forEach((u) => { (u.innerText = "|"), u.classList.add("separators"); }), r && Array.from(r).forEach((u) => { u.classList.add("custom-button"), u.classList.add("plain-button"); }); const d = (u = "", m, b) => { const h = document.createElement("li"), y = document.createElement("span"); (y.innerText = u), y.classList.add("custom-button"), ue(b, y), y.addEventListener("click", () => m(y)), h.appendChild(y), n.appendChild(h); }; t.length > 0 && t.forEach((u, m) => { [6, 8, 9, 10].includes(m) && u.remove(); }), n && tn && (d("历史记录", async () => { qt(); }), d("收藏列表", () => { if (me().length === 0) { w(S.ERROR, "没有收藏的bug"); return; } Ut(); }), He() || d("页面缩放", async () => { et(); }), M === D.BUG_LIST && (d("列表配置", () => { Kt(); }), d("邮件名英文名映射中文对照表", async () => { let u = null; const { monaco: m, editorNode: b } = await Ct({ bodyStyle: "width: 800px; height: 80vh", title: "邮件名英文名映射中文对照表(每周五自动同步云端数据一次)", onOk: (y) => { const E = u.getValue(); E && (localStorage.setItem(_.PERSONS_MAP, E), y(), w(S.SUCCESS, "更新成功")); }, onMount: () => { const y = document.querySelector(".global-dialog-footer"); if (y) { const E = document.createElement("button"); (E.innerText = "同步云端数据"), E.classList.add("custom-button"), E.addEventListener("click", async () => { (E.innerText = "同步中..."), E.classList.add("disabled-button"); try { const T = await st(); T && u && (u.setValue(JSON.stringify(T, null, 2)), w(S.SUCCESS, "同步成功, 记得保存~"), (E.innerText = "同步云端数据"), E.classList.remove("disabled-button")); } catch { w(S.ERROR, "同步失败"); } }), y.insertBefore(E, y.firstChild); } }, }), h = localStorage.getItem(_.PERSONS_MAP) ?? "{}"; (u = m.editor.create(b, { value: "", language: "json", theme: "vs-dark", fontFamily: "Consolas", fontWeight: 600, fontSize: 14, formatOnPaste: !0, hover: { enabled: !0 }, minimap: { enabled: !0 }, })), u == null || u.setValue(JSON.stringify(JSON.parse(h), null, 2)); }))), at( document.querySelector("#find_top"), "search_history_list_vue_app_top", ), at( document.querySelector("#find_bottom"), "search_history_list_vue_app_bottom", ), jt(), lt(Ne.MONDAY, _.HASCLEAR_COMPLETED_BUGS, () => { localStorage.setItem(_.COMPLETED_BUGS, ""); }), lt(Ne.FRIDAY, _.HAS_AUTO_SYNC_PERSON_MAP, st); }; async function on(e) { const { publicKey: n, privateKey: t, location: o } = e; if (!n || !t || !o) throw new Error("公钥、私钥、城市location不能为空"); const a = { ts: Math.floor(Date.now() / 1e3).toString(), ttl: e.ttl || 1800, uid: n, }, i = Object.keys(a) .sort() .map((m) => `${m}=${a[m]}`) .join("&"), r = CryptoJS.HmacSHA1(i, t).toString(CryptoJS.enc.Base64), s = encodeURIComponent(r), d = e.apiType === "daily" ? "daily.json" : "now.json", u = `${i}&sig=${s}&location=${encodeURIComponent(o)}`; return `https://api.seniverse.com/v3/weather/${d}?${u}&language=zh-Hans&unit=c`; } const Be = { publicKey: "Po_TCkQPEmOGYBCye", privateKey: "SyHEWyXh1IRy-0Agl", apiType: "now", ttl: 1800, }, it = async () => { try { const e = localStorage.getItem(_.CITY) ?? "成都", n = await on({ publicKey: Be.publicKey, privateKey: Be.privateKey, location: e, apiType: Be.apiType, ttl: Be.ttl, }); return await (await fetch(n)).json(); } catch (e) { return console.error("天气API错误:", e), null; } }, Ve = (e, n) => { if (e && n.includes("@")) { const t = n.split("@")[0]; return e[t]; } return n; }, re = () => JSON.parse(localStorage.getItem(_.PERSONS_MAP) ?? "{}"), rt = (e) => /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e), ct = (e) => new Promise((n) => setTimeout(n, e)), an = () => { const e = document.querySelector(".bz_quip"); if (e) { const n = [ { url: "http://api.qemao.com/api/yulu/?type=1", type: "毒鸡汤语录" }, { url: "http://api.qemao.com/api/yulu/?type=2", type: "祖安语录" }, { url: "http://api.qemao.com/api/yulu/?type=3", type: "社会语录" }, ]; localStorage.setItem(_.QUIP_TYPE, "0"); const t = async (a) => { try { GM_xmlhttpRequest({ method: "GET", url: a.url, onload: function (l) { if (l && l.status === 200) { const i = l.responseText, c = parseInt(localStorage.getItem(_.QUIP_TYPE) ?? "0"), r = `
${i} (点我刷新)
${n .map( (u, m) => ` `, ) .join("")}
`; e.innerHTML = r; const s = document.getElementById("quip-text"); Array.from( e.querySelectorAll( "input[type='radio'][name='quipType']", ), ).forEach((u) => { u.value === c.toString() && (u.checked = !0), u.addEventListener("change", () => { const m = u.value; localStorage.setItem(_.QUIP_TYPE, m), t(n[+m]); }); }), s && s.addEventListener("click", () => { t(n[c]); }); } }, }); } catch (l) { console.error(l); } }, o = parseInt(localStorage.getItem(_.QUIP_TYPE) ?? "0"); t(n[o]); } }, sn = () => { const e = document.querySelector(".bz_query_timestamp"); if (e) { e.innerHTML = "加载中..."; const n = () => { const o = document.createElement("input"); o.style.setProperty("width", "100%"), (o.value = localStorage.getItem(_.CITY) ?? "成都"), J({ title: "设置城市", bodyStyle: "width: 400px; height: 60px", body: o, onOk: async (a) => { const l = o.value; if (l) { localStorage.setItem(_.CITY, l), w(S.SUCCESS, "正在验证当前城市是否存在", 2e3); const i = await it(); if ( (await ct(2e3), (i == null ? void 0 : i.status_code) === "AP010010") ) { w( S.ERROR, "当前城市不存在,为你设置为默认城市:成都", 3e3, ), (o.value = "成都"), localStorage.setItem(_.CITY, "成都"); return; } a(), t(); } else l || w(S.ERROR, "请输入城市名称"); }, }); }, t = async () => { try { await Le(pe.CRYPTO_JS); const o = await it(); if (!o) { w(S.ERROR, "获取天气失败"); return; } const a = o.results[0].now; if (!a) return; const l = '|', i = [ `${localStorage.getItem(_.CITY)} `, qe("zhou"), a.text, a.temperature + "度", ]; e.innerHTML = i .map((s, d) => (d === i.length - 1 ? s : s + l)) .join(""); const c = document.createElement("span"); (c.title = "刷新天气"), (c.style.display = "inline-block"), (c.style.marginLeft = "10px"), (c.style.transform = "translateY(2px)"), (c.innerHTML = ''), c.classList.add("cursor-pointer"), c.addEventListener("click", async () => { c.firstElementChild.classList.add("self-rotate"), await ct(700), await t(), w(S.SUCCESS, "刷新成功"); }), e.appendChild(c); const r = document.getElementById("setting-city"); r && r.addEventListener("click", n); } catch (o) { console.error(o); } }; t(); } }, ln = () => { const e = document.querySelector("#long_format"), n = document.querySelector("#xml"), t = document.querySelector("#timesummary"), o = document.querySelector("#remember"), a = Array.from(document.querySelectorAll(".bz_id_column a")), l = Array.from(document.querySelectorAll(".bz_short_desc_column a")), i = Array.from(document.querySelectorAll(".bz_buglist .bz_bugitem")); if ( (e && (e.classList.add("custom-button"), e.classList.add("plain-button"), (e.style.marginLeft = "0")), n && (n.classList.add("custom-button"), n.classList.add("plain-button"), (n.style.marginLeft = "0")), t && (t.classList.add("custom-button"), t.classList.add("plain-button"), (t.style.marginLeft = "0")), o && (o.classList.add("custom-button"), o.classList.add("plain-button"), (o.style.marginLeft = "0")), a && a.forEach((c) => { const r = c.parentNode; (r.style.paddingLeft = "0px"), (r.style.width = "100px"), c.classList.add("custom-button"), c.classList.add("plain-button"), c.addEventListener("click", (s) => { s.preventDefault(), window.open(c.href, "_blank"); }); }), l && l.forEach((c) => { c.addEventListener("click", (r) => { r.preventDefault(), window.open(c.href, "_blank"); }); }), i.length) ) { const c = re(); i.forEach((r, s) => { Array.from(r.children).forEach((T) => { const N = T.firstElementChild && T.firstElementChild.tagName === "SPAN"; if (rt(T.innerText)) T.innerText = Ve(c, T.innerText); else if (N) { const f = T.firstElementChild; f.title && rt(f.title) && (f.innerText = Ve(c, f.title)); } }); const u = a[s].innerText, m = r.querySelector(".bz_short_desc_column a"), b = m.innerText, h = m.href, y = document.createElement("td"); Yt(y, u, b, h); const E = Jt(y, u); if ((Wt(y, u, b, h), r.appendChild(y), Ce(te.RESOLVED_MARK))) { const N = (localStorage.getItem(_.COMPLETED_BUGS) ?? "") .split(";") .filter((f) => f); E && N.includes(r.id) && (E.classList.add("plain-button"), r.style.setProperty("background-color", "#c7c7c7ff")); } }); } an(), sn(); }, rn = () => { M === D.BUG_LIST && (ln(), Ue()); }, V = (e, n, t) => { const o = document.createElement("div"); return ( o.classList.add("custom-button"), (o.innerText = e), o.addEventListener("click", (a) => t(a, o)), n(o), o ); }, cn = (e, n = "download") => { const t = document.createElement("a"); (t.style.display = "none"), (t.href = e), (t.download = n), document.body.appendChild(t), t.click(), document.body.removeChild(t); }, Ge = (e) => { var n; return (n = e.match(/mailto:([^]+)/)) == null ? void 0 : n[1]; }, Ie = (e, n, t, o) => { e && (n && (Pe({ id: t, name: o, url: window.location.href }), tt(t)), e.submit()); }, dt = () => { const e = JSON.parse(localStorage.getItem(_.FORM_ITEM_CONTROL) || "{}"), n = It.map((o) => { var l; const a = Array.isArray(e == null ? void 0 : e.list1) ? (l = e == null ? void 0 : e.list1) == null ? void 0 : l.find((i) => i.label === o.label) : null; return { ...o, show: a ? a.show : !0, disabled: a ? a.disabled : !1 }; }), t = At.map((o) => { var l; const a = Array.isArray(e == null ? void 0 : e.list2) ? (l = e == null ? void 0 : e.list2) == null ? void 0 : l.find((i) => i.label === o.label) : null; return { ...o, show: a ? a.show : !0, disabled: a ? a.disabled : !1 }; }); return { list1: n, list2: t }; }, dn = () => { const { list1: e, list2: n } = dt(); [...e, ...n].forEach((t) => { if (!t.show) { const o = document.querySelector(t.value); o.style.display = "none"; } }); }, un = () => { const e = document.querySelector("#bz_show_bug_column_2 .vcard .email"); return Ge((e == null ? void 0 : e.href) ?? ""); }, $e = () => { let e = null; const n = re(), t = document.querySelector("#assigned_to"), o = Array.from(document.querySelectorAll("#assigned_to > option")), a = document.querySelector("#bz_assignee_edit_action"), l = un(); let i = null; a && (a.classList.remove("disabled-button"), (a.innerText = "更改指派人")), M === D.BUG_DETAIL && t.value !== l && ((i = document.createElement("div")), (i.id = "assign_to_tester_btn"), (i.innerText = "转给报告人"), i.classList.add("custom-button"), i.classList.add("plain-button"), i.addEventListener("click", () => { a.click(), e && e.assignToTester(l), M === D.BUG_DETAIL && i && i.remove(); })), a && a.addEventListener("mousedown", () => { a.click(), M === D.BUG_DETAIL && i && i.remove(); }); const c = document.createElement("div"); (c.id = "assigned_to_list_vue_app"), c.style.setProperty("max-width", "800px"), M === D.BUG_DETAIL && i && a && a.parentNode.insertBefore(i, a.nextElementSibling), t.parentNode.insertBefore(c, t), t.classList.add("bz_default_hidden"), o.forEach((m) => { const b = m.innerText.match( /<([^]+)@(yonghongtech|test|sina).(com|cn)>/, ), h = b ? b[1] : ""; m.innerText = h && n[h] ? n[h] + " - " + m.innerText.replace("-", "").replace(n[h], "") : m.innerText; }); const { createApp: r, ref: s, reactive: d } = Vue, u = r({ template: ` `, setup() { const m = s(t.value), b = d( o .map((y) => ({ label: y.innerText, value: y.value })) .filter((y) => !!y.label), ); return { selectedValue: m, options: b, handleUpdateValue(y) { t.value = y; }, assignToTester: (y) => { (m.value = y), (t.value = y); }, }; }, }); return u.use(naive), (e = u.mount("#assigned_to_list_vue_app")), e; }; function ut(e, n) { const t = document.querySelector("#" + e); t && (t.onload = () => { const o = t.contentDocument; n(o); }); } const pn = (e) => { Array.from(e.childNodes).forEach((t) => { var o; t.nodeType === 3 && (( (o = t == null ? void 0 : t.textContent) == null ? void 0 : o.trim() ) ? e.removeChild(t) : (t.textContent = "")); }); }, pt = (e, n, t = !0) => { let o = ve(); 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(_.CUSTOM_BRANCHES, JSON.stringify(o)); }, ve = () => JSON.parse(localStorage.getItem(_.CUSTOM_BRANCHES) ?? "[]"), Fe = (e) => { localStorage.setItem(_.CUSTOM_BRANCHES, JSON.stringify(e)); }; function mt(e, n) { if (n < 1 || n >= e.length) return [...e]; const t = [...e]; return ([t[n], t[n - 1]] = [t[n - 1], t[n]]), t; } function ht(e, n) { if (n < 0 || n >= e.length - 1) return [...e]; const t = [...e]; return ([t[n], t[n + 1]] = [t[n + 1], t[n]]), t; } const mn = () => { const e = document.createElement("div"); (e.id = "new_branch_vue_app"), document.body.appendChild(e); const n = ve(), { 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)), Fe(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)), Fe(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, )), pt(b.title, !1); }, }), ], }, ), }, ]), u = ye((b) => { b ? (s.value = s.value.filter((h) => h.title.includes(b))) : (s.value = ve()); }, 500), m = ye(() => { r.value && ((s.value = [...s.value, { title: r.value }]), pt(r.value, !0), (r.value = "")); }, 500); return { showModal: i, searchValue: c, branchName: r, data: s, columns: d, onSearch: u, addBranch: m, onPositiveClick: () => { window.location.reload(); }, }; }, }); return l.use(naive), l.mount("#new_branch_vue_app"); }, gt = (e) => new Promise((n, t) => { GM_xmlhttpRequest({ method: e.method || "GET", url: e.url, headers: e.headers, data: e.data, onload: (o) => { n({ response: o.responseText, status: o.status, statusText: o.statusText, }); }, onerror: (o) => { t(new Error(`Request failed: ${o.statusText || "Unknown error"}`)); }, ontimeout: () => { t(new Error("Request timed out")); }, }); }), hn = (e, n) => { if (!Array.isArray(e) || e.length === 0) return []; const t = (l) => l[n], o = new Set(), a = []; for (const l of e) { const i = t(l); o.has(i) || (o.add(i), a.push(l)); } return a; }, Ye = () => { const e = localStorage.getItem(_.GITLAB_CONFIG); return e ? JSON.parse(e || "{}") : null; }, gn = async (e, n, t) => { const o = new URLSearchParams(); t.projectId && o.append("project_id", t.projectId.toString()), t.createdAfter && o.append("created_after", t.createdAfter), t.createdBefore && o.append("created_before", t.createdBefore), t.state ? o.append("state", t.state) : o.append("state", "merged"), o.append("per_page", "100"), o.append("order_by", "created_at"), o.append("sort", "desc"); const a = await gt({ url: `${e}/api/v4/merge_requests?${o}`, headers: { "PRIVATE-TOKEN": n, "Content-Type": "application/json" }, }); return a.status < 200 || a.status >= 300 ? [] : JSON.parse(a.response); }, fn = async (e, n, t, o) => { const a = await gt({ url: `${e}/api/v4/projects/${t}/merge_requests/${o}/commits`, headers: { "PRIVATE-TOKEN": n, "Content-Type": "application/json" }, }); return a.status < 200 || a.status >= 300 ? [] : JSON.parse(a.response); }, bn = async (e, n, t, o) => { const a = []; try { const l = await gn(e, n, { projectId: o.projectId, createdAfter: o.createdAfter, createdBefore: o.createdBefore, state: "merged", }); for (const i of l) try { (await fn(e, n, i.project_id, i.iid)) .filter((s) => s.message.includes(t)) .forEach((s) => { a.push({ commitHash: s.id, targetBranch: i.target_branch, gitlabUrl: e, projectId: i.project_id, mrId: i.iid, commitMessage: s.message, }); }); } catch (c) { console.error(`Failed to process MR ${i.iid}:`, c); continue; } } catch (l) { console.error("Failed to get merge requests:", l); } return a; }, yn = async (e, n = {}, t = [2, 3]) => { const o = [], a = Ye(); if (!a) return w(S.ERROR, "请先配置 GitLab 信息"), o; const { gitlabUrl: l, personalAccessToken: i, rangeDays: c = 1, projectIds: r = [], } = a, s = [...new Set([...t, ...r])]; if (!i) return console.warn("No personal access token provided"), o; if (!s || s.length === 0) return console.warn("No project IDs provided"), o; try { const d = s.map((m) => bn(l, i, e, { createdAfter: ge(Z(), c), ...n, projectId: m }), ), u = await Promise.all(d); return o.push(...u.flat()), hn(o, "commitHash"); } catch (d) { return ( console.error("Failed to get commits from multiple projects:", d), o ); } }, vn = (e) => new Map([ [2, "bi"], [3, "core"], ]).get(e) || "", ft = () => { const e = document.createElement("div"); (e.id = "gitlab_config_vue_app"), document.body.appendChild(e); const { createApp: n, ref: t } = Vue, o = n({ template: `
自动将指派人指定为报告人 自动填写 commit info 自动将 bug 标记为已修复 去生成 仅限开发人员使用 仅查询已经合并后的 commit 仅查询 BI、Core 两个项目
`, setup() { const a = t(!0), l = t(null), i = Ye(), c = t({ personalAccessToken: (i == null ? void 0 : i.personalAccessToken) || "", gitlabUrl: (i == null ? void 0 : i.gitlabUrl) || Qe, rangeDays: (i == null ? void 0 : i.rangeDays) || 1, projectIds: (i == null ? void 0 : i.projectIds) || [2, 3], autoSaveForm: (i == null ? void 0 : i.autoSaveForm) || !1, }); return { showModal: a, formRef: l, modelRef: c, rules: { personalAccessToken: [ { required: !0, message: "请输入 Personal Access Token" }, ], gitlabUrl: [{ required: !0, message: "请输入 GitLab 地址" }], rangeDays: [{ required: !0, message: "请输入查询范围(天)" }], }, onPositiveClick: () => { var s; (s = l.value) == null || s.validate((d) => { d || (localStorage.setItem( _.GITLAB_CONFIG, JSON.stringify(c.value), ), (a.value = !1)); }); }, onGenerateClick: () => { window.open( `${c.value.gitlabUrl}/-/profile/personal_access_tokens`, "_blank", ); }, }; }, }); return o.use(naive), o.mount("#gitlab_config_vue_app"); }, bt = (e, n = !1) => { e.classList.add("custom-button"), e.classList.add("plain-button"), n && e.classList.add("disabled-button"), (e.style = "margin-left: 2px; padding-top: 5px !important"), e.innerText === "First" && (e.innerText = "第一个"), e.innerText === "Last" && (e.innerText = "最后一个"), e.innerText === "Prev" && (e.innerText = "上一个"), e.innerText === "Next" && (e.innerText = "下一个"), e.innerText === "Show last search results" && (e.innerText = "显示上一次的搜索结果"), e.innerText === "This bug is not in your last search results." && (e.innerText = "这个 bug 不是你上一次搜索的结果"); }, _n = (e, n = !1) => { if (typeof e != "string" || e.trim() === "") return []; const t = n ? /[0-9a-fA-F]{40}/g : /[0-9a-fA-F]{40}|[0-9a-fA-F]{7}/g, o = e.match(t) || []; return Array.from(new Set(o)); }, xn = (e) => { const n = /(bi|core)(?::|[-/[\s]|$)/i, t = e.match(n); return t ? t[1].toLowerCase() : ""; }, Sn = (e, n, t = !1) => { const o = (l) => { const i = _n(l, t); if (i.length === 0) return l; const c = xn(l), r = [...i].sort((d, u) => u.length - d.length); let s = l; return ( r.forEach((d) => { const u = d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), m = new RegExp(`(^|\\W)(${u})(\\W|$)`, "g"); s = s.replace( m, (b, h, y, E) => `${h}${y}${E}`, ); }), s ); }, a = (l) => l .split( ` `, ) .map((r) => o(r)).join(` `); if (typeof e == "string") return e.replace( /(]*>)([\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: `
`, 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); } })();