Last active
May 18, 2017 06:53
-
-
Save bitzip/faf2e52d1f1d965e55eb to your computer and use it in GitHub Desktop.
为gitlab上的任务分支添加链接按钮到redmine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name redmine-issue-link | |
// @namespace https://gist.github.com/kelly-apollo/faf2e52d1f1d965e55eb | |
// @version 0.2.2 | |
// @description try to take over the world! | |
// @author Kelly Apollo | |
// @match https://gitlab.gizwits.com/* | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; | |
var MATCH_REGEX = /^(feature|bugfix|task)\/(\d+)( |_)/i | |
$(function(){ | |
$('a').each(function(idx, ele) { | |
ele = $(ele) | |
var match = ele.html() && ele.html().match(MATCH_REGEX) | |
if (match) { | |
ele.parent().append($('<span> </span>')) | |
ele.parent().append( | |
$('<a href="http://redmine.gizwits.com/issues/' + match[2] + | |
'">*redmine*</a>')) | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment