MediaWiki talk:Gadget-AddInformation.js

Latest comment: 1 year ago by RZuo in topic headings problem


This script will show a new link "Add Information" in the sidebar on image pages that do not use a {{Information}} template. The link will call one of my (Magnus Manske) tools, trying to fill the existing information into an {{Information}} template.

Proposed Extension edit

I would like to propose to add "== Summary ==" above information box and "== Licensing ==" above license template. At the moment I have to type those by hand each time I use the tool. --Jarekt 17:42, 14 February 2008 (UTC)Reply

Secure server issues edit

When one is logged in via the secure server (https), the tool misbehaves as it comes back from TS through a standard login (http), and hence as you are not logged in, it considers your edit as an IP address, to which the tool is not aligned due to it being a logged in beast.  — billinghurst sDrewth 00:42, 30 December 2010 (UTC)Reply

problems with handling templates edit

especially == {{int:filedesc}} == and == {{int:license}} ==. See: https://commons.wikimedia.org/w/index.php?title=File%3APlacencia.JPG&diff=71815697&oldid=35634215 --McZusatz (talk) 19:46, 29 May 2012 (UTC)Reply

This odd behaviour has not been fixed yet + tool doesn't work for me from the toolbox With FF 17, It lacks the specification of commons wikimedia as wiki target (at least this is shown if used via web interface). --Denniss (talk) 10:51, 8 November 2013 (UTC)Reply
tool doesn't work --Atamari (talk) 22:25, 15 July 2014 (UTC)Reply
@Magnus Manske: doesn't work with File:Gambia007.jpg --Atamari (talk) 16:10, 24 December 2014 (UTC)Reply

As we can see, there are now more experienced user to add this template! I mean this script is very outdated... (until the WMF need this for his MediaViewer).User: Perhelion (Commons: = crap?)  14:29, 5 May 2015 (UTC)Reply

@Magnus Manske: still doesn't work with File:Gambia007.jpg --Atamari (talk) 23:54, 9 June 2015 (UTC)Reply

Request in edit-modus edit

It is sometimes annoying if one tidy-up the text and then so one must go back in the read-modus to click the tool, which also can't handle so much individual unstructured text. I think it is in any way absolutely no problem to do so. Greetings -- Perhelion (talk) 22:42, 12 May 2014 (UTC)Reply

Gadget unwatches files while adding the information template? edit

I've been using this gadget to add the information template to pages that appear on my watchlist as having been added to Category:Media missing infobox template, but when I return to my watchlist after adding the template the file is no longer included - something in the process of adding the template also seems to be unwatching the file. Has anyone else encountered this problem? Thanks. Mike Peel (talk) 21:15, 9 December 2014 (UTC)Reply

I wanted to report this same problem when i saw you already report this. Same thing is happening to me. --Smooth_O (talk) 08:27, 8 January 2015 (UTC)Reply

fileinfotpl_desc edit

{{Editprotected}} Looks like .fileinfotpl_desc has to be replaced by #fileinfotpl_desc, because fileinfotpl_desc is not class title, but id of "td" element. Okras (talk) 09:55, 5 February 2015 (UTC)Reply

This is really creasy, because his code can never been have worked!!!
  1. the class never exist - so we never need this check
  2. if we check the id - the code says do not load the tool?!?
It is simple or I miss something? What do you think? User: Perhelion (Commons: = crap?)  11:22, 8 April 2015 (UTC)Reply
@Rillke, Dschwen, McZusatz, and Slomox: ?User: Perhelion (Commons: = crap?)  11:24, 8 April 2015 (UTC)Reply
  Done — It looks like the code was intended to only show the "Add {{Information}}" tool when there was no Commons information type box (i.e. {{Information}}, {{Artwork}}, etc.) on a file page. You're right, 'fileinfopl_desc' is an ID, not a class, and not a great way to detect these boxes. I've fixed the code to look instead for the class '. commons-file-information-table'. —RP88 (talk) 06:17, 16 November 2015 (UTC)Reply

Request - remove category edit

Please remove simultaneously this maintain Category: Media missing infobox template.User: Perhelion (Commons: = crap?)  17:24, 7 February 2015 (UTC)Reply

Done --Steinsplitter (talk) 21:09, 16 February 2015 (UTC)Reply
I guess it must be fixed in PHP on Toollabs.[1] ^^User: Perhelion (Commons: = crap?)  22:52, 16 February 2015 (UTC)Reply

Confusion of dates edit

I used this tool for File:Kostel sv. Cyrila a Metodeje.jpg and noticed that the tool confuses the dates and the date of upload falsely presents as "according to EXIF data" date of the photo even though the real EXIF date of the photo is different. --ŠJů (talk) 15:00, 26 March 2015 (UTC)Reply

Broken feedback edit

The edit summary contains the text "Adding {{Information}} template (using http://tools.wmflabs.org/add-information)". However, the linked page contains no link here to MediaWiki talk:Gadget-AddInformation.js for specific feedback. --ŠJů (talk) 15:05, 26 March 2015 (UTC)Reply

I mean this gadget should completely detached from the tool-server and PHP and so completely rewritten in JavaScript.User: Perhelion (Commons: = crap?)  09:09, 10 June 2015 (UTC)Reply
I mean @Magnus Manske: has this page not on his frequented support-pages (I mean I've many times written him and I got never anywhere an answer).User: Perhelion (Commons: = crap?)  09:13, 10 June 2015 (UTC)Reply
Magnus did not create this Gadget, so it is likely unknown to him. You may also add a line to the source code yourself: https://bitbucket.org/magnusmanske/add_information/overview --McZusatz (talk) 15:52, 12 June 2015 (UTC)Reply

Full JavaScript replacement (in planning) edit

There are some proposals to replace this gadget with an full JS version. Here is a first similar version (from de), which can used as backbone for a Commons-version.User: Perhelion (Commons: = crap?)  10:02, 29 June 2015 (UTC)Reply

Link not shown for certain pictures edit

Hello everyone, for some files like File:Kosice (Slovakia) - St. Michal's Chapel and St. Elisabeth Catedral - south view.jpg the link to add the info template is not shown. Can you confirm this? If so can somebody fix this? --Arnd (talk) 07:18, 30 June 2017 (UTC)Reply

This is because another template: Object location uses the commons-file-information-table class. Alternatively we could omit the check for this class with mw.config.get('wgCategories') and simply look for "Media missing infobox template"? @RP88: -- User: Perhelion 12:59, 5 August 2018 (UTC)Reply
@Perhelion: Yes, {{Object location}} and a few similar templates, because they add additional fields to the existing infobox templates, will look like infobox templates when checking by class. Checking for the presence or absence of Category:Media missing infobox template would be even less reliable. The category is not updated continuously (I think Jarekt occasionally does a run to update the category). So there will be files that don't have an infobox templates that aren't in this category. Similarly, because adding an infobox template doesn't remove this category, there will be files that do have an infobox template that nonetheless are still in this category. The most reliable method of detecting the presence of an infobox template on a page is to check the page for the indirect transclusion of {{Infobox template tag}}. However, given that you thought a single call per page to a jQuery class lookup that took on the order of 10 microseconds was too expensive, would you be happy with the cost incurred by switching this gadget to instead detect an infobox template by making an API call that triggers a database query? —RP88 (talk) 14:45, 5 August 2018 (UTC)Reply
It has been a few years since I did a bot run to add or remove Category:Media missing infobox template. I should do it again. --Jarekt (talk) 18:28, 5 August 2018 (UTC)Reply
Good hint, we should include an hidden span tag with id in this template, that would be the best and surest solution. -- User: Perhelion 15:01, 5 August 2018 (UTC)Reply
That would work, but would be non-standards conforming. It is possible for {{Infobox template tag}} to appear multiple times on a page (i.e. {{Art photo}}), but element IDs must be unique in a document. It would still work as I am pretty sure every reasonable browser will allow multiple elements to have the same ID without complaining and still rendering something reasonable. I think I have a better solution — update {{Object location}} and similar related templates to use a class that is identically styled as "commons-file-information-table", but named something else, perhaps "commons-file-information-table-addendum". —RP88 (talk) 15:14, 5 August 2018 (UTC)Reply
@RP88: I see now a better and simple solution. As I looked for the class values (as you mentioned), they only work if they on a parent class with a DIV element (additional fields get united with the parent and seems always in a table element), so we need only add the DIV to the selector (which I've done). -- User: Perhelion 21:45, 5 August 2018 (UTC)Reply
Looking at your contribution history, I don't see any relevant change to JS, CSS, or templates. Did you make this change? The current CSS combines {{Location}} into an infobox template by virtue of a selector detecting adjacent siblings. —RP88 (talk) 21:52, 5 August 2018 (UTC)Reply
OK, now I see your edit. I guess you made the edit after your talk message. I think your solution will work for now, but you are relying on the fact that the current infobox templates all place the class on a div element, and all the "addendum" templates place the class on a table element. That seems like a brittle solution. If you don't have any objection, I'm inclined to update the "addendum" templates to use a separate class name, which give us the best of both changes. OK with you? —RP88 (talk) 22:18, 5 August 2018 (UTC)Reply
(ec) I meant I'll do this change immediately after (with) this post. But I've done short-term some speed-tests with different selector types. I've also tested a parent ">" selector but this is not for sure, because it seems not sure which is always the direct parent of our class.
I'm not with you with on this, as the class are related together to work. I've checked also all templates, they are all in DIV , which seems strict condition for the CSS class (and for the child class). You edit would be a to heavy change. PS: The current selector rule is: .commons-file-information-table + table.commons-file-information-table,.commons-file-information-table + div.commons-file-information-table > table { So it is indeed not always DIV depending, but the child must be a table. So in practice our current selector should near 99% sure for now!? -- User: Perhelion 22:25, 5 August 2018 (UTC)Reply
The change I was thinking of making was .commons-file-information-table + table.commons-file-information-table-addendum,.commons-file-information-table + div.commons-file-information-table-addendum,.commons-file-information-table-addendum + table.commons-file-information-table-addendum,.commons-file-information-table-addendum + div.commons-file-information-table-addendum > table. This is an easy change to implement, as there are a very small number of addendum templates, but many obscure infobox templates. Updating the addendum templates is easy, your solution of making sure every infobox uses a div is not as easy (although, in practice, most probably indirectly use one of main seven so, as you say, the percentage of all files is probably >99%). I'd be happy to make this change, it's very easy. Why do think my suggested edit is a heavy change? —RP88 (talk) 22:54, 5 August 2018 (UTC)Reply
Because this is a "global" change, so we don't know all dependencies (I see now this settings are introduced by Rillke). Any global change should be first mentioned on COM:MRD, but I do not see any real need anymore. -- User: Perhelion 23:45, 5 August 2018 (UTC)Reply

class ".commons-file-information-table" or fileinfopl_desc ID edit

@Perhelion: I restored the detection of infobox templates by class ".commons-file-information-table" instead of by fileinfopl_desc ID. For some infoboxes the description is optional (i.e. ((Photograph))) and won't always have a fileinfopl_desc ID. Also, I am not sure this script should trigger on 'edit' actions. It will always fail to find an infobox template until after you preview. —RP88 (talk) 17:17, 4 August 2018 (UTC)Reply

Thanks for check, that's bad but fine. -- User: Perhelion 17:59, 4 August 2018 (UTC)Reply

Not working edit

Hi. I've found that this script is not working anymore as of July 2019. I've filed an upstream report. Ping to Magnus Manske as maintainer. Thank you, —MarcoAurelio 14:07, 15 July 2019 (UTC)Reply

headings problem edit

this gadget seems to fuck up existing headings, removing the leading "==".--Reseletti (talk) 13:18, 27 January 2022 (UTC)Reply

i guess special:diff/625053920 is an example of the problem you found. RZuo (talk) 16:53, 8 January 2023 (UTC)Reply
Return to "Gadget-AddInformation.js" page.