CI Train IRC nick fix

Use my IRC nickname on Ubuntu ci-train

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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)
});