|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <style> |
| 5 | + body { |
| 6 | + text-align:center; |
| 7 | + } |
| 8 | + .center { |
| 9 | + margin-left: auto; |
| 10 | + margin-right: auto; |
| 11 | + } |
| 12 | + .centered-text { |
| 13 | + text-align: center; |
| 14 | + } |
| 15 | + .centered-container { |
| 16 | + display: flex; |
| 17 | + flex-direction: column; |
| 18 | + align-items: center; |
| 19 | + justify-content: center; |
| 20 | + min-height: 100vh; |
| 21 | + } |
| 22 | + .application-icon { |
| 23 | + display: block; |
| 24 | + margin-left: auto; |
| 25 | + margin-right: auto; |
| 26 | + max-width: 130px; |
| 27 | + max-height: 130px; |
| 28 | + width: auto; |
| 29 | + height: auto; |
| 30 | + } |
| 31 | + .spinner { |
| 32 | + max-width: 48px; |
| 33 | + max-height: 48px; |
| 34 | + } |
| 35 | + </style> |
| 36 | + <link rel="stylesheet" href="dark.css" media="(prefers-color-scheme: dark)" /> |
| 37 | + <link rel="stylesheet" href="light.css" media="(prefers-color-scheme: light)" /> |
| 38 | + <meta charset="utf-8"> |
| 39 | + <link rel="icon" type="image/png" href="icon.png"> |
| 40 | + |
| 41 | + |
| 42 | + <script> |
| 43 | + function async_load(file, cb) { |
| 44 | + var d = document, t = 'script', |
| 45 | + o = d.createElement(t), |
| 46 | + s = d.getElementsByTagName(t)[0]; |
| 47 | + o.src = file; |
| 48 | + o.addEventListener('load', function (e) { cb(e); }, false); |
| 49 | + s.parentNode.insertBefore(o, s); |
| 50 | + } |
| 51 | + |
| 52 | + function webgl_support () { |
| 53 | + try { |
| 54 | + var canvas = document.createElement('canvas'); |
| 55 | + return !!window.WebGLRenderingContext && |
| 56 | + (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')); |
| 57 | + } catch(e) { |
| 58 | + return false; |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + function download_application() { |
| 63 | + var action = document.getElementById("action"); |
| 64 | + var main = document.getElementById("main"); |
| 65 | + |
| 66 | + if (webgl_support()) { |
| 67 | + if (WebAssembly) { |
| 68 | + action.innerHTML = "Downloading wasm_exec.js" |
| 69 | + async_load("wasm_exec.js", function(){ |
| 70 | + // WebAssembly.instantiateStreaming is not currently available in Safari |
| 71 | + if (WebAssembly && !WebAssembly.instantiateStreaming) { // polyfill |
| 72 | + WebAssembly.instantiateStreaming = async (resp, importObject) => { |
| 73 | + const source = await (await resp).arrayBuffer(); |
| 74 | + return await WebAssembly.instantiate(source, importObject); |
| 75 | + }; |
| 76 | + } |
| 77 | + |
| 78 | + action.innerHTML = "Downloading web assembly file."; |
| 79 | + |
| 80 | + const go = new Go(); |
| 81 | + WebAssembly.instantiateStreaming(fetch("fynedesk.wasm"), go.importObject).then((result) => { |
| 82 | + main.innerHTML = ""; |
| 83 | + go.run(result.instance); |
| 84 | + }); |
| 85 | + }) |
| 86 | + } else { |
| 87 | + action.innerHTML = "WebAssembly is not supported in your browser"; |
| 88 | + action.className = "action-error" |
| 89 | + } |
| 90 | + } else { |
| 91 | + action.innerHTML = "WebGL is not supported in your browser"; |
| 92 | + action.className = "action-error" |
| 93 | + } |
| 94 | + } |
| 95 | + </script> |
| 96 | + </head> |
| 97 | + <body scroll="no" style="overflow: hidden" onload="download_application()"> |
| 98 | + <div id="main"> |
| 99 | + <div class="centered-container"> |
| 100 | + <table class="center"> |
| 101 | + <tr><td><img class="application-icon" src="icon.png" alt="Application icon"/></td></tr> |
| 102 | + <tr><td><div class="centered-text"><div class="application-name">fynedesk</div></div></td></tr> |
| 103 | + <tr><td><div class="centered-text"><div class="application-version">v0.0.1</div></div></td></tr> |
| 104 | + <tr> |
| 105 | + <td> |
| 106 | + <picture> |
| 107 | + <source srcset="spinner_dark.gif" media="(prefers-color-scheme: dark)" /> |
| 108 | + <source srcset="spinner_light.gif" media="(prefers-color-scheme: light)" /> |
| 109 | + <img class="spinner" src="spinner_light.gif" /> |
| 110 | + </picture> |
| 111 | + </td> |
| 112 | + </tr> |
| 113 | + <tr> |
| 114 | + <td> |
| 115 | + <div class="centered-text"><div class="action" id="action"> |
| 116 | + <noscript>Javascript need to be enable for this application to work.</noscript> |
| 117 | + </div></div> |
| 118 | + </td> |
| 119 | + </tr> |
| 120 | + </table> |
| 121 | + </div> |
| 122 | + </div> |
| 123 | + <input id="dummyEntry" style="position: absolute; left: 0; top: -100pt; z-index: -10; font-size: 32pt;" /> |
| 124 | + </body> |
| 125 | +</html> |
0 commit comments