diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2019-07-28 12:43:37 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2019-07-28 12:43:37 +0000 |
| commit | 0cacd2d8013e01f09e71cd0f1d0510dc1d5fe704 (patch) | |
| tree | d7ad90c69e4642f292697da5616d337263eab95a | |
| parent | add start script for linux (diff) | |
| download | xxy-oscilloscope-0cacd2d8013e01f09e71cd0f1d0510dc1d5fe704.tar.gz xxy-oscilloscope-0cacd2d8013e01f09e71cd0f1d0510dc1d5fe704.zip | |
save controls in localStorage
| -rw-r--r-- | index.html | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -1,5 +1,4 @@ <!DOCTYPE html> -<!-- saved from url=(0029)https://dood.al/oscilloscope/ --> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>XXY Oscilloscope</title> <style> @@ -11,7 +10,7 @@ table { border-collapse: collapse; } #startOverlay { - display: block; + display: none; position: fixed; width: 100vw; height: 100vh; @@ -80,7 +79,7 @@ var toggleVisible = function(string) <td valign="top"> <canvas id="crtCanvas" width="584" height="584" style="z-index: 0;"></canvas> <div id="canvasFailure" style="position: relative; z-index: 1; font:25px arial; top:-40px; color:lightgreen;"></div> -<a href="javascript:toggleVisible('sidebar');">toggle sidebar</a> +<a href="javascript:toggleVisible('sidebar'); window.onresize();">toggle sidebar</a> </td> <td id="sidebar" width="360" valign="top"> @@ -371,7 +370,12 @@ var Controls = { setupControls : function() { var locationString = location.toString(); - if (!(locationString.includes('#'))) return; + if (!(locationString.includes('#'))) { + var stored = window.localStorage.getItem('controls'); + if (!stored) + return; + locationString = '#' + stored; + } var hash = locationString.split('#')[1]; var arrayString = decodeURI(hash); var a = arrayString.split(','); @@ -453,6 +457,12 @@ var Controls = { } } +// autosave controls every second +setInterval(function () { + var text = Controls.getControlsArray().toString(); + var hm = encodeURI(text); + localStorage.setItem('controls', hm); +}, 1000); </script> <div id="extraNotes" style="display:none"> |
