From 5552ce957b496dd4f0b8447dbfbf8718fbd1f2a7 Mon Sep 17 00:00:00 2001 From: mcd223 Date: Thu, 7 Feb 2019 19:38:42 -0500 Subject: redesign 3 --- JS/binary.js | 15 +++++++++++++++ JS/main.js | 14 ++++++++++++++ JS/morsecode.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ JS/oldsidenav.js | 11 +++++++++++ 4 files changed, 98 insertions(+) create mode 100644 JS/binary.js create mode 100644 JS/main.js create mode 100644 JS/morsecode.js create mode 100644 JS/oldsidenav.js (limited to 'JS') diff --git a/JS/binary.js b/JS/binary.js new file mode 100644 index 0000000..d0b8d21 --- /dev/null +++ b/JS/binary.js @@ -0,0 +1,15 @@ +//binary code convertor +function convertBinary() { + var output = document.getElementById("outputBinary"); + var input = document.getElementById("inputBinary").value; + output.value = ""; + for (i=0; i < input.length; i++) {var e=input[i].charCodeAt(0);var s = ""; + do{ + var a =e%2; + e=(e-a)/2; + s=a+s; + }while(e!=0); + while(s.length<8){s="0"+s;} + output.value+=s; + } +} \ No newline at end of file diff --git a/JS/main.js b/JS/main.js new file mode 100644 index 0000000..97b5449 --- /dev/null +++ b/JS/main.js @@ -0,0 +1,14 @@ +function searchDuck(event){ + var x = document.getElementById('Search').value; + if (event.keyCode == 13 || event.which == 13) { + if (x == '/4chan'){ + document.getElementById("pLink").innerHTML = "4chan"; + document.getElementById("pLink").href = "https://4chan.org/"; + document.getElementById("pLinks").innerHTML = "4channel"; + document.getElementById("pLinks").href = "https://4channel.org/"; + } + else{location='https://duckduckgo.com/?q=' + encodeURIComponent(document.getElementById('Search').value);}}//13 = enter +} +function FocusOnInput(){ + document.getElementById("Search").focus(); +} \ No newline at end of file diff --git a/JS/morsecode.js b/JS/morsecode.js new file mode 100644 index 0000000..f95ac5d --- /dev/null +++ b/JS/morsecode.js @@ -0,0 +1,58 @@ +//deals with morse code page +var charCodes=new Array(36); charCodes["a"]=". _"; +charCodes["b"]="_ . . ."; +charCodes["c"]="_ . _ ."; +charCodes["d"]="_ . ."; +charCodes["e"]="."; +charCodes["f"]=". . _ ."; +charCodes["g"]="_ _ ."; +charCodes["h"]=". . . ."; +charCodes["i"]=". ."; +charCodes["j"]=". _ _ _"; +charCodes["k"]="_ . _"; +charCodes["l"]=". _ . ."; +charCodes["m"]="_ _"; +charCodes["n"]="_ ."; +charCodes["o"]="_ _ _"; +charCodes["p"]=". _ _ ."; +charCodes["q"]="_ _ . _"; +charCodes["r"]=". _ ."; +charCodes["s"]=". . ."; +charCodes["t"]="_"; +charCodes["u"]=". . _"; +charCodes["v"]=". . . _"; +charCodes["w"]=". _ _"; +charCodes["x"]="_ . . _"; +charCodes["y"]="_ . _ _"; +charCodes["z"]="_ _ . ."; +charCodes["1"]=". _ _ _ _"; +charCodes["2"]=". . _ _ _"; +charCodes["3"]=". . . _ _"; +charCodes["4"]=". . . . _"; +charCodes["5"]=". . . . ."; +charCodes["6"]="_ . . . ."; +charCodes["7"]="_ _ . . ."; +charCodes["8"]="_ _ _ . ."; +charCodes["9"]="_ _ _ _ ."; +charCodes["0"]="_ _ _ _ _"; +var temp='' + +function encode() { +document.morsecode.chars.value=document.morsecode.chars.value.toLowerCase(); +document.morsecode.codebox.value=""; +temp='' +var chars=document.morsecode.chars.value.split(""); + +for (a=0; a