Jenkins Build History 加强

a Jenkins shortcut tools to build history

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Jenkins Build History 加强
// @namespace    https://github.com/gaoshang212/jenkins-buildHistory-Ext
// @version      0.1.1
// @description  a Jenkins shortcut tools to build history
// @author       gaoshang212
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @include      http://yd.koolearn-inc.com/view/*
// @exclude      http://yd.koolearn-inc.com/app/*
// ==/UserScript==

// 在 include 里输入您的 jenkins 地址

(function () {
    'use strict';

    function jenkins() {
        const $ = window.jQuery;
        if (!$) {
            return;
        }
        //'<a><img src="/static/f80a2d63/images/16x16/terminal.png" width="16" height="16" alt=""></a>&nbsp;'
        $('.build-row-cell').each((index, _node) => {
            const node = $(_node);
            const cmdlink = node.find('.build-status-link').attr('href');
            const ele = node.find('.pane.build-controls .build-badge');
            if (!ele.length) {
                return;
            }

            ele.prepend(`&nbsp;<a href='${cmdlink}'><img src="/static/f80a2d63/images/16x16/terminal.png" width="16" height="16" alt=""></a>&nbsp;`)
            const reg = cmdlink.replace(/console.*/, '')
            ///(?!=\/view\/.+)\d+(?!=console)/.exec(cmdlink);
            if (reg) {
                ele.prepend(`&nbsp;<a href='${reg}rebuild'><img src="/static/f80a2d63/images/16x16/clock.png" width="16" height="16" alt=""></a>&nbsp;`)
            }
        });
    }

    jenkins();
})();