diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/index.js | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/js/index.js b/js/index.js index 53fd366..8649175 100644 --- a/js/index.js +++ b/js/index.js @@ -144,7 +144,7 @@ function get_overview(link){ var resultl = result.match(plans_re).length; if(resultl == 0){ - $.mobile.changePage("#loginpopup"); + //$.mobile.changePage("#loginpopup", {rel: "dialog", position-to: 'window', inline: 'true'}); $("#loginform").removeClass('ui-disabled'); return; } @@ -190,36 +190,38 @@ function get_overview(link){ }); } -function login(){ - $("#loginform").addClass('ui-disabled'); - $.mobile.loading("show", { - text: "Lade...", - textVisible: true, - theme: "b", - }); +$(document).on("pageinit", function login(){ + $('#lnklogin').click(); + $('#loginpopup').on("popupafterclose", function(event){ + $.mobile.loading("show", { + text: "Lade...", + textVisible: true, + theme: "b", + }); - var username = encodeURIComponent($("#username").val()); - var password = encodeURIComponent($("#password").val()); - var params = "username=" + username + "&password=" + password; + var username = encodeURIComponent($("#username").val()); + var password = encodeURIComponent($("#password").val()); + var params = "username=" + username + "&password=" + password; - var request = $.ajax({ - type: "POST", - url: "https://***REMOVED***/moodle/login/index.php", - data: {username: username, password: password} - }); - request.done(function(result){ - var vertretungs_re = new RegExp("title=\"Vertretungsplan\" href=\"(http://***REMOVED***\\.de/moodle/course/view\\.php\\?id=\\d+)"); - var link = vertretungs_re.exec(result)[1]; + var request = $.ajax({ + type: "POST", + url: "https://***REMOVED***/moodle/login/index.php", + data: {username: username, password: password} + }); + request.done(function(result){ + var vertretungs_re = new RegExp("title=\"Vertretungsplan\" href=\"(http://***REMOVED***\\.de/moodle/course/view\\.php\\?id=\\d+)"); + var link = vertretungs_re.exec(result)[1]; - console.log('Login-Request erfolgreich: ' + link); + console.log('Login-Request erfolgreich: ' + link); - get_overview(link); - }); + get_overview(link); + }); - request.fail(function(jqXHR, textStatus){ - alert("Etwas ist schiefgelaufen: " + textStatus); + request.fail(function(jqXHR, textStatus){ + alert("Etwas ist schiefgelaufen: " + textStatus); + }); }); -} +}); var app = { // Application Constructor |
