Skip to content

zugvoegel/zugvoegel.github.io

Repository files navigation

This is Code for the political party comparisson at zugvoegel.org

Usage with wordpress

  • 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.

Ändern des inhalts

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.

Things to keep in mind

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

Testing Locally

  • Clone this repo

  • run a local http server to, e.g. python3 -m http.server in the repo folder (just opening the .html file in a browser will give a CORS error)

  • in chrome/safari open localhost:8000/appLocal.html or whatever port you see in the server

  • make sure the .json filename let json_file_path ="data_2025.json"+"?"+Date.now(); in appLocal.html is correct

  • to check the json you can use e.g. VS Code locally, or https://jsonlint.com/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 8