PrettyPaste: Add Fork and New button

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
Gunwant Jain
2022-01-16 13:21:15 +05:30
parent 372bbf28d3
commit 449f0c38a9
7 changed files with 80 additions and 7 deletions

View File

@@ -43,7 +43,7 @@ form.highlight {
}
textarea {
height: 100%;
height: 90%;
width: 100%;
background: none;
@@ -100,6 +100,10 @@ button[type="submit"] {
cursor: pointer;
}
button[type="submit"]:hover {
background-color: #be7611;
}
#upload_card {
display: none;
}

34
static/css/pretty.css Normal file
View File

@@ -0,0 +1,34 @@
.topRightBox {
position: fixed;
padding: 18px 10px;
color: #f29718;
background-color: #0f1419;
top: 0px;
right: 0px;
font-family: "Iosevka Web", monospace;
font-size: 20px;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
}
.topRightBox button {
color: inherit;
background-color: inherit;
margin: 0px 5px;
border: solid 0.2px;
border-color: #0f1419;
font-family: inherit;
font-size: inherit;
line-height: inherit;
cursor: pointer;
}
.topRightBox button:hover {
color: #be7611;
}
.rootBoot {
position: relative;
}

View File

@@ -6,6 +6,15 @@ const textarea = document.querySelector('textarea');
const select = document.querySelector('select');
const submitButton = document.querySelector('button[type="submit"]');
window.onload = () => {
if (localStorage["forkText"] !== null) {
const textArea = document.getElementById('textarea_content');
textArea.textContent = localStorage["forkText"];
localStorage.clear();
onInput();
}
}
const onInput = () => {
submitButton.classList.toggle('hidden', !textarea.value);
select.classList.toggle('hidden', !textarea.value);

15
static/js/pretty.js Normal file
View File

@@ -0,0 +1,15 @@
const homePage = document.location.origin;
function forkClicked () {
const paste = document.getElementById('pasteContent');
let text = paste.innerText;
localStorage["forkText"] = text;
console.log(text);
window.location = homePage;
}
function newPasteClicked () {
window.location = homePage;
}