diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-03-15 12:56:01 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-08-15 19:46:41 +0200 |
| commit | 2b5c1a92d38d84c752243809cda21300f7e579ae (patch) | |
| tree | 199e01d39b4ed524e8000fc00d88b05e0e309510 /js/index.js | |
| parent | 0e267a97dd42e5381e7704e151057e674fa8e0c3 (diff) | |
| download | wvs-vplan-2b5c1a92d38d84c752243809cda21300f7e579ae.tar.gz wvs-vplan-2b5c1a92d38d84c752243809cda21300f7e579ae.zip | |
ersetze Brick mit jQuery Mobile; füge Ladebalken und mehr Requests hinzu
Diffstat (limited to 'js/index.js')
| -rw-r--r-- | js/index.js | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/js/index.js b/js/index.js index 7d66553..3f6aecd 100644 --- a/js/index.js +++ b/js/index.js @@ -16,7 +16,32 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +function get_overview(){ + var req = new XMLHttpRequest(); + + req.onreadystatechange = function(){ + if(req.readyState == 4){ + if(req.status == 200 || window.location.href.indexOh("http") != -1){ + console.log('Übersichts-Request erfolgreich'); + $(".progress").css("max-width","40%"); + $(".progress-view").text("40%"); + document.getElementById('viewFlipBox').toggle(); + return 1; + }else{ + console.log('Etwas ist schiefgelaufen :('); + return; + } + } + } + + req.open("GET", "http://***REMOVED***/moodle/course/view.php?id=2", true); + req.send(); +} + function login(){ + document.getElementById('loginform').style.display = 'none'; + document.getElementById('loadingbar').style.display = 'block'; + var req = new XMLHttpRequest(); var username = encodeURIComponent(document.getElementById('username').value); @@ -27,11 +52,15 @@ function login(){ if(req.readyState == 4){ if(req.status == 0){ console.log("Es fehlt die Berechtigung, um auf den Server zuzugreifen."); - }else if(req.status != 200 || window.location.href.indexOf("http") != -1){ + return; + }else if(req.status != 200 && window.location.href.indexOf("http") != -1){ console.log("Etwas ist schiefgelaufen :("); + return; }else{ - console.log('Request erfolgreich'); - document.getElementById('viewFlipBox').toggle(); + console.log('Login-Request erfolgreich'); + document.getElementById("load-progress").style.maxWidth = "20%"; // TODO geht nicht + document.getElementById("load-progress-view").text = "20%"; + get_overview(); } } } @@ -39,7 +68,7 @@ function login(){ req.open("POST", "https://***REMOVED***/moodle/login/index.php", true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.send(params); -}; +} var app = { // Application Constructor |
