diff options
Diffstat (limited to 'common.js')
-rw-r--r-- | common.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/common.js b/common.js new file mode 100644 index 0000000..11dcdba --- /dev/null +++ b/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; +} + |