This is Code for the political party comparisson at zugvoegel.org
-
stelle sicher dass das Code Embed plugin installiert ist
-
in the desired wordpress site activate "custom fields"
- "ansicht anpassen" (oben rechts) -> "individuelle felder" ankreuzen
-
ganz unten zwei neue individuelle felder hinzufügen. Dazu
- "Ein neues benutzerdefiniertes Feld hinzufügen:" -> "Neu Eingeben".
Wir brauchen 2 felder:
Name = "CODEjQuery"
Wert:<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
und
Name = "CODEparteichecker"
Wert:<script> // jQuery let baseUrl = "https://zugvoegel.github.io/PartyCheckerApp/" $(window).on('load', function(){ $.getScript(baseUrl + "partyCheck.js"+"?"+Date.now(), function(){ console.log("starting setup") let target = $("#target_table"); let json_file_path ="https://zugvoegel.github.io/data.json"+"?"+Date.now(); // console.log(target) setUpPartyCheck(target, json_file_path, baseUrl); }); }); </script>
- Im Artikel den Editior auf 'Text' statt 'Visuell' umstellen (oben rechts) und an der gewünschten Stelle
{{CODEjQuery}}{{CODEparteichecker}}
<div id="target_table"></div>
einfügen.
Die tabelle kommt aus der datei let json_file_path ="https://zugvoegel.github.io/data.json" oben.
D.h. entweder diese datei in diesem Repo ändern oder eine neue datei erstellen und den namen oben entsprechend ändern.
quotes in the party position text have to be escaped. e.g. "spd": ["green", "die SPD will \\'sichere Häfen\\' für alle"]
\\' changes to \' when reading the json
\' escapes the quote in the javascript
-
Clone this repo
-
run a local http server to, e.g.
python3 -m http.serverin the repo folder (just opening the .html file in a browser will give a CORS error) -
in chrome/safari open
localhost:8000/appLocal.htmlor whatever port you see in the server -
make sure the .json filename
let json_file_path ="data_2025.json"+"?"+Date.now();inappLocal.htmlis correct -
to check the json you can use e.g. VS Code locally, or https://jsonlint.com/