Page MenuHomePhabricator

Add a pre-loaded trigger for Wikispeech
Closed, ResolvedPublic2 Estimated Story Points

Description

To avoid loading the Wikispeech JS for users not wishing to use it we should create an extremely small JS component (in a separate file) which simply adds an interactive component (like a button). Once interacted with we move on to load the full JS and start the segmenting.

While the design and accessibility considerations of the interactive component will require more consideration the basic logic should be possible to implement straight away.

This smaller js should still respect T243393: Only load Javascript when it may be used and only load when needed (whitelisted namespace, supported pagelanguage and current revision).

The "always enable" user setting should bypass the interactive component and load the full JS straight away. Conversely the visual elements of the interactive components should at the very least support being hidden by a minimal css addition to you user css (or a gadget)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

As a first design I'd suggest adding an entry/tab next to "read" (see image below) labeled "listen". This allows us to spend minimal time (at this stage) on design while also keeping the element out of the page itself.

Screenshot_2020-02-12 Wikipedia, the free encyclopedia.png (68×400 px, 3 KB)

An addition to the above specification should be a mention that toggling the "deactivate Wikispeech" setting should also hide this element.

Sounds like a good place to have it. Adding the button should be doable on the server side I think (haven't looked at the code).

I have found that the watch tab functions in a way that should work well for this so I'm working on copying that. I just need to figure out how it does the AJAX.

Apparently the tabs gets a click listener with preventDefault() and stopPropagation() in the handler function. There is still an action URL which may be for some kind of fallback, but I don't think we need this now. It may be needed when we tackle T164252: Keep functionality for preprocessing without javascript.

Sebastian_Berlin-WMSE changed the point value for this task from 8 to 6.May 28 2020, 10:27 AM

Apparently the tabs gets a click listener with preventDefault() and stopPropagation() in the handler function. There is also an action URL which may be for some kind of fallback, but I don't think we need this now. It may be needed when we tackle T164252: Keep functionality for preprocessing without javascript.

Make a subtask of implementing the action URL

Change 606184 had a related patch set uploaded (by Sebastian Berlin (WMSE); owner: Sebastian Berlin (WMSE)):
[mediawiki/extensions/Wikispeech@master] Add option for showing player

https://gerrit.wikimedia.org/r/606184

Added the tab for loading and showing the player. It only shows up if it's possible to play a page (correct namespace, rights etc.). It doesn't show if Wikispeech isn't enabled in the user settings, since the player always show up if possible in that case.

Once the tab is clicked it sticks around, which maybe should change in the future. It could be highlighted or hidden once clicked. If the former, clicking it again could hide the player.

Sebastian_Berlin-WMSE changed the point value for this task from 6 to 2.Jun 25 2020, 8:42 AM

Change 606184 merged by jenkins-bot:
[mediawiki/extensions/Wikispeech@master] Add option for showing player

https://gerrit.wikimedia.org/r/606184