Greetings! I'm back with another question. :)
I know that there are several MediaWiki configuration values available in JavaScript through the object mediawiki, and I've made use of mw.config a fair bit as necessary. Right now, I want to access the enums for namespaces, such as NS_MAIN = 0 or NS_TALK = 1, from JavaScript. Are these exposed anywhere in the mediawiki object?
Thanks,
-- Jason Ji jason.y.ji@gmail.com
This mailing list is generally about the API itself, and not really about API client libraries. You'd might get more relevant help on wikitech-l, or a list about MediaWiki's JavaScript libraries if there is one.
On Mon, Apr 28, 2014 at 5:43 PM, Jason Ji jason.y.ji@gmail.com wrote:
I know that there are several MediaWiki configuration values available in JavaScript through the object mediawiki, and I've made use of mw.config a fair bit as necessary. Right now, I want to access the enums for namespaces, such as NS_MAIN = 0 or NS_TALK = 1, from JavaScript. Are these exposed anywhere in the mediawiki object?
You could construct such a mapping using e.g. https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop...
Thanks! And sorry for the wrong email list!
-- Jason Ji jason.y.ji@gmail.com
On Mon, Apr 28, 2014 at 2:54 PM, Brad Jorsch (Anomie) <bjorsch@wikimedia.org
wrote:
This mailing list is generally about the API itself, and not really about API client libraries. You'd might get more relevant help on wikitech-l, or a list about MediaWiki's JavaScript libraries if there is one.
On Mon, Apr 28, 2014 at 5:43 PM, Jason Ji jason.y.ji@gmail.com wrote:
I know that there are several MediaWiki configuration values available in JavaScript through the object mediawiki, and I've made use of mw.config a fair bit as necessary. Right now, I want to access the enums for namespaces, such as NS_MAIN = 0 or NS_TALK = 1, from JavaScript. Are these exposed anywhere in the mediawiki object?
You could construct such a mapping using e.g. https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop...
-- Brad Jorsch (Anomie) Software Engineer Wikimedia Foundation
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
I think you want wgNamespaceIds.
On 28 April 2014 22:56, Jason Ji jason.y.ji@gmail.com wrote:
Thanks! And sorry for the wrong email list!
-- Jason Ji jason.y.ji@gmail.com
On Mon, Apr 28, 2014 at 2:54 PM, Brad Jorsch (Anomie) < bjorsch@wikimedia.org> wrote:
This mailing list is generally about the API itself, and not really about API client libraries. You'd might get more relevant help on wikitech-l, or a list about MediaWiki's JavaScript libraries if there is one.
On Mon, Apr 28, 2014 at 5:43 PM, Jason Ji jason.y.ji@gmail.com wrote:
I know that there are several MediaWiki configuration values available in JavaScript through the object mediawiki, and I've made use of mw.config a fair bit as necessary. Right now, I want to access the enums for namespaces, such as NS_MAIN = 0 or NS_TALK = 1, from JavaScript. Are these exposed anywhere in the mediawiki object?
You could construct such a mapping using e.g. https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop...
-- Brad Jorsch (Anomie) Software Engineer Wikimedia Foundation
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
On Tue, 29 Apr 2014 00:09:06 +0200, Alex Monk krenair@gmail.com wrote:
I think you want wgNamespaceIds.
That is, `mw.config.get( 'wgNamespaceIds' )` – this returns an object with keys like 'talk', for each namespace defined on the given wiki.
See also https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#mw.config .
Thanks! That's exactly what I was looking for. I hoped it would be in mw.config but must have gotten lost in the long list of options available.
-- Jason Ji jason.y.ji@gmail.com
On Mon, Apr 28, 2014 at 3:45 PM, Bartosz Dziewoński matma.rex@gmail.comwrote:
On Tue, 29 Apr 2014 00:09:06 +0200, Alex Monk krenair@gmail.com wrote:
I think you want wgNamespaceIds.
That is, `mw.config.get( 'wgNamespaceIds' )` – this returns an object with keys like 'talk', for each namespace defined on the given wiki.
See also https://www.mediawiki.org/wiki/Manual:Interface/ JavaScript#mw.config .
-- Matma Rex
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org