Jump to content

Topic on Project:Village Pump/Flow

Enabling tabbedWindow Gadget on Mediawiki.org as default for on-wiki documentation

12
Summary by Jayprakash12345

Done by User:Ladsgroup :)

Jayprakash12345 (talkcontribs)

Hello everyone, As part of my Google Summer of Code project, I have developed code snippets in PHP, Python and MediaWiki Javascript to demonstrate the use of MediaWiki Action API modules. All these code samples will be shown in a tabbed window in all the API module pages on MediaWiki.org like in https://test.wikipedia.org/wiki/API:Sandbox via a Gadget. This Gadget also deployed in MediaWiki.org. But it is not done yet for non-login users. For Login users, you can enable it from Special:Preferences-> Gadgets.

  1. API:Tokens
  2. API:Opensearch

After enabling the gadget, you can checkout above pages. I am looking for your suggestions and feedback to enable it for non-login users as well. So that we can do on-wiki API documentation. Thank you :)

MarkAHershberger (talkcontribs)

Combining the different languages into a single section on the page is a good idea since it takes up less space.

Ciencia Al Poder (talkcontribs)

A couple of issues:

The table of contents of the page has now this structure:

2 Example
2.1 GET request
2.2 Response
2.3 Sample code
2.4 Python
2.5 PHP
2.6 Javascript
2.7 MediaWiki JS

  • 2.4 through 2.7 should probably be nested as child of 2.3
  • When clicking the link from the TOC to those tabbed sections, the link doesn't work. It would be good to scroll and switch to the corresponding tab, or if that's not possible, at least scroll to the section.
Jayprakash12345 (talkcontribs)

Weird, We have already removing the TOC link like Python, PHP and Javascript etc by the gadget as OOUI does not support to set the id of tab directly. Can you check again with hard reset?

Ciencia Al Poder (talkcontribs)

Still the same. I'm using Firefox

MarkAHershberger (talkcontribs)

I don't normally use Chrome, so I visited the page in Chrome (77.0.3865.10 (Official Build) dev (64-bit)) and saw that 2.4-2.7 were still there.

SSethi (WMF) (talkcontribs)

I tested the Gadget in three different browsers, and I don't see section 2.4-2.7 show up in the TOC. More info on the browser versions:

  • Firefox: 68.0.1 (64-bit)
  • Chrome: 75.0.3770.142 (Official Build) (64-bit)
  • Safari: 12.1.1

@MarkAHershberger @Ciencia Al Poder I'm wondering if you were logged in when you tried to view the API:Tokens or API:Opensearch page in your browser. As this Gadget is not set as default / enabled for everyone, it won't work as expected if you are not logged in.

Ciencia Al Poder (talkcontribs)
Quiddity (talkcontribs)
Ciencia Al Poder (talkcontribs)
Jayprakash12345 (talkcontribs)

Just one question more, Can you see your web console error and warnings And paste here if any?

Ciencia Al Poder (talkcontribs)

Nothing relevant.

Being curious as to what could be failing, I reviewed the code and found that my section headers had a slightly different structure than what the script expects. Then I remembered having the HeadAnchor gadget active, which is what's causing the script to not function properly. If I deactivate that gadget, it works as you described. Sorry for the confusion!