[MediaWiki-l] Custom JavaScript

John phoenixoverride at gmail.com
Tue Nov 11 03:32:13 UTC 2014


Thats kind of what I had, the promise is what is screwing with me. I dont
really work with JavaScript much, and am more used to being able to call a
function and get a result, From what I can tell about the promise() this is
something different

On Mon, Nov 10, 2014 at 9:37 PM, Daniel Friesen <daniel at nadir-seen-fire.com>
wrote:

> On 2014-11-10 5:53 PM, John wrote:
> > OK, Ive spent the better part of two hours trying to figure out mediawiki
> > JavaScript. In the last two hours all I have accomplished is giving
> myself
> > a headache.
> >
> > My goal is a basic JavaScript tool for moving pages. On a private wiki I
> > run it is often needed to archive material that is no longer needed, We
> > dont like to delete because often this material is still useful. Instead
> we
> > move it to a custom namespace.
> >
> > What I am trying to do in JavaScript and failing spectacularly at is a
> tool
> > that will take Title, and move it to Archive:Title without a redirect
> with
> > a single click.
> >
> > Yes I know it sounds simple but Im having a devil of a time figuring out
> > how to use the mediawiki js api
> >
> > Any help would be welcome
>
> Here's a few hints of what you'll need.
>
> Get an APi instance with:
>   var api = new mw.Api();
>
> Get an edit token with:
>   api.getToken('edit');
>
> Move a page with:
>   api.post({
>       from: ...,
>       to: ...,
>       reason: "...",
>       noredirect: true,
>       token: edittoken
>   });
>
> Note that api methods are async and return a jQuery "promise".
>
> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


More information about the MediaWiki-l mailing list