summaryrefslogtreecommitdiffstats
path: root/module/web/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/main.js')
-rw-r--r--module/web/main.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/module/web/main.js b/module/web/main.js
new file mode 100644
index 000000000..a286df991
--- /dev/null
+++ b/module/web/main.js
@@ -0,0 +1,42 @@
+function getXmlHttpRequestObject() {
+ if (window.XMLHttpRequest) {
+ return new XMLHttpRequest(); //Not IE
+ } else if(window.ActiveXObject) {
+ return new ActiveXObject("Microsoft.XMLHTTP"); //IE
+ } else {
+ alert("Your browser doesn't support the XmlHttpRequest object. Better upgrade to Firefox.");
+ }
+}
+var req = getXmlHttpRequestObject();
+
+function getDownloads() {
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ if(req.status==200) {
+ document.getElementById('downloads').innerHTML = req.responseText;
+ } else {
+ alert("Fehler:\nHTTP-Status: "+req.status+"\nHTTP-Statustext: "+req.statusText);
+ }
+ };
+ }
+ req.open("GET", '/downloads', true);
+ req.send(null);
+}
+
+function addUrl(new_url) {
+ req.onreadystatechange = function() {
+ if (req.readyState == 4) {
+ if(req.status==200) {
+ document.getElementById('add_urls').innerHTML = req.responseText;
+ } else {
+ alert("Fehler:\nHTTP-Status: "+req.status+"\nHTTP-Statustext: "+req.statusText);
+ }
+ };
+ }
+ url = "/add=" + new_url
+ req.open("GET", url, true);
+ req.send(null);
+}
+
+window.setInterval("getDownloads()", 1000);
+