summaryrefslogtreecommitdiffstats
path: root/module/web/main.js
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-11-22 18:51:14 +0100
committerGravatar spoob <spoob@gmx.de> 2009-11-22 18:51:14 +0100
commit419a93755b6180bbab69aaf973cd99f49b4a2268 (patch)
tree5996b06cb7713058626fc48c44651df8284dd303 /module/web/main.js
parentfixed plugin index (diff)
downloadpyload-419a93755b6180bbab69aaf973cd99f49b4a2268.tar.xz
Webinterface with XMLRPC
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);
+