summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2010-05-12 07:19:18 +0200
committerGuillaume Seguin <guillaume@segu.in>2010-05-12 07:19:18 +0200
commit1ed65c3c743b7330c7c79f8f255f1f29962f3902 (patch)
tree71bfd6a38432b2d75374585e4792e47525757953
downloadsqwarea-helper-1ed65c3c743b7330c7c79f8f255f1f29962f3902.tar.gz
sqwarea-helper-1ed65c3c743b7330c7c79f8f255f1f29962f3902.tar.bz2
Initial import -- coords on ctrl+click
-rw-r--r--sqwarea-helper.user.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/sqwarea-helper.user.js b/sqwarea-helper.user.js
new file mode 100644
index 0000000..7b505a9
--- /dev/null
+++ b/sqwarea-helper.user.js
@@ -0,0 +1,39 @@
+// ==UserScript==
+// @name Sqwarea-Helper
+// @namespace http://guillaume.segu.in/
+// @description Enhances Sqwarea UI
+// @include http://sqwarea.cloudapp.net/Game
+// @include http://www.sqwarea.com/Game
+// ==/UserScript==
+
+var Map;
+
+function sqwarea_init_wait() {
+ if (typeof unsafeWindow.Map == 'undefined') {
+ window.setTimeout(sqwarea_init_wait, 100);
+ } else {
+ Map = unsafeWindow.Map;
+ sqwarea_helper_run();
+ }
+}
+
+function sqwarea_helper_run() {
+ Map.square._base_init_point = Map.square._initPoint;
+ Map.square._initPoint = function(y, x, square) {
+ Map.square._base_init_point (y, x, square);
+ square.bind ('click', function(e) {
+ if (e.ctrlKey) {
+ alert ("Square coords : (x, y) = (" + x + ", " + y + ")");
+ e.preventDefault();
+ }
+ });
+ }
+}
+
+(function () {
+ try {
+ sqwarea_init_wait();
+ } catch (e) {
+ alert("UserScript exception:\n" + e);
+ }
+})();