git.s-ol.nu xxy-oscilloscope / 0cacd2d
save controls in localStorage s-ol 2 months ago
1 changed file(s) with 14 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
11 <!DOCTYPE html>
2 <!-- saved from url=(0029)https://dood.al/oscilloscope/ -->
32 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
43 <title>XXY Oscilloscope</title>
54 <style>
1110 border-collapse: collapse;
1211 }
1312 #startOverlay {
14 display: block;
13 display: none;
1514 position: fixed;
1615 width: 100vw;
1716 height: 100vh;
8079 <td valign="top">
8180 <canvas id="crtCanvas" width="584" height="584" style="z-index: 0;"></canvas>
8281 <div id="canvasFailure" style="position: relative; z-index: 1; font:25px arial; top:-40px; color:lightgreen;"></div>
83 <a href="javascript:toggleVisible(&#39;sidebar&#39;);">toggle sidebar</a>
82 <a href="javascript:toggleVisible(&#39;sidebar&#39;); window.onresize();">toggle sidebar</a>
8483 </td>
8584 <td id="sidebar" width="360" valign="top">
8685
371370 setupControls : function()
372371 {
373372 var locationString = location.toString();
374 if (!(locationString.includes('#'))) return;
373 if (!(locationString.includes('#'))) {
374 var stored = window.localStorage.getItem('controls');
375 if (!stored)
376 return;
377 locationString = '#' + stored;
378 }
375379 var hash = locationString.split('#')[1];
376380 var arrayString = decodeURI(hash);
377381 var a = arrayString.split(',');
453457 }
454458 }
455459
460 // autosave controls every second
461 setInterval(function () {
462 var text = Controls.getControlsArray().toString();
463 var hm = encodeURI(text);
464 localStorage.setItem('controls', hm);
465 }, 1000);
456466 </script>
457467
458468 <div id="extraNotes" style="display:none">