Widget:A2Event: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
Zeile 21: Zeile 21:
 
         var event = window.a2.parser.parse("<!--{$event|escape:'javascript'}-->");
 
         var event = window.a2.parser.parse("<!--{$event|escape:'javascript'}-->");
 
     } catch (e) {
 
     } catch (e) {
         var error = "Line " + e.line + ", Column" + e.column + ": " + e.message;
+
         var error = "Line " + e.line + ", Column " + e.column + ": " + e.message;
 
     }
 
     }
 
    
 
    

Version vom 7. Juli 2012, 13:20 Uhr

<script type="text/javascript">

function wait4a2 (f){
    if (window.a2 && window.a2.parser) {
        f();
    } else {
        if (window.importJS) {
            importJS("MediaWiki:Skin/Projekt:Adventure2/lib.js");
            importJS("MediaWiki:Skin/Projekt:Adventure2/parser.js");
        }
        window.setTimeout(function() { wait4a2(f); }, 100);
    }
}

$(function () {
wait4a2(function () {

   var event = {};
   var error = "";
   try {
       var event = window.a2.parser.parse("");
   } catch (e) {
       var error = "Line " + e.line + ", Column " + e.column + ": " + e.message;
   }
  
   if ("" == "render"){  
       if (!error)
           a2.registerEventHandler(event);
   } else {
       $pre = $("<pr"+"e/>");
       $pre.text("\n"+String(error));

       if ($("#wikiPreview").length)
           $cont = $("#wikiPreview");
       else
           $cont = $("#bodyContent");

       $cont.append($pre);
   }
});
});
 
</script>