Introduce a constant for the empty guid in main.js

This commit is contained in:
lukeIam committed 2018-04-30 14:24:00 +02:00
1 parent 6ae126ca42
commit fdeaea7f40
1 file changed
+15 -14
+15 -14
View File
@@ -1,6 +1,7 @@
/// <reference path="../index.html" /> /// <reference path="../index.html" />
/// <reference path="../index.html" /> /// <reference path="../index.html" />
(function () { (function () {
var PROFILE_NULL_ID = '00000000-0000-0000-0000-000000000000';
var imageLoader; var imageLoader;
var translator; var translator;
var pageHandler; var pageHandler;
@@ -192,8 +193,8 @@
var t = this; var t = this;
this.customSelectPlaylistSongCallback = null; this.customSelectPlaylistSongCallback = null;
this.profileIdRequest = '00000000-0000-0000-0000-000000000000'; this.profileIdRequest = PROFILE_NULL_ID;
this.songIdRequest = '00000000-0000-0000-0000-000000000000'; this.songIdRequest = PROFILE_NULL_ID;
this.init = function () { this.init = function () {
replaceTransitionHandler(); replaceTransitionHandler();
@@ -207,8 +208,8 @@
this.reset = function () { this.reset = function () {
t.customSelectPlaylistSongCallback = null; t.customSelectPlaylistSongCallback = null;
t.profileIdRequest = '00000000-0000-0000-0000-000000000000'; t.profileIdRequest = PROFILE_NULL_ID;
t.songIdRequest = '00000000-0000-0000-0000-000000000000'; t.songIdRequest = PROFILE_NULL_ID;
}; };
var replaceTransitionHandler = function () { var replaceTransitionHandler = function () {
@@ -251,7 +252,7 @@
} }
if (sessionHandler.sessionId != "") { if (sessionHandler.sessionId != "") {
if (sessionHandler.ownProfileId != '00000000-0000-0000-0000-000000000000') { if (sessionHandler.ownProfileId != PROFILE_NULL_ID) {
$.mobile.changePage("#main", { transition: "slidefade" }); $.mobile.changePage("#main", { transition: "slidefade" });
} else { } else {
request({ request({
@@ -297,8 +298,8 @@
}); });
$('#registerButton').click(function () { $('#registerButton').click(function () {
sessionHandler.ownProfileId = '00000000-0000-0000-0000-000000000000'; sessionHandler.ownProfileId = PROFILE_NULL_ID;
pageHandler.profileIdRequest = '00000000-0000-0000-0000-000000000000'; pageHandler.profileIdRequest = PROFILE_NULL_ID;
$.mobile.changePage("#displayProfile", { transition: "slidefade" }); $.mobile.changePage("#displayProfile", { transition: "slidefade" });
}); });
}; };
@@ -549,7 +550,7 @@
}; };
var pagebeforeshowDisplayProfile = function () { var pagebeforeshowDisplayProfile = function () {
if (pageHandler.profileIdRequest != '00000000-0000-0000-0000-000000000000') { if (pageHandler.profileIdRequest != PROFILE_NULL_ID) {
var promise = request({ var promise = request({
url: "getProfile?profileId=" + pageHandler.profileIdRequest url: "getProfile?profileId=" + pageHandler.profileIdRequest
}).done(function (result) { }).done(function (result) {
@@ -596,7 +597,7 @@
"Difficulty": 0, "Difficulty": 0,
"IsEditable": true, "IsEditable": true,
"PlayerName": i18n.t("YourName") || "YourName", "PlayerName": i18n.t("YourName") || "YourName",
"ProfileId": '00000000-0000-0000-0000-000000000000', "ProfileId": PROFILE_NULL_ID,
"Type": 1 "Type": 1
}); });
$('#playerType').prop("value", 0); $('#playerType').prop("value", 0);
@@ -605,7 +606,7 @@
$('#playerSaveButton').click(function () { $('#playerSaveButton').click(function () {
var dataToUpload = {}; var dataToUpload = {};
dataToUpload["ProfileId"] = '00000000-0000-0000-0000-000000000000'; dataToUpload["ProfileId"] = PROFILE_NULL_ID;
dataToUpload["PlayerName"] = $('#playerName').prop("value"); dataToUpload["PlayerName"] = $('#playerName').prop("value");
dataToUpload["Type"] = $('#playerType').prop("value"); dataToUpload["Type"] = $('#playerType').prop("value");
dataToUpload["Difficulty"] = $('#playerDifficulty').prop("value"); dataToUpload["Difficulty"] = $('#playerDifficulty').prop("value");
@@ -1190,7 +1191,7 @@
} }
function SessionHandler() { function SessionHandler() {
this.ownProfileId = '00000000-0000-0000-0000-000000000000'; this.ownProfileId = PROFILE_NULL_ID;
this.sessionId = ""; this.sessionId = "";
this.serverBaseAddress = ""; this.serverBaseAddress = "";
@@ -1204,7 +1205,7 @@
request({ request({
url: "logout" url: "logout"
}, "noOverlay").always(function () { }, "noOverlay").always(function () {
t.ownProfileId = '00000000-0000-0000-0000-000000000000'; t.ownProfileId = PROFILE_NULL_ID;
t.sessionId = ""; t.sessionId = "";
@@ -1219,8 +1220,8 @@
var checkSession = function () { var checkSession = function () {
if (t.ownProfileId == '00000000-0000-0000-0000-000000000000' if (t.ownProfileId == PROFILE_NULL_ID
&& pageHandler.profileIdRequest == '00000000-0000-0000-0000-000000000000' && pageHandler.profileIdRequest == PROFILE_NULL_ID
&& ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login")) { && ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login")) {
return; return;
} }