var hotkeys_enabled = true;
+function browser_has_opacity() {
+ return navigator.userAgent.match("Gecko") != null ||
+ navigator.userAgent.match("Opera") != null;
+}
+
function exception_error(location, e) {
var msg;
return obj.readyState == 4 || obj.readyState == 0 || !obj.readyState;
}
-
function notify_callback() {
var container = document.getElementById('notify');
if (xmlhttp.readyState == 4) {
}
}
-function p_notify(msg) {
+var notify_hide_timerid = false;
+var notify_last_doc = false;
+
+function hide_notify() {
+ if (notify_last_doc) {
+ var n = notify_last_doc.getElementById("notify");
+ if (browser_has_opacity()) {
+ if (notify_opacity >= 0) {
+ notify_opacity = notify_opacity - 0.2;
+ n.style.opacity = notify_opacity;
+ notify_hide_timerid = window.setTimeout("hide_notify()", 20);
+ } else {
+ n.style.display = "none";
+ n.style.opacity = 1;
+ }
+ } else {
+ n.style.display = "none";
+ }
+ }
+}
+
+function notify_real(msg, doc, no_hide, is_err) {
- var n = parent.document.getElementById("notify");
- var nb = parent.document.getElementById("notify_body");
+ var n = doc.getElementById("notify");
+ var nb = doc.getElementById("notify_body");
if (!n || !nb) return;
} else {
n.style.display = "block";
}
-
- nb.innerHTML = msg;
-}
-function notify(msg) {
+ if (is_err) {
+ n.style.backgroundColor = "#ffcccc";
+ n.style.color = "black";
+ n.style.borderColor = "#ff0000";
+ } else {
+ n.style.backgroundColor = "#fff7d5";
+ n.style.borderColor = "#d7c47a";
+ n.style.color = "black";
+ }
+
+ nb.innerHTML = msg;
- var n = document.getElementById("notify");
- var nb = document.getElementById("notify_body");
+ if (notify_hide_timerid) {
+ window.clearTimeout(notify_hide_timerid);
+ }
- if (!n || !nb) return;
+ notify_last_doc = doc;
+ notify_opacity = 1;
- if (msg == "") {
- n.style.display = "none";
- } else {
- n.style.display = "block";
+ if (!no_hide) {
+ notify_hide_timerid = window.setTimeout("hide_notify()", 3000);
}
+}
- nb.innerHTML = msg;
+function p_notify(msg, no_hide, is_err) {
+ notify_real(msg, parent.document, no_hide, is_err);
+}
+function notify(msg, no_hide, is_err) {
+ notify_real(msg, document, no_hide, is_err);
}
function printLockingError() {
xmlhttp.send(null);
disableHotkeys();
+
}
function infobox_submit_callback() {
}
+function toggleSubmitNotEmpty(e, submit_id) {
+ try {
+ document.getElementById(submit_id).disabled = (e.value == "")
+ } catch (e) {
+ exception_error("toggleSubmitNotEmpty", e);
+ }
+}
+function isValidURL(s) {
+ return s.match("http://") != null || s.match("https://") != null;
+}