Widget:A2Event: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
J* (Diskussion | Beiträge) |
J* (Diskussion | Beiträge) |
||
Zeile 7: | Zeile 7: | ||
importJS("MediaWiki:Skin/Projekt:Adventure2/parser.js"); | importJS("MediaWiki:Skin/Projekt:Adventure2/parser.js"); | ||
} | } | ||
− | + | a2WaitForInit() | |
+ | }); | ||
+ | |||
+ | function a2WaitForInit() { | ||
+ | if (window.a2) | ||
+ | a2Init(); | ||
+ | else | ||
+ | window.setTimeout(a2WaitForInit, 500); | ||
+ | } | ||
+ | function a2Init(){ | ||
var event = {}; | var event = {}; | ||
var error = ""; | var error = ""; | ||
Zeile 25: | Zeile 34: | ||
$("#bodyContent").append($pre); | $("#bodyContent").append($pre); | ||
} | } | ||
− | + | ||
</script> | </script> |
Version vom 6. Juli 2012, 18:59 Uhr
<script type="text/javascript">
$(function () { if (!window.a2){ importJS("MediaWiki:Skin/Projekt:Adventure2/lib.js"); importJS("MediaWiki:Skin/Projekt:Adventure2/parser.js"); } a2WaitForInit() }); function a2WaitForInit() { if (window.a2) a2Init(); else window.setTimeout(a2WaitForInit, 500); } function a2Init(){ var event = {}; var error = ""; try { var event = a2.parser.parse(""); } catch (e) { var error = e; } if ("" == "render"){ if (!error) a2.registerEventHandler(event); } else {
$pre = $("
");
$pre.text("\n"+String(error)); $("#bodyContent").append($pre); }
</script>