From 8dfa321c8a65fa32218dd8ac26fa25a6accec88c Mon Sep 17 00:00:00 2001 From: lukeIam Date: Thu, 3 Oct 2013 21:44:07 +0200 Subject: [PATCH] Add a rudimentary login page --- Vocaluxe/Website/index.html | 20 +++++- Vocaluxe/Website/js/main.js | 127 ++++++++++++++++++++---------------- 2 files changed, 88 insertions(+), 59 deletions(-) diff --git a/Vocaluxe/Website/index.html b/Vocaluxe/Website/index.html index 945e3e6d..67df92ef 100644 --- a/Vocaluxe/Website/index.html +++ b/Vocaluxe/Website/index.html @@ -10,6 +10,21 @@ +
+
+

Login

+
+ + +
+ + +
+ Login +
+ +
+
@@ -20,7 +35,7 @@ -

Profile

@@ -150,7 +164,7 @@
-
+
diff --git a/Vocaluxe/Website/js/main.js b/Vocaluxe/Website/js/main.js index 46ffb565..2178679d 100644 --- a/Vocaluxe/Website/js/main.js +++ b/Vocaluxe/Website/js/main.js @@ -6,6 +6,7 @@ $(document).ready(function () { initPageLoadHandler(); initKeyboardPageHandler(); initMainPageHandler(); + initLoginPageHandler(); }); function replaceTransitionHandler() { @@ -131,65 +132,21 @@ function initPageLoadHandler() { } -function initKeyboardPageHandler() { - $('#keyboardButtonUp').click(function () { - $.ajax({ - url: "sendKeyEvent=up" - }) - }); - - $('#keyboardButtonDown').click(function () { - $.ajax({ - url: "sendKeyEvent=down" - }) - }); - - $('#keyboardButtonLeft').click(function () { - $.ajax({ - url: "sendKeyEvent=left" - }) - }); - - $('#keyboardButtonRight').click(function () { - $.ajax({ - url: "sendKeyEvent=right" - }) - }); - - $('#keyboardButtonEscape').click(function () { - $.ajax({ - url: "sendKeyEvent=escape" - }) - }); - - $('#keyboardButtonkeyboardButtonTab').click(function () { - $.ajax({ - url: "sendKeyEvent=tab" - }) - }); - - $('#keyboardButtonReturn').click(function () { - $.ajax({ - url: "sendKeyEvent=return" - }) - }); - - $('#keyboardButtonKeys').keyup(function (e) { - var c = String.fromCharCode(e.keyCode); - if (c.match(/\w/)) { - c = e.keyCode >= 65 ? c.toLowerCase() : c; - $.ajax({ - url: "sendKeyEvent=" + c - }) - } - var oldText = $('#keyboardButtonKeys')[0].value; - if (oldText.length > 0) { - $('#keyboardButtonKeys')[0].value = oldText.slice(1); - } +function initLoginPageHandler() { + $('#loginButton').click(function () { + ownProfileId = parseInt($('#playerId').prop("value")); + if (ownProfileId != "NaN") { + $.mobile.changePage("#main", { transition: "slidefade" }); + } }); } function initMainPageHandler() { + $('#yourProfileLink').click(function () { + profileIdRequest = ownProfileId; + $.mobile.changePage("#displayProfile", { transition: "slidefade" }); + }); + $('#mainPageTakePhotoLink').click(function () { if ($('#captureContainer').length > 0) { $('#captureContainer').remove(); @@ -230,4 +187,62 @@ function initMainPageHandler() { $('#capture').click(); }); -} \ No newline at end of file +} + +function initKeyboardPageHandler() { + $('#keyboardButtonUp').click(function () { + $.ajax({ + url: "sendKeyEvent?key=up" + }) + }); + + $('#keyboardButtonDown').click(function () { + $.ajax({ + url: "sendKeyEvent?key=down" + }) + }); + + $('#keyboardButtonLeft').click(function () { + $.ajax({ + url: "sendKeyEvent?key=left" + }) + }); + + $('#keyboardButtonRight').click(function () { + $.ajax({ + url: "sendKeyEvent?key=right" + }) + }); + + $('#keyboardButtonEscape').click(function () { + $.ajax({ + url: "sendKeyEvent?key=escape" + }) + }); + + $('#keyboardButtonkeyboardButtonTab').click(function () { + $.ajax({ + url: "sendKeyEvent?key=tab" + }) + }); + + $('#keyboardButtonReturn').click(function () { + $.ajax({ + url: "sendKeyEvent?key=return" + }) + }); + + $('#keyboardButtonKeys').keyup(function (e) { + var c = String.fromCharCode(e.keyCode); + if (c.match(/\w/)) { + c = e.keyCode >= 65 ? c.toLowerCase() : c; + $.ajax({ + url: "sendKeyEvent?key=" + c + }) + } + var oldText = $('#keyboardButtonKeys')[0].value; + if (oldText.length > 0) { + $('#keyboardButtonKeys')[0].value = oldText.slice(1); + } + }); +}