MediaWiki:TemplateCard.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.
/** * This script interacts with [[Template:Card]] * [[Category:Template script pages]] */ var TemplateCard = { init: function () { $( '#mw-content-text' ).find( '.card-content' ).each( TemplateCard.trimList ); }, /** * Trim lists of more than 10 items * Example: [[Appropedia:Admin panel]] */ trimList: function ( event ) { var $button = $( '<span>more</span>' ).css( 'cursor', 'pointer' ).on( 'click', function () { $( this ).hide().siblings().show(); } ); $( this ).find( 'li' ).eq( 10 ).nextAll().hide().last().after( $button ); } }; $( TemplateCard.init );