converted indentation to spaces
This commit is contained in:
parent
c7377dd408
commit
0d3a03f2fe
3 changed files with 121 additions and 121 deletions
|
@ -10,46 +10,46 @@ const confirmDeleteButton = document.querySelector("._delete-confirm");
|
|||
const saveToLocalButton = document.querySelector("._save-to-local");
|
||||
|
||||
function selectAll() {
|
||||
noteBody.select();
|
||||
noteBody.select();
|
||||
};
|
||||
|
||||
function showDeleteConfirm() {
|
||||
confirmDeleteButton.style.display = "inline";
|
||||
deleteAllButton.style.display = "none";
|
||||
confirmDeleteButton.style.display = "inline";
|
||||
deleteAllButton.style.display = "none";
|
||||
|
||||
timerId = setTimeout(() => {
|
||||
confirmDeleteButton.style.display = "none";
|
||||
deleteAllButton.style.display = "inline";
|
||||
}, 2500);
|
||||
timerId = setTimeout(() => {
|
||||
confirmDeleteButton.style.display = "none";
|
||||
deleteAllButton.style.display = "inline";
|
||||
}, 2500);
|
||||
};
|
||||
|
||||
function confirmDelete() {
|
||||
confirmDeleteButton.style.display = "none";
|
||||
deleteAllButton.style.display = "inline";
|
||||
confirmDeleteButton.style.display = "none";
|
||||
deleteAllButton.style.display = "inline";
|
||||
|
||||
noteTitle.value = "";
|
||||
noteBody.value = "";
|
||||
noteTitle.value = "";
|
||||
noteBody.value = "";
|
||||
|
||||
clearInterval(timerId);
|
||||
clearInterval(timerId);
|
||||
|
||||
saveTitle();
|
||||
saveText();
|
||||
saveTitle();
|
||||
saveText();
|
||||
};
|
||||
|
||||
function downloadNote() {
|
||||
let title = noteTitle.value || "Simple Note";
|
||||
let text = noteBody.value;
|
||||
let title = noteTitle.value || "Simple Note";
|
||||
let text = noteBody.value;
|
||||
|
||||
let element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', title);
|
||||
let element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', title);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click(); // Not my code, I just changed it a bit haha.
|
||||
element.click(); // Not my code, I just changed it a bit haha.
|
||||
|
||||
document.body.removeChild(element);
|
||||
document.body.removeChild(element);
|
||||
};
|
||||
|
||||
|
||||
|
@ -58,19 +58,19 @@ const note_title = "Note_Title";
|
|||
const note_text = "Note_Text";
|
||||
|
||||
function saveTitle() {
|
||||
localStorage.setItem(note_title, noteTitle.value);
|
||||
localStorage.setItem(note_title, noteTitle.value);
|
||||
};
|
||||
|
||||
function saveText() {
|
||||
localStorage.setItem(note_text, noteBody.value);
|
||||
localStorage.setItem(note_text, noteBody.value);
|
||||
};
|
||||
|
||||
function loadData() {
|
||||
let titleFromStorage = localStorage.getItem(note_title) || "";
|
||||
noteTitle.value = titleFromStorage;
|
||||
let titleFromStorage = localStorage.getItem(note_title) || "";
|
||||
noteTitle.value = titleFromStorage;
|
||||
|
||||
let textFromStorage = localStorage.getItem(note_text) || "";
|
||||
noteBody.value = textFromStorage;
|
||||
let textFromStorage = localStorage.getItem(note_text) || "";
|
||||
noteBody.value = textFromStorage;
|
||||
};
|
||||
|
||||
noteTitle.addEventListener("input", saveTitle);
|
||||
|
@ -82,5 +82,5 @@ confirmDeleteButton.addEventListener("click", confirmDelete);
|
|||
saveToLocalButton.addEventListener("click", downloadNote);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
loadData();
|
||||
loadData();
|
||||
});
|
|
@ -1,153 +1,153 @@
|
|||
:root {
|
||||
--font-size-primary: 0.906rem; /* 14.5px */
|
||||
--font-size-secondary: 0.688rem; /* 11px */
|
||||
--font-size-primary: 0.906rem; /* 14.5px */
|
||||
--font-size-secondary: 0.688rem; /* 11px */
|
||||
|
||||
--foreground: rgba(0, 0, 0, 0.75);
|
||||
--foreground: rgba(0, 0, 0, 0.75);
|
||||
|
||||
--border-color: rgba(0, 0, 0, 0.55);
|
||||
--border-shorthand: 0.063rem solid var(--border-color);
|
||||
--border-color: rgba(0, 0, 0, 0.55);
|
||||
--border-shorthand: 0.063rem solid var(--border-color);
|
||||
|
||||
/* Button */
|
||||
--button-hover-foreground: rgba(255, 255, 255, 0.9);
|
||||
--button-hover-backround: rgba(0, 0, 0, 0.78);
|
||||
--font-size-button: 0.769rem; /* 12.3px */
|
||||
/* Button */
|
||||
--button-hover-foreground: rgba(255, 255, 255, 0.9);
|
||||
--button-hover-backround: rgba(0, 0, 0, 0.78);
|
||||
--font-size-button: 0.769rem; /* 12.3px */
|
||||
|
||||
--seven: 0.438rem; /* 7px */
|
||||
--twelve: 0.75rem; /* 12px */
|
||||
--seven: 0.438rem; /* 7px */
|
||||
--twelve: 0.75rem; /* 12px */
|
||||
}
|
||||
|
||||
*, *::before, *::after {
|
||||
color: var(--foreground);
|
||||
box-sizing: border-box;
|
||||
color: var(--foreground);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body { /* Left & right spacing is left & right from default body margin + 12px */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
min-height: 91vh;
|
||||
margin-top: 4.5vh;
|
||||
margin-bottom: 4.5vh;
|
||||
padding: var(--twelve);
|
||||
font-size: var(--font-size-primary);
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
min-height: 91vh;
|
||||
margin-top: 4.5vh;
|
||||
margin-bottom: 4.5vh;
|
||||
padding: var(--twelve);
|
||||
font-size: var(--font-size-primary);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
max-width: 32rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
max-width: 32rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#simple-note {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
min-height: 18.75rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
min-height: 18.75rem;
|
||||
}
|
||||
|
||||
/* Title Input */
|
||||
|
||||
.__title {
|
||||
border: var(--border-shorthand);
|
||||
border-bottom: 0;
|
||||
width: 100%;
|
||||
border: var(--border-shorthand);
|
||||
border-bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.__title input {
|
||||
border: none;
|
||||
width: 100%;
|
||||
padding: var(--seven) var(--twelve);
|
||||
font-size: var(--font-size-button);
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
outline: none;
|
||||
border: none;
|
||||
width: 100%;
|
||||
padding: var(--seven) var(--twelve);
|
||||
font-size: var(--font-size-button);
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Body / textarea / The Note Itself */
|
||||
|
||||
.__body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.__body textarea {
|
||||
border: var(--border-shorthand);
|
||||
border-bottom: none;
|
||||
border-radius: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: var(--seven) var(--twelve);
|
||||
font-size: var(--font-size-button);
|
||||
resize: none;
|
||||
overflow-y: scroll;
|
||||
outline: none;
|
||||
border: var(--border-shorthand);
|
||||
border-bottom: none;
|
||||
border-radius: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: var(--seven) var(--twelve);
|
||||
font-size: var(--font-size-button);
|
||||
resize: none;
|
||||
overflow-y: scroll;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Bottom Part / The One With The Buttons */
|
||||
|
||||
.__function {
|
||||
display: flex;
|
||||
border: var(--border-shorthand);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
border: var(--border-shorthand);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
button {
|
||||
background: none;
|
||||
border: none;
|
||||
min-width: 20%;
|
||||
padding: var(--seven) var(--twelve);
|
||||
font-size: var(--font-size-button);
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: none;
|
||||
min-width: 20%;
|
||||
padding: var(--seven) var(--twelve);
|
||||
font-size: var(--font-size-button);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.__function button:not(:last-child) {
|
||||
border-right: var(--border-shorthand);
|
||||
border-right: var(--border-shorthand);
|
||||
}
|
||||
|
||||
._delete-all,
|
||||
._delete-confirm {
|
||||
color: #fff;
|
||||
background: #FD5E5E;
|
||||
color: #fff;
|
||||
background: #FD5E5E;
|
||||
}
|
||||
|
||||
._delete-confirm {
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
._save-to-local {
|
||||
border-left: var(--border-shorthand) !important;
|
||||
margin-left: auto;
|
||||
border-left: var(--border-shorthand) !important;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* Notice / Link */
|
||||
|
||||
#notice {
|
||||
margin-top: 0.656rem;
|
||||
padding: 0 var(--seven);
|
||||
font-size: var(--font-size-secondary);
|
||||
line-height: 1.1;
|
||||
word-wrap: break-word;
|
||||
margin-top: 0.656rem;
|
||||
padding: 0 var(--seven);
|
||||
font-size: var(--font-size-secondary);
|
||||
line-height: 1.1;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
/* Media Query */
|
||||
|
||||
@media (hover: hover) {
|
||||
.__function button:hover {
|
||||
color: var(--button-hover-foreground);
|
||||
background: var(--button-hover-backround);
|
||||
}
|
||||
.__function button:hover {
|
||||
color: var(--button-hover-foreground);
|
||||
background: var(--button-hover-backround);
|
||||
}
|
||||
}
|
||||
|
||||
/* Font Size */
|
||||
@media (max-width: 30rem) { /* 480px */
|
||||
html {
|
||||
font-size: calc(1rem - 10%);
|
||||
}
|
||||
html {
|
||||
font-size: calc(1rem - 10%);
|
||||
}
|
||||
}
|
||||
/* -------- */
|
22
index.html
22
index.html
|
@ -1,20 +1,20 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="author" content="westtle">
|
||||
<meta name="description" content="A very simple notepad that you can use.">
|
||||
<meta name="keywords" content="notepad, note, notepad online, simple note, simple notepad">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Simple Note</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="author" content="westtle">
|
||||
<meta name="description" content="A very simple notepad that you can use.">
|
||||
<meta name="keywords" content="notepad, note, notepad online, simple note, simple notepad">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Simple Note</title>
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="#">
|
||||
<!-- <link rel="stylesheet" type="text/css" href="assets/styles/style.min.css"> -->
|
||||
<link rel="icon" type="image/x-icon" href="#">
|
||||
<!-- <link rel="stylesheet" type="text/css" href="assets/styles/style.min.css"> -->
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
</main>
|
||||
<main>
|
||||
</main>
|
||||
|
||||
<!-- <script type="text/javascript" src="assets/scripts/script.min.js"></script> -->
|
||||
<!-- <script type="text/javascript" src="assets/scripts/script.min.js"></script> -->
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue