From 2be6ee4f7c8a57f920c5a06aadd9b4bd82ff7cb7 Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 21 Jun 2019 20:00:31 +0200 Subject: [PATCH] Implement source collapsing --- index.html | 33 +++++++++++++++++++-------------- model.js | 20 ++++++++++++++------ 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index f50afc94..1ac00497 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@
-
+
@@ -28,31 +28,36 @@ -
+
+
+ +
-
- diff --git a/model.js b/model.js index aa840b30..753fd5d1 100644 --- a/model.js +++ b/model.js @@ -30,6 +30,18 @@ function updateLuckBased() { invalidated(); } +function hideSource() { + $('.source-container').addClass('d-none'); + $('.structure-container').removeClass('col-lg-7'); + $('#showSourceButton').removeClass('d-none'); +} + +function showSource() { + $('.source-container').removeClass('d-none'); + $('.structure-container').addClass('col-lg-7'); + $('#showSourceButton').addClass('d-none'); +} + function linkSource() { let link = window.location.origin + window.location.pathname + '?q=' + JSON.stringify(table); $('#copyTextarea').removeClass('d-none').val(link); @@ -54,12 +66,8 @@ function updateSouce() { invalidated(); } -function updateIndentation(el) { - if (el.value === 'tab') { - indentation = '\t'; - } else { - indentation = parseInt(el.value); - } +function updateIndentation(value) { + indentation = value; invalidated(); }