var scorePages = new Object; var currentPage = new Object; function scoresRequestPage(mapid, page) { // console.log('scoresRequestPage', mapid, page); if (typeof(ajax) != 'object') { setTimeout(function() {scoresRequestPage(mapid, page)},200); return false; } // Ask again if it's busy. switch (ajax.xmlhttp.readyState) { case 4: case 0: break; default: setTimeout(function() {scoresRequestPage(mapid, page)},300); return false; } //console.log("Requesting Page", mapid, page, ajax.inUse); // == Additionally, check for achievements. ajax.requestFile = "do.php?r=reqScorePage&mapid="+mapid+"&reqPage="+page; ajax.onCompletion = scoresRequestPageDone; // Specify function to be executed on response. //ajax.onLoading = ''; //ajax.onLoaded = ''; //ajax.onFail = ''; ajax.runAJAX();// Do it! return true; } function scoresRequestLoading() { //Signify that it's working in some manner? //console.log("I'm loading teh page..."); } function scoresRequestPageDone() { //console.log("Request Page Done", ajax.response); var JO = decryptJSON(ajax.response); if (JO == undefined) return; scoresUpdatePage(JO.mapid, JO.page, scoresFormatPage(JO)); if (JO.notificationtext != undefined) { showNotification(JO.notificationtext); if (checkSound(JO.mapid)) { soundManager.setVolume('achieve', 50); setTimeout("soundManager.play('achieve');", 350); } } } function scoresUpdatePage(mapid, page, html) { // console.log("Updating Page", mapid, page); scoresPreparePage(mapid, page); scorePages[mapid][page].html = html; //if (scorePages[mapid][page] == currentPage[mapid]) { if (page == currentPage[mapid]) { scoresShowPage(mapid, page); } } function scoresShowMyPage(mapid) { //Future use } function scoresShowPage(mapid, page) { mapid = mapid - 0; page = page - 0; // console.log('scoresShowPage', mapid, page); if (scoresPreparePage(mapid, page) == false) { currentPage[mapid] = page; // currentPage[mapid] = scorePages[mapid][page]; //Signify some sort of loadingness? //Request Page scoresRequestPage(mapid, page); return; } if (typeof(scorePages[mapid][page].html) === 'undefined') { scoresRequestPage(mapid, page); currentPage[mapid] = page; return; } // console.log('scorpages', scorePages[mapid][page].html); updateDsp(mapid, 'dspScore', scorePages[mapid][page].html); //Also; update the page // console.log('here', scorePages[mapid][page], currentPage[mapid], scorePages[mapid][page] != currentPage[mapid]); if (page != currentPage[mapid]) { scoresRequestPage(mapid, page); } currentPage[mapid] = page; //currentPage[mapid] = scorePages[mapid][page]; } function scoresPreparePage (mapid, page) { if (typeof(scorePages[mapid]) != 'object') { scorePages[mapid] = new Object; scorePages[mapid][page] = new Object; return false; } if (typeof(scorePages[mapid][page]) != 'object') { scorePages[mapid][page] = new Object; return false; } return true; } function scoresFormatPage(JO) { // console.log("Formating page"); var p = "
"+navi+" | ||
Rank | "; p = p+" "; p = p+"Moves | "; p = p+"|
---|---|---|
";
if (u.medal == 'gold') {
p = p+ "![]() ![]() ![]() | ";
p = p+ "";
p = p+ " ";
p = p+ " ";
p = p+ "";
p = p+ " ";
p = p+ "";
p = p+ " ";
p = p+ " | ";
p = p+ ""+u.moves+" | "; p = p+ "
"+navi+" |