// ==UserScript==
// @name           Nagios: UI tweaks
// @namespace      http://djce.org.uk/greasemonkey
// @description    Makes parts of the Nagios UI more useable
// @include        https://*/nagios/*
// ==/UserScript==

// The "Delay next notification" form asks for a number of "minutes from now"
// until the next notification.  Which is a pain for anything past about 3
// hours.
// This mod adds a text tip underneath the input field which shows when "now +
// N minutes" is.
try
{
	var x = document.evaluate("//input[@name=\"not_dly\"]", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null);
	var e;
	if (x) e = x.singleNodeValue;
	if (e)
	{
		var n = document.createElement("br");
		e.parentNode.appendChild(n);

		n = document.createElement("span");
		var t = document.createTextNode("hello");
		n.appendChild(t);

		e.parentNode.appendChild(n);

		var f = function() {
			var mins = parseInt(e.value);
			var d = new Date;
			d = 1*d + mins*60*1000;
			d = new Date(d);
			t.nodeValue = d.toString();
		};

		f();
		e.addEventListener("change", f, false);
	}
} catch (e) {
	alert(e);
}

