Filter für Programme.

main
Mitja Stachowiak (Hessen) 2024-03-31 00:53:46 +01:00
parent 92bba7d973
commit 6ea0c16cb9
2 changed files with 77 additions and 4 deletions

View File

@ -705,3 +705,40 @@ aside {
margin-right: 20px;
}
.thema > div {
border: 2px solid #efebdc;
}
.thema > div:before {
display: block;
background-color: #efebdc;
color: #bedc0a;
font-weight: bold;
font-size: 0.8em;
line-height: 1em;
}
.thema > div.einleitung:before { content: 'Einleitung in das Thema'; }
.thema > div.problem:before { content: 'Problembeschreibung'; }
.thema > div.forderungen:before { content: 'Forderungen'; }
.thema > div.fortschrittsdefinition:before { content: 'Definition der Fortschrittsmessung'; }
.thema > div.zieldefinition:before { content: 'Begründung wie das Problem gelöst wird'; }
.thema > div.verteidigung:before { content: 'Entkräften von Gegenargumenten'; }
table td, .sortable th {
border: 1px solid #ddd;
padding: 8px;
}
table tr:nth-child(even){ background-color: #e2e2e2; }
table tr:hover { background-color: #4EADEB; }
table th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #C4DA47;
color: Black;
}

View File

@ -55,6 +55,9 @@ function setMakeupForm (el, showingRelease) {
el.genderSelect.addEventListener('input', function () {
makeupText(currentSite);
}, false);
el.selectProgram.addEventListener('input', function () {
filterProgram(currentSite);
}, false);
el.createRelease.addEventListener('click', function () {
makeupForm.isRelease = true;
dynFrame.getActiveCommunicator().el.src += ''; // reload
@ -62,6 +65,31 @@ function setMakeupForm (el, showingRelease) {
}, false);
}
function filterProgram (win) {
let head = win.document.getElementsByTagName('head')[0];
let sty = win.document.getElementById('programFilter');
if (!sty) {
sty = win.document.createElement('style');
sty.setAttribute('type', 'text\/css');
sty.setAttribute('id', 'programFilter');
head.appendChild(sty);
}
switch (makeupForm.selectProgram.value) {
case 'grundsatz':
sty.innerHTML = '.eu { display: none; }'+"\n"
+'.bundestag { display: none; }';
break;
case 'eu':
sty.innerHTML = '.grundsatz { display: none; }'+"\n"
+'.bundestag { display: none; }';
break;
case 'bundestag':
sty.innerHTML = '.eu { display: none; }'+"\n"
+'.grundsatz { display: none; }';
break;
}
}
function makeupText (win) {
let sty = win.document.getElementById('makeupStyle');
if (!sty) {
@ -118,6 +146,13 @@ function makeupText (win) {
}
function fetchText (win) {
let query = window.location.href.split('?').pop().split('&');
for (let i = 0; i < query.length; i++) {
query[i] = query[i].split('=');
if (query[i].length == 2 && query[i][0] == 'program') {
makeupForm.selectProgram.value = query[i][1];
}
}
if (makeupForm.showingRelease) {
makeupText(win);
return;
@ -127,7 +162,7 @@ function fetchText (win) {
var release = false;
if (makeupForm.isRelease) release = true;
function deleteElementExtra (el) {
function deleteElementExtra (el) { // deletes an element from parent and in some special cases also recursively the parent, if it is empty afterwards.
let p = el.parentElement;
p.removeChild(el);
let empty = true;
@ -176,7 +211,7 @@ function fetchText (win) {
function iterateContent (el) {
for (let i = el.childNodes.length-1; i >= 0; i--) {
if (el.childNodes[i].nodeType == 8) {
if (el.childNodes[i].nodeType == 8) { // comments
if (release) {
el.removeChild(el.childNodes[i]);
continue;
@ -197,7 +232,7 @@ function fetchText (win) {
}
}
}
if (el.childNodes[i].nodeType == 1) {
if (el.childNodes[i].nodeType == 1) { // elements
if (el.childNodes[i].tagName.toLowerCase() == 'del' && release) {
deleteElementExtra(el.childNodes[i]);
continue;
@ -215,7 +250,7 @@ function fetchText (win) {
el.childNodes[i].removeAttribute('zustimmung');
else {
if (acceptance.accepted) el.childNodes[i].className += ' accepted';
else el.childNodes[i].className = ' rejected';
else el.childNodes[i].className += ' rejected';
}
}
}
@ -239,6 +274,7 @@ function fetchText (win) {
parent.showAcceptance(arr);
}, false);
makeupText(win);
filterProgram(win);
/*
if (!document.getElementById('loadTextBranch').checked) return;