diff --git a/.public/index.html b/.public/index.html index 2f29395..f922386 100644 --- a/.public/index.html +++ b/.public/index.html @@ -1,249 +1,269 @@ - - - - - - - - - - - - - - - - - - - - - - - -
-

If you're using Safari on iPhone, please google how to enable WebGL2.0 on iPhone.

-

iPhoneのSafariをお使いの方は、「iPhoneでWebGL2.0を有効にする方法」でググってください。

-
-
- - - - - - -

-

-
- - - - - + + +
+

If you're using Safari on iPhone, please google how to enable WebGL2.0 on iPhone.

+

iPhoneのSafariをお使いの方は、「iPhoneでWebGL2.0を有効にする方法」でググってください。

+
+
+ + + + + + +

+

+
+ + + + + - let name = window.localStorage.getItem("name"); - if (name) { - document.querySelector("#name").value = name; - } - - document.on_load = () => { - if (name) { - on_name_change(name) - } - document.querySelector("#random").onclick = () => on_click_random(); - document.querySelector("#room").onclick = () => on_click_room(); - document.querySelector("#share").onclick = () => on_click_share(); - document.querySelector("#name").oninput = (event) => { - window.localStorage.setItem("name", event.target.value); - on_name_change(event.target.value); - } - } - - // https://stackoverflow.com/questions/7995752/detect-desktop-browser-not-mobile-with-javascript#comment106045591_16156769 - document.is_mobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0; - document.is_iphone = navigator.platform == 'iPhone' || (navigator.userAgent.indexOf('Mac') != -1 && window.is_mobile); - - document.querySelector("#name").focus - - // If key pressed and not focused on the name input, then focus the canvas. - let name_focus = false; - let name_input = document.querySelector("#name"); - name_input.addEventListener("blur", () => {name_focus = false}); - name_input.addEventListener("focus", () => {name_focus = true}); - window.onkeypress = (event) => { - console.log(event); - let canvas = document.querySelector("canvas"); - if (canvas && !name_focus) { - canvas.focus() - } - }; - - if (localStorage.getItem("first") != "false") { - localStorage.setItem("first", "false"); - if (navigator.language.startsWith("ja")) { - toggleHelpJa(); - } else { - toggleHelpEn(); - } - } - - document.querySelector("#help").onclick = () => { - if (navigator.language.startsWith("ja")) { - toggleHelpJa(); - } else { - toggleHelpEn(); - } - } - - if ('serviceWorker' in navigator) { - window.addEventListener('load', () => { - navigator.serviceWorker.register('/sw.js') - .then(registration => { - console.log(`Service Worker registered! Scope: ${registration.scope}`); - }) - .catch(err => { - console.log(`Service Worker registration failed: ${err}`); - }); - }); - } - - init() - diff --git a/build.sh b/build.sh index 2df2175..63b113b 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #! /bin/bash RUSTFLAGS=--cfg=web_sys_unstable_apis cargo build --target wasm32-unknown-unknown --release --features web && -wasm-bindgen --out-dir .public --target web target/wasm32-unknown-unknown/release/hug.wasm +~/.cargo/registry/bin/wasm-bindgen-0.2.64/bin/wasm-bindgen --out-dir .public --target web target/wasm32-unknown-unknown/release/hug.wasm