Schulkarte: Unterschied zwischen den Versionen
Aus Altes Köln
HorstR (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
HorstR (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
== Schulkarte Diagnose == | |||
=== 1) Roh-SMW-Ausgabe === | |||
(zeigt, ob SMW überhaupt Daten liefert) | |||
<pre> | <pre> | ||
[ | [ | ||
| Zeile 7: | Zeile 12: | ||
|?Schultyp=type | |?Schultyp=type | ||
|format=list | |format=list | ||
|template=SchulJSON | |||
|sep=, | |sep=, | ||
|headers=hide | |||
|plain=yes | |||
|link=none | |||
}} | |||
] | |||
</pre> | |||
---- | |||
=== 2) JSON-Debugdaten für Script === | |||
<script id="smw-data" type="application/json"> | |||
[ | |||
{{#ask: | |||
[[Kategorie:Schule]] | |||
|?Schule=name | |||
|?Koordinaten=coords | |||
|?Schultyp=type | |||
|format=list | |||
|template=SchulJSON | |template=SchulJSON | ||
|sep=, | |||
|headers=hide | |headers=hide | ||
|plain=yes | |plain=yes | ||
| Zeile 14: | Zeile 40: | ||
}} | }} | ||
] | ] | ||
</pre> | </script> | ||
<div id="debug" | |||
style="white-space:pre-wrap;border:1px solid #933;background:#fee; | |||
padding:8px;margin-top:10px;font-size:0.9em"> | |||
Datenloader läuft … | |||
</div> | |||
<script> | |||
(function(){ | |||
var el = document.getElementById("smw-data"); | |||
var dbg = document.getElementById("debug"); | |||
if(!el){ | |||
dbg.textContent = "❌ FEHLER: smw-data Element fehlt – Query wurde nicht erzeugt!"; | |||
return; | |||
} | |||
var raw = el.textContent.trim(); | |||
dbg.textContent = "✍ Rohdaten erhalten:\n\n" + raw; | |||
try { | |||
var json = JSON.parse(raw); | |||
dbg.textContent += "\n\n✔ JSON ist gültig – Beispiel erstes Objekt:\n" + | |||
JSON.stringify(json[0], null, 2); | |||
} catch(e){ | |||
dbg.textContent += "\n\n❌ JSON FEHLER:\n" + e.message; | |||
dbg.textContent += "\n\nHinweis: Vermutlich wird {{#ask}} nicht geparst."; | |||
} | |||
})(); | |||
</script> | |||
---- | |||
=== Erklärung === | |||
* Feld 1 zeigt die SMW-Abfrage roh — wenn hier **{{#ask** sichtbar bleibt**, wird SMW nicht ausgeführt. | |||
* Feld 2 wird vom Script eingelesen und als JSON validiert. | |||
Version vom 7. Dezember 2025, 23:19 Uhr
Schulkarte Diagnose
1) Roh-SMW-Ausgabe
(zeigt, ob SMW überhaupt Daten liefert)
[
{{#ask:
[[Kategorie:Schule]]
|?Schule=name
|?Koordinaten=coords
|?Schultyp=type
|format=list
|template=SchulJSON
|sep=,
|headers=hide
|plain=yes
|link=none
}}
]
2) JSON-Debugdaten für Script
<script id="smw-data" type="application/json"> [
{
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
, {
"name": "", "type": "Unbekannt", "coords": ""
}
]
</script>
Datenloader läuft …
<script> (function(){
var el = document.getElementById("smw-data");
var dbg = document.getElementById("debug");
if(!el){
dbg.textContent = "❌ FEHLER: smw-data Element fehlt – Query wurde nicht erzeugt!";
return;
}
var raw = el.textContent.trim(); dbg.textContent = "✍ Rohdaten erhalten:\n\n" + raw;
try {
var json = JSON.parse(raw);
dbg.textContent += "\n\n✔ JSON ist gültig – Beispiel erstes Objekt:\n" +
JSON.stringify(json[0], null, 2);
} catch(e){
dbg.textContent += "\n\n❌ JSON FEHLER:\n" + e.message;
dbg.textContent += "\n\nHinweis: Vermutlich wird {{#ask}} nicht geparst.";
}
})(); </script>
Erklärung
- Feld 1 zeigt die SMW-Abfrage roh — wenn hier **{{#ask** sichtbar bleibt**, wird SMW nicht ausgeführt.
- Feld 2 wird vom Script eingelesen und als JSON validiert.
