Page MenuHomePhabricator

Add JS callback for diff page content load for use by gadgets
Closed, DeclinedPublic

Description

In bug 26175, there was a suggestion to provide some sort of onContentLoad callback for use by gadgets, so that the gadget code can execute after the diff page loads.


Version: unspecified
Severity: enhancement

Details

Reference
bz26328

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:22 PM
bzimport set Reference to bz26328.

a.d.bergi wrote:

I pondered about it, and came to the conclusion that it should not just be an onLoad-, but also an onChange-Event. For example, when I have changed some links I may inform other scripts (like popups) about the change.
Most of these may be new content, changed and/or rendered by the API, but it has not to.
We even could go so far providing these "event-Listeners" as new Hooks for the page load, so that scripts won't have to register twice.
In my opinion, we should pass some arguments to the trigger:

  • distinguish between content and userinterface (sidebar, header). What about interwiki and categories?
  • selectors for the loaded elements, e.g. an id
  • identificator for the script and its function

Other scripts can handle the events and react specific to the passed data.

Feel free to file a separate issue with your feature request, but please don't expand the scope of this issue. Thanks.

pdhanda wrote:

RobLa, Do you have an example of a gadget that was affected by bug 26175?

(In reply to comment #3)

RobLa, Do you have an example of a gadget that was affected by bug 26175?

I don't. Perhaps Andreas (andber93@web.de) does?

a.d.bergi wrote:

(In reply to comment #3)
Sorry, I thougt this bug was for a more general request.

(In reply to comment #3)

Do you have an example of a gadget that was affected by bug 26175?

Oh, everything that wants to change the page view or add eventListeners to the page content. And thats a lot:

  • Moving the [Edit]-Links right to the Headings (from monobook.js, common.js)
  • The to-top-link-gadget has the same problem
  • [[de:MediaWiki:Gadget-Einleitung-bearbeiten.js]] fails when there are no [edit]-links
  • [[de:MediaWiki:Gadget-bkl-check.js]] has no links to analyze
  • Lupin's popups can add event listeners only to links it knows about
  • Wikiminiatlas sees no coordinate-links it can add a map to

...
In the official [[de:MediaWiki:Gadgets-definition]]-list also markadmins, screenreader-optimzing, ß -> ss (swiss spelling) and the timezone-converter are harmed.
Not listing any userscripts which have the problem, too.