MediaWiki talk:Gadget-ImageHeader.js

Latest comment: 4 years ago by Nikki in topic Gadget broken by MediaWiki API change

Link to "undefined" edit

{{Edit request}} Please search the code for page_image and change the line as follows:

deferred.resolve( page.thumbnail.source, page.pageprops.page_image_free || page.pageprops.page_image );

--Thiemo Mättig (WMDE) 08:38, 4 July 2017 (UTC)Reply

  Done Matěj Suchánek (talk) 09:31, 4 July 2017 (UTC)Reply

TypeError: position is undefined edit

{{Edit request}} I saw this error on history pages. Please change the line

if ( mediaWiki.config.get('wgNamespaceNumber') !== 0 ) {

as follows:

if ( mw.config.get( 'wgNamespaceNumber' ) !== 0 || mw.config.get( 'wgAction' ) !== 'view' ) {

Thanks! --Thiemo Mättig (WMDE) 08:21, 1 September 2017 (UTC)Reply

  Done Matěj Suchánek (talk) 12:09, 1 September 2017 (UTC)Reply

Gadget shows current image on old revisions edit

{{Edit request}}

For example, see Special:PermanentLink/44517277 – the gadget shows a photo of Trump that did not even exist at the time of that revision (because he wasn’t president yet, bless those innocent days). I think it would make more sense to only show the image on the current revision, i. e. if mw.config.get( 'wbIsEditView' ) is true. --Lucas Werkmeister (talk) 12:02, 27 August 2019 (UTC)Reply

Currently, the gadget doesn’t show the image on old or current revisions, see below. Temporarily disabling the edit request for that reason. --Lucas Werkmeister (talk) 23:46, 18 April 2020 (UTC)Reply
proposed solution; I’m not fully happy with it, but it’ll do for now. It would be nice to listen to the wikibase.entityPage.entityLoaded hook, and see if we can find the page image somewhere in there, and if yes, use it even if the revision is not the current one (because the page image hasn’t changed since then); however, that would require more involved changes to the gadget (an extra async step that needs to be synchronized with the rest of the asynchronous work; the gadget currently only gets the thumbnail URL of the page image and not a file name that we could easily compare to the entity data; the page image isn’t limited to just image (P18); possibly more). --Lucas Werkmeister (talk) 12:31, 19 April 2020 (UTC)Reply
Note: I’ve also added a few other minor fixes to User:Lucas Werkmeister/Gadget-ImageHeader.js, if you want to import those too. --Lucas Werkmeister (talk) 12:39, 19 April 2020 (UTC)Reply
Done - copied all the changes, seemed reasonable enough. - Nikki (talk) 12:55, 19 April 2020 (UTC)Reply

Gadget broken by MediaWiki API change edit

{{Edit request}}

Currently, the gadget doesn’t show any page image, at least on my system. In the dev tools, I can see an API request with an error response:

"code":"badinteger",
"info":"Invalid value \"803.0000000000001\" for integer parameter \"pithumbsize\"."

I assume this is due to stricter validation of integer-type parameters, a breaking API change deployed ca. two months ago. The gadget should round its width/height at some point instead of sending floating-point numbers to an API that expects integers. (I’ll try to write a fix tomorrow and add {{Edit request}} then.) --Lucas Werkmeister (talk) 23:45, 18 April 2020 (UTC)Reply

proposed fix --Lucas Werkmeister (talk) 12:29, 19 April 2020 (UTC)Reply
Done - Nikki (talk) 12:55, 19 April 2020 (UTC)Reply
Return to "Gadget-ImageHeader.js" page.