PrettyPaste: Add Fork and New button
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
@@ -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
15
static/js/pretty.js
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user