# HG changeset patch # User Matti Hamalainen # Date 1647772542 -7200 # Node ID a00a1507f4c4f90573c7322fdd72e4a658dbc0d2 # Parent 44e104b0ae9090e8cbd0143cb2c44f32424bb4e7 Remove unused code. diff -r 44e104b0ae90 -r a00a1507f4c4 map.js --- a/map.js Mon Mar 07 00:18:29 2022 +0200 +++ b/map.js Sun Mar 20 12:35:42 2022 +0200 @@ -207,73 +207,3 @@ window.prompt("Copy to clipboard: Ctrl+C, Enter", str); } } - - -function pmapScheduleNextUpdate() -{ - setTimeout(pmapUpdatePlayerPosition, pmapUpdateDelay); -} - - -function pmapIncreaseUpdateDelay(v) -{ - pmapUpdateDelay += v; - if (pmapUpdateDelay > 5000) - pmapUpdateDelay = 5000; -} - - -function pmapError(msg) -{ - alert(msg); -} - - -function pmapUpdatePlayerPosition() -{ - XDownloadUrl("http://tnsp.org/gmapng/playerpos.php?name="+pmapPlrName+"&token="+pmapPlrToken, - function(data, responseCode) - { - // Check response for type - pmapUpdateFails = 0; - if (typeof(data) == "string") - { - // Check response - if (dmatches = data.match(/^Error: (.*)$/)) - { - pmapError("An error occured: "+ dmatches[1]); - return false; - } - else - if (dmatches = data.match(/{[A-Za-z0-9\'\":, ]+}/)) - { - var pos = JSON.parse(dmatches[0]); - if (typeof(pos) == "object" && (pos.x != pmapPlrPrevPos.x || pos.y != pmapPlrPrevPos.y)) - { - pmapPlrMarker.setPosition(pmapMapCoordsToLatLng(new google.maps.Point(pos.x * 2 + 1, pos.y * 2 + 1), 7)); - pmap.panTo(pmapMapCoordsToLatLng(new google.maps.Point(pos.x, pos.y), 6)); - pmapPlrPrevPos = pos; - pmapUpdateDelay = 500; - } - else - // Position not changed, increase update delay - pmapIncreaseUpdateDelay(500); - } - else - // Not a position update, increase update delay - pmapIncreaseUpdateDelay(1000); - } - else - pmapUpdateDelay = 10000; - - pmapScheduleNextUpdate(); - }, - function() - { - pmapUpdateDelay = 10000; - if (pmapUpdateFails++ > 5) - pmapError("An error occured: Server failed to respond."); - else - pmapScheduleNextUpdate(); - }); -}