summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-03-28 18:36:32 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2016-08-15 19:46:47 +0200
commit4fcf21c8fb2b8f9420f102c6006860c77ee9ce64 (patch)
treed606c1b293d437964c912c8786da554190268c34 /js
parentc1b413b4fcbc15436d667a436cd53fe066fe2414 (diff)
downloadwvs-vplan-4fcf21c8fb2b8f9420f102c6006860c77ee9ce64.tar.gz
wvs-vplan-4fcf21c8fb2b8f9420f102c6006860c77ee9ce64.zip
stelle Login als Popup dar
Diffstat (limited to 'js')
-rw-r--r--js/index.js52
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