MediaWiki:TemplateCard.js:修订间差异

Tbpedia>Sophivorus
无编辑摘要
 
(导入1个版本:​Appropedia Template Card)
 
(未显示同一用户的1个中间版本)
(没有差异)

2024年3月1日 (五) 23:22的最新版本

/**
 * 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 );