.hdao-jobs-grid
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 30px;
margin: 0;
.hdao-job-card
background-color: #003C69;
padding: 32px 30px;
display: flex;
flex-direction: column;
align-items: flex-start;
/* Badge-Leiste mit den Schlagwoertern */
.hdao-job-tags
display: flex;
flex-wrap: wrap;
gap: 8px;
margin: 0 0 20px;
padding: 0;
list-style: none;
.hdao-job-tag
font-family: var(--e-global-typography-accent-font-family), "Helvetica Neue", Arial, sans-serif;
font-weight: var(--e-global-typography-accent-font-weight, 600);
background-color: #FFFFFF;
color: #0C1524;
font-size: 11px;
line-height: 1.2;
text-transform: uppercase;
letter-spacing: .8px;
padding: 7px 12px;
white-space: nowrap;
.hdao-job-title
font-family: var(--e-global-typography-primary-font-family), "Helvetica Neue", Arial, sans-serif;
font-weight: var(--e-global-typography-primary-font-weight, 700);
color: #FFFFFF;
font-size: 20px;
line-height: 1.3;
text-transform: uppercase;
letter-spacing: .2px;
margin: 0 0 12px;
/* Titel-Link: in jedem Zustand weiss und ohne Unterstreichung */
.hdao-job-card .hdao-job-title .hdao-job-title-link,
.hdao-job-card .hdao-job-title .hdao-job-title-link:visited,
.hdao-job-card .hdao-job-title .hdao-job-title-link:hover,
.hdao-job-card .hdao-job-title .hdao-job-title-link:focus,
.hdao-job-card .hdao-job-title .hdao-job-title-link:active
color: #FFFFFF;
text-decoration: none;
.hdao-job-title-link:focus-visible
outline: 2px solid #FFFFFF;
outline-offset: 3px;
.hdao-job-link
font-family: var(--e-global-typography-accent-font-family), "Helvetica Neue", Arial, sans-serif;
font-weight: var(--e-global-typography-accent-font-weight, 600);
color: #22C4C4;
font-size: 13px;
line-height: 1.4;
text-transform: uppercase;
letter-spacing: .6px;
text-decoration: none;
margin: auto 0 0;
padding-top: 12px;
display: inline-block;
transition: color .2s ease;
.hdao-job-link:hover,
.hdao-job-link:focus-visible
color: #FFFFFF;
text-decoration: underline;
.hdao-job-link:focus-visible
outline: 2px solid #22C4C4;
outline-offset: 3px;
.hdao-jobs-status
margin: 0;
@media (max-width: 767px) {
.hdao-jobs-grid
grid-template-columns: 1fr; gap: 20px;
.hdao-job-title
font-size: 18px;
.hdao-job-tag
font-size: 10px; padding: 6px 10px;
}
(function () {
"use strict";
/* ============ CONFIG ============ */
var CONFIG =
domain: "https://www.hdao-controls.de", // Quelldomain OHNE Slash am Ende
kategorie: "stellenangebote", // Kategorie-Slug der Stellen
anzahl: 10,
linktext: "Stelle ansehen",
tagsZeigen: true, // Schlagwoerter ein- oder ausblenden
tagsMax: 3, // max. Anzahl Badges pro Kachel (0 = alle)
tagsStil: "kombiniert", // "kombiniert" = ein Badge mit Trenner, "einzeln" = ein Badge je Tag
tagsTrenner: " \u00B7 ", // Trennzeichen im kombinierten Badge
leerText: "Aktuell keine weiteren Stellenangebote.",
fehlerText: "Die Stellenangebote konnten nicht geladen werden.",
ausschliessen: ["Initiativbewerbung"] // Titel (oder Titelteile), die nicht angezeigt werden
;
/* ================================ */
var wrap = document.querySelector("[data-hdao-jobs]");
if (!wrap) return;
var grid = wrap.querySelector("[data-hdao-grid]");
var status = wrap.querySelector("[data-hdao-status]");
function zeigeStatus(text)
status.textContent = text;
status.hidden = false;
grid.hidden = true;
function decode(str)
var t = document.createElement("textarea");
t.innerHTML = str;
return t.value;
/* Prueft, ob der Stellentitel einen der Ausschluss-Begriffe enthaelt */
function istAusgeschlossen(post) {
var titel = decode(post.title.rendered).toLowerCase();
return CONFIG.ausschliessen.some(function (begriff)
return titel.indexOf(begriff.toLowerCase()) !== -1;
);
}
/* Sammelt alle Tag-IDs aller Posts und holt die Namen in EINEM Request */
function holeTagNamen(posts) {
if (!CONFIG.tagsZeigen) return Promise.resolve(
);
var ids = [];
posts.forEach(function (p) {
(p.tags || []).forEach(function (id)
if (ids.indexOf(id) === -1) ids.push(id);
);
});
if (!ids.length) return Promise.resolve(
);
var url = CONFIG.domain + "/wp-json/wp/v2/tags"
+ "?include=" + ids.join(",")
+ "&per_page=100&_fields=id,name";
return fetch(url)
.then(function (r)
return r.ok ? r.json() : []; )
.then(function (tags) {
var map =
;
tags.forEach(function (t)
map[t.id] = decode(t.name); );
return map;
})
.catch(function () { return
; }); // Tags optional, Kacheln laufen trotzdem
}
function baueTagLeiste(post, tagMap) {
var namen = (post.tags || [])
.map(function (id)
return tagMap[id]; )
.filter(Boolean);
if (!namen.length) return null;
if (CONFIG.tagsMax > 0) namen = namen.slice(0, CONFIG.tagsMax);
var leiste = document.createElement("ul");
leiste.className = "hdao-job-tags";
if (CONFIG.tagsStil === "kombiniert")
var li = document.createElement("li");
li.className = "hdao-job-tag";
li.textContent = namen.join(CONFIG.tagsTrenner);
leiste.appendChild(li);
else {
namen.forEach(function (name)
var li = document.createElement("li");
li.className = "hdao-job-tag";
li.textContent = name;
leiste.appendChild(li);
);
}
return leiste;
}
function render(posts, tagMap) {
if (!posts.length)
zeigeStatus(CONFIG.leerText);
return;
grid.innerHTML = "";
posts.forEach(function (p)
var card = document.createElement("article");
card.className = "hdao-job-card";
var tagLeiste = baueTagLeiste(p, tagMap);
if (tagLeiste) card.appendChild(tagLeiste);
var title = document.createElement("h3");
title.className = "hdao-job-title";
var titleLink = document.createElement("a");
titleLink.className = "hdao-job-title-link";
titleLink.href = p.link;
titleLink.target = "_blank";
titleLink.rel = "noopener";
titleLink.textContent = decode(p.title.rendered);
title.appendChild(titleLink);
var link = document.createElement("a");
link.className = "hdao-job-link";
link.href = p.link;
link.target = "_blank";
link.rel = "noopener";
link.textContent = CONFIG.linktext + " \u00BB";
card.appendChild(title);
card.appendChild(link);
grid.appendChild(card);
);
status.hidden = true;
grid.hidden = false;
}
function holePosts(catId) {
var url = CONFIG.domain + "/wp-json/wp/v2/posts"
+ "?per_page=" + encodeURIComponent(Math.min(CONFIG.anzahl + CONFIG.ausschliessen.length, 100))
+ "&orderby=date&order=desc"
+ "&_fields=id,link,title,tags"
+ (catId ? "&categories=" + catId : "");
return fetch(url).then(function (r)
if (!r.ok) throw new Error("HTTP " + r.status);
return r.json();
);
}
fetch(CONFIG.domain + "/wp-json/wp/v2/categories?slug="
+ encodeURIComponent(CONFIG.kategorie) + "&_fields=id")
.then(function (r)
return r.ok ? r.json() : []; )
.then(function (cats)
return holePosts(cats && cats[0] ? cats[0].id : 0); )
.then(function (posts) {
posts = posts
.filter(function (p)
return !istAusgeschlossen(p); )
.slice(0, CONFIG.anzahl);
return holeTagNamen(posts).then(function (tagMap)
render(posts, tagMap);
);
})
.catch(function (e)
console.error("Externe Stellen:", e);
zeigeStatus(CONFIG.fehlerText);
);
})();