From 299ab2e8589c05b28f66f7588b13e40d2c7cb248 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 16 Mar 2021 18:36:23 +0000 Subject: [PATCH] clock: wip svg, dump from game We dump a pile of stuff c&p out of firefox This lets us hack on the svg with low edit/test/review. Signed-off-by: Ian Jackson --- server dummy - alice - Otter.html | 922 ++++++++++++++ server dummy - alice - Otter_files/script.js | 1163 ++++++++++++++++++ server dummy - alice - Otter_files/wasm.js | 370 ++++++ 3 files changed, 2455 insertions(+) create mode 100644 server dummy - alice - Otter.html create mode 100644 server dummy - alice - Otter_files/script.js create mode 100644 server dummy - alice - Otter_files/wasm.js diff --git a/server dummy - alice - Otter.html b/server dummy - alice - Otter.html new file mode 100644 index 00000000..bae1583f --- /dev/null +++ b/server dummy - alice - Otter.html @@ -0,0 +1,922 @@ + + + + server::dummy - alice - Otter + + + + + + + + + + + + + +
+ +Hi alice + +| +g + + +| +FAKING RANDOMNESS! +server online 1#1 1C1 G538 U1 K1 + +| +switch to landscape view | +links: Voice Shapelib | + +% + + +

+
+
+
+    
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+      
+
+    
+    
+    
+
+
+      
+
+
+        
+
+
+    
+    
+
+

+

+ +
+
+
b send to bottom (below other pieces)
l rotate left
r rotate right
+
P Pin to table
W Enter wresting mode
+
+
Mouse select/deselect/drag
+
shift multiple selection
+
Show + H this help + U players +
+
+
+ + + +
+ + +

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[server:] (re)configured the game2021-03-16 18:05:40 +0000
alice [server:alice] joined the game2021-03-16 18:05:42 +0000
bob [server:bob] joined the game2021-03-16 18:05:42 +0000
[server:] set the link Info2021-03-16 18:05:42 +0000
[server:] removed the link Info2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:42 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:05:55 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
[server:] (re)configured the game2021-03-16 18:06:56 +0000
alice grasped the chess clock2021-03-16 18:15:23 +0000
alice released the chess clock2021-03-16 18:15:25 +0000
alice grasped the chess clock2021-03-16 18:15:26 +0000
alice released the chess clock2021-03-16 18:15:26 +0000
alice grasped the chess clock2021-03-16 18:15:26 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
[server:] (re)configured the game2021-03-16 18:16:01 +0000
alice grasped the chess clock2021-03-16 18:16:07 +0000
+
+
+ + + + diff --git a/server dummy - alice - Otter_files/script.js b/server dummy - alice - Otter_files/script.js new file mode 100644 index 00000000..ce3a40aa --- /dev/null +++ b/server dummy - alice - Otter_files/script.js @@ -0,0 +1,1163 @@ +"use strict"; +// -*- JavaScript -*- +// autogenerated from templates/script.ts webassembly-types/webassembly.d.ts templates/otter_wasm.ns.d.ts +// -*- JavaScript -*- + +// Copyright 2020-2021 Ian Jackson and contributors to Otter +// SPDX-License-Identifier: AGPL-3.0-or-later +// There is NO WARRANTY. --> + +// elemnts for a piece +// +// In svg toplevel +// +// uelem +// #use{} +// +// .piece piece id (static) +// container to allow quick movement and hang stuff off +// +// delem +// #defs{} +// +// +// And in each delem +// +// pelem +// #piece{} +// .dragraise dragged more than this ? raise to top! +// +// currently-displayed version of the piece +// to allow addition/removal of selected indication +// contains 1 or 3 subelements: +// one is straight from server and not modified +// one is possible +// one is possible +// +// #select{} +// generated by server, referenced by JS in pelem for selection +// +// #def.{}.stuff +// generated by server, reserved for Piece trait impl + +let wasm; +var pieces = Object.create(null); +; +// todo turn all var into let +// todo any exceptions should have otter in them or something +var globalinfo_elem; +var layout; +var held_surround_colour; +var general_timeout = 10000; +var messages = Object(); +var pieceops = Object(); +var update_error_handlers = Object(); +var piece_error_handlers = Object(); +var our_dnd_type = "text/puvnex-game-server-dummy"; +var api_queue = []; +var api_posting = false; +var us; +var gen = 0; +var cseq = 0; +var ctoken; +var uo_map = Object.create(null); +var keyops_local = Object(); +var last_log_ts; +var last_zoom_factor = 1.0; +var firefox_bug_zoom_factor_compensation = 1.0; +var gen_update_hook = function () { }; +var svg_ns; +var space; +var pieces_marker; +var defs_marker; +var log_elem; +var logscroll_elem; +var status_node; +var uos_node; +var zoom_val; +var zoom_btn; +var links_elem; +var wresting; +const pane_keys = { + "H": "help", + "U": "players", +}; +const uo_kind_prec = { + 'GlobalExtra': 50, + 'Client': 70, + 'Global': 100, + 'Piece': 200, + 'ClientExtra': 500, +}; +var players; +var movements = []; +function xhr_post_then(url, data, good) { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function () { + if (xhr.readyState != XMLHttpRequest.DONE) { + return; + } + if (xhr.status != 200) { + xhr_report_error(xhr); + } + else { + good(xhr); + } + }; + xhr.timeout = general_timeout; + xhr.open('POST', url); + xhr.setRequestHeader('Content-Type', 'application/json'); + xhr.send(data); +} +function xhr_report_error(xhr) { + json_report_error({ + statusText: xhr.statusText, + responseText: xhr.responseText, + }); +} +function json_report_error(error_for_json) { + let error_message = JSON.stringify(error_for_json); + string_report_error(error_message); +} +function string_report_error(error_message) { + let errornode = document.getElementById('error'); + errornode.textContent += '\nError (reloading may help?):' + error_message; + console.error("ERROR reported via log", error_message); + // todo want to fix this for at least basic game reconfigs, auto-reload? +} +function api(meth, data) { + api_queue.push([meth, data]); + api_check(); +} +function api_delay(meth, data) { + if (api_queue.length == 0) + window.setTimeout(api_check, 10); + api_queue.push([meth, data]); +} +function api_check() { + if (api_posting) { + return; + } + if (!api_queue.length) { + return; + } + do { + var [meth, data] = api_queue.shift(); + if (meth != 'm') + break; + let piece = data.piece; + let p = pieces[piece]; + if (p == null) + break; + p.queued_moves--; + if (p.queued_moves == 0) + break; + } while (1); + api_posting = true; + xhr_post_then('/_/api/' + meth, JSON.stringify(data), api_posted); +} +function api_posted() { + api_posting = false; + api_check(); +} +function api_piece(f, meth, piece, p, op) { + clear_halo(piece, p); + cseq += 1; + p.cseq = cseq; + f(meth, { + ctoken: ctoken, + piece: piece, + gen: gen, + cseq: cseq, + op: op, + }); +} +function svg_element(id) { + let elem = document.getElementById(id); + return elem; +} +function piece_element(base, piece) { + return svg_element(base + piece); +} +// ----- key handling ----- +function recompute_keybindings() { + uo_map = Object.create(null); + let all_targets = []; + for (let piece of Object.keys(pieces)) { + let p = pieces[piece]; + if (p.held != us) + continue; + all_targets.push(piece); + for (var uo of p.uos) { + let currently = uo_map[uo.def_key]; + if (currently === null) + continue; + if (currently !== undefined) { + if (currently.opname != uo.opname) { + uo_map[uo.def_key] = null; + continue; + } + } + else { + currently = Object.assign({ targets: [] }, uo); + uo_map[uo.def_key] = currently; + } + currently.desc = currently.desc < uo.desc ? currently.desc : uo.desc; + currently.targets.push(piece); + } + } + let add_uo = function (targets, uo) { + uo_map[uo.def_key] = Object.assign({ targets: targets }, uo); + }; + if (all_targets.length) { + add_uo(all_targets, { + def_key: 'l', + kind: 'Client', + wrc: 'Predictable', + opname: "left", + desc: "rotate left", + }); + add_uo(all_targets, { + def_key: 'r', + kind: 'Client', + wrc: 'Predictable', + opname: "right", + desc: "rotate right", + }); + add_uo(all_targets, { + def_key: 'b', + kind: 'Client', + wrc: 'Predictable', + opname: "lower", + desc: "send to bottom (below other pieces)", + }); + } + if (all_targets.length) { + let got = 0; + for (let t of all_targets) { + got |= 1 << Number(pieces[t].pinned); + } + if (got == 1) { + add_uo(all_targets, { + def_key: 'P', + kind: 'ClientExtra', + opname: 'pin', + desc: 'Pin to table', + wrc: 'Predictable', + }); + } + else if (got == 2) { + add_uo(all_targets, { + def_key: 'P', + kind: 'ClientExtra', + opname: 'unpin', + desc: 'Unpin from table', + wrc: 'Predictable', + }); + } + } + add_uo(null, { + def_key: 'W', + kind: 'ClientExtra', + opname: 'wrest', + desc: wresting ? 'Exit wresting mode' : 'Enter wresting mode', + wrc: 'Predictable', + }); + var uo_keys = Object.keys(uo_map); + uo_keys.sort(function (ak, bk) { + let a = uo_map[ak]; + let b = uo_map[bk]; + return uo_kind_prec[a.kind] - uo_kind_prec[b.kind] + || ak.localeCompare(bk); + }); + let mid_elem = null; + for (let celem = uos_node.firstElementChild; celem != null; celem = nextelem) { + var nextelem = celem.nextElementSibling; + let cid = celem.getAttribute("id"); + if (cid == "uos-mid") + mid_elem = celem; + else if (celem.getAttribute("class") == 'uos-mid') { } + else + celem.remove(); + } + for (var kk of uo_keys) { + let uo = uo_map[kk]; + let prec = uo_kind_prec[uo.kind]; + let ent = document.createElement('div'); + ent.innerHTML = '' + kk + ' ' + uo.desc; + if (prec < 400) { + ent.setAttribute('class', 'uokey-l'); + uos_node.insertBefore(ent, mid_elem); + } + else { + ent.setAttribute('class', 'uokey-r'); + uos_node.appendChild(ent); + } + } +} +function some_keydown(e) { + // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event + // says to do this, something to do with CJK composition. + // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent + // says that keyCode is deprecated + // my tsc says this isComposing thing doesn't exist. wat. + if (e.isComposing /* || e.keyCode === 229 */) + return; + if (e.ctrlKey || e.altKey || e.metaKey) + return; + let pane = pane_keys[e.key]; + if (pane) { + return pane_switch(pane); + } + let uo = uo_map[e.key]; + if (uo === undefined || uo === null) + return; + console.log('KEY UO', e, uo); + if (uo.kind == 'Client' || uo.kind == 'ClientExtra') { + let f = keyops_local[uo.opname]; + f(uo); + return; + } + if (!(uo.kind == 'Global' || uo.kind == 'GlobalExtra' || uo.kind == 'Piece')) + throw 'bad kind ' + uo.kind; + for (var piece of uo.targets) { + let p = pieces[piece]; + api_piece(api, 'k', piece, p, { opname: uo.opname, wrc: uo.wrc }); + if (uo.wrc == 'UpdateSvg') { + p.cseq_updatesvg = p.cseq; + redisplay_ancillaries(piece, p); + } + } +} +function pane_switch(newpane) { + let new_e; + for (;;) { + new_e = document.getElementById('pane_' + newpane); + let style = new_e.getAttribute('style'); + if (style || newpane == 'help') + break; + newpane = 'help'; + } + for (let old_e = new_e.parentElement.firstElementChild; old_e; old_e = old_e.nextElementSibling) { + old_e.setAttribute('style', 'display: none;'); + } + new_e.removeAttribute('style'); +} +keyops_local['left'] = function (uo) { rotate_targets(uo, +1); }; +keyops_local['right'] = function (uo) { rotate_targets(uo, -1); }; +function rotate_targets(uo, dangle) { + for (let piece of uo.targets) { + let p = pieces[piece]; + p.angle += dangle + 8; + p.angle %= 8; + let transform = wasm_bindgen.angle_transform(p.angle); + p.pelem.setAttributeNS(null, 'transform', transform); + api_piece(api, 'rotate', piece, p, p.angle); + } + recompute_keybindings(); + return true; +} +keyops_local['lower'] = function (uo) { lower_targets(uo); }; +function lower_targets(uo) { + function target_treat_pinned(p) { + return wresting || p.pinned; + ; + } + let targets_todo = Object.create(null); + for (let piece of uo.targets) { + let p = pieces[piece]; + let pinned = target_treat_pinned(p); + targets_todo[piece] = { p, piece, pinned, }; + } + let problem = lower_pieces(targets_todo); + if (problem !== null) { + add_log_message('Cannot lower: ' + problem); + return false; + } + return true; +} +function lower_pieces(targets_todo) { + // This is a bit subtle. We don't want to lower below pinned pieces + // (unless we are pinned too, or the user is wresting). But maybe + // the pinned pieces aren't already at the bottom. For now we will + // declare that all pinned pieces "should" be below all non-pinned + // ones. Not as an invariant, but as a thing we will do here to try + // to make a sensible result. We implement this as follows: if we + // find pinned pieces above non-pinned pieces, we move those pinned + // pieces to the bottom too, just below us, preserving their + // relative order. + // + // Disregarding pinned targets: + // + // Z + // Z + // topmost unpinned target * + // B ( + // B unpinned non-target + // B | unpinned target * + // B | pinned non-target, mis-stacked * + // B )* + // B + // bottommost unpinned non-target + // if that is below topmost unpinned target + // <- tomove_unpinned: insert targets from * here Q -> + // <- tomove_misstacked: insert non-targets from * here Q-> + // A + // A pinned things (nomove_pinned) + // <- tomove_pinned: insert all pinned targets here P -> + // + // When wresting, treat all targets as pinned. + // bottom of the stack order first + let tomove_unpinned = []; + let tomove_misstacked = []; + let nomove_pinned = []; + let tomove_pinned = []; + let bottommost_unpinned = null; + let n_targets_todo_unpinned = 0; + for (const piece of Object.keys(targets_todo)) { + let p = targets_todo[piece]; + if (!p.pinned) + n_targets_todo_unpinned++; + } + let walk = pieces_marker; + for (;;) { // starting at the bottom of the stack order + if (n_targets_todo_unpinned == 0 + && bottommost_unpinned !== null) { + // no unpinned targets left, state Z, we can stop now + console.log('LOWER STATE Z FINISHED'); + break; + } + if (Object.keys(targets_todo).length == 0 && + bottommost_unpinned !== null) { + console.log('LOWER NO TARGETS BUT UNPINNED!', n_targets_todo_unpinned); + break; + } + let new_walk = walk.nextElementSibling; + if (new_walk == null) { + console.log('LOWER WALK NO SIBLING!'); + break; + } + walk = new_walk; + let piece = walk.dataset.piece; + if (piece == null) { + console.log('LOWER WALK REACHED TOP'); + break; + } + let todo = targets_todo[piece]; + if (todo) { + console.log('LOWER WALK', piece, 'TODO', todo.pinned); + delete targets_todo[piece]; + if (!todo.pinned) + n_targets_todo_unpinned--; + (todo.pinned ? tomove_pinned : tomove_unpinned).push(todo); + continue; + } + let p = pieces[piece]; + if (bottommost_unpinned === null) { // state A + if (!p.pinned) { + console.log('LOWER WALK', piece, 'STATE A -> Z'); + bottommost_unpinned = { p, piece }; + } + else { + console.log('LOWER WALK', piece, 'STATE A'); + nomove_pinned.push({ p, piece }); + } + continue; + } + // state B + if (p.pinned) { + console.log('LOWER WALK', piece, 'STATE B MIS-STACKED'); + tomove_misstacked.push({ p, piece }); + } + else { + console.log('LOWER WALK', piece, 'STATE B'); + } + } + let z_top = bottommost_unpinned ? bottommost_unpinned.p.z : + walk.dataset.piece != null ? pieces[walk.dataset.piece].z : + // rather a lack of things we are not adjusting! + wasm_bindgen.def_zcoord(); + let plan = []; + let partQ = tomove_unpinned.concat(tomove_misstacked); + let partP = tomove_pinned; + if (nomove_pinned.length == 0) { + plan.push({ + content: partQ.concat(partP), + z_top, + z_bot: null, + }); + } + else { + plan.push({ + content: partQ, + z_top, + z_bot: nomove_pinned[nomove_pinned.length - 1].p.z, + }, { + content: partP, + z_top: nomove_pinned[0].p.z, + z_bot: null, + }); + } + console.log('LOWER PLAN', plan); + for (const pe of plan) { + for (const e of pe.content) { + if (e.p.held != null && e.p.held != us) { + return "lowering would disturb a piece held by another player"; + } + } + } + z_top = null; + for (const pe of plan) { + if (pe.z_top != null) + z_top = pe.z_top; + let z_bot = pe.z_bot; + let zrange = wasm_bindgen.range(z_bot, z_top, pe.content.length); + console.log('LOQER PLAN PE', pe, z_bot, z_top, pe.content.length, zrange.debug()); + for (const e of pe.content) { + let p = e.p; + piece_set_zlevel(e.piece, p, (oldtop_piece) => { + let z = zrange.next(); + p.z = z; + api_piece(api, "setz", e.piece, e.p, { z }); + }); + } + } + return null; +} +keyops_local['wrest'] = function (uo) { + wresting = !wresting; + document.getElementById('wresting-warning').innerHTML = !wresting ? "" : + " (wresting mode!)"; + ungrab_all(); + recompute_keybindings(); +}; +keyops_local['pin'] = function (uo) { + if (!lower_targets(uo)) + return; + pin_unpin(uo, true); +}; +keyops_local['unpin'] = function (uo) { + pin_unpin(uo, false); +}; +function pin_unpin(uo, newpin) { + for (let piece of uo.targets) { + let p = pieces[piece]; + p.pinned = newpin; + api_piece(api, 'pin', piece, p, newpin); + redisplay_ancillaries(piece, p); + } + recompute_keybindings(); +} +var DRAGGING; +(function (DRAGGING) { + DRAGGING[DRAGGING["NO"] = 0] = "NO"; + DRAGGING[DRAGGING["MAYBE_GRAB"] = 1] = "MAYBE_GRAB"; + DRAGGING[DRAGGING["MAYBE_UNGRAB"] = 2] = "MAYBE_UNGRAB"; + DRAGGING[DRAGGING["YES"] = 4] = "YES"; + DRAGGING[DRAGGING["RAISED"] = 8] = "RAISED"; +})(DRAGGING || (DRAGGING = {})); +; +var drag_pieces = []; +var dragging = DRAGGING.NO; +var dcx; +var dcy; +const DRAGTHRESH = 5; +function drag_add_piece(piece, p) { + drag_pieces.push({ + piece: piece, + dox: parseFloat(p.uelem.getAttributeNS(null, "x")), + doy: parseFloat(p.uelem.getAttributeNS(null, "y")), + }); +} +function some_mousedown(e) { + console.log('mousedown', e, e.clientX, e.clientY, e.target); + if (e.button != 0) { + return; + } + if (e.altKey) { + return; + } + if (e.metaKey) { + return; + } + if (e.ctrlKey) { + return; + } + else { + drag_mousedown(e, e.shiftKey); + } +} +function drag_mousedown(e, shifted) { + var target = e.target; // we check this just now! + var piece = target.dataset.piece; + if (!piece) { + if (!shifted) { + ungrab_all(); + } + return; + } + let p = pieces[piece]; + let held = p.held; + drag_cancel(); + drag_pieces = []; + if (held == us) { + dragging = DRAGGING.MAYBE_UNGRAB; + drag_add_piece(piece, p); // contrive to have this one first + for (let tpiece of Object.keys(pieces)) { + if (tpiece == piece) + continue; + let tp = pieces[tpiece]; + if (tp.held != us) + continue; + drag_add_piece(tpiece, tp); + } + } + else if (held == null || wresting) { + // xxx prevent clicking on anything that is occulting, unless wresting + if (!shifted) { + ungrab_all(); + } + if (p.pinned && !wresting) { + add_log_message('That piece is pinned to the table.'); + return; + } + dragging = DRAGGING.MAYBE_GRAB; + drag_add_piece(piece, p); + set_grab(piece, p, us); + api_piece(api, wresting ? 'wrest' : 'grab', piece, p, {}); + } + else { + add_log_message('That piece is held by another player.'); + return; + } + dcx = e.clientX; + dcy = e.clientY; + window.addEventListener('mousemove', drag_mousemove, true); + window.addEventListener('mouseup', drag_mouseup, true); +} +function ungrab_all() { + for (let tpiece of Object.keys(pieces)) { + let tp = pieces[tpiece]; + if (tp.held == us) { + set_ungrab(tpiece, tp); + api_piece(api, 'ungrab', tpiece, tp, {}); + } + } +} +function set_grab(piece, p, owner) { + p.held = owner; + redisplay_ancillaries(piece, p); + recompute_keybindings(); +} +function set_ungrab(piece, p) { + p.held = null; + redisplay_ancillaries(piece, p); + recompute_keybindings(); +} +function clear_halo(piece, p) { + p.last_seen_moved = null; + redisplay_ancillaries(piece, p); +} +function ancillary_node(piece, stroke) { + var nelem = document.createElementNS(svg_ns, 'use'); + nelem.setAttributeNS(null, 'href', '#surround' + piece); + nelem.setAttributeNS(null, 'stroke', stroke); + nelem.setAttributeNS(null, 'fill', 'none'); + return nelem; +} +function redisplay_ancillaries(piece, p) { + let href = '#surround' + piece; + console.log('REDISPLAY ANCILLARIES', href); + for (let celem = p.pelem.firstElementChild; celem != null; celem = nextelem) { + var nextelem = celem.nextElementSibling; + let thref = celem.getAttributeNS(null, "href"); + if (thref == href) { + celem.remove(); + } + } + let halo_colour = null; + if (p.cseq_updatesvg != null) { + halo_colour = 'purple'; + } + else if (p.last_seen_moved != null) { + halo_colour = 'yellow'; + } + else if (p.held != null && p.pinned) { + halo_colour = '#8cf'; + } + if (halo_colour != null) { + let nelem = ancillary_node(piece, halo_colour); + if (p.held != null) { + nelem.setAttributeNS(null, 'stroke-width', '2px'); + } + p.pelem.prepend(nelem); + } + if (p.held != null) { + let da = players[p.held].dasharray; + let nelem = ancillary_node(piece, held_surround_colour); + nelem.setAttributeNS(null, 'stroke-dasharray', da); + p.pelem.appendChild(nelem); + } +} +function drag_mousemove(e) { + var ctm = space.getScreenCTM(); + var ddx = (e.clientX - dcx) / (ctm.a * firefox_bug_zoom_factor_compensation); + var ddy = (e.clientY - dcy) / (ctm.d * firefox_bug_zoom_factor_compensation); + var ddr2 = ddx * ddx + ddy * ddy; + if (!(dragging & DRAGGING.YES)) { + if (ddr2 > DRAGTHRESH) { + dragging |= DRAGGING.YES; + } + } + //console.log('mousemove', ddx, ddy, dragging); + if (dragging & DRAGGING.YES) { + console.log('DRAG PIECES', drag_pieces); + for (let dp of drag_pieces) { + console.log('DRAG PIECES PIECE', dp); + let tpiece = dp.piece; + let tp = pieces[tpiece]; + var x = Math.round(dp.dox + ddx); + var y = Math.round(dp.doy + ddy); + tp.uelem.setAttributeNS(null, "x", x + ""); + tp.uelem.setAttributeNS(null, "y", y + ""); + tp.queued_moves++; + api_piece(api_delay, 'm', tpiece, tp, [x, y]); + } + if (!(dragging & DRAGGING.RAISED) && drag_pieces.length == 1) { + let dp = drag_pieces[0]; + let piece = dp.piece; + let p = pieces[piece]; + let dragraise = +p.pelem.dataset.dragraise; + if (dragraise > 0 && ddr2 >= dragraise * dragraise) { + dragging |= DRAGGING.RAISED; + console.log('CHECK RAISE ', dragraise, dragraise * dragraise, ddr2); + piece_set_zlevel(piece, p, (oldtop_piece) => { + let oldtop_p = pieces[oldtop_piece]; + let z = wasm_bindgen.increment(oldtop_p.z); + p.z = z; + api_piece(api, "setz", piece, p, { z: z }); + }); + } + } + } + return ddr2; +} +function drag_mouseup(e) { + console.log('mouseup', dragging); + let ddr2 = drag_mousemove(e); + drag_end(); +} +function drag_end() { + if (dragging == DRAGGING.MAYBE_UNGRAB || + (dragging & ~DRAGGING.RAISED) == (DRAGGING.MAYBE_GRAB | DRAGGING.YES)) { + let dp = drag_pieces[0]; + let piece = dp.piece; + let p = pieces[piece]; + set_ungrab(piece, p); + api_piece(api, 'ungrab', piece, p, {}); + } + drag_cancel(); +} +function drag_cancel() { + window.removeEventListener('mousemove', drag_mousemove, true); + window.removeEventListener('mouseup', drag_mouseup, true); + dragging = DRAGGING.NO; + drag_pieces = []; +} +messages.AddPlayer = function (j) { + players[j.player] = j.data; + player_info_pane_set(j); +}; +messages.RemovePlayer = function (j) { + delete players[j.player]; + player_info_pane_set(j); +}; +function player_info_pane_set(j) { + document.getElementById('player_list') + .innerHTML = j.new_info_pane; +} +messages.SetLinks = function (msg) { + if (msg.length != 0 && layout == 'Portrait') { + msg += " |"; + } + links_elem.innerHTML = msg; +}; +// ----- logs ----- +messages.Log = function (j) { + add_timestamped_log_message(j.when, j.logent.html); +}; +function add_log_message(msg_html) { + add_timestamped_log_message('', msg_html); +} +function add_timestamped_log_message(ts_html, msg_html) { + var lastent = log_elem.lastElementChild; + var in_scrollback = lastent == null || + // inspired by + // https://stackoverflow.com/questions/487073/how-to-check-if-element-is-visible-after-scrolling/21627295#21627295 + // rejected + // https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API + (() => { + let le_top = lastent.getBoundingClientRect().top; + let le_bot = lastent.getBoundingClientRect().bottom; + let ld_bot = logscroll_elem.getBoundingClientRect().bottom; + console.log("ADD_LOG_MESSAGE bboxes: le t b, bb", le_top, le_bot, ld_bot); + return 0.5 * (le_bot + le_top) > ld_bot; + })(); + console.log('ADD LOG MESSAGE ', in_scrollback, layout, msg_html); + var ne; + function add_thing(elemname, cl, html) { + var ie = document.createElement(elemname); + ie.innerHTML = html; + ie.setAttribute("class", cl); + ne.appendChild(ie); + } + if (layout == 'Portrait') { + ne = document.createElement('tr'); + add_thing('td', 'logmsg', msg_html); + add_thing('td', 'logts', ts_html); + } + else if (layout == 'Landscape') { + ts_html = last_log_ts.update(ts_html); + ne = document.createElement('div'); + add_thing('span', 'logts', ts_html); + ne.appendChild(document.createElement('br')); + add_thing('span', 'logmsg', msg_html); + ne.appendChild(document.createElement('br')); + } + else { + throw 'bad layout ' + layout; + } + log_elem.appendChild(ne); + if (!in_scrollback) { + logscroll_elem.scrollTop = logscroll_elem.scrollHeight; + } +} +// ----- zoom ----- +function zoom_pct() { + let str = zoom_val.value; + let val = parseFloat(str); + if (isNaN(val)) { + return undefined; + } + else { + return val; + } +} +function zoom_enable() { + zoom_btn.disabled = (zoom_pct() === undefined); +} +function zoom_activate() { + let pct = zoom_pct(); + if (pct !== undefined) { + let fact = pct * 0.01; + let last_ctm_a = space.getScreenCTM().a; + document.getElementsByTagName('body')[0] + .style.transform = 'scale(' + fact + ',' + fact + ')'; + if (fact != last_zoom_factor) { + if (last_ctm_a == space.getScreenCTM().a) { + console.log('FIREFOX GETSCREENCTM BUG'); + firefox_bug_zoom_factor_compensation = fact; + } + else { + console.log('No firefox getscreenctm bug'); + firefox_bug_zoom_factor_compensation = 1.0; + } + last_zoom_factor = fact; + } + } + zoom_btn.disabled = true; +} +function handle_piece_update(j) { + console.log('PIECE UPDATE ', j); + var piece = j.piece; + var m = j.op; + var k = Object.keys(m)[0]; + let p = pieces[piece]; + pieceops[k](piece, p, m[k]); +} +; +messages.Piece = handle_piece_update; +pieceops.ModifyQuiet = function (piece, p, info) { + console.log('PIECE UPDATE MODIFY QUIET ', piece, info); + piece_modify(piece, p, info, false); +}; +pieceops.Modify = function (piece, p, info) { + console.log('PIECE UPDATE MODIFY LOuD ', piece, info); + piece_note_moved(piece, p); + piece_modify(piece, p, info, false); +}; +piece_error_handlers.PosOffTable = function () { return true; }; +piece_error_handlers.Conflict = function () { return true; }; +function piece_modify(piece, p, info, conflict_expected) { + p.delem.innerHTML = info.svg; + p.pelem = piece_element('piece', piece); + p.uelem.setAttributeNS(null, "x", info.pos[0] + ""); + p.uelem.setAttributeNS(null, "y", info.pos[1] + ""); + p.held = info.held; + p.pinned = info.pinned; + p.angle = info.angle; + p.uos = info.uos; + piece_set_zlevel(piece, p, (oldtop_piece) => { + p.z = info.z; + p.zg = info.zg; + }); + piece_checkconflict_nrda(piece, p, conflict_expected); + redisplay_ancillaries(piece, p); + recompute_keybindings(); + console.log('MODIFY DONE'); +} +/* +pieceops.Insert = function +(piece: PieceId, p: null, + info: { svg: string, held: PlayerId, pos: Pos, z: number, zg: Generation}) { + console.log('PIECE UPDATE INSERT ',piece,info) + delem = document.createElementNS(svg_ns,'defs'); + delem.setAttributeNS(null,'id','defs'+piece); + delem.innerHTML = info.svg; + space.appendChild(delem); + pelem = + + nelem.setAttributeNS(null,'stroke',stroke); + nelem.setAttributeNS(null,'fill','none'); +*/ +function piece_set_zlevel(piece, p, modify) { + // Calls modify, which should set .z and/or .gz, and/or + // make any necessary API call. + // + // Then moves uelem to the right place in the DOM. This is done + // by assuming that uelem ought to go at the end, so this is + // O(new depth), which is right (since the UI for inserting + // an object is itself O(new depth) UI operations to prepare. + let oldtop_elem = defs_marker.previousElementSibling; + let oldtop_piece = oldtop_elem.dataset.piece; + modify(oldtop_piece); + let ins_before = defs_marker; + let earlier_elem; + for (;; ins_before = earlier_elem) { + earlier_elem = ins_before.previousElementSibling; + if (earlier_elem == pieces_marker) + break; + if (earlier_elem == p.uelem) + continue; + let earlier_p = pieces[earlier_elem.dataset.piece]; + if (!piece_z_before(p, earlier_p)) + break; + } + if (ins_before != p.uelem) + space.insertBefore(p.uelem, ins_before); +} +function piece_note_moved(piece, p) { + let now = performance.now(); + let need_redisplay = p.last_seen_moved == null; + p.last_seen_moved = now; + if (need_redisplay) + redisplay_ancillaries(piece, p); + let cutoff = now - 1000.; + while (movements.length > 0 && movements[0].this_motion < cutoff) { + let mr = movements.shift(); + if (mr.p.last_seen_moved != null && + mr.p.last_seen_moved < cutoff) { + mr.p.last_seen_moved = null; + redisplay_ancillaries(mr.piece, mr.p); + } + } + movements.push({ piece: piece, p: p, this_motion: now }); +} +function piece_z_before(a, b) { + if (a.z < b.z) + return true; + if (a.z > b.z) + return false; + if (a.zg < b.zg) + return true; + if (a.zg > b.zg) + return false; + return false; +} +pieceops.Move = function (piece, p, info) { + piece_checkconflict_nrda(piece, p, false); + piece_note_moved(piece, p); + p.uelem.setAttributeNS(null, "x", info[0] + ""); + p.uelem.setAttributeNS(null, "y", info[1] + ""); +}; +pieceops.SetZLevel = function (piece, p, info) { + piece_note_moved(piece, p); + piece_set_zlevel(piece, p, (oldtop_piece) => { + let oldtop_p = pieces[oldtop_piece]; + p.z = info.z; + p.zg = info.zg; + }); +}; +messages.Recorded = function (j) { + let piece = j.piece; + let p = pieces[piece]; + piece_recorded_cseq(p, j); + if (p.cseq_updatesvg != null && j.cseq >= p.cseq_updatesvg) { + p.cseq_updatesvg = null; + redisplay_ancillaries(piece, p); + } + if (j.svg != null) { + p.delem.innerHTML = j.svg; + p.pelem = piece_element('piece', piece); + redisplay_ancillaries(piece, p); + } + if (j.zg != null) { + var zg_new = j.zg; // type narrowing doesn't propagate :-/ + piece_set_zlevel(piece, p, (oldtop_piece) => { + p.zg = zg_new; + }); + } +}; +function piece_recorded_cseq(p, j) { + if (p.cseq != null && j.cseq >= p.cseq) { + p.cseq = null; + } +} +messages.RecordedUnpredictable = function (j) { + let piece = j.piece; + let p = pieces[piece]; + piece_recorded_cseq(p, j); + piece_modify(piece, p, j.ns, false); +}; +messages.Error = function (m) { + console.log('ERROR UPDATE ', m); + var k = Object.keys(m)[0]; + update_error_handlers[k](m[k]); +}; +update_error_handlers.PieceOpError = function (m) { + let piece = m.state.piece; + let p = pieces[piece]; + console.log('ERROR UPDATE PIECE ', m, p); + if (p == null) + return; + let conflict_expected = piece_error_handlers[m.error](piece, p, m); + handle_piece_update(m.state); +}; +function piece_checkconflict_nrda(piece, p, conflict_expected) { + if (p.cseq != null) { + p.cseq = null; + if (drag_pieces.some(function (dp) { return dp.piece == piece; })) { + console.log('drag end due to conflict'); + drag_end(); + } + if (!conflict_expected) { + add_log_message('Conflict! - simultaneous update'); + } + } + return false; +} +function test_swap_stack() { + let old_bot = pieces_marker.nextElementSibling; + let container = old_bot.parentElement; + container.insertBefore(old_bot, defs_marker); + window.setTimeout(test_swap_stack, 1000); +} +function startup() { + console.log('STARTUP'); + console.log(wasm_bindgen.setup("OK")); + var body = document.getElementById("main-body"); + zoom_btn = document.getElementById("zoom-btn"); + zoom_val = document.getElementById("zoom-val"); + links_elem = document.getElementById("links"); + ctoken = body.dataset.ctoken; + us = body.dataset.us; + gen = +body.dataset.gen; + let sse_url_prefix = body.dataset.sseUrlPrefix; + status_node = document.getElementById('status'); + status_node.innerHTML = 'js-done'; + log_elem = document.getElementById("log"); + logscroll_elem = document.getElementById("logscroll") || log_elem; + let dataload = JSON.parse(body.dataset.load); + held_surround_colour = dataload.held_surround_colour; + players = dataload.players; + delete body.dataset.load; + uos_node = document.getElementById("uos"); + space = svg_element('space'); + pieces_marker = svg_element("pieces_marker"); + defs_marker = svg_element("defs_marker"); + svg_ns = space.getAttribute('xmlns'); + for (let uelem = pieces_marker.nextElementSibling; uelem != defs_marker; uelem = uelem.nextElementSibling) { + let piece = uelem.dataset.piece; + let p = JSON.parse(uelem.dataset.info); + p.uelem = uelem; + p.delem = piece_element('defs', piece); + p.pelem = piece_element('piece', piece); + p.queued_moves = 0; + delete uelem.dataset.info; + pieces[piece] = p; + redisplay_ancillaries(piece, p); + } + last_log_ts = wasm_bindgen.timestamp_abbreviator(dataload.last_log_ts); + var es = new EventSource(sse_url_prefix + "/_/updates?ctoken=" + ctoken + '&gen=' + gen); + es.onmessage = function (event) { + console.log('GOTEVE', event.data); + var k; + var m; + try { + var [tgen, ms] = JSON.parse(event.data); + for (m of ms) { + k = Object.keys(m)[0]; + messages[k](m[k]); + } + gen = tgen; + gen_update_hook(); + } + catch (exc) { + var s = exc.toString(); + string_report_error('exception handling update ' + + k + ': ' + JSON.stringify(m) + ': ' + s); + } + }; + es.addEventListener('commsworking', function (event) { + console.log('GOTDATA', event.data); + status_node.innerHTML = event.data; + }); + es.addEventListener('player-gone', function (event) { + console.log('PLAYER-GONE', event); + status_node.innerHTML = event.data; + add_log_message('You are no longer in the game'); + space.removeEventListener('mousedown', some_mousedown); + document.removeEventListener('keydown', some_keydown); + es.close(); + }); + es.addEventListener('updates-expired', function (event) { + console.log('UPDATES-EXPIRED', event); + string_report_error('connection to server interrupted too long'); + }); + es.onerror = function (e) { + console.log('FOO', e, es); + json_report_error({ + updates_error: e, + updates_event_source: es, + updates_event_source_ready: es.readyState, + update_oe: e.className, + }); + }; + recompute_keybindings(); + space.addEventListener('mousedown', some_mousedown); + document.addEventListener('keydown', some_keydown); +} +var wasm_promise; +; +function doload() { + console.log('DOLOAD'); + globalinfo_elem = document.getElementById('global-info'); + layout = globalinfo_elem.dataset.layout; + var elem = document.getElementById('loading_token'); + var ptoken = elem.dataset.ptoken; + xhr_post_then('/_/session/' + layout, JSON.stringify({ ptoken: ptoken }), loaded); + wasm_promise = wasm_input + .then(wasm_bindgen); +} +function loaded(xhr) { + console.log('LOADED'); + var body = document.getElementById('loading_body'); + wasm_promise.then((got_wasm) => { + wasm = got_wasm; + body.outerHTML = xhr.response; + startup(); + }); +} +// todo scroll of log messages to bottom did not always work somehow +// think I have fixed this with approximation +doload(); diff --git a/server dummy - alice - Otter_files/wasm.js b/server dummy - alice - Otter_files/wasm.js new file mode 100644 index 00000000..9a9f9a7a --- /dev/null +++ b/server dummy - alice - Otter_files/wasm.js @@ -0,0 +1,370 @@ +let wasm_bindgen; +(function() { + const __exports = {}; + let wasm; + + let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + + cachedTextDecoder.decode(); + + let cachegetUint8Memory0 = null; + function getUint8Memory0() { + if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { + cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); + } + return cachegetUint8Memory0; + } + + function getStringFromWasm0(ptr, len) { + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + } + + const heap = new Array(32).fill(undefined); + + heap.push(undefined, null, true, false); + + let heap_next = heap.length; + + function addHeapObject(obj) { + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; + + heap[idx] = obj; + return idx; + } + +function getObject(idx) { return heap[idx]; } + +function dropObject(idx) { + if (idx < 36) return; + heap[idx] = heap_next; + heap_next = idx; +} + +function takeObject(idx) { + const ret = getObject(idx); + dropObject(idx); + return ret; +} + +let WASM_VECTOR_LEN = 0; + +let cachedTextEncoder = new TextEncoder('utf-8'); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' + ? function (arg, view) { + return cachedTextEncoder.encodeInto(arg, view); +} + : function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); + +function passStringToWasm0(arg, malloc, realloc) { + + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length); + getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len); + + const mem = getUint8Memory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3); + const view = getUint8Memory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +let cachegetInt32Memory0 = null; +function getInt32Memory0() { + if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { + cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); + } + return cachegetInt32Memory0; +} + +let stack_pointer = 32; + +function addBorrowedObject(obj) { + if (stack_pointer == 1) throw new Error('out of js stack'); + heap[--stack_pointer] = obj; + return stack_pointer; +} +/** +* @param {any} packed +*/ +__exports.check = function(packed) { + try { + wasm.check(addBorrowedObject(packed)); + } finally { + heap[stack_pointer++] = undefined; + } +}; + +/** +* @param {any} packed +* @returns {any} +*/ +__exports.increment = function(packed) { + try { + var ret = wasm.increment(addBorrowedObject(packed)); + return takeObject(ret); + } finally { + heap[stack_pointer++] = undefined; + } +}; + +/** +* @returns {any} +*/ +__exports.def_zcoord = function() { + var ret = wasm.def_zcoord(); + return takeObject(ret); +}; + +/** +* @param {any} a +* @param {any} b +* @param {number} count +* @returns {ZCoordIterator} +*/ +__exports.range = function(a, b, count) { + try { + var ret = wasm.range(addBorrowedObject(a), addBorrowedObject(b), count); + return ZCoordIterator.__wrap(ret); + } finally { + heap[stack_pointer++] = undefined; + heap[stack_pointer++] = undefined; + } +}; + +/** +* @param {string} j +* @returns {TimestampAbbreviator} +*/ +__exports.timestamp_abbreviator = function(j) { + var ret = wasm.timestamp_abbreviator(addHeapObject(j)); + return TimestampAbbreviator.__wrap(ret); +}; + +/** +* @param {number} angle +* @returns {string} +*/ +__exports.angle_transform = function(angle) { + var ret = wasm.angle_transform(angle); + return takeObject(ret); +}; + +/** +* @param {string} s +* @returns {string} +*/ +__exports.setup = function(s) { + var ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len0 = WASM_VECTOR_LEN; + var ret = wasm.setup(ptr0, len0); + return takeObject(ret); +}; + +/** +*/ +class TimestampAbbreviator { + + static __wrap(ptr) { + const obj = Object.create(TimestampAbbreviator.prototype); + obj.ptr = ptr; + + return obj; + } + + free() { + const ptr = this.ptr; + this.ptr = 0; + + wasm.__wbg_timestampabbreviator_free(ptr); + } + /** + * @param {string} now + * @returns {string} + */ + update(now) { + try { + var ret = wasm.timestampabbreviator_update(this.ptr, addBorrowedObject(now)); + return takeObject(ret); + } finally { + heap[stack_pointer++] = undefined; + } + } +} +__exports.TimestampAbbreviator = TimestampAbbreviator; +/** +*/ +class ZCoordIterator { + + static __wrap(ptr) { + const obj = Object.create(ZCoordIterator.prototype); + obj.ptr = ptr; + + return obj; + } + + free() { + const ptr = this.ptr; + this.ptr = 0; + + wasm.__wbg_zcoorditerator_free(ptr); + } + /** + * @returns {any} + */ + next() { + var ret = wasm.zcoorditerator_next(this.ptr); + return takeObject(ret); + } + /** + * @returns {any} + */ + debug() { + var ret = wasm.zcoorditerator_debug(this.ptr); + return takeObject(ret); + } +} +__exports.ZCoordIterator = ZCoordIterator; + +async function load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +async function init(input) { + if (typeof input === 'undefined') { + let src; + if (typeof document === 'undefined') { + src = location.href; + } else { + src = document.currentScript.src; + } + input = src.replace(/\.js$/, '_bg.wasm'); + } + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + var ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_is_null = function(arg0) { + var ret = getObject(arg0) === null; + return ret; + }; + imports.wbg.__wbg_new_59cb74e423758ede = function() { + var ret = new Error(); + return addHeapObject(ret); + }; + imports.wbg.__wbg_stack_558ba5917b466edd = function(arg0, arg1) { + var ret = getObject(arg1).stack; + var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }; + imports.wbg.__wbg_error_4bb6c2a97407129a = function(arg0, arg1) { + try { + console.error(getStringFromWasm0(arg0, arg1)); + } finally { + wasm.__wbindgen_free(arg0, arg1); + } + }; + imports.wbg.__wbindgen_object_drop_ref = function(arg0) { + takeObject(arg0); + }; + imports.wbg.__wbindgen_string_get = function(arg0, arg1) { + const obj = getObject(arg1); + var ret = typeof(obj) === 'string' ? obj : undefined; + var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len0 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len0; + getInt32Memory0()[arg0 / 4 + 0] = ptr0; + }; + imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }; + imports.wbg.__wbindgen_rethrow = function(arg0) { + throw takeObject(arg0); + }; + + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } + + const { instance, module } = await load(await input, imports); + + wasm = instance.exports; + init.__wbindgen_wasm_module = module; + + return wasm; +} + +wasm_bindgen = Object.assign(init, __exports); + +})(); -- 2.30.2