欢迎来到奇葩栖息地!欢迎加入Discord服务器:XfrfHCzfbW欢迎加入QQ频道:r01m9y3iz6请先至特殊:参数设置验证邮箱后再进行编辑。特殊:参数设置挑选自己想要使用的小工具!不会编辑?请至这里学习Wikitext语法。

MediaWiki:Common.js

来自奇葩栖息地
SkyEye FAST讨论 | 贡献2021年9月29日 (三) 13:30的版本 (// Edit via Wikiplus)

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */

/**
 * Pause animations on mouseover of a designated container (.animated-container)
 *
 * This is so people have a chance to look at the image and click on pages they want to view.
 */
$( '#mw-content-text' ).on( 'mouseenter mouseleave', '.animated-container', function( e ) {
	$( this ).find( '.animated' ).toggleClass( 'animated-paused', e.type === 'mouseenter' );
} );

/* [[Template:Tabs]] */
$(".tabtable").each(function(i, e) {
	var $table = $(e);
	var $nav = $table.find(".tabtable-nav");
	$table.find(".tabtable-cell").each(function(i, e) {
		var $cell = $(e);
		var $tab = $("<div class='tabtable-tab'><span>" + $cell.attr("data-title") +"</span></div>");
		$nav.append($tab);
		$tab.click(function() {
			$table.find(".tabtable-cell").removeClass("active");
			$cell.addClass("active");
			$nav.find(".tabtable-tab").removeClass("active");
			$tab.addClass("active");
		});
	});
	$table.find(".tabtable-cell").first().addClass("active");
	$nav.find(".tabtable-tab").first().addClass("active");
});


/* debug */
console.info('Common.js has been successfully loaded.');