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 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") {