CI Train IRC nick fix

Use my IRC nickname on Ubuntu ci-train

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// Copyright 2015 Marco Trevisan (Treviño) <[email protected]>
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License version 3, as published
// by the Free Software Foundation.
//
// ==UserScript==
// @name        CI Train IRC nick fix
// @namespace   3v1n0.net
// @version     0.1
// @description Use my IRC nickname on Ubuntu ci-train
// @include     http*://requests.ci-train.ubuntu.com/*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js
// @require     https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349.js
// @grant       none
// ==/UserScript==

var MY_LP_NICK = '3v1n0'
var MY_IRC_NICK = 'Trevinho'

waitForKeyElements('input[name="landers"]', function(landers_inputs) {
  for (var i = 0; i < landers_inputs.length; ++i)
    landers_inputs[i].value = landers_inputs[i].value.replace(new RegExp("\\b"+MY_LP_NICK+"\\b", 'g'), MY_IRC_NICK)
});

waitForKeyElements('a[href="#/user/'+MY_LP_NICK+'"]', function(my_links) {
  for (var i = 0; i < my_links.length; ++i)
    my_links[i].href = my_links[i].href.replace(MY_LP_NICK, MY_IRC_NICK)
});