|
|
| Zeile 40: |
Zeile 40: |
| | http://kamelopedia.mormo.org/api.php?format=jsonfm&indexpageids&action=query&prop=revisions&titles=Hauptseite&rvprop=ids|flags|timestamp|user|content|comment | | http://kamelopedia.mormo.org/api.php?format=jsonfm&indexpageids&action=query&prop=revisions&titles=Hauptseite&rvprop=ids|flags|timestamp|user|content|comment |
| | ... und dann den Timestamp zum Schreiben benutzen (vorher .replace(/[^0-9]/g, "")!) | | ... und dann den Timestamp zum Schreiben benutzen (vorher .replace(/[^0-9]/g, "")!) |
| − | <!--
| |
| − | wiki = {
| |
| − | /*
| |
| − | * getSource: fragt wiki nach Seitenquelltexten
| |
| − | * Argumente und Rückgabewerte als Objekt:
| |
| − | * objekt.wiki.title = Seitentitel (benötigtes Argument)
| |
| − | * objekt.wiki.source = Seitenquelltext (Rückgabewert)
| |
| − | */
| |
| − | getSource: new Async([
| |
| − | function ( args ) {
| |
| − | if (args == null)
| |
| − | args = {};
| |
| − | if (args.wiki == null)
| |
| − | args.wiki = {};
| |
| | | | |
| − | new Ajax.Request( wgServer+wgScript, {
| + | Aktuelle version läuft aber schon im lib-Verzeichnis. |
| − | method:'get',
| |
| − | parameters: 'action=raw&title='+escape(args.wiki.title),
| |
| − | onSuccess: function( transport ) { args.wiki.source = transport.responseText; wiki.getSource.continue(args) },
| |
| − | onFailure: function() { args.wiki.source = null; wiki.getSource.continue( args ) }
| |
| − | })
| |
| − | },
| |
| − | null
| |
| − | ]),
| |
| − | /*
| |
| − | * getHTML: fragt wiki nach gerenderten Seiten
| |
| − | * Argumente und Rückgabewerte als Objekt:
| |
| − | * objekt.wiki.title = Seitentitel (benötigtes Argument)
| |
| − | * objekt.wiki.HTML = SeitenHTML (Rückgabewert)
| |
| − | */
| |
| − | getHTML: new Async([
| |
| − | function ( args ) {
| |
| − | if (args == null)
| |
| − | args = {};
| |
| − | if (args.wiki == null)
| |
| − | args.wiki = {};
| |
| − | | |
| − | new Ajax.Request( wgServer+wgScript, {
| |
| − | method:'get',
| |
| − | parameters: 'action=render&title='+escape(args.wiki.title),
| |
| − | onSuccess: function( transport ) { args.wiki.HTML = transport.responseText; wiki.getHTML.continue(args) },
| |
| − | onFailure: function() { args.wiki.HTML = null; wiki.getHTML.continue( args ) }
| |
| − | })
| |
| − | },
| |
| − | null
| |
| − | ]),
| |
| − | /*
| |
| − | * parse: lässt Wiki beliebigen Wiki-Quelltext rendern
| |
| − | * Argumente und Rückgabewerte als Objekt:
| |
| − | * objekt.wiki.source = Quelltext (benötigtes Argument)
| |
| − | * objekt.wiki.title = Seitentitel (für {{PAGENAME}} oder ähnliches)
| |
| − | * objekt.wiki.HTML = SeitenHTML (Rückgabewert)
| |
| − | */
| |
| − | parse: new Async([
| |
| − | function ( args ) {
| |
| − | if (args == null)
| |
| − | args = {};
| |
| − | if (args.wiki == null)
| |
| − | args.wiki = {};
| |
| − | | |
| − | filter1='<div id="wikilibajaxfilterdiv1"></div>';
| |
| − | filter2='<div id="wikilibajaxfilterdiv2"></div>';
| |
| − | | |
| − | new Ajax.Request( wgServer+wgScript, {
| |
| − | method:'post',
| |
| − | parameters: 'action=submit&wpPreview=true&live=true&title='+escape(args.wiki.title)+'&wpTextbox1='+escape(filter1+args.wiki.source+filter2),
| |
| − | onSuccess: function( transport ) { args.wiki.HTML = transport.responseText.replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, "\"").replace(/&/gi,"&").replace(new RegExp("^(.|\n)*"+filter1),"").replace(new RegExp(filter2+"(.|\n)*$"),""); wiki.parse.continue(args) },
| |
| − | onFailure: function() { args.wiki.HTML = null; wiki.parse.continue( args ) }
| |
| − | })
| |
| − | },
| |
| − | null
| |
| − | ])
| |
| − | };
| |
| − | | |
| − | ready = function ( a ) { alert("->"+String(a.wiki.HTML) ) };
| |
| − | | |
| − | wiki.parse.start( { wiki: {title:"Test", source:"{{Bild}}"} }, ready )
| |
| − | -->
| |
| | | | |
| | == UI == | | == UI == |