Skip to content

Instantly share code, notes, and snippets.

@wangwen1220
Last active October 11, 2023 10:05
Show Gist options
  • Save wangwen1220/aa03eaa2536018e64d72dd480950085a to your computer and use it in GitHub Desktop.
Save wangwen1220/aa03eaa2536018e64d72dd480950085a to your computer and use it in GitHub Desktop.
Jenkins Build History 加强
// ==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 http://jenkins.17haoyun.cn/static/d33a9f69/images/headshot.png
// @grant none
// @include http://jenkins.17haoyun.cn/*
// @exclude http://yd.koolearn-inc.com/app/*
// @require https://unpkg.com/hotkeys-js/dist/hotkeys.min.js
// ==/UserScript==
// 在 include 里输入您的 jenkins 地址
(function(window, document) {
'use strict'
function main() {
// 添加历史记录快捷图标
document.querySelectorAll('.build-row-cell').forEach((node, index) => {
const cmdlink = node.querySelector('.build-status-link').getAttribute('href')
const elem = node.querySelector('.pane.build-controls .build-badge')
if (!elem) return
elem.insertAdjacentHTML('afterbegin', `&nbsp;<a href='${cmdlink}'><img src="/static/f80a2d63/images/16x16/terminal.png" width="16" height="16"></a>&nbsp;`)
const reg = cmdlink.replace(/console.*/, '')
if (reg) {
elem.insertAdjacentHTML('afterbegin', `&nbsp;<a href='${reg}rebuild'><img src="/static/f80a2d63/images/16x16/clock.png" width="16" height="16"></a>&nbsp;`)
}
})
// 添加搜索框快捷键
window.hotkeys('ctrl+shift+f, command+shift+f', function() {
document.querySelector('#search-box').focus()
return false
})
}
main()
})(window, document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment