summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2010-05-12 07:32:29 +0200
committerGuillaume Seguin <guillaume@segu.in>2010-05-12 07:32:29 +0200
commit50784fb9844f949a935a09537702fb2b47db1373 (patch)
tree462f6fef8bb610e75b9b4a0cdc51766268e59ccd
parent9f7c64076941610fdc8bfdac8cce16dbbe49ecd8 (diff)
downloadsqwarea-helper-50784fb9844f949a935a09537702fb2b47db1373.tar.gz
sqwarea-helper-50784fb9844f949a935a09537702fb2b47db1373.tar.bz2
Add go to coords feature
-rw-r--r--sqwarea-helper.user.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/sqwarea-helper.user.js b/sqwarea-helper.user.js
index 1eb99b4..82f1066 100644
--- a/sqwarea-helper.user.js
+++ b/sqwarea-helper.user.js
@@ -7,13 +7,16 @@
// ==/UserScript==
(function () {
- var Map, $;
+ var Map, Tools, $;
function sqwarea_init_wait() {
- if (typeof unsafeWindow.Map == 'undefined' || typeof unsafeWindow.$ == 'undefined') {
+ if (typeof unsafeWindow.Map == 'undefined'
+ || typeof unsafeWindow.Tools == 'undefined'
+ || typeof unsafeWindow.$ == 'undefined') {
window.setTimeout(sqwarea_init_wait, 100);
} else {
Map = unsafeWindow.Map;
+ Tools = unsafeWindow.Tools;
$ = unsafeWindow.$;
sqwarea_helper_run();
}
@@ -53,6 +56,14 @@
}
square.hover(Map.square._mouseOver, Map.square._mouseOut);
}
+ // Add "Go to _C_oords" button
+ var gotobutton = $("<li class=\"GoToCoords\"><img src=\"../../Content/Images/troops.png\" /> Go to <u>C</u>oords</li>");
+ gotobutton.click(function() {
+ var destination = window.prompt ("Destination coords ?", "a,b");
+ destination = Tools.point.parse (destination);
+ Map.goToPoint (destination);
+ });
+ $("div.Actions ol").append (gotobutton);
}
try {