From 4c09b9e911bc07d89cdbbda809277ef0716c1b4a Mon Sep 17 00:00:00 2001 From: teldra Date: Sun, 26 Jun 2022 15:40:56 +0200 Subject: [PATCH] small fixes --- themes/buha/static/js/generator.js | 47 +++++++++++++++++------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/themes/buha/static/js/generator.js b/themes/buha/static/js/generator.js index bf62133..a9a0538 100644 --- a/themes/buha/static/js/generator.js +++ b/themes/buha/static/js/generator.js @@ -69,23 +69,27 @@ function insert_file(fname) { let t = arr[2]; let x = arr[1]; let target = arr[0]; - var id = document.getElementById(target); - function typeInTextarea(newText, el = id) { - const [start, end] = [el.selectionStart, el.selectionEnd]; - el.setRangeText(newText, start, end); - } - if (t == "image") { - var desc = prompt("Desc for ", "Describe the Picture for the Blind"); - var out = "![" + desc + "](" + x + ") \n\n"; - } else if (t == "other") { - var desc = prompt("Desc for ", "Describe the File for the Blind"); - var out = "[" + desc + "](" + x + ") \n\n"; - } - if (out != null) { - typeInTextarea(out); - var end = id.value.length; - id.setSelectionRange(end, end); - id.focus({preventScroll: true}); + if (!(x.startsWith("banner"))) { + var id = document.getElementById(target); + function typeInTextarea(newText, el = id) { + const [start, end] = [el.selectionStart, el.selectionEnd]; + el.setRangeText(newText, start, end); + } + if (t == "image") { + var n = prompt("Name", "Wikipedia Logo"); + var desc = prompt("Describe the Picture for the Blind", "A Globe composed of letters and puzzle pieces"); + if (desc != null && n != null) {var out = "\n\n![" + n + "](" + x + " \"" + desc + "\"" + ")\n\n";} + } else if (t == "other") { + var n = prompt("Name", "Textfile"); + var desc = prompt("Describe the File for the Blind", "A file with content related to the subject"); + if (desc != null && n != null) {var out = "\n\n[" + n + "](" + x + " \"" + desc + "\"" + ")\n\n";} + } + if (out != null) { + typeInTextarea(out); + var end = id.value.length; + id.setSelectionRange(end, end); + id.focus({preventScroll: true}); + } } } @@ -126,15 +130,16 @@ function button(str) { if (x == "url") { let url = prompt("Please enter URL", "https://wikipedia.org"); if (url != null) { - let desc = prompt("Description", "The free Encyclopedia"); - if (desc != null) {var out = "[" + desc + "](" + url + ") ";} + var n = prompt("Name", "Wikipedia"); + var desc = prompt("Describe the Link for the Blind", "The free Encyclopedia"); + if (desc != null && n != null) {var out = "\n\n![" + n + "](" + x + " \"" + desc + "\"" + ")\n\n";} } } if (x == "picurl") { let url = prompt("Please enter Link to an image", "https://de.wikipedia.org/static/images/project-logos/dewiki.png"); if (url != null) { - let desc = prompt("Description", "Wikipedia logo"); - if (desc != null) {var out = "![" + desc + "](" + url + ") ";} + var n = prompt("Name", "Wikipedia Logo"); + var desc = prompt("Describe the Picture for the Blind", "A Globe composed of letters and puzzle pieces"); if (desc != null && n != null) {var out = "\n\n![" + n + "](" + x + " \"" + desc + "\"" + ")\n\n";} } } if (x == "headline") {