Files
computing-box/Export/assets/js/script.min.js
Alexander Davis 43b8b60579 Bit:Box Feature Migration
Migrated features from Bit:Box website.
Minor changes to CSS
Linked Header and Footer across all pages to allow automatic update to both across all pages
Export folder created

Preparation for upcoming changes:
- Site-wide naming convention change
- Creation of copyright page
- About page changes
2024-10-27 20:36:57 +00:00

1 line
15 KiB
JavaScript

function resetBinarySimulator(){document.getElementById("blb256").classList.remove("poweredOn"),document.getElementById("blb256").classList.add("poweredOff"),document.getElementById("swt256").classList.remove("btnActive"),bit256=!1,document.getElementById("blb128").classList.add("poweredOff"),document.getElementById("blb128").classList.remove("poweredOn"),document.getElementById("swt128").classList.remove("btnActive"),bit128=!1,document.getElementById("blb64").classList.add("poweredOff"),document.getElementById("blb64").classList.remove("poweredOn"),document.getElementById("swt64").classList.remove("btnActive"),bit64=!1,document.getElementById("blb32").classList.add("poweredOff"),document.getElementById("blb32").classList.remove("poweredOn"),document.getElementById("swt32").classList.remove("btnActive"),bit32=!1,document.getElementById("blb16").classList.add("poweredOff"),document.getElementById("blb16").classList.remove("poweredOn"),document.getElementById("swt16").classList.remove("btnActive"),bit16=!1,document.getElementById("blb8").classList.add("poweredOff"),document.getElementById("blb8").classList.remove("poweredOn"),document.getElementById("swt8").classList.remove("btnActive"),bit8=!1,document.getElementById("blb4").classList.add("poweredOff"),document.getElementById("blb4").classList.remove("poweredOn"),document.getElementById("swt4").classList.remove("btnActive"),bit4=!1,document.getElementById("blb2").classList.add("poweredOff"),document.getElementById("blb2").classList.remove("poweredOn"),document.getElementById("swt2").classList.remove("btnActive"),bit2=!1,document.getElementById("blb1").classList.add("poweredOff"),document.getElementById("blb1").classList.remove("poweredOn"),document.getElementById("swt1").classList.remove("btnActive"),bit1=!1,denary=0,updateBinary()}function changeClass256(){bit256?(document.getElementById("blb256").classList.add("poweredOff"),document.getElementById("blb256").classList.remove("poweredOn"),document.getElementById("swt256").classList.remove("btnActive"),bit256=!1,denary-=256,updateBinary()):(document.getElementById("blb256").classList.add("poweredOn"),document.getElementById("blb256").classList.remove("poweredOff"),document.getElementById("swt256").classList.add("btnActive"),bit256=!0,denary+=256,updateBinary())}function changeClass128(){bit128?(document.getElementById("blb128").classList.add("poweredOff"),document.getElementById("blb128").classList.remove("poweredOn"),document.getElementById("swt128").classList.remove("btnActive"),bit128=!1,denary-=128,updateBinary()):(document.getElementById("blb128").classList.add("poweredOn"),document.getElementById("blb128").classList.remove("poweredOff"),document.getElementById("swt128").classList.add("btnActive"),bit128=!0,denary+=128,updateBinary())}function changeClass64(){bit64?(document.getElementById("blb64").classList.add("poweredOff"),document.getElementById("blb64").classList.remove("poweredOn"),document.getElementById("swt64").classList.remove("btnActive"),bit64=!1,denary-=64,updateBinary()):(document.getElementById("blb64").classList.add("poweredOn"),document.getElementById("blb64").classList.remove("poweredOff"),document.getElementById("swt64").classList.add("btnActive"),bit64=!0,denary+=64,updateBinary())}function changeClass32(){bit32?(document.getElementById("blb32").classList.add("poweredOff"),document.getElementById("blb32").classList.remove("poweredOn"),document.getElementById("swt32").classList.remove("btnActive"),bit32=!1,denary-=32,updateBinary()):(document.getElementById("blb32").classList.add("poweredOn"),document.getElementById("blb32").classList.remove("poweredOff"),document.getElementById("swt32").classList.add("btnActive"),bit32=!0,denary+=32,updateBinary())}function changeClass16(){bit16?(document.getElementById("blb16").classList.add("poweredOff"),document.getElementById("blb16").classList.remove("poweredOn"),document.getElementById("swt16").classList.remove("btnActive"),bit16=!1,denary-=16,updateBinary()):(document.getElementById("blb16").classList.add("poweredOn"),document.getElementById("blb16").classList.remove("poweredOff"),document.getElementById("swt16").classList.add("btnActive"),bit16=!0,denary+=16,updateBinary())}function changeClass8(){bit8?(document.getElementById("blb8").classList.add("poweredOff"),document.getElementById("blb8").classList.remove("poweredOn"),document.getElementById("swt8").classList.remove("btnActive"),bit8=!1,denary-=8,updateBinary()):(document.getElementById("blb8").classList.add("poweredOn"),document.getElementById("blb8").classList.remove("poweredOff"),document.getElementById("swt8").classList.add("btnActive"),bit8=!0,denary+=8,updateBinary())}function changeClass4(){bit4?(document.getElementById("blb4").classList.add("poweredOff"),document.getElementById("blb4").classList.remove("poweredOn"),document.getElementById("swt4").classList.remove("btnActive"),bit4=!1,denary-=4,updateBinary()):(document.getElementById("blb4").classList.add("poweredOn"),document.getElementById("blb4").classList.remove("poweredOff"),document.getElementById("swt4").classList.add("btnActive"),bit4=!0,denary+=4,updateBinary())}function changeClass2(){bit2?(document.getElementById("blb2").classList.add("poweredOff"),document.getElementById("blb2").classList.remove("poweredOn"),document.getElementById("swt2").classList.remove("btnActive"),bit2=!1,denary-=2,updateBinary()):(document.getElementById("blb2").classList.add("poweredOn"),document.getElementById("blb2").classList.remove("poweredOff"),document.getElementById("swt2").classList.add("btnActive"),bit2=!0,denary+=2,updateBinary())}function changeClass1(){bit1?(document.getElementById("blb1").classList.add("poweredOff"),document.getElementById("blb1").classList.remove("poweredOn"),document.getElementById("swt1").classList.remove("btnActive"),bit1=!1,denary-=1,updateBinary()):(document.getElementById("blb1").classList.add("poweredOn"),document.getElementById("blb1").classList.remove("poweredOff"),document.getElementById("swt1").classList.add("btnActive"),bit1=!0,denary+=1,updateBinary())}function updateBinary(){binary="",bit256?binary+="1":binary+="0",bit128?binary+="1":binary+="0",bit64?binary+="1":binary+="0",bit32?binary+="1":binary+="0",bit16?binary+="1":binary+="0",bit8?binary+="1":binary+="0",bit4?binary+="1":binary+="0",bit2?binary+="1":binary+="0",bit1?binary+="1":binary+="0",document.getElementById("denaryNumber").innerHTML=denary,document.getElementById("binaryNumber").innerHTML=binary}function resetHexadecimal(){"/alevel-hexadecimal"==window.location.pathname&&(resetPlace4096(),resetPlace256()),resetPlace16(),resetPlace1()}function resetPlace4096(){place4096=0;var e=100/15*place4096/100;document.getElementById("blb4").style.opacity=e,updateNumbers()}function resetPlace256(){place256=0;var e=100/15*place256/100;document.getElementById("blb3").style.opacity=e,updateNumbers()}function resetPlace16(){place16=0;var e=100/15*place16/100;document.getElementById("blb2").style.opacity=e,updateNumbers()}function resetPlace1(){place1=0;var e=100/15*place1/100;document.getElementById("blb1").style.opacity=e,updateNumbers()}function toggleUp4096(){if(place4096>=0&&place4096<15){place4096+=1;var e=100/15*place4096/100;document.getElementById("blb4").style.opacity=e,updateNumbers()}}function toggleDown4096(){if(place4096>0){place4096-=1;var e=100/15*place4096/100;document.getElementById("blb4").style.opacity=e,updateNumbers()}}function toggleUp256(){if(place256>=0&&place256<15){place256+=1;var e=100/15*place256/100;document.getElementById("blb3").style.opacity=e,updateNumbers()}}function toggleDown256(){if(place256>0){place256-=1;var e=100/15*place256/100;document.getElementById("blb3").style.opacity=e,updateNumbers()}}function toggleUp16(){if(place16>=0&&place16<15){place16+=1;var e=100/15*place16/100;document.getElementById("blb2").style.opacity=e,updateNumbers()}}function toggleDown16(){if(place16>0){place16-=1;var e=100/15*place16/100;document.getElementById("blb2").style.opacity=e,updateNumbers()}}function toggleUp1(){if(place1>=0&&place1<15){place1+=1;var e=100/15*place1/100;document.getElementById("blb1").style.opacity=e,updateNumbers()}}function toggleDown1(){if(place1>0){place1-=1;var e=100/15*place1/100;document.getElementById("blb1").style.opacity=e,updateNumbers()}}function updateNumbers(){binary="",hexadecimal="";var e=window.location.pathname;"/hexadecimal/aLevelHexadecimal.html"==e?(denary=4096*place4096+256*place256+16*place16+place1,hexadecimal=convertToHex(place4096)+convertToHex(place256)+convertToHex(place16)+convertToHex(place1),binary=convertToBinary(place4096)+convertToBinary(place256)+convertToBinary(place16)+convertToBinary(place1)):"/hexadecimal/gcseHexadecimal.html"==e&&(denary=16*place16+place1,hexadecimal=convertToHex(place16)+convertToHex(place1),binary=convertToBinary(place16)+convertToBinary(place1)),document.getElementById("denaryNumber").innerHTML=denary,document.getElementById("hexadecimalNumber").innerHTML=hexadecimal,document.getElementById("binaryNumber").innerHTML=binary}function convertToHex(e){var t=e-9;return t<=0?e.toString():1==t?"A":2==t?"B":3==t?"C":4==t?"D":5==t?"E":6==t?"F":void 0}function convertToBinary(e){var t="";return e-8>=0?(e-=8,t+="1"):t+="0",e-4>=0?(e-=4,t+="1"):t+="0",e-2>=0?(e-=2,t+="1"):t+="0",e-1>=0?(e-=1,t+="1"):t+="0",t}function resetColours(){resetPlaceR16(),resetPlaceR1(),resetPlaceG16(),resetPlaceG1(),resetPlaceB16(),resetPlaceB1()}function resetPlaceR16(){placeR16=0;var e=100/15*placeR16/100;document.getElementById("blbR2").style.opacity=e,updateColours()}function resetPlaceR1(){placeR1=0;var e=100/15*placeR1/100;document.getElementById("blbR1").style.opacity=e,updateColours()}function resetPlaceG16(){placeG16=0;var e=100/15*placeG16/100;document.getElementById("blbG2").style.opacity=e,updateColours()}function resetPlaceG1(){placeG1=0;var e=100/15*placeG1/100;document.getElementById("blbG1").style.opacity=e,updateColours()}function resetPlaceB16(){placeB16=0;var e=100/15*placeB16/100;document.getElementById("blbB2").style.opacity=e,updateColours()}function resetPlaceB1(){placeB1=0;var e=100/15*placeB1/100;document.getElementById("blbB1").style.opacity=e,updateColours()}function toggleUpR16(){if(placeR16>=0&&placeR16<15){placeR16+=1;var e=100/15*placeR16/100;document.getElementById("blbR2").style.opacity=e,updateColours()}}function toggleDownR16(){if(placeR16>0){placeR16-=1;var e=100/15*placeR16/100;document.getElementById("blbR2").style.opacity=e,updateColours()}}function toggleUpR1(){if(place1>=0&&placeR1<15){placeR1+=1;var e=100/15*placeR1/100;document.getElementById("blbR1").style.opacity=e,updateColours()}}function toggleDownR1(){if(placeR1>0){placeR1-=1;var e=100/15*placeR1/100;document.getElementById("blbR1").style.opacity=e,updateColours()}}function toggleUpG16(){if(placeG16>=0&&placeG16<15){placeG16+=1;var e=100/15*placeG16/100;document.getElementById("blbG2").style.opacity=e,updateColours()}}function toggleDownG16(){if(placeG16>0){placeG16-=1;var e=100/15*placeG16/100;document.getElementById("blbG2").style.opacity=e,updateColours()}}function toggleUpG1(){if(placeG1>=0&&placeG1<15){placeG1+=1;var e=100/15*placeG1/100;document.getElementById("blbG1").style.opacity=e,updateColours()}}function toggleDownG1(){if(placeG1>0){placeG1-=1;var e=100/15*placeG1/100;document.getElementById("blbG1").style.opacity=e,updateColours()}}function toggleUpB16(){if(placeB16>=0&&placeB16<15){placeB16+=1;var e=100/15*placeB16/100;document.getElementById("blbB2").style.opacity=e,updateColours()}}function toggleDownB16(){if(placeB16>0){placeB16-=1;var e=100/15*placeB16/100;document.getElementById("blbB2").style.opacity=e,updateColours()}}function toggleUpB1(){if(placeB1>=0&&placeB1<15){placeB1+=1;var e=100/15*placeB1/100;document.getElementById("blbB1").style.opacity=e,updateColours()}}function toggleDownB1(){if(placeB1>0){placeB1-=1;var e=100/15*placeB1/100;document.getElementById("blbB1").style.opacity=e,updateColours()}}function updateColours(){hexadecimal="",redDenary=0,greenDenary=0,blueDenary=0,redBinary="",greenBinary="",blueBinary="",denary=16*placeR16+placeR1+", "+(16*placeG16+placeG1)+", "+(16*placeB16+placeB1),hexadecimal="#"+convertToHex(placeR16)+convertToHex(placeR1)+convertToHex(placeG16)+convertToHex(placeG1)+convertToHex(placeB16)+convertToHex(placeB1),redBinary=convertToBinary(placeR16)+convertToBinary(placeR1),greenBinary=convertToBinary(placeG16)+convertToBinary(placeG1),blueBinary=convertToBinary(placeB16)+convertToBinary(placeB1),document.getElementById("denaryNumber").innerHTML=denary,document.getElementById("hexadecimalNumber").innerHTML=hexadecimal,document.getElementById("colouredHex").style.backgroundColor=hexadecimal,document.getElementById("invertedHex").style.backgroundColor=invertedHex(),document.getElementById("redBinaryNumber").innerHTML=redBinary,document.getElementById("blueBinaryNumber").innerHTML=blueBinary,document.getElementById("greenBinaryNumber").innerHTML=greenBinary}function invertedHex(){return hexadecimal="#"+convertToHex(15-placeR16)+convertToHex(15-placeR1)+convertToHex(15-placeG16)+convertToHex(15-placeG1)+convertToHex(15-placeB16)+convertToHex(15-placeB1),hexadecimal}function convertToHex(e){var t=e-9;return t<=0?e.toString():1==t?"A":2==t?"B":3==t?"C":4==t?"D":5==t?"E":6==t?"F":void 0}function convertToBinary(e){var t="";return e-8>=0?(e-=8,t+="1"):t+="0",e-4>=0?(e-=4,t+="1"):t+="0",e-2>=0?(e-=2,t+="1"):t+="0",e-1>=0?(e-=1,t+="1"):t+="0",t}function updateHex(e){if(null==e)resetColours();else{if("#"==e.charAt(0)&&(e=e.substring(1)),isHex(e)){let o=e.split("");placeR1=parseInt(o[1],16);var t=100/15*placeR1/100;document.getElementById("blbR1").style.opacity=t,placeR16=parseInt(o[0],16);var n=100/15*placeR16/100;document.getElementById("blbR2").style.opacity=n,placeG1=parseInt(o[3],16);var a=100/15*placeG1/100;document.getElementById("blbG1").style.opacity=a,placeG16=parseInt(o[2],16);var l=100/15*placeG16/100;document.getElementById("blbG2").style.opacity=l,placeB1=parseInt(o[5],16);var c=100/15*placeB1/100;document.getElementById("blbB1").style.opacity=c,placeB16=parseInt(o[4],16);var d=100/15*placeB16/100;document.getElementById("blbB2").style.opacity=d,updateColours()}else window.alert("Invalid Entry"),resetColours()}}function isHex(e){return regexp=/^[0-9a-fA-F]+$/,!!regexp.test(e)}function requestHex(){updateHex(prompt("Please enter your Hex Value"))}function invertHex(){customHex=invertedHex(),updateHex(customHex)}denary=0,binary="",bit1=!1,bit2=!1,bit4=!1,bit8=!1,bit16=!1,bit32=!1,bit64=!1,bit128=!1,bit256=!1,function(){"use strict";!function(){if("requestAnimationFrame"in window&&!/Mobile|Android/.test(navigator.userAgent)){var e=document.querySelectorAll("[data-bss-parallax]");if(e.length){var t,n=[];window.addEventListener("scroll",a),window.addEventListener("resize",a),a()}}function a(){n.length=0;for(var a=0;a<e.length;a++){var c=e[a].getBoundingClientRect(),d=parseFloat(e[a].getAttribute("data-bss-parallax-speed"),10)||.5;c.bottom>0&&c.top<window.innerHeight&&n.push({speed:d,node:e[a]})}cancelAnimationFrame(t),n.length&&(t=requestAnimationFrame(l))}function l(){for(var e=0;e<n.length;e++){var t=n[e].node,a=n[e].speed;t.style.transform="translate3d(0, "+-window.scrollY*a+"px, 0)"}}}()}(),denary=0,binary="",hexadecimal="",place1=0,place16=0,place256=0,place4096=0,denary=0,redDenary=0,greenDenary=0,blueDenary=0,redBinary="",greenBinary="",blueBinary="",hexadecimal="",placeR1=0,placeR16=0,placeG1=0,placeG16=0,placeB1=0,placeB16=0;