User:Bargioni/show properties.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
// Stefano Bargioni 2021-10-06
// add color to IDs of properties and elements added by User:Inductiveload/scripts/ShowQsAndPs.js
// and a button to remove them
( function ( $, mw ) {
importScript( 'User:Inductiveload/scripts/ShowQsAndPs.js' );
if (mw.config.get('wbEntityId').substr(0,1) != 'Q') return ; // only apply to items
$( function () {
setTimeout(function(){
$( '.wikibase-statementgroupview' ).each( function ( idx, elem ) {
$(elem).find( '.wikibase-statementgroupview-property-label span' ).addClass('PP');
$(elem).find( '.wikibase-snakview-value a' ).parent().find('span').addClass('PP');
$(elem).find( '.wikibase-snakview-property a' ).each(function( i, e ){
$(e).parent().find('span').addClass('PP');
});
});
$('.PP').css('color','red');
}, 1000);
$('#claims').append('<span id="PP" style="float:right; color:red; font-size:0.8em; cursor:pointer" title="remove IDs of properties and elements">Remove IDs of Ps and Qs</span>');
$('#PP').click(function(){
$('.PP').remove();
$('#PP').remove();
});
} );
}( jQuery, mediaWiki ) );