From d1cf0d30edfb52a6e94dbdc41c679971417bb94e Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Fri, 28 Oct 2016 19:05:48 +0000 Subject: [PATCH 01/12] Improved formatting --- In Javascript/main.css | 144 +++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 56 deletions(-) diff --git a/In Javascript/main.css b/In Javascript/main.css index bcdaab7..d6131f1 100644 --- a/In Javascript/main.css +++ b/In Javascript/main.css @@ -1,50 +1,58 @@ body { background-color: #3498db; - font-family: Futura,Helvetica, "Century Gothic"; + font-family: Futura, Helvetica, "Century Gothic"; text-shadow: 1px 1px 0px black; - margin:0px; - padding:0px; + margin: 0px; + padding: 0px; } .todo { - font-size:12px; + font-size: 12px; } + .header { color: white; font-size: 50px; - padding-top:20px; + padding-top: 20px; text-align: center; } + .content { text-align: center; - margin:auto; - width:80%; - font-size:12px; - color:white; + margin: auto; + width: 80%; + font-size: 12px; + color: white; } -#instructionBlock,.data { - font-size:12px !important; + +#instructionBlock, +.data { + font-size: 12px !important; } -.data td { - border:1px solid black; - border-bottom:0px; - border-right:0px; + +.data td { + border: 1px solid black; + border-bottom: 0px; + border-right: 0px; } + .data td:last-child { - border-right:1px solid black; + border-right: 1px solid black; } -.data tr:last-child td{ - border-bottom:1px solid black; + +.data tr:last-child td { + border-bottom: 1px solid black; } -a.button, input.button { - cursor: pointer; - font-family:Futura,Century Gothic; +a.button, +input.button { + cursor: pointer; + font-family: Futura, Century Gothic; background: #44c650; border: 0px; padding: 5px 80px; - font-weight:bold; - text-transform:uppercase; + font-weight: bold; + text-transform: uppercase; color: white; font-size: 15px; text-shadow: 1px 1px 0px #222; @@ -54,58 +62,82 @@ a.button, input.button { -o-transition: background-color 0.15s ease-in-out; transition: background-color 0.15s ease-in-out; } + a.button { - display: inline-block; - text-decoration: none; - padding: 6px 12px 6px 12px; + display: inline-block; + text-decoration: none; + padding: 6px 12px 6px 12px; } + input.button { -//font-size:15px!important; -padding: 5px 20px; + //font-size:15px!important; + padding: 5px 20px; } -a.button:active, input.button:active { - position:relative; - top:1px; + +a.button:active, +input.button:active { + position: relative; + top: 1px; } -a.button:hover, input.button:hover { - background: #00b200; - color:white; + +a.button:hover, +input.button:hover { + background: #00b200; + color: white; text-shadow: 1px 1px 0px #222; - position:relative; - cursor:pointer; - cursor:hand; + position: relative; + cursor: pointer; + cursor: hand; } -input[type="text"],input[type="password"],textarea, select { - margin-left:0px; - background-color: #F7f7f7; + +input[type="text"], +input[type="password"], +textarea, +select { + margin-left: 0px; + background-color: #F7f7f7; border: 1px solid black; padding: 5px; - color:#444; - -webkit-transition: border-color 0.2s ease-in-out; + color: #444; + -webkit-transition: border-color 0.2s ease-in-out; -moz-transition: border-color 0.2s ease-in-out; -o-transition: border-color 0.2s ease-in-out; - transition: border-color 0.2s ease-in-out; + transition: border-color 0.2s ease-in-out; } -input[type="text"]:hover ,input[type="password"]:hover,textarea:hover,select:hover { - // border :1px solid pink; + +input[type="text"]:hover, +input[type="password"]:hover, +textarea:hover, +select:hover { + // border :1px solid pink; box-shadow: 0px 0px 9px black; } -input[type="text"]:focus ,input[type="password"]:focus,textarea:focus,select:focus { - border :1px solid #CB4242; + +input[type="text"]:focus, +input[type="password"]:focus, +textarea:focus, +select:focus { + border: 1px solid #CB4242; box-shadow: 0px 0px 9px #cb4242; } -input, textarea, keygen, select, button, isindex { - outline:none; + +input, +textarea, +keygen, +select, +button, +isindex { + outline: none; resize: none; } -a -{ + +a { color: white; - font-weight:bold; + font-weight: bold; background-color: rgba(220, 220, 220, 0.35); - text-decoration:none; + text-decoration: none; } -a:hover -{ + +a:hover { background-color: rgba(240, 240, 240, 0.52); -} \ No newline at end of file +} From f3b57251454f573d1fb77157cbda499d1fccb5f4 Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Fri, 28 Oct 2016 19:28:22 +0000 Subject: [PATCH 02/12] removed unused and unrelated CSS classes --- In Javascript/main.css | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/In Javascript/main.css b/In Javascript/main.css index d6131f1..665cc03 100644 --- a/In Javascript/main.css +++ b/In Javascript/main.css @@ -6,10 +6,6 @@ body { padding: 0px; } -.todo { - font-size: 12px; -} - .header { color: white; font-size: 50px; @@ -25,11 +21,6 @@ body { color: white; } -#instructionBlock, -.data { - font-size: 12px !important; -} - .data td { border: 1px solid black; border-bottom: 0px; @@ -70,7 +61,6 @@ a.button { } input.button { - //font-size:15px!important; padding: 5px 20px; } @@ -91,9 +81,7 @@ input.button:hover { } input[type="text"], -input[type="password"], -textarea, -select { +textarea { margin-left: 0px; background-color: #F7f7f7; border: 1px solid black; @@ -106,27 +94,19 @@ select { } input[type="text"]:hover, -input[type="password"]:hover, -textarea:hover, -select:hover { - // border :1px solid pink; +textarea:hover { box-shadow: 0px 0px 9px black; } input[type="text"]:focus, -input[type="password"]:focus, -textarea:focus, -select:focus { +textarea:focus { border: 1px solid #CB4242; box-shadow: 0px 0px 9px #cb4242; } input, textarea, -keygen, -select, -button, -isindex { +button { outline: none; resize: none; } From 4731477deacbbfe8f073964197578239625556c2 Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Fri, 28 Oct 2016 19:30:13 +0000 Subject: [PATCH 03/12] removed more unused CSS --- In Javascript/main.css | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/In Javascript/main.css b/In Javascript/main.css index 665cc03..c1e90bf 100644 --- a/In Javascript/main.css +++ b/In Javascript/main.css @@ -21,20 +21,6 @@ body { color: white; } -.data td { - border: 1px solid black; - border-bottom: 0px; - border-right: 0px; -} - -.data td:last-child { - border-right: 1px solid black; -} - -.data tr:last-child td { - border-bottom: 1px solid black; -} - a.button, input.button { cursor: pointer; From 276ec0508e2df443b84c7f8169970d2700909476 Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Fri, 28 Oct 2016 19:30:54 +0000 Subject: [PATCH 04/12] removed red outline around text box --- In Javascript/main.css | 6 ------ 1 file changed, 6 deletions(-) diff --git a/In Javascript/main.css b/In Javascript/main.css index c1e90bf..fa7484e 100644 --- a/In Javascript/main.css +++ b/In Javascript/main.css @@ -84,12 +84,6 @@ textarea:hover { box-shadow: 0px 0px 9px black; } -input[type="text"]:focus, -textarea:focus { - border: 1px solid #CB4242; - box-shadow: 0px 0px 9px #cb4242; -} - input, textarea, button { From 2009d86f4d8e3e49ff74726051160f80162a2b0e Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Thu, 3 Nov 2016 15:27:59 +0000 Subject: [PATCH 05/12] improved link styling --- In Javascript/main.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/In Javascript/main.css b/In Javascript/main.css index fa7484e..ae93926 100644 --- a/In Javascript/main.css +++ b/In Javascript/main.css @@ -94,10 +94,10 @@ button { a { color: white; font-weight: bold; - background-color: rgba(220, 220, 220, 0.35); + background-color: rgba(242, 242, 242, 0.2); text-decoration: none; } a:hover { - background-color: rgba(240, 240, 240, 0.52); + background-color: rgba(255, 255, 255, 0.38); } From cb8231cd915f7e1db259bc9f1bef7f3cf03f7600 Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Fri, 4 Nov 2016 04:39:00 +0000 Subject: [PATCH 06/12] Added a delay function and fixed time being *1000. There was a bug before, that caused the window to freeze up (seemingly forever). This was due to the fact that the times in milliseconds were being treated as time in seconds. This has been fixed with a *.0001 function. Also, a block of code for the "delay" function has been added. Delays between same notes in the included demo song have also been added. --- In Javascript/airgap.html | 8 ++++++++ In Javascript/airgap.js | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/In Javascript/airgap.html b/In Javascript/airgap.html index 5c4420b..d091a96 100644 --- a/In Javascript/airgap.html +++ b/In Javascript/airgap.html @@ -24,23 +24,31 @@ 400 2093 400 2349 400 2673 +400 0 400 2673 +400 0 790 2673 400 2349 400 2349 +400 0 790 2349 400 2673 400 3136 +400 0 790 3136 400 2673 400 2349 400 2093 400 2349 400 2673 +400 0 400 2673 +400 0 400 2673 +400 0 400 2673 400 2349 +400 0 400 2349 400 2673 400 2349 diff --git a/In Javascript/airgap.js b/In Javascript/airgap.js index 6b8c463..f690fe8 100644 --- a/In Javascript/airgap.js +++ b/In Javascript/airgap.js @@ -33,13 +33,19 @@ function start() { var line, time, freq; for (var i = 0; i < length; i++) { line = song[i].split(" "); - if (line[1] == "0") { - // delay + if (+line[1] == 0) { + pause(line[0]); } else { freq = +line[1]; - time = +line[0]; + time = (+line[0])*.001; square_am_signal(time, freq); } } } + +function pause(time) { + window.logs.value += "\nPaused / " + time*.001 + " seconds"; + var dt = new Date(); + while ((new Date()) - dt <= time) { /* Do nothing */ } +} \ No newline at end of file From f98382deafc99524cd7e98cfeb056a7a734688cf Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Tue, 22 Nov 2016 18:07:00 +0000 Subject: [PATCH 07/12] fixed description meta --- In Javascript/airgap.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/In Javascript/airgap.html b/In Javascript/airgap.html index d091a96..4a121ad 100644 --- a/In Javascript/airgap.html +++ b/In Javascript/airgap.html @@ -5,7 +5,7 @@ System Bus Radio - + From 81a3f76a4460cbf5a564cd5961eacc861cd823d9 Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Tue, 22 Nov 2016 18:23:58 +0000 Subject: [PATCH 08/12] created var for window log --- In Javascript/airgap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/In Javascript/airgap.js b/In Javascript/airgap.js index f690fe8..0dfe7a8 100644 --- a/In Javascript/airgap.js +++ b/In Javascript/airgap.js @@ -8,9 +8,10 @@ function now() { var NSEC_PER_SEC = 1000000000; var register = 3.1415; +var logs = document.getElementById('logs'); function square_am_signal(time, freq) { - document.getElementById('logs').value += "Playing / " + time + " seconds / " + freq + "Hz\n"; + window.logs.value += "\nPlaying / " + time + " seconds / " + freq + "Hz"; var period = NSEC_PER_SEC / freq; var start = now(); var end = now() + time * NSEC_PER_SEC; From 15419f56280da277377fb10ce4136e5f7c16ecf8 Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Wed, 23 Nov 2016 13:24:37 +0000 Subject: [PATCH 09/12] moved var definition --- In Javascript/airgap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/In Javascript/airgap.js b/In Javascript/airgap.js index 0dfe7a8..4e8bafc 100644 --- a/In Javascript/airgap.js +++ b/In Javascript/airgap.js @@ -8,7 +8,6 @@ function now() { var NSEC_PER_SEC = 1000000000; var register = 3.1415; -var logs = document.getElementById('logs'); function square_am_signal(time, freq) { window.logs.value += "\nPlaying / " + time + " seconds / " + freq + "Hz"; @@ -29,6 +28,7 @@ function square_am_signal(time, freq) { } function start() { + var logs = document.getElementById('logs'); var song = document.getElementById("tones").value.split("\n"); var length = song.length; var line, time, freq; From 3959810fca96e0f77a0a12a88071dc759cbea6ca Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Wed, 23 Nov 2016 13:32:33 +0000 Subject: [PATCH 10/12] Preperations for web using a worker --- In Javascript/airgap.html | 2 +- In Javascript/{airgap.js => worker.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename In Javascript/{airgap.js => worker.js} (100%) diff --git a/In Javascript/airgap.html b/In Javascript/airgap.html index 4a121ad..afd526b 100644 --- a/In Javascript/airgap.html +++ b/In Javascript/airgap.html @@ -7,7 +7,7 @@ System Bus Radio - +
diff --git a/In Javascript/airgap.js b/In Javascript/worker.js similarity index 100% rename from In Javascript/airgap.js rename to In Javascript/worker.js From d935c282492bf9cd2024ea1d4fb34806ad307b68 Mon Sep 17 00:00:00 2001 From: Elliot Gerchak Date: Sun, 27 Nov 2016 05:13:23 +0000 Subject: [PATCH 11/12] Implemented Web Workers Functionality is now taken care of by Web Workers. The advantages of this is that the page will no longer freeze/lock up when the script is working. This also means that the page status can now update in realtime. (Before, it only updated after the script finished running.) Because it possible for buttons to be clicked during operation, it is now possible to stop script mid-execution. Song recursion should also be possible now but, has not been implemented. --- In Javascript/airgap.html | 5 +++-- In Javascript/airgap.js | 19 +++++++++++++++++++ In Javascript/worker.js | 20 ++++++++++++++------ 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 In Javascript/airgap.js diff --git a/In Javascript/airgap.html b/In Javascript/airgap.html index afd526b..12f7acf 100644 --- a/In Javascript/airgap.html +++ b/In Javascript/airgap.html @@ -7,7 +7,7 @@ System Bus Radio - +
@@ -15,7 +15,8 @@

-

+ +

Feel free to edit the code below or copy and paste any valid code.
Column one is time in milliseconds, and column two is frequency.