fix: format complex changes

Formats all the general js files. Separate in case these should be
treated differently for any reason. This commit includes all javascript
and HTML files.
This commit is contained in:
FireIsGood committed 2024-05-16 14:37:00 -07:00
1 parent bc3e778e80
commit ef823489fe
15 files changed
+1123 -1115

No files matched your search

+144 -144
View File
@@ -1,171 +1,171 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>404 Page NotFound</title>
<link href="https://fonts.googleapis.com/css?family=Quicksand:700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Quicksand:700" rel="stylesheet" />
<style>
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
padding: 0;
margin: 0;
}
body {
padding: 0;
margin: 0;
}
#notfound {
position: relative;
height: 100vh;
background-color: #fafbfd;
}
#notfound {
position: relative;
height: 100vh;
background-color: #fafbfd;
}
#notfound .notfound {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#notfound .notfound {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.notfound {
max-width: 520px;
width: 100%;
text-align: center;
}
.notfound {
max-width: 520px;
width: 100%;
text-align: center;
}
.notfound .notfound-bg {
position: absolute;
left: 0px;
right: 0px;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
z-index: -1;
}
.notfound .notfound-bg > div {
width: 100%;
background: #fff;
border-radius: 90px;
height: 125px;
}
.notfound .notfound-bg > div:nth-child(1) {
-webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;
box-shadow: 5px 5px 0px 0px #f3f3f3;
}
.notfound .notfound-bg > div:nth-child(2) {
-webkit-transform: scale(1.3);
-ms-transform: scale(1.3);
transform: scale(1.3);
-webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;
box-shadow: 5px 5px 0px 0px #f3f3f3;
position: relative;
z-index: 10;
}
.notfound .notfound-bg > div:nth-child(3) {
-webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;
box-shadow: 5px 5px 0px 0px #f3f3f3;
position: relative;
z-index: 90;
}
.notfound h1 {
font-family: "Quicksand", sans-serif;
font-size: 86px;
text-transform: uppercase;
font-weight: 700;
margin-top: 0;
margin-bottom: 8px;
color: #4d4d4d;
}
.notfound h2 {
font-family: "Quicksand", sans-serif;
font-size: 26px;
margin: 0;
font-weight: 700;
color: #4d4d4d;
}
.notfound a {
font-family: "Quicksand", sans-serif;
font-size: 14px;
text-decoration: none;
text-transform: uppercase;
background: #23b883;
display: inline-block;
padding: 15px 30px;
border-radius: 5px;
color: #fff;
font-weight: 700;
margin-top: 20px;
}
.notfound-social {
margin-top: 20px;
}
.notfound-social > a {
display: inline-block;
height: 40px;
line-height: 40px;
width: 40px;
font-size: 14px;
color: #fff;
background-color: #dedede;
margin: 3px;
padding: 0px;
-webkit-transition: 0.2s all;
transition: 0.2s all;
}
.notfound-social > a:hover {
background-color: #18e06f;
}
@media only screen and (max-width: 767px) {
.notfound .notfound-bg {
position: absolute;
left: 0px;
right: 0px;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
z-index: -1;
width: 287px;
margin: auto;
}
.notfound .notfound-bg > div {
width: 100%;
background: #fff;
border-radius: 90px;
height: 125px;
}
.notfound .notfound-bg > div:nth-child(1) {
-webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;
box-shadow: 5px 5px 0px 0px #f3f3f3;
}
.notfound .notfound-bg > div:nth-child(2) {
-webkit-transform: scale(1.3);
-ms-transform: scale(1.3);
transform: scale(1.3);
-webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;
box-shadow: 5px 5px 0px 0px #f3f3f3;
position: relative;
z-index: 10;
}
.notfound .notfound-bg > div:nth-child(3) {
-webkit-box-shadow: 5px 5px 0px 0px #f3f3f3;
box-shadow: 5px 5px 0px 0px #f3f3f3;
position: relative;
z-index: 90;
height: 85px;
}
}
@media only screen and (max-width: 480px) {
.notfound h1 {
font-family: 'Quicksand', sans-serif;
font-size: 86px;
text-transform: uppercase;
font-weight: 700;
margin-top: 0;
margin-bottom: 8px;
color: #4d4d4d;
font-size: 68px;
}
.notfound h2 {
font-family: 'Quicksand', sans-serif;
font-size: 26px;
margin: 0;
font-weight: 700;
color: #4d4d4d;
}
.notfound a {
font-family: 'Quicksand', sans-serif;
font-size: 14px;
text-decoration: none;
text-transform: uppercase;
background: #23b883;
display: inline-block;
padding: 15px 30px;
border-radius: 5px;
color: #fff;
font-weight: 700;
margin-top: 20px;
}
.notfound-social {
margin-top: 20px;
}
.notfound-social > a {
display: inline-block;
height: 40px;
line-height: 40px;
width: 40px;
font-size: 14px;
color: #fff;
background-color: #dedede;
margin: 3px;
padding: 0px;
-webkit-transition: 0.2s all;
transition: 0.2s all;
}
.notfound-social > a:hover {
background-color: #18e06f;
}
@media only screen and (max-width: 767px) {
.notfound .notfound-bg {
width: 287px;
margin: auto;
}
.notfound .notfound-bg > div {
height: 85px;
}
}
@media only screen and (max-width: 480px) {
.notfound h1 {
font-size: 68px;
}
.notfound h2 {
font-size: 18px;
}
font-size: 18px;
}
}
</style>
</head>
<body>
<div id="notfound">
<div class="notfound">
</head>
<body>
<div id="notfound">
<div class="notfound">
<div class="notfound-bg">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<h1>oops!</h1>
<h2>Error 404 : Page Not Found</h2>
<a href="https://cheatsheets.zip">go back</a>
</div>
</div>
</div>
</body>
</body>
</html>
+99 -96
View File
@@ -1,95 +1,102 @@
<div class="flex items-center justify-center mt-8 mb-3">
<div class="w-1/3 px-2">
<p class="font-medium text-right">Permissions: </p>
</div>
<div class="w-1/3 px-2">
<input class="appearance-none block w-full bg-grey-lighter dark:bg-slate-800 text-grey-darker border border-red rounded py-2 px-3 focus:outline-none focus:border-emerald-500" id="num" placeholder="777" maxlength="3" type="text">
</div>
<div class="w-1/3 px-2 ">
<input class="appearance-none block w-full bg-grey-lighter dark-bg-slate-800 text-grey-darker border border-grey-lighter rounded py-2 px-3 focus:outline-none focus:border-emerald-500" id="let" placeholder="rwxrwxrwx" maxlength="9" type="text">
</div>
<div class="mb-3 mt-8 flex items-center justify-center">
<div class="w-1/3 px-2">
<p class="text-right font-medium">Permissions:</p>
</div>
<div class="w-1/3 px-2">
<input
class="bg-grey-lighter text-grey-darker border-red block w-full appearance-none rounded border px-3 py-2 focus:border-emerald-500 focus:outline-none dark:bg-slate-800"
id="num"
placeholder="777"
maxlength="3"
type="text"
/>
</div>
<div class="w-1/3 px-2">
<input
class="bg-grey-lighter dark-bg-slate-800 text-grey-darker border-grey-lighter block w-full appearance-none rounded border px-3 py-2 focus:border-emerald-500 focus:outline-none"
id="let"
placeholder="rwxrwxrwx"
maxlength="9"
type="text"
/>
</div>
</div>
<table class="show-header center-text">
<thead>
<thead>
<tr>
<th></th>
<th>User</th>
<th>Group</th>
<th>Other</th>
<th></th>
<th>User</th>
<th>Group</th>
<th>Other</th>
</tr>
</thead>
<tbody>
</thead>
<tbody>
<tr>
<td style="text-align: right">Read</td>
<td><input checked="" id="1" type="checkbox"></td>
<td><input checked="" id="4" type="checkbox"></td>
<td><input checked="" id="7" type="checkbox"></td>
<td style="text-align: right">Read</td>
<td><input checked="" id="1" type="checkbox" /></td>
<td><input checked="" id="4" type="checkbox" /></td>
<td><input checked="" id="7" type="checkbox" /></td>
</tr>
<tr>
<td style="text-align: right">Write</td>
<td><input checked="" id="2" type="checkbox"></td>
<td><input checked="" id="5" type="checkbox"></td>
<td><input checked="" id="8" type="checkbox"></td>
<td style="text-align: right">Write</td>
<td><input checked="" id="2" type="checkbox" /></td>
<td><input checked="" id="5" type="checkbox" /></td>
<td><input checked="" id="8" type="checkbox" /></td>
</tr>
<tr>
<td style="text-align: right">Execute</td>
<td><input checked="" id="3" type="checkbox"></td>
<td><input checked="" id="6" type="checkbox"></td>
<td><input checked="" id="9" type="checkbox"></td>
<td style="text-align: right">Execute</td>
<td><input checked="" id="3" type="checkbox" /></td>
<td><input checked="" id="6" type="checkbox" /></td>
<td><input checked="" id="9" type="checkbox" /></td>
</tr>
</tbody>
</tbody>
</table>
<script>
const reg_num = /^[0-7]{3}$/; // some regex to check the num input
const reg_let = /^([r\-]{1}[w\-]{1}[x\-]{1}){3}$/; // some regex to check the text input
window.addEventListener("DOMContentLoaded", function () {
// loop over all the check boxes
for (let i = 1; i < 10; i++) {
let checkBox = document.getElementById(`${i}`);
checkBox.addEventListener('change', function () {
checkBox.addEventListener("change", function () {
change_occured(true, false, false);
// get rid of bad input classes
document.getElementById('num').classList.remove('bad-input');
document.getElementById("num").classList.remove("bad-input");
document.getElementById('let').classList.remove('bad-input');
document.getElementById("let").classList.remove("bad-input");
});
}
// the octal input
let num_input = document.getElementById('num');
let num_input = document.getElementById("num");
let num_fn = function () {
// check for bad input
if (!reg_num.test(this.value)) {
this.classList.add('bad-input');
this.classList.add("bad-input");
} else {
this.classList.remove('bad-input');
this.classList.remove("bad-input");
change_occured(false, true, false);
}
};
num_input.addEventListener('change', num_fn);
num_input.addEventListener('keyup', num_fn);
num_input.addEventListener("change", num_fn);
num_input.addEventListener("keyup", num_fn);
// the let input
let let_input = document.getElementById('let');
let let_input = document.getElementById("let");
let let_fn = function () {
// check for bad input
if (!reg_let.test(this.value)) {
this.classList.add('bad-input');
this.classList.add("bad-input");
} else {
this.classList.remove('bad-input');
this.classList.remove("bad-input");
change_occured(false, false, true);
}
};
let_input.addEventListener('change',let_fn);
let_input.addEventListener('keyup',let_fn);
let_input.addEventListener("change", let_fn);
let_input.addEventListener("keyup", let_fn);
});
/* SETUP
@@ -98,18 +105,20 @@
x-1-3 x-1-6 x-1-9
*/
// define a function that runs when a change occures
function change_occured(caller_was_check, caller_was_num, caller_was_let) {
let num1 = 0, num2 = 0, num3 = 0; // these are the three numbers for the octal
let perm_string = ''; // holds the permision string ex. rw-x--r--
let num1 = 0,
num2 = 0,
num3 = 0; // these are the three numbers for the octal
let perm_string = ""; // holds the permision string ex. rw-x--r--
if (caller_was_check) {
// loop over all the check boxes and get the permisions
for (let i = 1; i < 10; i++) {
let checkBox = document.getElementById(`${i}`);
if (checkBox.checked) { // if checked
if (checkBox.checked) {
// if checked
let current_perm = check_to_octal_and_text(i);
perm_string += `${current_perm.perm_let}`;
@@ -120,19 +129,18 @@
} else {
num3 += current_perm.perm_num;
}
} else { // if not checked
perm_string += '-';
} else {
// if not checked
perm_string += "-";
}
}
// set the permision input text
document.getElementById('let').value = perm_string;
document.getElementById('num').value = `${num1}${num2}${num3}`;
document.getElementById("let").value = perm_string;
document.getElementById("num").value = `${num1}${num2}${num3}`;
} else if (caller_was_num) {
// get the individual numbers
let num_input_val = document.getElementById('num').value;
let num_input_val = document.getElementById("num").value;
num1 = num_input_val.substring(0, 1);
num2 = num_input_val.substring(1, 2);
num3 = num_input_val.substring(2, 3);
@@ -143,63 +151,59 @@
perm_string += octal_to_check_and_txt(num3, 2); //Owner
// set the permision input text
document.getElementById('let').value = perm_string;
document.getElementById("let").value = perm_string;
} else if (caller_was_let) {
// get the text input
let perm_text = document.getElementById('let').value;
let perm_text = document.getElementById("let").value;
num1 = text_to_check_and_octal(perm_text.substring(0, 3), 0)
num2 = text_to_check_and_octal(perm_text.substring(3, 6), 3)
num3 = text_to_check_and_octal(perm_text.substring(6, 9), 6)
num1 = text_to_check_and_octal(perm_text.substring(0, 3), 0);
num2 = text_to_check_and_octal(perm_text.substring(3, 6), 3);
num3 = text_to_check_and_octal(perm_text.substring(6, 9), 6);
// set the octal value
document.getElementById('num').value = `${num1}${num2}${num3}`;
document.getElementById("num").value = `${num1}${num2}${num3}`;
}
}
// define a function to converts the checkbox # to the respective permissions
// returns perm_num, perm_let
function check_to_octal_and_text(check_num) {
let perm_num = 0;
let perm_let = '-';
let perm_let = "-";
switch (check_num) {
case 1:
case 4:
case 7:
perm_num = 4;
perm_let = 'r';
perm_let = "r";
break;
case 2:
case 5:
case 8:
perm_num = 2;
perm_let = 'w';
perm_let = "w";
break;
case 3:
case 6:
case 9:
perm_num = 1;
perm_let = 'x';
perm_let = "x";
break;
default:
perm_num = 0;
perm_let = '-';
perm_let = "-";
}
// return values
return {
perm_num,
perm_let
perm_let,
};
}
/**
Takes a number 1-7 and which class it is in:
0 = owner
@@ -209,69 +213,68 @@
Returns: perm text (ex. "rwx") and sets the appropriate checkboxes
*/
function octal_to_check_and_txt(octal_num, class_num) {
let perm_text = '';
let perm_text = "";
let offset = class_num * 3;
switch (octal_num) {
case '1':
case "1":
document.getElementById(`${1 + offset}`).checked = false;
document.getElementById(`${2 + offset}`).checked = false;
document.getElementById(`${3 + offset}`).checked = true;
perm_text = '--x';
perm_text = "--x";
break;
case '2':
case "2":
document.getElementById(`${1 + offset}`).checked = false;
document.getElementById(`${2 + offset}`).checked = true;
document.getElementById(`${3 + offset}`).checked = false;
perm_text = '-w-';
perm_text = "-w-";
break;
case '3':
case "3":
document.getElementById(`${1 + offset}`).checked = false;
document.getElementById(`${2 + offset}`).checked = true;
document.getElementById(`${3 + offset}`).checked = true;
perm_text = '-wx';
perm_text = "-wx";
break;
case '4':
case "4":
document.getElementById(`${1 + offset}`).checked = true;
document.getElementById(`${2 + offset}`).checked = false;
document.getElementById(`${3 + offset}`).checked = false;
perm_text = 'r--';
perm_text = "r--";
break;
case '5':
case "5":
document.getElementById(`${1 + offset}`).checked = true;
document.getElementById(`${2 + offset}`).checked = false;
document.getElementById(`${3 + offset}`).checked = true;
perm_text = 'r-x';
perm_text = "r-x";
break;
case '6':
case "6":
document.getElementById(`${1 + offset}`).checked = true;
document.getElementById(`${2 + offset}`).checked = true;
document.getElementById(`${3 + offset}`).checked = false;
perm_text = 'rw-';
perm_text = "rw-";
break;
case '7':
case "7":
document.getElementById(`${1 + offset}`).checked = true;
document.getElementById(`${2 + offset}`).checked = true;
document.getElementById(`${3 + offset}`).checked = true;
perm_text = 'rwx';
perm_text = "rwx";
break;
default:
document.getElementById(`${1 + offset}`).checked = false;
document.getElementById(`${2 + offset}`).checked = false;
document.getElementById(`${3 + offset}`).checked = false;
perm_text = '---';
perm_text = "---";
}
return perm_text;
}
/**
Takes 3 letters (r, w, x, - ex. 'rw-') and an offset (0,3,6)
Returns the octal num and sets the appropriate checkboxes
@@ -282,13 +285,13 @@
// add up the oct num and set the check boxes
for (let i = 0; i < 3; i++) {
current_let = letters.substring(i, i + 1);
if (current_let == 'r') {
if (current_let == "r") {
document.getElementById(`${i + 1 + offset}`).checked = true;
perm_num += 4;
} else if (current_let == 'w') {
} else if (current_let == "w") {
document.getElementById(`${i + 1 + offset}`).checked = true;
perm_num += 2;
} else if (current_let == 'x') {
} else if (current_let == "x") {
document.getElementById(`${i + 1 + offset}`).checked = true;
perm_num += 1;
} else {
@@ -297,4 +300,4 @@
}
return perm_num;
}
</script>
</script>