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