Fixed: ownProfileId is undefined and some similar "this" problems

This commit is contained in:
lukeIam committed 2014-11-12 20:52:31 +01:00
1 parent a8371303c8
commit 2da8b54d67
1 file changed
+13 -9
+13 -9
View File
@@ -300,6 +300,8 @@
var songPageHandler; var songPageHandler;
var playlistPageHandler; var playlistPageHandler;
var t = this;
this.customSelectPlaylistSongCallback = null; this.customSelectPlaylistSongCallback = null;
this.profileIdRequest = -1; this.profileIdRequest = -1;
this.songIdRequest = -1; this.songIdRequest = -1;
@@ -316,9 +318,9 @@
}; };
this.reset = function () { this.reset = function () {
this.customSelectPlaylistSongCallback = null; t.customSelectPlaylistSongCallback = null;
this.profileIdRequest = -1; t.profileIdRequest = -1;
this.songIdRequest = -1; t.songIdRequest = -1;
}; };
var replaceTransitionHandler = function () { var replaceTransitionHandler = function () {
@@ -1358,14 +1360,16 @@
this.sessionId = ""; this.sessionId = "";
this.serverBaseAddress = ""; this.serverBaseAddress = "";
var t = this;
var init = function() { var init = function() {
initHeartbeat(); initHeartbeat();
}; };
this.logout = function () { this.logout = function () {
this.ownProfileId = -1; t.ownProfileId = -1;
this.sessionId = ""; t.sessionId = "";
pageHandler.reset(); pageHandler.reset();
@@ -1377,8 +1381,8 @@
var checkSession = function() { var checkSession = function() {
if (ownProfileId == -1 if (t.ownProfileId == -1
&& profileIdRequest == -1 && pageHandler.profileIdRequest == -1
&& ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) { && ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) {
return; return;
} }
@@ -1386,10 +1390,10 @@
url: "getOwnProfileId" url: "getOwnProfileId"
}, "noOverlay").done(function (result) { }, "noOverlay").done(function (result) {
if (result == -1) { if (result == -1) {
this.logout(); t.logout();
} }
}).fail(function (result) { }).fail(function (result) {
this.logout(); t.logout();
}); });
}; };