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
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/]
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@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
John wrote:
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.
Might suggest using a maintainance script to do it: https://www.mediawiki.org/wiki/Manual:MoveBatch.php
A maintenance script would solve nothing. It would defeat the goal of the tool. I am trying to enable users to quickly archive pages after reviewing them. If a script has to be run server side each time, it would just be easier to manually move the pages. What I am trying to do is enable one click moving from within the web browser. This shouldnt be rocket science, I can do it in 10 lines of python, but having a JavaScript version would make it simpler, and maintain attribution of who moved it.
On Tue, Nov 11, 2014 at 12:23 AM, svetlana svetlana@fastmail.com.au wrote:
John wrote:
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.
Might suggest using a maintainance script to do it: https://www.mediawiki.org/wiki/Manual:MoveBatch.php
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Here is a complete example: https://test2.wikipedia.org/wiki/User:TheDJ/common.js
Note that for anything post+token related, it's a lot easier to use api.postWithEditToken() or api.postWithToken(). It does automatic token re-requesting if it expired.
DJ
On Tue, Nov 11, 2014 at 12:00 PM, John phoenixoverride@gmail.com wrote:
A maintenance script would solve nothing. It would defeat the goal of the tool. I am trying to enable users to quickly archive pages after reviewing them. If a script has to be run server side each time, it would just be easier to manually move the pages. What I am trying to do is enable one click moving from within the web browser. This shouldnt be rocket science, I can do it in 10 lines of python, but having a JavaScript version would make it simpler, and maintain attribution of who moved it.
On Tue, Nov 11, 2014 at 12:23 AM, svetlana svetlana@fastmail.com.au wrote:
John wrote:
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.
Might suggest using a maintainance script to do it: https://www.mediawiki.org/wiki/Manual:MoveBatch.php
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org