summaryrefslogtreecommitdiff
path: root/JS
diff options
context:
space:
mode:
Diffstat (limited to 'JS')
-rw-r--r--JS/binary.js15
-rw-r--r--JS/main.js14
-rw-r--r--JS/morsecode.js58
-rw-r--r--JS/oldsidenav.js11
4 files changed, 98 insertions, 0 deletions
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<chars.length; a++) {
+if (chars[a]!=" ") {
+if (window.charCodes[chars[a]]) {
+document.morsecode.codebox.value+=charCodes[chars[a]]+" ";
+temp+=chars[a]+"="+charCodes[chars[a]]+"\n";
+}
+else
+temp+=chars[a]+"=(None)\n";
+}
+else temp+="\n";
+}
+document.morsecode.codebox.value+="\n\n\nEXPLANATION:\n\n"+temp
+} \ No newline at end of file
diff --git a/JS/oldsidenav.js b/JS/oldsidenav.js
new file mode 100644
index 0000000..c9ebbe0
--- /dev/null
+++ b/JS/oldsidenav.js
@@ -0,0 +1,11 @@
+/*Attenion this sidebar Code will be removed when the rest of the pages on the main site are updated
+It will still be available at https://old.jacobmcdonnell.com/version-1/ and at https://old.jacobmcdonnell.com/version-2/ */
+//sidebar code
+function openNav() {
+ document.getElementById("mySidenav").style.width = "250px";
+ document.getElementById("nav").style.marginLeft = "250px";
+}
+function closeNav() {
+ document.getElementById("mySidenav").style.width = "0";
+ document.getElementById("nav").style.marginLeft= "0";
+} \ No newline at end of file