small fixes

This commit is contained in:
teldra 2022-06-26 15:40:56 +02:00
parent fcb1ec51c7
commit 4c09b9e911
1 changed files with 26 additions and 21 deletions

View File

@ -69,23 +69,27 @@ function insert_file(fname) {
let t = arr[2]; let t = arr[2];
let x = arr[1]; let x = arr[1];
let target = arr[0]; let target = arr[0];
var id = document.getElementById(target); if (!(x.startsWith("banner"))) {
function typeInTextarea(newText, el = id) { var id = document.getElementById(target);
const [start, end] = [el.selectionStart, el.selectionEnd]; function typeInTextarea(newText, el = id) {
el.setRangeText(newText, start, end); 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"); if (t == "image") {
var out = "![" + desc + "](" + x + ") \n\n"; var n = prompt("Name", "Wikipedia Logo");
} else if (t == "other") { var desc = prompt("Describe the Picture for the Blind", "A Globe composed of letters and puzzle pieces");
var desc = prompt("Desc for ", "Describe the File for the Blind"); if (desc != null && n != null) {var out = "\n\n![" + n + "](" + x + " \"" + desc + "\"" + ")\n\n";}
var out = "[" + desc + "](" + x + ") \n\n"; } else if (t == "other") {
} var n = prompt("Name", "Textfile");
if (out != null) { var desc = prompt("Describe the File for the Blind", "A file with content related to the subject");
typeInTextarea(out); if (desc != null && n != null) {var out = "\n\n[" + n + "](" + x + " \"" + desc + "\"" + ")\n\n";}
var end = id.value.length; }
id.setSelectionRange(end, end); if (out != null) {
id.focus({preventScroll: true}); 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") { if (x == "url") {
let url = prompt("Please enter URL", "https://wikipedia.org"); let url = prompt("Please enter URL", "https://wikipedia.org");
if (url != null) { if (url != null) {
let desc = prompt("Description", "The free Encyclopedia"); var n = prompt("Name", "Wikipedia");
if (desc != null) {var out = "[" + desc + "](" + url + ") ";} 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") { if (x == "picurl") {
let url = prompt("Please enter Link to an image", "https://de.wikipedia.org/static/images/project-logos/dewiki.png"); let url = prompt("Please enter Link to an image", "https://de.wikipedia.org/static/images/project-logos/dewiki.png");
if (url != null) { if (url != null) {
let desc = prompt("Description", "Wikipedia logo"); var n = prompt("Name", "Wikipedia Logo");
if (desc != null) {var out = "![" + desc + "](" + url + ") ";} 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") { if (x == "headline") {