Sixth and Seventh Week into the Coding Period
In the past two weeks, I have worked on Mission 3 of The Userscript Tour i.e. Strengths of the MediaWiki Action API, and made some amendments in the order of guiders and demo userscripts as per the suggestions from the mentors.
Mission 3 introduces the users to the MediaWiki Action API, which is a web service that facilitates wiki operations such as editing a page, deleting a page, getting information about a page, authenticating the user and so much more. This mission gives users the base required to start using the API in userscripts.
Pages created on MediaWiki
- TUT/3/Start
- TUT/Badge/3
- TUT/Badge/3template
- TUT/Badge/3template1
- TUT/3/End
Userscripts created
-
basicPageInfo.js: Shows the basic infomation about the current page (number of bytes/characters) at the top of the content area. This userscript is written to help users get started with making API calls to the Wikimedia servers.
-
quickChangeLog.js: Adds a link to the Toolbox portlet area, which when clicked shows 25 most recent changes on MediaWiki in the form of a jQuery dialog box. Initially, I added this userscript in Mission 2. However, it didn’t fit well in the context of what I was trying to demonstrate, thus it was replaced.
Sequence of steps in Mission 3
- Welcome back!
- MediaWiki Action API
- What can it be used for?
- Interesting use case
- Hands-on
- Your subpage
- Sneak Peek
- The Rationale
- Edit common.js
- Load the userscript
- Edit summary and Save Changes
- Number of bytes
- Endpoints
- Module, submodule, parameter
- Where to go for reference?
- Lots of use cases!
- Your subpage
- Check it out
- The Rationale
- Load Quick ChangeLog
- Edit summary and Save Changes
- Play around
- Congrats!
- Mission 3 complete!
Issues faced
I had decided to tell users how to test their API calls in the API Sandbox, since Sandbox is a great place to customize requests and analyze the response. However, I soon realized that while navigating to different sections, the page doesn’t reload.
This means that the chainable transition() method of the GuidedTour extension won’t run at all since it doesn’t listen to events such as onclick, onmouseover, etc. And thus the guiders will not change on their own in the API Sandbox. I looked up for stuff like mediawiki hooks, but it didn’t work. I am yet to figure out the possible solution.