User:BrokenSegue/shorten.js
Jump to navigation
Jump to search
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)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// <nowiki>
// to use add importScript( 'User:BrokenSegue/shorten.js' ); to your common.js
const MAX_HEIGHT = 500;
(function(mw, $, wb) {
"use strict";
if (mw.config.get('wgNamespaceNumber') !== 0 || !mw.config.exists('wbEntityId')) {
return;
}
let statementBlocks = $(".wikibase-statementlistview");
let tallBlocks = statementBlocks.filter(function(){return this.getBoundingClientRect().height > MAX_HEIGHT});
tallBlocks.css("max-height", MAX_HEIGHT).css("overflow-y", "auto");
}(mediaWiki, jQuery, wikibase));
// </nowiki>