many updates
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
function login() {
|
||||
var err = false;
|
||||
var firstInvalid = null;
|
||||
var data = new Object();
|
||||
var div = document.getElementById("content");
|
||||
var form = document.getElementById("authentication");
|
||||
var errElement = document.getElementById("err");
|
||||
if (errElement != null) {
|
||||
errElement.innerHTML = "";
|
||||
}
|
||||
var inputs = div.getElementsByTagName("INPUT");
|
||||
console.log(inputs);
|
||||
for (var i = inputs.length - 1; i >= 0; i--) {
|
||||
@@ -10,14 +15,22 @@ function login() {
|
||||
var value = inputs[i].value;
|
||||
if (value.length == 0) {
|
||||
inputs[i].style.borderColor = "red";
|
||||
inputs[i].setAttribute("aria-invalid", "true");
|
||||
if (firstInvalid == null) {
|
||||
firstInvalid = inputs[i];
|
||||
}
|
||||
err = true;
|
||||
}
|
||||
else {
|
||||
inputs[i].style.borderColor = "";
|
||||
inputs[i].setAttribute("aria-invalid", "false");
|
||||
}
|
||||
data[key] = value;
|
||||
}
|
||||
if (err == true) {
|
||||
if (firstInvalid != null) {
|
||||
firstInvalid.focus();
|
||||
}
|
||||
data = new Object();
|
||||
return;
|
||||
}
|
||||
@@ -25,10 +38,31 @@ function login() {
|
||||
if (data["confirm"] != data["password"]) {
|
||||
document.getElementById('password').style.borderColor = "red";
|
||||
document.getElementById('confirm').style.borderColor = "red";
|
||||
document.getElementById('password').setAttribute("aria-invalid", "true");
|
||||
document.getElementById('confirm').setAttribute("aria-invalid", "true");
|
||||
document.getElementById("err").innerHTML = "{{.account.failed}}";
|
||||
document.getElementById('password').focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log(data);
|
||||
form.submit();
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var form = document.getElementById("authentication");
|
||||
if (form == null) {
|
||||
return;
|
||||
}
|
||||
var inputs = form.getElementsByTagName("INPUT");
|
||||
for (var i = 0; i < inputs.length; i++) {
|
||||
inputs[i].addEventListener("keydown", function (event) {
|
||||
if (event.key == "Enter") {
|
||||
event.preventDefault();
|
||||
login();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (inputs.length > 0) {
|
||||
inputs[0].focus();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ var UNDO = new Object();
|
||||
var SERVER_CONNECTION = false;
|
||||
var WS_AVAILABLE = false;
|
||||
var ACTIVE_MENU_ID = "";
|
||||
var LAST_FOCUSED_ELEMENT = null;
|
||||
// Menü
|
||||
var menuItems = new Array();
|
||||
menuItems.push(new MainMenuItem("playlist", "{{.mainMenu.item.playlist}}", "m3u.png", "{{.mainMenu.headline.playlist}}"));
|
||||
@@ -19,7 +20,7 @@ menuItems.push(new MainMenuItem("log", "{{.mainMenu.item.log}}", "log.png", "{{.
|
||||
menuItems.push(new MainMenuItem("logout", "{{.mainMenu.item.logout}}", "logout.png", "{{.mainMenu.headline.logout}}"));
|
||||
// Kategorien für die Einstellungen
|
||||
var settingsCategory = new Array();
|
||||
settingsCategory.push(new SettingsCategoryItem("{{.settings.category.general}}", "xteveAutoUpdate,tuner,epgSource,api"));
|
||||
settingsCategory.push(new SettingsCategoryItem("{{.settings.category.general}}", "xteveAutoUpdate,tuner,epgSource,api,use_plexAPI,plex.url,plex.token"));
|
||||
settingsCategory.push(new SettingsCategoryItem("{{.settings.category.files}}", "update,files.update,temp.path,cache.images,xepg.replace.missing.images"));
|
||||
settingsCategory.push(new SettingsCategoryItem("{{.settings.category.streaming}}", "buffer,udpxy,buffer.size.kb,buffer.timeout,user.agent,ffmpeg.path,ffmpeg.options,vlc.path,vlc.options"));
|
||||
settingsCategory.push(new SettingsCategoryItem("{{.settings.category.backup}}", "backup.path,backup.keep"));
|
||||
@@ -50,6 +51,42 @@ function showElement(elmID, type) {
|
||||
return;
|
||||
}
|
||||
element.className = cssClass;
|
||||
element.setAttribute("aria-hidden", type == true ? "false" : "true");
|
||||
if (elmID == "loading" && document.body != null) {
|
||||
document.body.setAttribute("aria-busy", type == true ? "true" : "false");
|
||||
}
|
||||
if (elmID == "popup") {
|
||||
var popupContent_1 = document.getElementById("popup-custom");
|
||||
if (type == true) {
|
||||
LAST_FOCUSED_ELEMENT = document.activeElement;
|
||||
if (popupContent_1 != null) {
|
||||
setTimeout(function () {
|
||||
popupContent_1.focus();
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (LAST_FOCUSED_ELEMENT != null && LAST_FOCUSED_ELEMENT.focus != undefined) {
|
||||
setTimeout(function () {
|
||||
LAST_FOCUSED_ELEMENT.focus();
|
||||
}, 20);
|
||||
}
|
||||
LAST_FOCUSED_ELEMENT = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
function announceToScreenReader(message) {
|
||||
if (message == undefined || message.length == 0) {
|
||||
return;
|
||||
}
|
||||
var region = document.getElementById("sr-announcer");
|
||||
if (region == null) {
|
||||
return;
|
||||
}
|
||||
region.innerText = "";
|
||||
setTimeout(function () {
|
||||
region.innerText = message;
|
||||
}, 20);
|
||||
}
|
||||
function setConnectionState(state, text) {
|
||||
var label = text;
|
||||
@@ -75,6 +112,8 @@ function setConnectionState(state, text) {
|
||||
}
|
||||
indicator.className = "status-" + state;
|
||||
indicator.innerText = label;
|
||||
indicator.setAttribute("aria-label", "Connection status: " + label);
|
||||
announceToScreenReader("Connection status " + label);
|
||||
}
|
||||
function changeButtonAction(element, buttonID, attribute) {
|
||||
var value = element.options[element.selectedIndex].value;
|
||||
@@ -190,15 +229,29 @@ function sortTable(column) {
|
||||
var table = document.getElementById("content_table");
|
||||
var tableHead = table.getElementsByTagName("TR")[0];
|
||||
var tableItems = tableHead.getElementsByTagName("TD");
|
||||
for (var h = 0; h < tableItems.length; h++) {
|
||||
if (tableItems[h].getAttribute("role") == "columnheader") {
|
||||
tableItems[h].setAttribute("aria-sort", "none");
|
||||
}
|
||||
}
|
||||
var sortObj = new Object();
|
||||
var x, xValue;
|
||||
var tableHeader;
|
||||
var sortByString = false;
|
||||
if (column > 0 && COLUMN_TO_SORT > 0) {
|
||||
tableItems[COLUMN_TO_SORT].className = "pointer";
|
||||
tableItems[column].className = "sortThis";
|
||||
tableItems[COLUMN_TO_SORT].classList.remove("sortThis");
|
||||
tableItems[COLUMN_TO_SORT].classList.add("pointer");
|
||||
tableItems[column].classList.remove("pointer");
|
||||
tableItems[column].classList.add("sortThis");
|
||||
}
|
||||
COLUMN_TO_SORT = column;
|
||||
var mobileSort = document.getElementById("mapping-sort-mobile");
|
||||
if (mobileSort != null && (column == 1 || column == 3 || column == 4 || column == 5)) {
|
||||
mobileSort.value = column.toString();
|
||||
}
|
||||
if (tableItems[column] != undefined && tableItems[column].getAttribute("role") == "columnheader") {
|
||||
tableItems[column].setAttribute("aria-sort", "ascending");
|
||||
}
|
||||
var rows = table.rows;
|
||||
if (rows[1] != undefined) {
|
||||
tableHeader = rows[0];
|
||||
@@ -258,6 +311,7 @@ function createSearchObj() {
|
||||
var channels = getObjKeys(data);
|
||||
var channelKeys = ["x-active", "x-channelID", "x-name", "_file.m3u.name", "x-group-title", "x-xmltv-file"];
|
||||
channels.forEach(function (id) {
|
||||
SEARCH_MAPPING[id] = "";
|
||||
channelKeys.forEach(function (key) {
|
||||
if (key == "x-active") {
|
||||
switch (data[id][key]) {
|
||||
@@ -290,6 +344,9 @@ function searchInMapping() {
|
||||
for (var i = 1; i < trs.length; ++i) {
|
||||
var id = trs[i].getAttribute("id");
|
||||
var element = SEARCH_MAPPING[id];
|
||||
if (element == undefined) {
|
||||
continue;
|
||||
}
|
||||
switch (element.toLowerCase().includes(searchValue.toLowerCase())) {
|
||||
case true:
|
||||
document.getElementById(id).style.display = "";
|
||||
@@ -299,6 +356,7 @@ function searchInMapping() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
announceToScreenReader("Search updated");
|
||||
return;
|
||||
}
|
||||
function calculateWrapperHeight() {
|
||||
|
||||
@@ -35,7 +35,9 @@ var WizardItem = /** @class */ (function (_super) {
|
||||
var key = this.key;
|
||||
var content = new PopupContent();
|
||||
var description;
|
||||
var wizardField = null;
|
||||
var doc = document.getElementById(this.DocumentID);
|
||||
doc.setAttribute("aria-busy", "true");
|
||||
doc.innerHTML = "";
|
||||
doc.appendChild(headline);
|
||||
switch (key) {
|
||||
@@ -50,6 +52,7 @@ var WizardItem = /** @class */ (function (_super) {
|
||||
select.setAttribute("class", "wizard");
|
||||
select.id = key;
|
||||
doc.appendChild(select);
|
||||
wizardField = select;
|
||||
description = "{{.wizard.tuner.description}}";
|
||||
break;
|
||||
case "epgSource":
|
||||
@@ -59,6 +62,7 @@ var WizardItem = /** @class */ (function (_super) {
|
||||
select.setAttribute("class", "wizard");
|
||||
select.id = key;
|
||||
doc.appendChild(select);
|
||||
wizardField = select;
|
||||
description = "{{.wizard.epgSource.description}}";
|
||||
break;
|
||||
case "m3u":
|
||||
@@ -67,6 +71,7 @@ var WizardItem = /** @class */ (function (_super) {
|
||||
input.setAttribute("class", "wizard");
|
||||
input.id = key;
|
||||
doc.appendChild(input);
|
||||
wizardField = input;
|
||||
description = "{{.wizard.m3u.description}}";
|
||||
break;
|
||||
case "xmltv":
|
||||
@@ -75,6 +80,7 @@ var WizardItem = /** @class */ (function (_super) {
|
||||
input.setAttribute("class", "wizard");
|
||||
input.id = key;
|
||||
doc.appendChild(input);
|
||||
wizardField = input;
|
||||
description = "{{.wizard.xmltv.description}}";
|
||||
break;
|
||||
default:
|
||||
@@ -82,8 +88,20 @@ var WizardItem = /** @class */ (function (_super) {
|
||||
break;
|
||||
}
|
||||
var pre = document.createElement("PRE");
|
||||
pre.id = "wizard-description-" + key;
|
||||
pre.innerHTML = description;
|
||||
doc.appendChild(pre);
|
||||
if (wizardField != null) {
|
||||
wizardField.setAttribute("aria-label", this.headline);
|
||||
wizardField.setAttribute("aria-describedby", pre.id);
|
||||
setTimeout(function () {
|
||||
wizardField.focus();
|
||||
}, 20);
|
||||
}
|
||||
doc.setAttribute("aria-busy", "false");
|
||||
if (typeof announceToScreenReader == "function") {
|
||||
announceToScreenReader(this.headline + " step");
|
||||
}
|
||||
console.log(headline, key);
|
||||
};
|
||||
return WizardItem;
|
||||
@@ -145,3 +163,20 @@ configurationWizard.push(new WizardItem("tuner", "{{.wizard.tuner.title}}"));
|
||||
configurationWizard.push(new WizardItem("epgSource", "{{.wizard.epgSource.title}}"));
|
||||
configurationWizard.push(new WizardItem("m3u", "{{.wizard.m3u.title}}"));
|
||||
configurationWizard.push(new WizardItem("xmltv", "{{.wizard.xmltv.title}}"));
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var container = document.getElementById("content");
|
||||
if (container == null) {
|
||||
return;
|
||||
}
|
||||
container.addEventListener("keydown", function (event) {
|
||||
if (event.key != "Enter") {
|
||||
return;
|
||||
}
|
||||
var target = event.target;
|
||||
if (target == null || target.tagName != "INPUT") {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
saveWizard();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,13 @@ var MainMenuItem = /** @class */ (function (_super) {
|
||||
item.setAttribute("onclick", "javascript: openThisMenu(this)");
|
||||
item.setAttribute("id", this.id);
|
||||
item.setAttribute("data-menu", this.menuKey);
|
||||
item.setAttribute("role", "menuitem");
|
||||
item.setAttribute("tabindex", "0");
|
||||
item.setAttribute("aria-controls", "content");
|
||||
item.setAttribute("aria-label", this.value);
|
||||
item.setAttribute("onkeydown", "if(event.key==='Enter' || event.key===' '){event.preventDefault();openThisMenu(this);}");
|
||||
var img = this.createIMG(this.imgSrc);
|
||||
img.setAttribute("alt", "");
|
||||
var value = this.createValue(this.value);
|
||||
item.appendChild(img);
|
||||
item.appendChild(value);
|
||||
@@ -452,7 +458,7 @@ var Cell = /** @class */ (function () {
|
||||
break;
|
||||
case "INPUTCHANNEL":
|
||||
element = document.createElement("INPUT");
|
||||
element.setAttribute("onchange", "javscript: changeChannelNumber(this)");
|
||||
element.setAttribute("onchange", "javascript: changeChannelNumber(this)");
|
||||
element.value = this.value;
|
||||
element.type = "text";
|
||||
break;
|
||||
@@ -484,10 +490,18 @@ var Cell = /** @class */ (function () {
|
||||
}
|
||||
if (this.onclick == true) {
|
||||
td.setAttribute("onclick", this.onclickFunktion);
|
||||
td.className = "pointer";
|
||||
td.className = "pointer keyboard-clickable";
|
||||
td.setAttribute("tabindex", "0");
|
||||
td.setAttribute("role", "button");
|
||||
td.setAttribute("onkeydown", "if(event.key==='Enter' || event.key===' '){event.preventDefault();this.click();}");
|
||||
}
|
||||
if (this.tdClassName != undefined) {
|
||||
td.className = this.tdClassName;
|
||||
if (td.className.length > 0) {
|
||||
td.className = td.className + " " + this.tdClassName;
|
||||
}
|
||||
else {
|
||||
td.className = this.tdClassName;
|
||||
}
|
||||
}
|
||||
return td;
|
||||
};
|
||||
@@ -511,6 +525,7 @@ var ShowContent = /** @class */ (function (_super) {
|
||||
COLUMN_TO_SORT = -1;
|
||||
// Alten Inhalt löschen
|
||||
var doc = document.getElementById(this.DocumentID);
|
||||
doc.setAttribute("aria-busy", "true");
|
||||
doc.innerHTML = "";
|
||||
showPreview(false);
|
||||
// Überschrift
|
||||
@@ -557,9 +572,31 @@ var ShowContent = /** @class */ (function (_super) {
|
||||
var input = this.createInput("button", menuKey, "{{.button.bulkEdit}}");
|
||||
input.setAttribute("onclick", 'javascript: bulkEdit()');
|
||||
interaction.appendChild(input);
|
||||
var sortSelect = document.createElement("SELECT");
|
||||
sortSelect.setAttribute("id", "mapping-sort-mobile");
|
||||
sortSelect.className = "mobile-only-control";
|
||||
sortSelect.setAttribute("aria-label", "Sort mapping");
|
||||
var sortOptions = [
|
||||
{ label: "{{.mapping.table.chNo}}", value: "1" },
|
||||
{ label: "{{.mapping.table.channelName}}", value: "3" },
|
||||
{ label: "{{.mapping.table.playlist}}", value: "4" },
|
||||
{ label: "{{.mapping.table.groupTitle}}", value: "5" }
|
||||
];
|
||||
sortOptions.forEach(function (optionData) {
|
||||
var option = document.createElement("OPTION");
|
||||
option.innerText = optionData.label;
|
||||
option.value = optionData.value;
|
||||
sortSelect.appendChild(option);
|
||||
});
|
||||
sortSelect.value = "1";
|
||||
sortSelect.onchange = function () {
|
||||
sortTable(parseInt(this.value, 10));
|
||||
};
|
||||
interaction.appendChild(sortSelect);
|
||||
var input = this.createInput("search", "search", "");
|
||||
input.setAttribute("id", "searchMapping");
|
||||
input.setAttribute("placeholder", "{{.button.search}}");
|
||||
input.setAttribute("aria-label", "{{.button.search}}");
|
||||
input.className = "search";
|
||||
input.setAttribute("oninput", 'javascript: searchInMapping()');
|
||||
interaction.appendChild(input);
|
||||
@@ -581,6 +618,7 @@ var ShowContent = /** @class */ (function (_super) {
|
||||
var settings = this.createDIV();
|
||||
wrapper.appendChild(settings);
|
||||
showSettings();
|
||||
finalizeContentAccessibility(headline);
|
||||
return;
|
||||
break;
|
||||
case "log":
|
||||
@@ -594,6 +632,7 @@ var ShowContent = /** @class */ (function (_super) {
|
||||
var logs = this.createDIV();
|
||||
wrapper.appendChild(logs);
|
||||
showLogs(true);
|
||||
finalizeContentAccessibility(headline);
|
||||
return;
|
||||
break;
|
||||
case "logout":
|
||||
@@ -666,10 +705,129 @@ var ShowContent = /** @class */ (function (_super) {
|
||||
break;
|
||||
}
|
||||
showElement("loading", false);
|
||||
finalizeContentAccessibility(headline);
|
||||
};
|
||||
return ShowContent;
|
||||
}(Content));
|
||||
var SHELL_LAYOUT_READY = false;
|
||||
function isKeyboardActivationKey(event) {
|
||||
return event.key == "Enter" || event.key == " ";
|
||||
}
|
||||
function makeKeyboardClickable(element, label) {
|
||||
if (element == null) {
|
||||
return;
|
||||
}
|
||||
if (element.getAttribute("data-keyboard-ready") == "true") {
|
||||
return;
|
||||
}
|
||||
var tagName = element.tagName.toUpperCase();
|
||||
if (tagName == "INPUT" || tagName == "BUTTON" || tagName == "SELECT" || tagName == "TEXTAREA" || tagName == "A") {
|
||||
return;
|
||||
}
|
||||
element.setAttribute("data-keyboard-ready", "true");
|
||||
if (element.getAttribute("tabindex") == null) {
|
||||
element.setAttribute("tabindex", "0");
|
||||
}
|
||||
if (element.getAttribute("role") == null) {
|
||||
element.setAttribute("role", "button");
|
||||
}
|
||||
element.classList.add("keyboard-clickable");
|
||||
if (label != undefined && label.length > 0) {
|
||||
if (element.getAttribute("aria-label") == null || element.getAttribute("aria-label").length == 0) {
|
||||
element.setAttribute("aria-label", label);
|
||||
}
|
||||
}
|
||||
element.addEventListener("keydown", function (event) {
|
||||
if (isKeyboardActivationKey(event) == false) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
this.click();
|
||||
});
|
||||
}
|
||||
function applyTableAccessibility(table, sectionName) {
|
||||
if (table == null) {
|
||||
return;
|
||||
}
|
||||
table.setAttribute("role", "table");
|
||||
var rows = table.getElementsByTagName("TR");
|
||||
var headerLabels = [];
|
||||
if (rows.length > 0) {
|
||||
var headerCells = rows[0].getElementsByTagName("TD");
|
||||
for (var h = 0; h < headerCells.length; h++) {
|
||||
var headerLabel = headerCells[h].innerText;
|
||||
if (headerLabel == undefined || headerLabel.length == 0) {
|
||||
headerLabel = "Value";
|
||||
}
|
||||
if (headerLabel == "BULK") {
|
||||
headerLabel = "Select";
|
||||
}
|
||||
headerLabels.push(headerLabel);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
rows[i].setAttribute("role", "row");
|
||||
if (rows[i].getAttribute("onclick") != null) {
|
||||
var rowLabel = rows[i].innerText;
|
||||
if (rowLabel == undefined || rowLabel.length == 0) {
|
||||
rowLabel = sectionName + " row";
|
||||
}
|
||||
makeKeyboardClickable(rows[i], rowLabel);
|
||||
}
|
||||
var cells = rows[i].getElementsByTagName("TD");
|
||||
for (var c = 0; c < cells.length; c++) {
|
||||
if (i == 0) {
|
||||
cells[c].setAttribute("role", "columnheader");
|
||||
}
|
||||
else {
|
||||
cells[c].setAttribute("role", "cell");
|
||||
}
|
||||
var dataLabel = headerLabels[c];
|
||||
if (dataLabel == undefined || dataLabel.length == 0) {
|
||||
dataLabel = "Value";
|
||||
}
|
||||
cells[c].setAttribute("data-label", dataLabel);
|
||||
var checkbox = cells[c].querySelector('input[type="checkbox"]');
|
||||
if (checkbox != null) {
|
||||
cells[c].setAttribute("data-cell-type", "checkbox");
|
||||
}
|
||||
else {
|
||||
var image = cells[c].querySelector("img");
|
||||
if (image != null) {
|
||||
cells[c].setAttribute("data-cell-type", "image");
|
||||
}
|
||||
else {
|
||||
cells[c].removeAttribute("data-cell-type");
|
||||
}
|
||||
}
|
||||
if (cells[c].getAttribute("onclick") != null) {
|
||||
var cellLabel = cells[c].innerText;
|
||||
if (cellLabel == undefined || cellLabel.length == 0) {
|
||||
cellLabel = sectionName + " details";
|
||||
}
|
||||
makeKeyboardClickable(cells[c], cellLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function finalizeContentAccessibility(sectionName) {
|
||||
var content = document.getElementById("content");
|
||||
if (content == null) {
|
||||
return;
|
||||
}
|
||||
content.setAttribute("aria-busy", "false");
|
||||
var heading = content.getElementsByTagName("H3")[0];
|
||||
if (heading != null) {
|
||||
heading.setAttribute("tabindex", "-1");
|
||||
setTimeout(function () {
|
||||
heading.focus();
|
||||
}, 20);
|
||||
}
|
||||
applyTableAccessibility(document.getElementById("content_table"), sectionName);
|
||||
if (sectionName != undefined && sectionName.length > 0) {
|
||||
announceToScreenReader(sectionName + " loaded");
|
||||
}
|
||||
}
|
||||
function setLayoutMenuState(open) {
|
||||
if (document.body == null) {
|
||||
return;
|
||||
@@ -680,6 +838,35 @@ function setLayoutMenuState(open) {
|
||||
else {
|
||||
document.body.classList.remove("menu-open");
|
||||
}
|
||||
var toggle = document.getElementById("menu-toggle");
|
||||
if (toggle != null) {
|
||||
toggle.setAttribute("aria-expanded", open == true ? "true" : "false");
|
||||
toggle.setAttribute("aria-label", open == true ? "Close navigation menu" : "Open navigation menu");
|
||||
}
|
||||
var overlay = document.getElementById("layout-overlay");
|
||||
if (overlay != null) {
|
||||
overlay.setAttribute("aria-hidden", open == true ? "false" : "true");
|
||||
}
|
||||
var wrapper = document.getElementById("menu-wrapper");
|
||||
if (wrapper != null) {
|
||||
if (window.innerWidth <= 900) {
|
||||
wrapper.setAttribute("aria-hidden", open == true ? "false" : "true");
|
||||
}
|
||||
else {
|
||||
wrapper.setAttribute("aria-hidden", "false");
|
||||
}
|
||||
}
|
||||
if (window.innerWidth <= 900 && open == false && toggle != null && wrapper != null && wrapper.contains(document.activeElement)) {
|
||||
toggle.focus();
|
||||
}
|
||||
if (window.innerWidth <= 900 && open == true && wrapper != null) {
|
||||
var firstMenuItem = wrapper.querySelector("#main-menu li");
|
||||
if (firstMenuItem != null) {
|
||||
setTimeout(function () {
|
||||
firstMenuItem.focus();
|
||||
}, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
function toggleLayoutMenu() {
|
||||
if (document.body == null) {
|
||||
@@ -702,10 +889,12 @@ function setActiveMenu(menuID) {
|
||||
var items = menu.getElementsByTagName("LI");
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
items[i].classList.remove("menu-active");
|
||||
items[i].removeAttribute("aria-current");
|
||||
}
|
||||
var activeItem = document.getElementById(ACTIVE_MENU_ID);
|
||||
if (activeItem != null) {
|
||||
activeItem.classList.add("menu-active");
|
||||
activeItem.setAttribute("aria-current", "page");
|
||||
}
|
||||
}
|
||||
function renderStatusCards() {
|
||||
@@ -728,6 +917,7 @@ function renderStatusCards() {
|
||||
cards.forEach(function (card) {
|
||||
var box = document.createElement("DIV");
|
||||
box.className = "status-card status-card-" + card.tone;
|
||||
box.setAttribute("role", "listitem");
|
||||
var label = document.createElement("P");
|
||||
label.className = "status-card-label";
|
||||
label.innerText = card.label;
|
||||
@@ -741,6 +931,7 @@ function renderStatusCards() {
|
||||
}
|
||||
box.appendChild(label);
|
||||
box.appendChild(value);
|
||||
box.setAttribute("aria-label", card.label + ": " + value.innerText);
|
||||
wrapper.appendChild(box);
|
||||
});
|
||||
}
|
||||
@@ -768,7 +959,8 @@ function initShellLayout() {
|
||||
}
|
||||
if (event.key == "/") {
|
||||
var target = event.target;
|
||||
var onInput = target.tagName == "INPUT" || target.tagName == "TEXTAREA" || target.tagName == "SELECT";
|
||||
var tagName = target != null && target.tagName != undefined ? target.tagName : "";
|
||||
var onInput = tagName == "INPUT" || tagName == "TEXTAREA" || tagName == "SELECT";
|
||||
if (onInput == true) {
|
||||
return;
|
||||
}
|
||||
@@ -779,6 +971,7 @@ function initShellLayout() {
|
||||
}
|
||||
}
|
||||
});
|
||||
setLayoutMenuState(false);
|
||||
setConnectionState("idle");
|
||||
SHELL_LAYOUT_READY = true;
|
||||
}
|
||||
@@ -798,6 +991,10 @@ function PageReady() {
|
||||
return;
|
||||
}
|
||||
function createLayout() {
|
||||
var contentRegion = document.getElementById("content");
|
||||
if (contentRegion != null) {
|
||||
contentRegion.setAttribute("aria-busy", "true");
|
||||
}
|
||||
// Client Info
|
||||
var obj = SERVER["clientInfo"];
|
||||
var keys = getObjKeys(obj);
|
||||
@@ -808,6 +1005,9 @@ function createLayout() {
|
||||
}
|
||||
renderStatusCards();
|
||||
if (!document.getElementById("main-menu")) {
|
||||
if (contentRegion != null) {
|
||||
contentRegion.setAttribute("aria-busy", "false");
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Menü erstellen
|
||||
@@ -835,6 +1035,7 @@ function createLayout() {
|
||||
if (ACTIVE_MENU_ID.length > 0 && document.getElementById(ACTIVE_MENU_ID)) {
|
||||
setActiveMenu(ACTIVE_MENU_ID);
|
||||
}
|
||||
setLayoutMenuState(document.body.classList.contains("menu-open"));
|
||||
var content = document.getElementById("content");
|
||||
var menu = document.getElementById("main-menu");
|
||||
if (ACTIVE_MENU_ID.length == 0 && content != null && menu != null) {
|
||||
@@ -845,6 +1046,9 @@ function createLayout() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (contentRegion != null) {
|
||||
contentRegion.setAttribute("aria-busy", "false");
|
||||
}
|
||||
return;
|
||||
}
|
||||
function openThisMenu(element) {
|
||||
@@ -852,6 +1056,10 @@ function openThisMenu(element) {
|
||||
var content = new ShowContent(id);
|
||||
setActiveMenu(id);
|
||||
content.show();
|
||||
var contentArea = document.getElementById("content");
|
||||
if (contentArea != null) {
|
||||
contentArea.scrollTop = 0;
|
||||
}
|
||||
closeLayoutMenuIfMobile();
|
||||
calculateWrapperHeight();
|
||||
return;
|
||||
@@ -890,9 +1098,26 @@ var PopupContent = /** @class */ (function (_super) {
|
||||
}
|
||||
PopupContent.prototype.createHeadline = function (headline) {
|
||||
this.doc.innerHTML = "";
|
||||
var titleBar = document.createElement("DIV");
|
||||
titleBar.className = "popup-title";
|
||||
var element = document.createElement("H3");
|
||||
element.id = "popup-title-text";
|
||||
element.innerHTML = headline.toUpperCase();
|
||||
this.doc.appendChild(element);
|
||||
titleBar.appendChild(element);
|
||||
var closeButton = document.createElement("BUTTON");
|
||||
closeButton.setAttribute("type", "button");
|
||||
closeButton.className = "popup-close";
|
||||
closeButton.setAttribute("aria-label", "Close dialog");
|
||||
closeButton.innerHTML = "×";
|
||||
closeButton.onclick = function () {
|
||||
showElement("popup", false);
|
||||
};
|
||||
titleBar.appendChild(closeButton);
|
||||
this.doc.appendChild(titleBar);
|
||||
var popup = document.getElementById("popup");
|
||||
if (popup != null) {
|
||||
popup.setAttribute("aria-labelledby", "popup-title-text");
|
||||
}
|
||||
// Tabelle erstellen
|
||||
this.table = document.createElement("TABLE");
|
||||
this.doc.appendChild(this.table);
|
||||
|
||||
@@ -74,6 +74,29 @@ var SettingsCategory = /** @class */ (function () {
|
||||
setting.appendChild(tdLeft);
|
||||
setting.appendChild(tdRight);
|
||||
break;
|
||||
case "plex.url":
|
||||
var tdLeft = document.createElement("TD");
|
||||
tdLeft.innerHTML = "{{.settings.plexURL.title}}" + ":";
|
||||
var tdRight = document.createElement("TD");
|
||||
var input = content.createInput("text", "plex.url", data);
|
||||
input.setAttribute("placeholder", "{{.settings.plexURL.placeholder}}");
|
||||
input.setAttribute("onchange", "javascript: this.className = 'changed'");
|
||||
tdRight.appendChild(input);
|
||||
setting.appendChild(tdLeft);
|
||||
setting.appendChild(tdRight);
|
||||
break;
|
||||
case "plex.token":
|
||||
var tdLeft = document.createElement("TD");
|
||||
tdLeft.innerHTML = "{{.settings.plexToken.title}}" + ":";
|
||||
var tdRight = document.createElement("TD");
|
||||
var input = content.createInput("password", "plex.token", data);
|
||||
input.setAttribute("placeholder", "{{.settings.plexToken.placeholder}}");
|
||||
input.setAttribute("autocomplete", "off");
|
||||
input.setAttribute("onchange", "javascript: this.className = 'changed'");
|
||||
tdRight.appendChild(input);
|
||||
setting.appendChild(tdLeft);
|
||||
setting.appendChild(tdRight);
|
||||
break;
|
||||
case "buffer.timeout":
|
||||
var tdLeft = document.createElement("TD");
|
||||
tdLeft.innerHTML = "{{.settings.bufferTimeout.title}}" + ":";
|
||||
@@ -240,6 +263,17 @@ var SettingsCategory = /** @class */ (function () {
|
||||
setting.appendChild(tdLeft);
|
||||
setting.appendChild(tdRight);
|
||||
break;
|
||||
case "use_plexAPI":
|
||||
var tdLeft = document.createElement("TD");
|
||||
tdLeft.innerHTML = "{{.settings.usePlexAPI.title}}" + ":";
|
||||
var tdRight = document.createElement("TD");
|
||||
var input = content.createCheckbox(settingsKey);
|
||||
input.checked = data;
|
||||
input.setAttribute("onchange", "javascript: this.className = 'changed'");
|
||||
tdRight.appendChild(input);
|
||||
setting.appendChild(tdLeft);
|
||||
setting.appendChild(tdRight);
|
||||
break;
|
||||
// Select
|
||||
case "tuner":
|
||||
var tdLeft = document.createElement("TD");
|
||||
@@ -364,6 +398,12 @@ var SettingsCategory = /** @class */ (function () {
|
||||
case "user.agent":
|
||||
text = "{{.settings.userAgent.description}}";
|
||||
break;
|
||||
case "plex.url":
|
||||
text = "{{.settings.plexURL.description}}";
|
||||
break;
|
||||
case "plex.token":
|
||||
text = "{{.settings.plexToken.description}}";
|
||||
break;
|
||||
case "ffmpeg.path":
|
||||
text = "{{.settings.ffmpegPath.description}}";
|
||||
break;
|
||||
@@ -388,6 +428,9 @@ var SettingsCategory = /** @class */ (function () {
|
||||
case "api":
|
||||
text = "{{.settings.api.description}}";
|
||||
break;
|
||||
case "use_plexAPI":
|
||||
text = "{{.settings.usePlexAPI.description}}";
|
||||
break;
|
||||
case "files.update":
|
||||
text = "{{.settings.filesUpdate.description}}";
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user