my eye

index.html

Raw

$var title: Braid Examples
<h2>Diamond Types</h2>
<p>Diamond Types is a fast sequence CRDT written in Rust with WASM JavaScript bindings
for client and server. This example uses the <a
href=https://github.com/Microsoft/monaco-editor>Monaco editor</a> as a frontend.</p>
<style>
#diamondEditor {
  border: .1em solid #333;
  height: 40em;
  width: 60em; }
</style>
<div id=diamondEditor></div>
<div id=diamondStatus></div>
<div id=diamondConnection></div>
<div id=diamondVersion></div>
<script type=module>
import { load, diamondize } from '/static/web.js'
load(() => {
  diamondize(
    '/api/data/c83jflds9',
    document.querySelector('#diamondEditor'),
    document.querySelector('#diamondStatus'),
    document.querySelector('#diamondConnection'),
    document.querySelector('#diamondVersion'),
    {
      language: 'markdown',
      roundedSelection: true,
      scrollBeyondLastLine: false,
      wordWrap: 'wordWrapColumn',
      wordWrapColumn: 88,
      wrappingIndent: 'same'
    })
})

// window.onbeforeunload = function (e) {
//     console.log(e)
//     e.preventDefault();
//     console.log(e)
//     e.returnValue = 'Really want to quit the game?';
// }

// let warn = false;
// window.addEventListener('beforeunload', e => {
//   if (!warn) return;
//   // Cancel the event
//   e.preventDefault();
//   // Chrome requires returnValue to be set
//   e.returnValue = '';
// });
// warn = true;  // during runtime you change warn to true

// //Prevent Ctrl+S (and Ctrl+W for old browsers and Edge)
// document.onkeydown = function (e) {
//     e = e || window.event;//Get event
// 
//     if (!e.ctrlKey) return;
// 
//     var code = e.which || e.keyCode;//Get key code
// 
//     console.log('a')
//     switch (code) {
//         case 83://Block Ctrl+S
//             console.log('s')
//         case 87://Block Ctrl+W -- Not work in Chrome and new Firefox
//             console.log('w')
//         e.preventDefault();
//         e.stopPropagation();
//         break;
//     }
// }
</script>