Se4598 added a comment.

Ok, I try to explain what this patch aims at.
The patch in question solves the problem that previously it wasn't possible to 
add new renderer without overwriting popups javascript functions with own 
customized ones, which are prone to break if the original function changes. 
Also obviously this only works easy with one external party.
You can see that approach  taken at the wikidata gadget by bene* at 
https://www.wikidata.org/wiki/MediaWiki:Gadget-PopupsFix.js who overwrites 
mw.popups.render.article.init.

Now with the change all you have to do is to add your own renderer to a 
js-object provided by popups. No overwriting of popups code needed!

As practical working thing, I just created 
https://www.mediawiki.org/wiki/User:Se4598/testpopups.js
There I first replaced the popups function by the one in the relevant changeset 
(to create the after-merge-state).

Then I created a own renderer (code from 232237, slightly modified). The 
matcher-function returns true in this example, but operates on the URL 
(contrary to what 232237 states), so here Wikidata can inspect the href of the 
link and extract the namespace etc.).

Testing: include my testscript, see all appearing hovercards in blue. (Only 
works on content-namespace links, as previously stated, but can be changed 
without modifing popups code)

Benefit: The already existing gadget could be modified to not overwrite popups 
code any longer, so no dirty hacks and no maintenance required if 
mw.popups.render.article.init needs to change! :) This would lay the foundation 
that own renderer code could be included in Wikidata itself.

@Jdlrobson Sorry, I understand you. I hope you now understand what the 
intention behind that patch is and this is answerred: "I just want to know 
whether https://gerrit.wikimedia.org/r/232236 helps you do that."


TASK DETAIL
  https://phabricator.wikimedia.org/T102921

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Prtksxna, Se4598
Cc: Se4598, Jdlrobson, gerritbot, Prtksxna, thiemowmde, aude, Ricordisamoa, 
hoo, Lydia_Pintscher, Bene, Aklapper, Wikidata-bugs, Quiddity



_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to