Page MenuHomePhabricator

Add CSS ID tags to structured data anchors on file pages
Closed, ResolvedPublic

Description

Users would like the ability to hide/unhide the Structured data field from file pages. If ID tags are added to the Structured data sections, this can be done in the user's CSS.

Event Timeline

I don't understand this request. Do you actually mean HTML ids? Those are in general banned from new Wikimedia code. We use classes instead. There's already the filepage-mediainfo-entitytermsview class, which some people are using to hide the captions box, but as ever those change as the code we write changes and so those might break. Is that sufficient? Note though that with the proposed tabbed interface it's not plausible to hide everything with a single class selector (without also hiding the rendered wikitext of the page).

Yes, I was meaning an actual HTML id. That way, users can add additional css classes to the ID using their user javascript page, e.g., $( "#captions" ).addClass( "mw-collapsed" ); - or better yet, provide some other way to let users auto-collapse the caption box, like a gadget or by having it as a beta feature. From my experience with the wikidata infobox on commons, this is a good way of keeping those that don't want to see the extra box happy.

Yes, I was meaning an actual HTML id. That way, users can add additional css classes to the ID using their user javascript page, e.g., $( "#captions" ).addClass( "mw-collapsed" );

What value do you think an id provides that a class does not?

$( '.filepage-mediainfo-entityview' ).addClass('mw-collapsed'); won't work because the mw-collapsed hack isn't compatible with floated divs, I think, but certainly $( '.filepage-mediainfo-entityview' ).css( { 'display': 'none' } ); works fine, and one could create a user script or whatever that does mw-collapsed equivalent functionality.

I think you just answered your own question. The display:none approach is already in use, but mw-collapsed would be better so it's not completely disabled, and as things stand that requires a html id. I'm happy to see the problem solved a different way, this is just how I know the problem can be solved.

Ah, I had a typo in my test code - the javascript at https://commons.wikimedia.org/w/index.php?title=User%3AMike_Peel%2Fcommon.js&type=revision&diff=334439260&oldid=324345310 does actually work! So maybe that's the best way forward for now.

Mike_Peel claimed this task.

I'm closing this as there's a different way of doing it, so this isn't needed. Thanks for looking at it!