diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2012-04-13 17:27:27 -0700 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2012-04-13 17:27:27 -0700 |
commit | 1da7929920f4939336931fe0bf5df59342f649fd (patch) | |
tree | 0e8ab63a4b90edec007bb581f8150ec0cc76e745 | |
parent | 18faf0d54d6ee8e016d0c584a08560c30109d254 (diff) | |
download | pathery-1da7929920f4939336931fe0bf5df59342f649fd.tar.xz |
Score updates
-rw-r--r-- | js/mapspecs.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js index 1f9702e..f6a1791 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -154,8 +154,8 @@ function grid_click(obj) { }
function updateDsp(mapid, element, data) {
- if (mapdata[mapid] == undefined)
- return;
+ //if (mapdata[mapid] == undefined)
+ // return;
//if (mapdata[mapid].example != true) {
if (document.getElementById(mapid+','+element) != undefined) {
handle = document.getElementById(mapid+','+element);
@@ -299,6 +299,29 @@ function request_path_done() { ajax.runAJAX();// Do it!
}
+// Force score update.
+function updateScoresReq(mapid) {
+ //Get score update.
+ ajax.requestFile = "do.php?checkachieve=true&r=getscores&mapid="+mapid; //prepare strdata
+ ajax.onCompletion = updateScoresGet; // Specify function to be executed on response.
+ ajax.runAJAX();// Do it!
+}
+function updateScoresGet() {
+ JO = decryptJSON(ajax.response);
+ updateDsp(JO.mapid, 'dspScore', JO.scores);
+}
+
+function decryptJSON(text) {
+ if (typeof(JSON) == 'undefined') {
+ var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')');
+ //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML);
+ } else {
+ var JO = JSON.parse(ajax.response);
+ }
+ return JO;
+}
+
+
function animatePath(path, mapid, start) {
tmp = start.split(',');
y = tmp[0];
|