beautification of editor

This commit is contained in:
ville rantanen
2018-07-21 20:23:45 +03:00
parent bd301eca6f
commit 90660262d5
5 changed files with 86 additions and 22 deletions

View File

@@ -21,18 +21,18 @@ function index_form_submit() {
document.getElementById("index_form_name").value;
}
function infoToggle() {
var info = document.getElementById("list_info");
info.style.display = info.style.display === 'block' ? 'none' : 'block';
function toggler(id) {
var el = document.getElementById(id);
if (el) {
el.style.display = el.style.display === 'block' ? 'none' : 'block';
}
}
function infoToggle() {
toggler("list_info");
}
function scriptToggle() {
var el = document.getElementById("list_script");
if (el) {
el.style.display = el.style.display === 'block' ? 'none' : 'block';
}
toggler("list_script");
}
@@ -151,6 +151,20 @@ function UploadURL() {
}
function updateEditorPreview() {
var input = document.getElementById("editor_area");
var preview = document.getElementById("editor_preview");
preview.innerHTML = md.render(input.value);
}
function previewToggle() {
toggler("editor_preview");
if (document.getElementById("editor_preview").style.display === 'block') {
document.getElementById("editor_area").style.width = "40vw";
} else {
document.getElementById("editor_area").style.width = "82vw";
}
}
function changeTitle(newTitle) {
document.title = "Flees - " + newTitle;
}