summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html27
-rw-r--r--js/index.js52
2 files changed, 41 insertions, 38 deletions
diff --git a/index.html b/index.html
index b3cd3ae..90d6b61 100644
--- a/index.html
+++ b/index.html
@@ -28,32 +28,33 @@
</head>
<body>
<div class="app">
- <div data-role="page" class="page" id="loginpage">
+ <div data-role="page" class="page" id="loginpage" data-theme="a">
<div data-role="header">
- <h1>WvS VPlan | Login</h1>
+ <h1>WvS VPlan</h1>
</div>
<div role="main" class="ui-content">
- <form action="javascript:login()" id="loginform">
- <label for="username">Benutzername</label>
- <input type="text" id="username" hint="Benutzername" autofocus required>
- <label for="password">Passwort</label>
- <input type="password" id="password" hint="Passwort" required>
- <button type="submit">Einloggen</button>
- </form>
- <div data-role="popup" id="loginpopup">
- <p>Deine Logindaten sind inkorrekt.</p>
+ <a id='lnklogin' href='#loginpopup' data-rel="popup" data-role="button" data-position-to="window" data-inline="true" style="display:none;"></a>
+ <div data-role="popup" id="loginpopup" data-theme="a">
+ <form style="padding:10px 20px;">
+ <h3>Bitte einloggen</h3>
+ <label for="username" class="ui-hidden-accessible">Benutzername</label>
+ <input type="text" id="username" hint="Benutzername" autofocus required>
+ <label for="password" class="ui-hidden-accessible">Passwort</label>
+ <input type="password" id="password" hint="Passwort" required>
+ <button type="submit">Einloggen</button>
+ </form>
</div>
</div>
</div>
</div>
+ <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
+ <script type="text/javascript" src="js/jquery.mobile-1.4.2.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
<script type="text/javascript" src="js/pdf.js"></script>
- <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
- <script type="text/javascript" src="js/jquery.mobile-1.4.2.min.js"></script>
</body>
</html>
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