prevent activation for empty groups
This commit is contained in:
parent
0778496191
commit
b38540d1ff
1 changed files with 48 additions and 41 deletions
19
directory.js
19
directory.js
|
|
@ -4,12 +4,15 @@ const C = document.createElement;
|
||||||
const ordNrRegex = /.*pOrgNr=([0-9]+).*/gm;
|
const ordNrRegex = /.*pOrgNr=([0-9]+).*/gm;
|
||||||
const personalIDRegex = /.*pStPersonNr=([0-9]+).*/gm;
|
const personalIDRegex = /.*pStPersonNr=([0-9]+).*/gm;
|
||||||
|
|
||||||
function appendLink() {
|
function appendLink(nonEmptyGroup) {
|
||||||
if (document.getElementById("kf-trombi_row")) return;
|
if (document.getElementById("kf-trombi_row")) return;
|
||||||
|
|
||||||
var row_header = document.createElement("th");
|
var row_header = document.createElement("th");
|
||||||
row_header.textContent = "Trombi";
|
row_header.textContent = "Trombi";
|
||||||
|
|
||||||
|
var row_links = document.createElement("td");
|
||||||
|
|
||||||
|
if (nonEmptyGroup) {
|
||||||
var link = document.createElement("a");
|
var link = document.createElement("a");
|
||||||
link.textContent = "Toggle";
|
link.textContent = "Toggle";
|
||||||
link.href="#";
|
link.href="#";
|
||||||
|
|
@ -48,9 +51,10 @@ function appendLink() {
|
||||||
const trombi = document.getElementById("kf-trombi_trombi");
|
const trombi = document.getElementById("kf-trombi_trombi");
|
||||||
trombi.classList.toggle('kf-trombi_enhanced');
|
trombi.classList.toggle('kf-trombi_enhanced');
|
||||||
})
|
})
|
||||||
|
|
||||||
var row_links = document.createElement("td");
|
|
||||||
row_links.append(link, slider, column_nr, column_label, enhanced_checkbox, enhance_label);
|
row_links.append(link, slider, column_nr, column_label, enhanced_checkbox, enhance_label);
|
||||||
|
} else {
|
||||||
|
row_links.textContent = "empty group!"
|
||||||
|
}
|
||||||
|
|
||||||
var tr = document.createElement("tr");
|
var tr = document.createElement("tr");
|
||||||
tr.classList.add("coNavGroup");
|
tr.classList.add("coNavGroup");
|
||||||
|
|
@ -128,6 +132,9 @@ if (document.getElementById("kf-trombi_trombi")) {
|
||||||
document.getElementById("kf-trombi_row").remove();
|
document.getElementById("kf-trombi_row").remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
appendLink();
|
// only enable on non-empty groups
|
||||||
generateTrombi();
|
const nonEmptyGroup = (document.getElementsByClassName("cNoEntry").length == 0);
|
||||||
|
appendLink(nonEmptyGroup);
|
||||||
|
if (nonEmptyGroup) {
|
||||||
|
generateTrombi();
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue