1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

Add toggle for reader mode

This commit is contained in:
ksamuel
2020-08-13 16:53:17 +02:00
parent 1939a6b89e
commit cda601a355
4 changed files with 40 additions and 5 deletions

View File

@ -26,11 +26,13 @@ const app = new Vue({
downloadLink: {},
displayBottomToolBar: false,
openPreviousPastesMenu: false,
readerMode: false,
isUploading: false,
currentPaste: {
ownerKey: '',
id: '',
type: '',
content: ''
},
newPaste: {
expiration: '1_day',
@ -66,6 +68,28 @@ const app = new Vue({
},
methods: {
toggleReaderMode: function () {
if (!this.readerMode) {
this.messages = [];
this.currentPaste.content = zerobin.getPasteContent();
}
this.readerMode = !this.readerMode;
},
increaseFontSize: function (amount) {
let readableModeContent = document.getElementById('readable-paste-content')
let fontSize = window.getComputedStyle(readableModeContent, null).getPropertyValue('font-size');
amount = amount || 5;
readableModeContent.style.fontSize = (parseFloat(fontSize) + amount) + "px";
},
decreaseFontSize: function () {
this.increaseFontSize(-5);
},
formatEmail: (email) => {
return "mailto:" + email.replace('__AT__', '@');
},