From cda601a3551aa85b073b017fe184201404c47c87 Mon Sep 17 00:00:00 2001 From: ksamuel Date: Thu, 13 Aug 2020 16:53:17 +0200 Subject: [PATCH] Add toggle for reader mode --- zerobin/default_settings.py | 2 +- zerobin/static/js/behavior.js | 24 ++++++++++++++++++++++++ zerobin/views/base.tpl | 11 ++++++++++- zerobin/views/paste.tpl | 8 +++++--- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/zerobin/default_settings.py b/zerobin/default_settings.py index f4e00bf..edab738 100644 --- a/zerobin/default_settings.py +++ b/zerobin/default_settings.py @@ -9,7 +9,7 @@ PORT = "3255" # Names/links to insert in the footer. # MENU = ( - ("Create paste", "/"), # First link will be highlighted + ("Create paste", "/"), ("Github", "https://github.com/Tygs/0bin"), ("Faq", "/faq/"), # You probably want to keep this # Any link with "mailto:" will be escaped to limit spam, but displayed diff --git a/zerobin/static/js/behavior.js b/zerobin/static/js/behavior.js index cf0499e..774800b 100644 --- a/zerobin/static/js/behavior.js +++ b/zerobin/static/js/behavior.js @@ -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__', '@'); }, diff --git a/zerobin/views/base.tpl b/zerobin/views/base.tpl index fd4bb1f..f251b35 100644 --- a/zerobin/views/base.tpl +++ b/zerobin/views/base.tpl @@ -11,6 +11,7 @@ + %if not settings.DEBUG: %else: @@ -26,7 +27,7 @@
-
+
ΓΈbin.net "A client side encrypted PasteBin"
All pastes are AES256 encrypted, we cannot know what you paste... @@ -34,6 +35,14 @@