summaryrefslogtreecommitdiff
path: root/js/common.js
blob: 11dcdba36596d71b4772738b0caac31de1c10def (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var data,
    ui_type;


/*
 * hacky way to remove class from node
 *
 */
function removeClass(node, className)
{
  node.className =
    node.className.replace(" "+className,'');
  node.className =
    node.className.replace(" "+className,''); // ???

  return false;
}

/*
 *
 *
 */
function toggleDisplay(node)
{
  if (node.style.display=='none') {
    node.style.display = 'block';
  } else {
    node.style.display = 'none';
  }

  return false;
}

/*
 * trim string
 *
 */
function trim(s)
{
  return s.replace(/^\s+|\s+$/g, '');
}

/*
 * cross-site request
 *
 */
function CreateCORSRequest(method, url)
{
  var xhr = new XMLHttpRequest();
  if ("withCredentials" in xhr) {
    xhr.open(method, url, true);
  } else {
    xhr = null;
  }

  return xhr;
}