diff --git a/In Javascript/airgap.html b/In Javascript/airgap.html index 4a2215d..4c91257 100644 --- a/In Javascript/airgap.html +++ b/In Javascript/airgap.html @@ -17,34 +17,34 @@


+

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.

+400 2673 +400 2349 +400 2093 +400 2349 +400 2673 +400 2673 +790 2673 +400 2349 +400 2349 +790 2349 +400 2673 +400 3136 +790 3136 +400 2673 +400 2349 +400 2093 +400 2349 +400 2673 +400 2673 +400 2673 +400 2673 +400 2349 +400 2349 +400 2673 +400 2349 +790 2093
Ported by Yeo Quan Yang. Credits to the original author William Entriken @https://github.com/fulldecent

Project site at https://github.com/fulldecent/system-bus-radio

List of computers that work and what frequency to try at https://github.com/fulldecent/system-bus-radio/blob/master/TEST-DATA.tsv
diff --git a/In Javascript/airgap.js b/In Javascript/airgap.js index a0aef3a..6b8c463 100644 --- a/In Javascript/airgap.js +++ b/In Javascript/airgap.js @@ -28,23 +28,18 @@ function square_am_signal(time, freq) { } function start() { - var song = document.getElementById("tones").value.split(":"); + var song = document.getElementById("tones").value.split("\n"); var length = song.length; - var i = 1, - line, time, freq; - while (1 <= length) { + var line, time, freq; + for (var i = 0; i < length; i++) { line = song[i].split(" "); - if (line[0] == "beep") { - freq = +line[0].split("=")[1]; - time = +line[2].split("=")[1].slice(0, -1); - square_am_signal(time, freq); - } - if (line[0] == "delay") { + if (line[1] == "0") { // delay } - if (song[i] == "end") { - i = 1; + else { + freq = +line[1]; + time = +line[0]; + square_am_signal(time, freq); } - i++; } }