1 String.prototype.trim = function() {return this.replace(/^\s*(.+)\s*$/,"$1");}
4 * hard_empty() is needed because dojo.empty() doesn't seem to work on
5 * XUL nodes. This also means that dojo.place() with a position argument of
6 * "only" doesn't do what it should, but calling hard_empty() on the refnode
7 * first will do the trick.
9 function hard_empty(node) {
10 if (typeof(node) == "string")
11 node = dojo.byId(node);
13 dojo.forEach(node.childNodes, dojo.destroy);
17 if (typeof(e) == "string") e = dojo.byId(e);
18 openils.Util.addCSSClass(e, "hideme");
22 if (typeof(e) == "string") e = dojo.byId(e);
23 openils.Util.removeCSSClass(e, "hideme");
26 function hide_table_cell(e) {
27 if (typeof(e) == "string") e = dojo.byId(e);
29 e.style.display = "none";
30 e.style.visibility = "hidden";
33 function show_table_cell(e) {
34 if (typeof(e) == "string") e = dojo.byId(e);
35 e.style.display = "table-cell";
36 e.style.visibility = "visible";
39 function soft_hide(e) { /* doesn't disrupt XUL grid alignment */
40 if (typeof(e) == "string") e = dojo.byId(e);
41 e.style.visibility = "hidden";
44 function soft_show(e) {
45 if (typeof(e) == "string") e = dojo.byId(e);
46 e.style.visibility = "visible";
50 if (typeof(busy._window) == "undefined")
51 busy._window = dojo.query("window")[0];
52 busy._window.style.cursor = on ? "wait" : "auto";
55 function T(s) { return document.createTextNode(s); }
56 function D(s) {return s ? openils.Util.timeStamp(s, {"selector":"date"}) : "";}
57 function node_by_name(s, ctx) {return dojo.query("[name='" + s + "']", ctx)[0];}
59 function num_sort(a, b) {
60 [a, b] = [Number(a), Number(b)];
61 return a > b ? 1 : (a < b ? -1 : 0);