Files
paste/static/js/pretty.js
Gunwant Jain eff3f0dbd6 pretty: add softwrapping to pastes
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2022-01-25 14:34:21 +05:30

33 lines
737 B
JavaScript

const homePage = document.location.origin;
const pasteContentDiv = document.getElementById('pasteContent');
let wrap_level = 0;
function wrapClicked() {
wrap_level = (wrap_level === 2) ? 0 : wrap_level + 1;
switch (wrap_level) {
case 0:
pasteContentDiv.style.width = 'max-content';
break;
case 1:
pasteContentDiv.style.width = 'auto';
break;
case 2:
pasteContentDiv.style.width = '80ch';
break;
}
}
function forkClicked() {
let text = pasteContentDiv.innerText;
localStorage["forkText"] = text;
console.log(text);
window.location = homePage;
}
function newPasteClicked() {
window.location = homePage;
}