summaryrefslogtreecommitdiff
path: root/js/common.js
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-10-28 13:43:08 +0100
committerPatrick Simianer <p@simianer.de>2015-10-28 13:43:08 +0100
commit04563ca60c3ffb2c02edf5e09582528d837aa925 (patch)
treef78c3fa38a9bca1bb798b193cd20b629925dc6d8 /js/common.js
parent000cd92db93f8c6655e150b07deed690b6b4db11 (diff)
mv
Diffstat (limited to 'js/common.js')
-rw-r--r--js/common.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/js/common.js b/js/common.js
new file mode 100644
index 0000000..11dcdba
--- /dev/null
+++ b/js/common.js
@@ -0,0 +1,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;
+}
+