◆少前百科是非盈利性、非官方的少女前线维基百科。
◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科
◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科
◆To foreigners,You can use twitter to contact us.
Icon Nyto Silver.png

“MediaWiki:Common.js”的版本间的差异

来自少前百科GFwiki
跳转至: 导航搜索
(fix bug)
 
(未显示4个用户的34个中间版本)
第1行: 第1行:
 
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
 
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
 +
/* AspectRatio change */
 +
!function(){var t=document.querySelectorAll(".reAspectRatio");if(0!=t.length)for(var e=0;e<t.length;e++){var l=t[e].dataset.aspectRatio;if(null!=l||0!=l.split(":").length){var i=t[e].querySelector("img");i.height=i.width*l.split(":")[1]/l.split(":")[0]}}}();
  
/* nolazyout */
+
RLQ.push(function(){
/* 本段js引用自kcwiki https://kcwiki.org/wiki/MediaWiki:Common.js */
+
$(function () {
$(document).ready(function(){
+
    var iconbox = document.querySelectorAll('table.iconbox tr > td:last-child');var iconcontainer = document.querySelectorAll('table.iconbox tr');
$('.no-lazy').each(function() {
+
    if (iconbox.length == 0) {return;}
    if ($(this).data('url')) {
+
    for (var i = 0; i < iconbox.length; i++)
        var img = this.tagName.toUpperCase() == 'IMG' ? $(this) : $('<img />');
+
      {
        img.off("load").one('load', function(e) {
+
        var len = iconbox[i].offsetWidth;var test= iconbox[i].getElementsByTagName("div").length;if(test==0){console.log(iconbox[i],test);iconcontainer[i].remove();continue}
            if ($(this).prop('tagName').toUpperCase() != 'IMG') {
+
        var num = Math.floor( len / 80);if(num==0){continue}
                $(this).html(img);
+
        for (var j = 0; j < iconbox[i].getElementsByClassName("TDnavbox").length;j += num) {;
            }
+
          iconbox[i].getElementsByClassName("TDnavbox")[j].classList.add("lead");
            img.show();
+
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+1]){iconbox[i].getElementsByClassName("TDnavbox")[j+1].classList.add("lead");}
            if ($(this).hasClass('apng') && window.APNG) {
+
        }
                APNG.ifNeeded(function() {
+
      }
                    APNG.animateImage(img.get(0));
+
  })
                });
+
$(window).resize(function () {
            }
+
    var iconbox = document.querySelectorAll('table.iconbox tr > td:last-child');
        });
+
    var iconcontainer = document.querySelectorAll('table.iconbox tr');
+
    var leadicon = document.querySelectorAll('table.iconbox tr > td:last-child div.lead');
        img.attr('src', $(this).data('url'));
+
    for (var i = 0; i < leadicon.length; i++) {
        img.removeAttr('data-url');
+
      leadicon[i].classList.remove("lead")
        if (img.data('srcset')) {
+
    }
            img.attr('srcset', img.data('srcset'));
+
    if (iconbox.length == 0) {return;}
            img.removeAttr('data-srcset');
+
    for (var i = 0; i < iconbox.length; i++)
            var testImage = new Image();
+
      {
+
        var len = iconbox[i].offsetWidth;
            if ($.fn.hidpi && $.devicePixelRatio() > 1 && testImage.srcset === undefined) {
+
        var num = Math.floor( len / 80);if(num==0){continue}
                var srcset = img.attr('srcset'),
+
        for (var j = 0; j < iconbox[i].getElementsByClassName("TDnavbox").length;j += num) {;
                    match;
+
          iconbox[i].getElementsByClassName("TDnavbox")[j].classList.add("lead");
                if (typeof srcset === 'string' && srcset !== '') {
+
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+1]){iconbox[i].getElementsByClassName("TDnavbox")[j+1].classList.add("lead");}
                    match = $.matchSrcSet(devicePixelRatio, srcset);
+
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+2]){iconbox[i].getElementsByClassName("TDnavbox")[j+2].classList.add("lead");}
                    if (match !== null) {
+
        }
                        img.attr('src', match);
+
      }
                    }
+
  })});
                }
+
 
            }
+
/**
        }
+
* Countdown
       
+
*
        $(this).off("appear").on("appear",function(e){})
+
* @version 2.1
    }
+
*
});
+
* @author Pecoes <https://c.wikia.com/wiki/User:Pecoes>
});
+
* @author Asaba <https://dev.wikia.com/wiki/User:Asaba>
// End of Disable LazyLoad
+
*
 +
* Version 1 authors:
 +
* - Splarka <https://c.wikia.com/wiki/User:Splarka>
 +
* - Eladkse <https://c.wikia.com/wiki/User:Eladkse>
 +
*
 +
* documentation and examples at:
 +
* <https://dev.wikia.com/wiki/Countdown>
 +
*/
 +
 +
/*jshint jquery:true, browser:true, devel:true, camelcase:true, curly:false, undef:true, bitwise:true, eqeqeq:true, forin:true, immed:true, latedef:true, newcap:true, noarg:true, unused:true, regexp:true, strict:true, trailing:false */
 +
/*global mediaWiki:true*/
 +
 +
;(function (module, mw, $, undefined) {
 +
 +
'use strict';
 +
 +
var translations = $.extend(true, {
 +
// English (English)
 +
en: {
 +
and: 'and',
 +
second: 'second',
 +
seconds: 'seconds',
 +
minute: 'minute',
 +
minutes: 'minutes',
 +
hour: 'hour',
 +
hours: 'hours',
 +
day: 'day',
 +
days: 'days'
 +
},
 +
zh: {
 +
and: '',
 +
second: '秒',
 +
seconds: '秒',
 +
minute: '分钟',
 +
minutes: '分钟',
 +
hour: '小时',
 +
hours: '小时',
 +
day: '天',
 +
days: '天'
 +
}
 +
}, module.translations || {}),
 +
i18n = translations[
 +
mw.config.get('wgContentLanguage')
 +
] || translations.zh;
 +
 +
var countdowns = [];
 +
 +
var NO_LEADING_ZEROS = 1,
 +
SHORT_FORMAT = 2,
 +
NO_ZEROS = 4;
 +
 +
function output (i, diff) {
 +
/*jshint bitwise:false*/
 +
var delta, result, parts = [];
 +
delta = diff % 60;
 +
//parts.unshift(delta + ' ' + i18n[delta === 1 ? 'second' : 'seconds']);
 +
result = ' ' + i18n[delta === 1 ? 'second' : 'seconds'];
 +
if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
 +
parts.unshift(delta + result);
 +
diff = Math.floor(diff / 60);
 +
delta = diff % 60;
 +
//if (delta>0){ parts.unshift(delta + ' ' + i18n[delta === 1 ? 'minute' : 'minutes']);}
 +
result = ' ' + i18n[delta === 1 ? 'minute' : 'minutes'];
 +
if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
 +
parts.unshift(delta + result);
 +
diff = Math.floor(diff / 60);
 +
delta = diff % 24;
 +
//if (delta>0){ parts.unshift(delta + ' ' + i18n[delta === 1 ? 'hour'  : 'hours' ]);}
 +
result = ' ' + i18n[delta === 1 ? 'hour'  : 'hours'  ];
 +
if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
 +
parts.unshift(delta + result);
 +
diff = Math.floor(diff / 24);
 +
//if (diff>0){ parts.unshift(diff  + ' ' + i18n[diff  === 1 ? 'day'    : 'days'   ]);}
 +
result = ' ' + i18n[diff  === 1 ? 'day'    : 'days'  ];
 +
if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
 +
parts.unshift(diff  + result);
 +
result = parts.pop();
 +
if (countdowns[i].opts & NO_LEADING_ZEROS) {
 +
while (parts.length && parts[0][0] === '0') {
 +
parts.shift();
 +
}
 +
}
 +
if (countdowns[i].opts & NO_ZEROS) {
 +
parts = parts.filter(function(part) {
 +
return part[0] !== '0';
 +
});
 +
}
 +
if (parts.length) {
 +
if (countdowns[i].opts & SHORT_FORMAT) {
 +
result = parts.join(' ') + ' ' + result;
 +
} else {
 +
result = parts.join(', ') + ' ' + i18n.and + ' ' + result;
 +
}
 +
}
 +
countdowns[i].node.text(result);
 +
}
 +
 +
function end(i) {
 +
var c = countdowns[i].node.parent();
 +
switch (c.attr('data-end')) {
 +
case 'remove':
 +
c.remove();
 +
return true;
 +
case 'stop':
 +
output(i, 0);
 +
return true;
 +
case 'toggle':
 +
var toggle = c.attr('data-toggle');
 +
if (toggle && toggle == 'next') {
 +
c.next().css('display', 'inline');
 +
c.css('display', 'none');
 +
return true;
 +
}
 +
if (toggle && $(toggle).length) {
 +
$(toggle).css('display', 'inline');
 +
c.css('display', 'none');
 +
return true;
 +
}
 +
break;
 +
case 'callback':
 +
var callback = c.attr('data-callback');
 +
if (callback && $.isFunction(module[callback])) {
 +
output(i, 0);
 +
module[callback].call(c);
 +
return true;
 +
}
 +
break;
 +
}
 +
countdowns[i].countup = true;
 +
output(i, 0);
 +
return false;
 +
}
 +
 +
function update () {
 +
var now = Date.now();
 +
var countdownsToRemove = [];
 +
$.each(countdowns.slice(0), function (i, countdown) {
 +
var diff = Math.floor((countdown.date - now) / 1000);
 +
if (diff <= 0 && !countdown.countup) {
 +
if (end(i)) countdownsToRemove.push(i);
 +
} else {
 +
output(i, Math.abs(diff));
 +
}
 +
});
 +
var x;
 +
while((x = countdownsToRemove.pop()) !== undefined) {
 +
countdowns.splice(x, 1);
 +
}
 +
if (countdowns.length) {
 +
window.setTimeout(function () {
 +
update();
 +
}, 1000);
 +
}
 +
}
 +
 +
function getOptions (node) {
 +
/*jshint bitwise:false*/
 +
var text = node.parent().attr('data-options'),
 +
opts = 0;
 +
if (text) {
 +
if (/no-leading-zeros/.test(text)) {
 +
opts |= NO_LEADING_ZEROS;
 +
}
 +
if (/short-format/.test(text)) {
 +
opts |= SHORT_FORMAT;
 +
}
 +
if (/no-zeros/.test(text)) {
 +
opts |= NO_ZEROS;
 +
}
 +
}
 +
return opts;
 +
}
 +
 +
function init() {
 +
var countdown = $('.countdown:not(.handled)');
 +
if (!countdown.length) return;
 +
$('.nocountdown').css('display', 'none');
 +
countdown
 +
.css('display', 'inline')
 +
.find('.countdowndate')
 +
.each(function () {
 +
var $this = $(this),
 +
date = (new Date($this.text())).valueOf();
 +
if (isNaN(date)) {
 +
$this.text('BAD DATE');
 +
return;
 +
}
 +
countdowns.push({
 +
node: $this,
 +
opts: getOptions($this),
 +
date: date,
 +
});
 +
});
 +
countdown.addClass('handled');
 +
if (countdowns.length) {
 +
update();
 +
}
 +
}
 +
 +
mw.hook('wikipage.content').add(init);
 +
 +
}(window.countdownTimer = window.countdownTimer || {}, mediaWiki, jQuery));
 +
 
 +
// End Countdown
  
//图片载入效果
 
/* 本段js引用自kcwiki https://kcwiki.org/wiki/MediaWiki:Common.js */
 
$('img').on('appear', function(e){
 
var that = $(this);
 
that.css('opacity',0);
 
setTimeout(function(){
 
that.css('transition','opacity 1s').css('opacity',1);
 
}, 1);
 
});
 
//End of 图片载入效果
 
  
 
/* 功能hack */
 
/* 功能hack */
第65行: 第260行:
 
}
 
}
 
})
 
})
/* Spine Loader */
+
 
mw.loader.load("/index.php?title=MediaWiki:Gadget-chibiAnimation.js&action=raw&ctype=text/javascript");
 
 
/* 标签式图标图鉴首列元素侦测 */
 
/* 标签式图标图鉴首列元素侦测 */
 
RLQ.push(function(){$(function () {
 
RLQ.push(function(){$(function () {
第109行: 第303行:
  
 
/* 返回顶部按钮 */
 
/* 返回顶部按钮 */
 +
RLQ.push(function(){
 
$(function() {
 
$(function() {
 
     var txt = " ",
 
     var txt = " ",
第132行: 第327行:
 
     }).scroll();
 
     }).scroll();
 
});
 
});
 +
})
 
/* goTop END */
 
/* goTop END */
  
第205行: 第401行:
 
});
 
});
  
 +
//collapse  折叠2
 +
$(function(){
 +
  $(".gfCollapse").click(function(e){
 +
if($(this).next().prop("nodeName") == "P" && !($(this).next().html())){
 +
    var nextElement = $(this).next().next();
 +
    $(this).next().css("display", "none");
 +
}else var nextElement = $(this).next();
 +
 +
    if($(this).attr("status") == "none"){
 +
        $(this).attr("status", "visible");
 +
        var signElement = $(this).children().children(".gfCollapseSign");
 +
        signElement.html(signElement.attr("data-visible"));
 +
        nextElement.slideDown("fast");}
 +
    else{
 +
        $(this).attr("status", "none");
 +
        var signElement = $(this).children().children(".gfCollapseSign");
 +
        signElement.html(signElement.attr("data-none"));
 +
        nextElement.slideUp("fast");}
 +
    });
 +
});
 +
 +
window.addEventListener("resize", function() {
 +
    $(".gfCollapse").children().css("max-width", parseInt(Number($(".gfCollapse").parent().width()) -40));});
 +
window.addEventListener("load", function() {
 +
    $(".gfCollapse").children().css("max-width", parseInt(Number($(".gfCollapse").parent().width()) -40));});
 +
 
/* adds show/hide-button to navigation bars */
 
/* adds show/hide-button to navigation bars */
 
function createNavigationBarToggleButton( $content ) {
 
function createNavigationBarToggleButton( $content ) {
第274行: 第496行:
 
obj.filter('.mw-collapsed').find('.mw-collapsible-toggle a').click();
 
obj.filter('.mw-collapsed').find('.mw-collapsible-toggle a').click();
 
}
 
}
 +
//滚动公告
 +
  /* autoScroll("#scrollDiv"); */
 +
 +
//该部分代码复制自Wikipedia
 +
//阅读更多:https://en.wikipedia.org/wiki/MediaWiki:Common.js
 +
//文字内容遵守【知识共享 署名-非商业性使用-相同方式共享 3.0】协议。
 +
mw.loader.using( 'mediawiki.util', function () {
 +
/**
 +
* Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
 +
*
 +
* Maintainers: TheDJ
 +
*/
 +
function mwCollapsibleSetup( $collapsibleContent ) {
 +
var $element,
 +
$toggle,
 +
autoCollapseThreshold = 2;
 +
$.each( $collapsibleContent, function ( index, element ) {
 +
$element = $( element );
 +
if ( $element.hasClass( 'collapsible' ) ) {
 +
$element.find( 'tr:first > th:first' ).prepend( $element.find( 'tr:first > * > .mw-collapsible-toggle' ) );
 +
}
 +
if ( $collapsibleContent.length >= autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
 +
$element.data( 'mw-collapsible' ).collapse();
 +
} else if ( $element.hasClass( 'innercollapse' ) ) {
 +
if ( $element.parents( '.outercollapse' ).length > 0 ) {
 +
$element.data( 'mw-collapsible' ).collapse();
 +
}
 +
}
 +
// because of colored backgrounds, style the link in the text color
 +
// to ensure accessible contrast
 +
$toggle = $element.find( '.mw-collapsible-toggle' );
 +
if ( $toggle.length ) {
 +
// Make the toggle inherit text color
 +
if ( $toggle.parent()[ 0 ].style.color ) {
 +
$toggle.find( 'a' ).css( 'color', 'inherit' );
 +
}
 +
}
 +
} );
 +
}
 +
 +
mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );
 +
});

2021年8月2日 (一) 00:30的最新版本

/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */
/* AspectRatio change */
!function(){var t=document.querySelectorAll(".reAspectRatio");if(0!=t.length)for(var e=0;e<t.length;e++){var l=t[e].dataset.aspectRatio;if(null!=l||0!=l.split(":").length){var i=t[e].querySelector("img");i.height=i.width*l.split(":")[1]/l.split(":")[0]}}}();

RLQ.push(function(){
$(function () {
    var iconbox = document.querySelectorAll('table.iconbox tr > td:last-child');var iconcontainer = document.querySelectorAll('table.iconbox tr');
    if (iconbox.length == 0) {return;}
    for (var i = 0; i < iconbox.length; i++) 
      {
        var len = iconbox[i].offsetWidth;var test= iconbox[i].getElementsByTagName("div").length;if(test==0){console.log(iconbox[i],test);iconcontainer[i].remove();continue}
        var num = Math.floor( len / 80);if(num==0){continue}
        for (var j = 0; j < iconbox[i].getElementsByClassName("TDnavbox").length;j += num) {;
          iconbox[i].getElementsByClassName("TDnavbox")[j].classList.add("lead");
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+1]){iconbox[i].getElementsByClassName("TDnavbox")[j+1].classList.add("lead");}
        }
      } 
  })
$(window).resize(function () {
    var iconbox = document.querySelectorAll('table.iconbox tr > td:last-child');
    var iconcontainer = document.querySelectorAll('table.iconbox tr');
    var leadicon = document.querySelectorAll('table.iconbox tr > td:last-child div.lead');
    for (var i = 0; i < leadicon.length; i++) {
      leadicon[i].classList.remove("lead")
    }
    if (iconbox.length == 0) {return;}
    for (var i = 0; i < iconbox.length; i++) 
      {
        var len = iconbox[i].offsetWidth;
        var num = Math.floor( len / 80);if(num==0){continue}
        for (var j = 0; j < iconbox[i].getElementsByClassName("TDnavbox").length;j += num) {;
          iconbox[i].getElementsByClassName("TDnavbox")[j].classList.add("lead");
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+1]){iconbox[i].getElementsByClassName("TDnavbox")[j+1].classList.add("lead");}
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+2]){iconbox[i].getElementsByClassName("TDnavbox")[j+2].classList.add("lead");}
        }
      } 
  })});

/**
 * Countdown
 *
 * @version 2.1
 *
 * @author Pecoes <https://c.wikia.com/wiki/User:Pecoes>
 * @author Asaba <https://dev.wikia.com/wiki/User:Asaba>
 *
 * Version 1 authors:
 * - Splarka <https://c.wikia.com/wiki/User:Splarka>
 * - Eladkse <https://c.wikia.com/wiki/User:Eladkse>
 *
 * documentation and examples at:
 * <https://dev.wikia.com/wiki/Countdown>
 */
 
/*jshint jquery:true, browser:true, devel:true, camelcase:true, curly:false, undef:true, bitwise:true, eqeqeq:true, forin:true, immed:true, latedef:true, newcap:true, noarg:true, unused:true, regexp:true, strict:true, trailing:false */
/*global mediaWiki:true*/
 
;(function (module, mw, $, undefined) {
 
	'use strict';
 
	var translations = $.extend(true, {
		// English (English)
		en: {
			and: 'and',
			second: 'second',
			seconds: 'seconds',
			minute: 'minute',
			minutes: 'minutes',
			hour: 'hour',
			hours: 'hours',
			day: 'day',
			days: 'days'
		},
		zh: {
			and: '',
			second: '秒',
			seconds: '秒',
			minute: '分钟',
			minutes: '分钟',
			hour: '小时',
			hours: '小时',
			day: '天',
			days: '天'
		}
	}, module.translations || {}),
	i18n = translations[
		mw.config.get('wgContentLanguage')
	] || translations.zh;
 
	var countdowns = [];
 
	var NO_LEADING_ZEROS = 1,
	SHORT_FORMAT = 2,
	NO_ZEROS = 4;
 
	function output (i, diff) {
		/*jshint bitwise:false*/
		var delta, result, parts = [];
		delta = diff % 60;
		//parts.unshift(delta + ' ' + i18n[delta === 1 ? 'second' : 'seconds']);
		result = ' ' + i18n[delta === 1 ? 'second' : 'seconds'];
		if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
		parts.unshift(delta + result);
		diff = Math.floor(diff / 60);
		delta = diff % 60;
		//if (delta>0){ parts.unshift(delta + ' ' + i18n[delta === 1 ? 'minute' : 'minutes']);}
		result = ' ' + i18n[delta === 1 ? 'minute' : 'minutes'];
		if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
		parts.unshift(delta + result);
		diff = Math.floor(diff / 60);
		delta = diff % 24;
		//if (delta>0){ parts.unshift(delta + ' ' + i18n[delta === 1 ? 'hour'  : 'hours'  ]);}
		result = ' ' + i18n[delta === 1 ? 'hour'   : 'hours'  ];
		if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
		parts.unshift(delta + result);
		diff = Math.floor(diff / 24);
		//if (diff>0){ parts.unshift(diff  + ' ' + i18n[diff  === 1 ? 'day'    : 'days'   ]);}
		result = ' ' + i18n[diff  === 1 ? 'day'    : 'days'   ];
		if (countdowns[i].opts & SHORT_FORMAT) result = result.charAt(1);
		parts.unshift(diff  + result);
		result = parts.pop();
		if (countdowns[i].opts & NO_LEADING_ZEROS) {
			while (parts.length && parts[0][0] === '0') {
				parts.shift();
			}
		}
		if (countdowns[i].opts & NO_ZEROS) {
			parts = parts.filter(function(part) {
				return part[0] !== '0';
			});
		}
		if (parts.length) {
			if (countdowns[i].opts & SHORT_FORMAT) {
				result = parts.join(' ') + ' ' + result;
			} else {
				result = parts.join(', ') + ' ' + i18n.and + ' ' + result;
			}
		}
		countdowns[i].node.text(result);
	}
 
	function end(i) {
		var c = countdowns[i].node.parent();
		switch (c.attr('data-end')) {
		case 'remove':
			c.remove();
			return true;
		case 'stop':
			output(i, 0);
			return true;
		case 'toggle':
			var toggle = c.attr('data-toggle');
			if (toggle && toggle == 'next') {
				c.next().css('display', 'inline');
				c.css('display', 'none');
				return true;
			}
			if (toggle && $(toggle).length) {
				$(toggle).css('display', 'inline');
				c.css('display', 'none');
				return true;
			}
			break;
		case 'callback':
			var callback = c.attr('data-callback');
			if (callback && $.isFunction(module[callback])) {
				output(i, 0);
				module[callback].call(c);
				return true;
			}
			break;
		}
		countdowns[i].countup = true;
		output(i, 0);
		return false;
	}
 
	function update () {
		var now = Date.now();
		var countdownsToRemove = [];
		$.each(countdowns.slice(0), function (i, countdown) {
			var diff = Math.floor((countdown.date - now) / 1000);
			if (diff <= 0 && !countdown.countup) {
				if (end(i)) countdownsToRemove.push(i);
			} else {
				output(i, Math.abs(diff));
			}
		});
		var x;
		while((x = countdownsToRemove.pop()) !== undefined) {
			countdowns.splice(x, 1);
		}
		if (countdowns.length) {
			window.setTimeout(function () {
				update();
			}, 1000);
		}
	}
 
	function getOptions (node) {
		/*jshint bitwise:false*/
		var text = node.parent().attr('data-options'),
			opts = 0;
		if (text) {
			if (/no-leading-zeros/.test(text)) {
				opts |= NO_LEADING_ZEROS;
			}
			if (/short-format/.test(text)) {
				opts |= SHORT_FORMAT;
			}
			if (/no-zeros/.test(text)) {
				opts |= NO_ZEROS;
			}
		}
		return opts;
	}
 
	function init() {
		var countdown = $('.countdown:not(.handled)');
		if (!countdown.length) return;
		$('.nocountdown').css('display', 'none');
		countdown
		.css('display', 'inline')
		.find('.countdowndate')
		.each(function () {
			var $this = $(this),
				date = (new Date($this.text())).valueOf();
			if (isNaN(date)) {
				$this.text('BAD DATE');
				return;
			}
			countdowns.push({
				node: $this,
				opts: getOptions($this),
				date: date,
			});
		});
		countdown.addClass('handled');
		if (countdowns.length) {
			update();
		}
	}
 
	mw.hook('wikipage.content').add(init);
 
}(window.countdownTimer = window.countdownTimer || {}, mediaWiki, jQuery));

// End Countdown


/* 功能hack */
RLQ.push(function(){ //template:Purge 无确认清除缓存 (仅注册用户)
	var purge = document.querySelector("li#ca-purge > a")
	var purge_link = document.getElementsByClassName("purgelink")
	if (!purge){return}
	for (var i = 0; i < purge_link.length; i++) {
		purge_link[i].firstElementChild.onclick=function(){purge.click()};
		purge_link[i].firstElementChild.href="javascript:void(0)";
	}
})

/* 标签式图标图鉴首列元素侦测 */
RLQ.push(function(){$(function () {
    var iconbox = document.querySelectorAll('table.iconbox tr > td:last-child');var iconcontainer = document.querySelectorAll('table.iconbox tr');
    if (iconbox.length == 0) {return;}
    for (var i = 0; i < iconbox.length; i++) 
      {
        var len = iconbox[i].offsetWidth;var test= iconbox[i].getElementsByTagName("div").length;if(test==0){console.log(iconbox[i],test);iconcontainer[i].remove();continue}
        var num = Math.floor( len / 80);if(num==0){continue}
        for (var j = 0; j < iconbox[i].getElementsByClassName("TDnavbox").length;j += num) {;
          iconbox[i].getElementsByClassName("TDnavbox")[j].classList.add("lead");
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+1]){iconbox[i].getElementsByClassName("TDnavbox")[j+1].classList.add("lead");}
        }
      } 
  })
$(window).resize(function () {
    var iconbox = document.querySelectorAll('table.iconbox tr > td:last-child');
    var iconcontainer = document.querySelectorAll('table.iconbox tr');
    var leadicon = document.querySelectorAll('table.iconbox tr > td:last-child div.lead');
    for (var i = 0; i < leadicon.length; i++) {
      leadicon[i].classList.remove("lead")
    }
    if (iconbox.length == 0) {return;}
    for (var i = 0; i < iconbox.length; i++) 
      {
        var len = iconbox[i].offsetWidth;
        var num = Math.floor( len / 80);if(num==0){continue}
        for (var j = 0; j < iconbox[i].getElementsByClassName("TDnavbox").length;j += num) {;
          iconbox[i].getElementsByClassName("TDnavbox")[j].classList.add("lead");
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+1]){iconbox[i].getElementsByClassName("TDnavbox")[j+1].classList.add("lead");}
          if(!!iconbox[i].getElementsByClassName("TDnavbox")[j+2]){iconbox[i].getElementsByClassName("TDnavbox")[j+2].classList.add("lead");}
        }
      } 
  })});
/* 黑幕 */
var heimu = document.getElementsByClassName("black-black");
function overMouse(){this.style.color="white"}
function leftMouse(){this.style.color="black"}
for(var i=0;i<heimu.length;i++){
heimu[i].addEventListener("mouseover", overMouse);
heimu[i].addEventListener("mouseleave", leftMouse);}

/* 返回顶部按钮 */
RLQ.push(function(){
$(function() {
    var txt = " ",
        btn = $('<div/>', {
            'text': txt,
            'attr': {
                'title': txt,
                'class': 'backToTop'
            },
            'css': {
                'user-select': 'none'
            },
            'on': {
                'click': function() {
                    $("html, body").animate({
                        scrollTop: 0
                    }, 120);
                }
            }
        }).appendTo(document.body);
    $(window).on('scroll', function() {
        $(document).scrollTop() > 0 ? btn.fadeIn() : btn.fadeOut();
    }).scroll();
});
})
/* goTop END */

/**
 * Dynamic Navigation Bars (experimental)
 *
 * Description: See [[Wikipedia:NavFrame]].
 * Maintainers: UNMAINTAINED
 */

/* set up the words in your language */
var collapseCaption = '隐藏';
var expandCaption = '显示';

var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
var indexNavigationBar = 0;

/**
 * Shows and hides content and picture (if available) of navigation bars
 * Parameters:
 *     indexNavigationBar: the index of navigation bar to be toggled
 **/
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
    var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
    var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
    var NavChild;

    if ( !NavFrame || !NavToggle ) {
        return false;
    }

    /* if shown now */
    if ( NavToggle.firstChild.data === NavigationBarHide ) {
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
                NavChild.style.display = 'none';
            }
        }
    NavToggle.firstChild.data = NavigationBarShow;

    /* if hidden now */
    } else if ( NavToggle.firstChild.data === NavigationBarShow ) {
        for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
            if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
                NavChild.style.display = 'block';
            }
        }
        NavToggle.firstChild.data = NavigationBarHide;
    }

    event.preventDefault();
};

	    //collapse  折叠和图标折叠
	$(function(){
	   $(".simpleCollapse").click(function(e){
	      var dest=$(this).next(),
	          spen=$(this).children('span'),
	          i=$(this).children("i");
	      if(dest.is(":visible")){         
	         dest.slideUp('fast',function(){
	            spen.html(spen.attr('data-ht'));
	            i.removeClass("fa-minus-square").addClass("fa-plus-square").html(" 详细");
	         });
	      }else {
	         dest.slideDown('fast',function(){
	            spen.html(spen.attr('data-st'));
	             i.removeClass("fa-plus-square").addClass("fa-minus-square").html("");
	         });
	      }
	    });
	});

//collapse  折叠2
$(function(){
   $(".gfCollapse").click(function(e){
		if($(this).next().prop("nodeName") == "P" && !($(this).next().html())){
		    var nextElement = $(this).next().next();
		    $(this).next().css("display", "none");
		}else var nextElement = $(this).next();
		
	    if($(this).attr("status") == "none"){ 
	        $(this).attr("status", "visible");
	        var signElement = $(this).children().children(".gfCollapseSign");
	        signElement.html(signElement.attr("data-visible"));
	        nextElement.slideDown("fast");}
	    else{ 
	        $(this).attr("status", "none");
	        var signElement = $(this).children().children(".gfCollapseSign");
	        signElement.html(signElement.attr("data-none"));
	        nextElement.slideUp("fast");}
    });
});

window.addEventListener("resize", function() { 
    $(".gfCollapse").children().css("max-width", parseInt(Number($(".gfCollapse").parent().width()) -40));});
window.addEventListener("load", function() { 
    $(".gfCollapse").children().css("max-width", parseInt(Number($(".gfCollapse").parent().width()) -40));});
	
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton( $content ) {
    var NavChild;
    /* iterate over all < div >-elements */
    var $divs = $content.find( 'div' );
    $divs.each( function ( i, NavFrame ) {
        /* if found a navigation bar */
        if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {

            indexNavigationBar++;
            var NavToggle = document.createElement( 'a' );
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
            NavToggle.setAttribute( 'href', '#' );
            $( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, indexNavigationBar ) );

            var isCollapsed = $( NavFrame ).hasClass( 'collapsed' );
            /**
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
             * the old way of making NavFrames start out collapsed was to manually add style="display:none"
             * to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
             * the content visible without JavaScript support), the new recommended way is to add the class
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
             */
            for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
                if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
                    if ( NavChild.style.display === 'none' ) {
                        isCollapsed = true;
                    }
                }
            }
            if ( isCollapsed ) {
                for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
                    if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            var NavToggleText = document.createTextNode( isCollapsed ? NavigationBarShow : NavigationBarHide );
            NavToggle.appendChild( NavToggleText );

            /* Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked) */
            for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
                if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
                    NavToggle.style.color = NavFrame.childNodes[j].style.color;
                    NavFrame.childNodes[j].appendChild( NavToggle );
                }
            }
            NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
        }
    } );
}

mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );

//Hide End

//隐藏内容,该部分代码复制自萌娘百科
//阅读更多:https://zh.moegirl.org/MediaWiki:Common.js
//文字内容遵守【知识共享 署名-非商业性使用-相同方式共享 3.0】协议。
//由于mw的锅导致部分文字可能超出#mw-content-text的范围,为这些文字的{{hide}}补上隐藏效果
function missedHideFun(obj) {
	$('<span class="mw-collapsible-toggle"><span class="mw-collapsible-bracket">[</span><a href="javascript:void(0);"/><span class="mw-collapsible-bracket">]</span></span>').appendTo(obj.find('tr:first > :last'));
	obj.find('.mw-collapsible-toggle a').text('隐藏').bind('click', function() {
		var a = $(this).closest('table.mw-collapsible').find('tr').not(':first');
		"none" == a.css("display") ? a.show() && $(this).text("显示") : a.hide() && $(this).text("隐藏");
	});
	obj.filter('.mw-collapsed').find('.mw-collapsible-toggle a').click();
}
//滚动公告
   /* autoScroll("#scrollDiv"); */

//该部分代码复制自Wikipedia
//阅读更多:https://en.wikipedia.org/wiki/MediaWiki:Common.js
//文字内容遵守【知识共享 署名-非商业性使用-相同方式共享 3.0】协议。
mw.loader.using( 'mediawiki.util', function () {
	/**
	 * Add support to mw-collapsible for autocollapse, innercollapse and outercollapse
	 *
	 * Maintainers: TheDJ
	 */
	function mwCollapsibleSetup( $collapsibleContent ) {
		var $element,
			$toggle,
			autoCollapseThreshold = 2;
		$.each( $collapsibleContent, function ( index, element ) {
			$element = $( element );
			if ( $element.hasClass( 'collapsible' ) ) {
				$element.find( 'tr:first > th:first' ).prepend( $element.find( 'tr:first > * > .mw-collapsible-toggle' ) );
			}
			if ( $collapsibleContent.length >= autoCollapseThreshold && $element.hasClass( 'autocollapse' ) ) {
				$element.data( 'mw-collapsible' ).collapse();
			} else if ( $element.hasClass( 'innercollapse' ) ) {
				if ( $element.parents( '.outercollapse' ).length > 0 ) {
					$element.data( 'mw-collapsible' ).collapse();
				}
			}
			// because of colored backgrounds, style the link in the text color
			// to ensure accessible contrast
			$toggle = $element.find( '.mw-collapsible-toggle' );
			if ( $toggle.length ) {
				// Make the toggle inherit text color
				if ( $toggle.parent()[ 0 ].style.color ) {
					$toggle.find( 'a' ).css( 'color', 'inherit' );
				}
			}
		} );
	}

	mw.hook( 'wikipage.collapsibleContent' ).add( mwCollapsibleSetup );
});