MediaWiki:Common.js

来自舰娘百科
跳转至: 导航搜索
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */

// 公告滚动
function AutoScroll(objNotice) {
    $(objNotice).find("ul:first").animate({
        marginTop:"-25px"
    },500,function(){
        $(this).css({marginTop: "0px"}).find("li:first").appendTo(this);
    });
}
//悬停的卡片
function qxmgTip(){
    $(document).on('mouseover','.j-qxmgtip',function(){
        $tip = $(this).find('.mgtip-tip');
        $tip.show();
        //修复图片不加载
        $(window).scrollTop($(window).scrollTop()-1).scrollTop($(window).scrollTop()+1);
        $(this).on('mousemove',function(e){
            var _oleft = $(this).offset().left,
                _otop = $(this).offset().top,
                _wt = $(window).scrollTop() + $(window).outerHeight(),
                _wl = $(window).scrollLeft() + $(window).outerWidth(),
                _left = e.pageX - _oleft + 15,
                _top = e.pageY - _otop + 15,
                _targetWidth = $tip.outerWidth(),
                _targetHeight = $tip.outerHeight();
            if( _left + _oleft + _targetWidth > _wl ){
                _left -= _targetWidth + 30;
            }
            if( _top + _otop + _targetHeight > _wt ){
                _top -= _targetHeight + 30;
            }
            $tip.css({
                left: _left,
                top: _top
            });
        });
        $(this).on('mouseout',function(){
            $tip.hide();
            $(this).off('mousemove').off('mouseout');
        });
    });
}

$(document).ready(function() {
    setInterval('AutoScroll("#scrollDiv")',5000);
    //图片载入效果
    $('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 图片载入效果
   
   //悬停的卡片
	qxmgTip();
});
 
// 固定表格页头
var TableHeadFix = function () {
    var obj, $table, $newtable, $win, 
    isReay = true,
    obj = this;
 
    this.clonehead = function () {
        $newtable = $table.clone();
        $newtable.find('tr:gt(0)').remove();
 
        $newtable.css('top', '0');
        $newtable.css('position', 'fixed');
        // Fixed by kk @ 2015-04-03
        $newtable.css('margin-top', '0');
        $newtable.hide();
    };
 
    this.check = function () {
        if($table.size() == 0){
             return;
        }
        var scrollTop = $win.scrollTop();
        var start_offset = $table.offset();
        if (scrollTop > start_offset.top && scrollTop <= (start_offset.top + $table.height())) {
            if(isReay){
                obj.tabWidth();
                isReay = false;
            }
            $newtable.show();
        } else {
            $newtable.hide();
        }
    };

    this.event = function () {
        $win.bind('scroll', obj.check);
        $win.bind('resize', function(){
            isReay = true;
            obj.tabWidth();
        });
    };

    this.tabWidth = function(){
        $newtable.width($table.width() + 2).css('table-layout','fixed');
        var tabTh = $table.find('tr:first').children('th');
        var newTabTh = $newtable.find('tr:first').children('th');
        newTabTh.css('padding','0');
        tabTh.each(function(index,ele){
            newTabTh.eq(index).width(  $(ele).outerWidth() - 1 );
        });
    };
 
    this.init = function (obj) {
        $win = $(window);
        $table = $(obj);
        this.clonehead();
        $table.after($newtable);
 
        this.event();
        this.check();
    };
}
 
$(function () {
    //设置table
    $('.fixtable').each(function(){
    	var tableHeadFix = new TableHeadFix();
    	tableHeadFix.init(this);
    });
});
 
/* 超简易HTML倒数时间
 * Super simple HTML countdown timer. Seriously, it couldn't get any simpler.
 * Written by Maru <maru@puella-magi.net>. Released under public domain.
 * Requires jQuery.
 *
 * <span class="countdown" data-until="2012/12/25 00:00:00">
 *   {DAY} days {HOUR} hours {MINUTE} minutes {SECOND} seconds
 * </span>
 */
(function(self) {
	$.each(self, function(i, elem) {
		var elem = $(elem);
		var targetDate = new Date(elem.data('until'));
		var template = elem.html();
		var counter = function() {
			var text = template;
			var dateDiff = Math.floor((targetDate - new Date()) / 1000);
			if(dateDiff>=0) {
				$.each({
					day: (Math.floor(dateDiff/86400) % 100000),
					hour: (Math.floor(dateDiff/3600) % 24),
					minute: (Math.floor(dateDiff/60) % 60),
					second: (Math.floor(dateDiff) % 60)
				}, function(k, v) {
					text = text.replace("{" + k.toUpperCase() + "}", v);
				});
				elem.html(text);
				setTimeout(counter, 1000);
			} else {
				$.each({
					day: (Math.floor(0)),
					hour: (Math.floor(0)),
					minute: (Math.floor(0)),
					second: (Math.floor(0))
				}, function(k, v) {
					text = text.replace("{" + k.toUpperCase() + "}", v);
				});
				elem.html(text);
				setTimeout(counter, 1000);
			}
		}
		counter();
	});
})($('.countdown'));
/* 逆転「チェンジエアブレイブ」
 *
 * <span class="countup" data-since="2012/12/25 00:00:00">
 *   {DAY} days {HOUR} hours {MINUTE} minutes {SECOND} seconds
 * </span>
 */
(function(self) {
	$.each(self, function(i, elem) {
		var elem = $(elem);
		var targetDate = new Date(elem.data('since'));
		var template = elem.html();
		var counter = function() {
			var text = template;
			var dateDiff = Math.floor((new Date() - targetDate) / 1000);
			if(dateDiff>=0) {
				$.each({
					day: (Math.floor(dateDiff/86400) % 100000),
					hour: (Math.floor(dateDiff/3600) % 24),
					minute: (Math.floor(dateDiff/60) % 60),
					second: (Math.floor(dateDiff) % 60)
				}, function(k, v) {
					text = text.replace("{" + k.toUpperCase() + "}", v);
				});
				elem.html(text);
				setTimeout(counter, 1000);
			} else {
				$.each({
					day: (Math.floor(0)),
					hour: (Math.floor(0)),
					minute: (Math.floor(0)),
					second: (Math.floor(0))
				}, function(k, v) {
					text = text.replace("{" + k.toUpperCase() + "}", v);
				});
				elem.html(text);
				setTimeout(counter, 1000);
			}
		}
		counter();
	});
})($('.countup'));
//日常,周常,月常,季常任务的倒计时
(function(self) {
	$.each(self, function(i, elem) {

        var stringTime = function(intTemp){
            return (intTemp < 10 ? ("0" + intTemp):intTemp);
        }

		var elem = $(elem);
        var timeSpan =  elem.children('.timer-time')[0];
        var template = $(timeSpan).html();
        var type = elem.data('type');
        var offset_GMT = new Date().getTimezoneOffset(); // 本地时间和格林威治的时间差,单位为分钟
        var date1 = new Date();
        var monthDay = new Array(31,(date1.getYear()%4&&((date1.getYear()%100!=0)||(date1.getYear()%400==0)) ? 29:28),31,30,31,30,31,31,30,31,30,31);
        var quarterDay = new Array(31 + (date1.getYear()%4&&((date1.getYear()%100!=0)||(date1.getYear()%400==0)) ? 29:28),(date1.getYear()%4&&((date1.getYear()%100!=0)||(date1.getYear()%400==0)) ? 29:28),92,61,31,92,62,31,91,61,30,62 + ((date1.getYear()+1)%4&&(((date1.getYear()+1)%100!=0)||((date1.getYear()+1)%400==0)) ? 29:28));

		var counter = function() {
            var tempDate = new Date().getTime(); // 本地时间距 1970 年 1 月 1 日午夜(GMT 时间)之间的毫秒数
            
            switch(type){
                case "day":
                    var timezone = 4; //目标时区时间
                    var nowDate = new Date(tempDate  + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
                    var text = template;
                    $.each({
                        hour:  stringTime(23 - nowDate.getHours()),
                        minute:  stringTime(59-nowDate.getMinutes()),
                        second:  stringTime(59-nowDate.getSeconds())
                    }, function(k, v) {
                        text = text.replace("{" + k.toUpperCase() + "}", v);
                    });
                    break;
                case "weekly":
                    var timezone = 4; //目标时区时间
                    var nowDate = new Date(tempDate  + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
                    var text = template;
                    $.each({
                        day:"0" + (nowDate.getDay() == 0 ? 0:7-nowDate.getDay()),
                        hour: stringTime(23 - nowDate.getHours()),
                        minute:  stringTime(59-nowDate.getMinutes()),
                        second:  stringTime(59-nowDate.getSeconds())
                    }, function(k, v) {
                        text = text.replace("{" + k.toUpperCase() + "}", v);
                    });
                    break;
                case "monthly":
                    var timezone = 4; //目标时区时间
                    var nowDate = new Date(tempDate  + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
                    var text = template;
                    $.each({
                        day: stringTime(monthDay[nowDate.getMonth()]-nowDate.getDate()),
                        hour:  stringTime(23 - nowDate.getHours()),
                        minute:  stringTime(59-nowDate.getMinutes()),
                        second:  stringTime(59-nowDate.getSeconds())
                    }, function(k, v) {
                        text = text.replace("{" + k.toUpperCase() + "}", v);
                    });
                    break;
                case "quarterly":
                    var timezone = 4; //目标时区时间
                    var nowDate = new Date(tempDate  + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
                    var text = template;
                    $.each({
                        day: stringTime(quarterDay[nowDate.getMonth()]-nowDate.getDate()),
                        hour:  stringTime(23 - nowDate.getHours()),
                        minute:  stringTime(59-nowDate.getMinutes()),
                        second:  stringTime(59-nowDate.getSeconds())
                    }, function(k, v) {
                        text = text.replace("{" + k.toUpperCase() + "}", v);
                    });
                    break;
                case "exercises":
                    var timezone = 6; //目标时区时间
                    var nowDate = new Date(tempDate  + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
                    var text = template;
                    $.each({
                        hour: stringTime(11 - nowDate.getHours()%12),
                        minute:  stringTime(59-nowDate.getMinutes()),
                        second:  stringTime(59-nowDate.getSeconds())
                    }, function(k, v) {
                        text = text.replace("{" + k.toUpperCase() + "}", v);
                    });
                    break;
                case "EO":
                    var timezone = 9; //目标时区时间
                    var nowDate = new Date(tempDate  + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
                    var text = template;
                    $.each({
                        day: stringTime(monthDay[nowDate.getMonth()]-nowDate.getDate()),
                        hour:  stringTime(23 - nowDate.getHours()),
                        minute:  stringTime(59-nowDate.getMinutes()),
                        second:  stringTime(59-nowDate.getSeconds())
                    }, function(k, v) {
                        text = text.replace("{" + k.toUpperCase() + "}", v);
                    });
                    break;
                case "rank":
                    var timezone = 11; //目标时区时间
                    var nowDate = new Date(tempDate  + offset_GMT * 60 * 1000 + timezone * 60 * 60 * 1000);
                    var text = template;
                    $.each({
                        day: stringTime(monthDay[nowDate.getMonth()]-nowDate.getDate()),
                        hour:  stringTime(23 - nowDate.getHours()),
                        minute:  stringTime(59-nowDate.getMinutes()),
                        second:  stringTime(59-nowDate.getSeconds())
                    }, function(k, v) {
                        text = text.replace("{" + k.toUpperCase() + "}", v);
                    });
                    break;
            }
			$(timeSpan).html(text);
            console.log("test");
            setTimeout(counter, 1000);
		}
		counter();
	});
})($('.timer'));
 
// Tables with class=zebra
$(document).ready(function() {
  // the "className" includes all the classes so we must use re;
  // CSS is case-sensitive anyway, so there is no point ignoring case:
  var re = /\bzebra\b/,  
    t = document.getElementsByTagName("TABLE"),
    n = t.length,
    r, nr;
  for (var i=0; i<n; i++) {
    if ( re.test(t[i].className)) {
      r = t[i].getElementsByTagName("TR");
      nr = r.length;
      for (var j=1; j < nr; j+=2) {
        if (r[j].className) { r[j].className += " stripe";}
        else r[j].className = "stripe";
      }
    }
  }
});

// Execute ext.lazyload after upload. Mod by Gizeta.
(function() {
	var state = mw.loader.moduleRegistry["mediawiki.special.upload"].state;
	if (state === "loading" || state === "ready") {
		mw.loader.using("mediawiki.special.upload", function() {
			var originFunc = window.wgUploadWarningObj.processResult;
			window.wgUploadWarningObj.processResult = function(result, fileName) {
				originFunc.call(this, result, fileName);
				if (mw.loader.moduleRegistry["ext.lazyload"].state === "ready")
					mw.loader.moduleRegistry["ext.lazyload"].script($, $);
			};
		});
	}
})();

// 自定义浮动目录样式添加
$(function(){
    var toc = $('#toc');
    if (!toc.hasClass('toc-custom-disable')) {
        var tocAfter = toc.clone().addClass('toc-custom');
    $("body").append(tocAfter);
	tocAfter.css('marginRight', -Math.min(tocAfter.outerWidth(), 240));
    }
});

//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(i.attr("data-text"));
         });
      }else {
         dest.slideDown('fast',function(){
            spen.html(spen.attr('data-st'));
             i.removeClass("fa-plus-square").addClass("fa-minus-square").html("");
         });
      }
    });
});

// 悬浮海图
$(document).ready(function(){
    if($(".fixed-map").length>0){
        document.ondragstart = function() {return false;}
        $(document).scroll(function(e){
            var offsetTop = $(".fixed-map").offset().top;
            var offsetTop2 = $(".mw-content-ltr").offset().top;
            var windowScrollTop = $(window).scrollTop();
            if(offsetTop >= windowScrollTop || offsetTop2 + $(".mw-content-ltr").height() <= windowScrollTop){
                $(".float-map").css({display:"none"});
            } else {
                $(".float-map").css({display:""});
            }
        });
        var _moving = false;
        var _x, _y;
        $(".float-map").mousedown(function(e){
            _moving = true;
            _x = e.pageX - parseInt($(".float-map").css("left"));
            _y = e.pageY - parseInt($(".float-map").css("top"));
            $(".float-map").fadeTo(20, 0.25);
        }).mouseover(function(){
    	    $(".float-map").fadeTo("fast", 0.25);
        }).mouseout(function(){
    	    $(".float-map").fadeTo("fast", 1);
        });
        $(document).mousemove(function(e){
            if(_moving){
                var edge = 10, x = e.pageX - _x, y = e.pageY - _y;
                var maxX = $(window).width() - $(".float-map").width();
                var maxY = $(window).height() - $(".float-map").height();
                var _left = x > maxX ? maxX - edge : x > edge ? x : edge;
                var _top  = y > maxY ? maxY - edge : y > edge ? y : edge;
                $(".float-map").css({top: _top, left: _left, right:""});
            }
        }).mouseup(function(){
            _moving = false;
            $(".float-map").fadeTo("fast", 1);
        });
    }
});

//复制修改内容
/* 本段js引用自萌娘百科 https://zh.moegirl.org/MediaWiki:Common.js */
function copyRights(select) {
var div = $('<div>', {
css: {
position: 'absolute',
left: '-99999px',
'z-index': '-99999'
},
html: '<div></div><br>阅读更多:' + window.location.href + '<br>本文引自kcwiki舰娘百科(https://zh.kcwiki.moe/),文字内容遵守CC BY-NC-SA协议。'
}).appendTo('body'),
valueDiv = div.find('div');
$(document.body).on('copy', function() {
var selection = select(),
value = selection.toString().split('\n'),
range = selection.getRangeAt(0);
if (!value || value.join('').length < 128 //当复制内容为空或长度小于定值时不添加声明
|| $(selection.anchorNode).add(selection.basenode).add(selection.focusNode).closest('.Wikiplus-InterBox')[0]) //如果选中了wikiplus的内容
return;
value.forEach(function(v) {
valueDiv.append($('<div>', {
text: v
}));
});
selection.selectAllChildren(div[0]);
window.setTimeout(function() { //以下将还原选区
selection.removeAllRanges();
selection.addRange(range);
valueDiv.empty();
}, 0);
});
}
$(function(){
if (window.getSelection && mw.config.get('wgUserGroups').indexOf('sysop') + mw.config.get('wgUserGroups').indexOf('patroller') == -2 && ['edit', 'submit'].indexOf(mw.config.get('wgAction')) === -1)
	copyRights(window.getSelection);
});

/* nolazyout */
$(document).ready(function(){
	$('.no-lazy').each(function() {
	    if ($(this).data('url')) {
	        var img = this.tagName.toUpperCase() == 'IMG' ? $(this) : $('<img />');
	        img.off("load").one('load', function(e) {
	            if ($(this).prop('tagName').toUpperCase() != 'IMG') {
	                $(this).html(img);
	            }
	            img.show();
	            if ($(this).hasClass('apng') && window.APNG) {
	                APNG.ifNeeded(function() {
	                    APNG.animateImage(img.get(0));
	                });
	            }
	        });
	
	        img.attr('src', $(this).data('url'));
	        img.removeAttr('data-url');
	        if (img.data('srcset')) {
	            img.attr('srcset', img.data('srcset'));
	            img.removeAttr('data-srcset');
	            var testImage = new Image();
	
	            if ($.fn.hidpi && $.devicePixelRatio() > 1 && testImage.srcset === undefined) {
	                var srcset = img.attr('srcset'),
	                    match;
	                if (typeof srcset === 'string' && srcset !== '') {
	                    match = $.matchSrcSet(devicePixelRatio, srcset);
	                    if (match !== null) {
	                        img.attr('src', match);
	                    }
	                }
	            }
	        }
	        
	        $(this).off("appear").on("appear",function(e){})
	    }
	});
});
// End of Disable LazyLoad

/*
== 編輯工具欄 ==
*/

/**
 * tip for custom edittools
 * 
 * Maintainers: fdcn@zh.wikipedia
 */
$( '#wpSummaryLabel .mw-summary-preset' ).on( 'click', '.mw-summary-preset-item a', function( e ) {
    e.preventDefault();
    var $this = $( this ), summary = $( '#wpSummary' ).val();
    var $item = $this.parent( '.mw-summary-preset-item' );
    summary = summary.replace( /\s+$/g, '' );
    if ( summary != '' ) {
        summary += ' ';
    }
    summary += $item.attr( 'title' ) || $this.text();
    $this.replaceWith( $this.contents() );
    $( '#wpSummary' ).val( summary );
} );

//Tabs
//本文引自萌娘百科(https://zh.moegirl.org/),文字内容遵守【知识共享 署名-非商业性使用-相同方式共享 3.0】协议。
$(document).ready(function(){
    function tabs() {
        var defaultStyle = {
            purple: {
                labelColor: ' ', //anti check
                labelBackgroundColor: '#9070c0',
                labelBorderColor: '#b090e0 #7050a0 #9070c0 #b090e0',
                labelPadding: '.2em .3em .2em .3em',
                textBorderColor: '#9070c0',
                textBackgroundColor: '#f0edf5',
                textPadding: '1em'
            },
            green: {
                labelColor: ' ',
                labelBackgroundColor: '#75c045',
                labelBorderColor: '#90d060 #60b030 #75c045 #90d060',
                labelPadding: '.2em .3em .2em .3em',
                textBorderColor: '#75c045 #60b030 #60b030 #75c045',
                textBackgroundColor: '#f5fffa',
                textPadding: '1em'
            },
            red: {
                labelColor: ' ',
                labelBackgroundColor: '#FF0000',
                labelBorderColor: '#FF8888 #CC0000 #FF0000 #FF8888',
                labelPadding: '.2em .3em .2em .3em',
                textBorderColor: '#FF0000 #CC0000 #CC0000 #FF0000',
                textBackgroundColor: '#fffafa',
                textPadding: '1em'
            },
            blue: {
                labelColor: ' ',
                labelBackgroundColor: '#5b8dd6',
                labelBorderColor: '#88abde #3379de #5b8dd6 #88abde',
                labelPadding: '.2em .3em .2em .3em',
                textBackgroundColor: '#f0f8ff',
                textBorderColor: '#5b8dd6 #3379de #3379de #5b8dd6',
                textPadding: '1em'
            },
            yellow: {
                labelColor: ' ',
                labelBackgroundColor: '#ffe147',
                labelBorderColor: '#ffe977 #ffd813 #ffe147 #ffe977',
                labelPadding: '.2em .3em .2em .3em',
                textBackgroundColor: '#fffce8',
                textBorderColor: '#ffe147 #ffd813 #ffd813 #ffe147',
                textPadding: '1em'
            },
            orange: {
                labelColor: ' ',
                labelBackgroundColor: '#ff9d42',
                labelBorderColor: '#ffac5d #ff820e #ff9d42 #ffac5d',
                labelPadding: '.2em .3em .2em .3em',
                textBackgroundColor: '#ffeedd',
                textBorderColor: '#ff9d42 #ff820e #ff820e #ff9d42',
                textPadding: '1em'
            },
            black: {
                labelColor: ' ',
                labelBackgroundColor: '#7f7f7f',
                labelBorderColor: '#999999 #4c4c4c #7f7f7f #999999',
                labelPadding: '.2em .3em .2em .3em',
                textBackgroundColor: '#e5e5e5',
                textBorderColor: '#7f7f7f #4c4c4c #4c4c4c #7f7f7f',
                textPadding: '1em'
            }
        };
        $('body').addClass('tab');
        // A Class
        function StyleSheet() {}
        StyleSheet.prototype.getOwnPropertyNamesLength = function getOwnPropertyNamesLength() {
            return Object.getOwnPropertyNames(this).length;
        };
        String.prototype.toLowerFirstCase = function toLowerFirstCase() {
            return this[0].toLowerCase() + this.substring(1);
        };
        $('.Tabs').each(function(i) {
            if ($(this).children('.TabLabel')[0]) return true;
            var self = $(this),
                data = $.extend({
                    labelPadding: null,
                    labelBorderColor: null,
                    labelColor: null,
                    labelBackgroundColor: $('#content').css('background-color'),
                    textPadding: null,
                    textBorderColor: null,
                    textBackgroundColor: null,
                    defaultTab: 1,
                }, self.attr('class').length > 4 ? defaultStyle[self.attr('class').slice(5)] || {} : {}, this.dataset || {}),
                tabLabel = self.append('<div class="TabLabel"></div>').children('.TabLabel'),
                tabContent = self.append('<div class="TabContent"></div>').children('.TabContent'),
                labelPadding = data.labelPadding,
                labelColor = data.labelColor,
                styleSheet = {
                    label: new StyleSheet(),
                    text: new StyleSheet()
                },
                defaultTab = parseInt(data.defaultTab);
            self.children('.Tab').each(function() {
                if ($(this).children('.TabLabelText').text().replace(/\s/g, '')) {
                    $(this).children('.TabLabelText').appendTo(tabLabel);
                    $(this).children('.TabContentText').appendTo(self.children('.TabContent'));
                }
                $(this).remove();
            });
            if (isNaN(defaultTab) || defaultTab <= 0 || defaultTab > tabLabel.children('.TabLabelText').length) defaultTab = 1;
            tabLabel.children('.TabLabelText').on('click', function() {
                var label = $(this);
                label.addClass('selected').siblings().removeClass('selected').css({
                    'border-color': '#aaa',
                    'background-color': 'inherit'
                });
                tabContent.children('.TabContentText').eq(tabLabel.children('.TabLabelText').index(label)).addClass('selected').siblings().removeClass('selected').removeAttr('style');
                if (styleSheet.label.getOwnPropertyNamesLength()) label.css(styleSheet.label);
                if (label.is(':visible')) tabLabel.height(label.outerHeight(true));
                else tabLabel.removeAttr('style');
            }).eq(defaultTab - 1).click();
            if (labelPadding) tabLabel.children('.TabLabelText').css('padding', labelPadding);
            ['labelBorderColor', 'labelBackgroundColor', 'textPadding', 'textBorderColor', 'textBackgroundColor'].forEach(function(n) {
                var target = /^label/.test(n) ? 'label' : 'text',
                    key = n.replace(target, '').toLowerFirstCase();
                styleSheet[target][key] = data[n];
            });
            if (labelColor) styleSheet.label.borderTopColor = labelColor;
            else if (styleSheet.label.borderColor) styleSheet.label.borderTopColor = 'green';
            tabLabel.find('.selected').click();
            if (styleSheet.text.getOwnPropertyNamesLength()) tabContent.css(styleSheet.text);
            if (data.autoWidth == 'yes') self.css('display', 'inline-block');
        });
    }
    if ($('.Tabs')[0]) tabs();
})

$().ready(function(){
	var temp = "<div style='margin-top:10px;font-size:15px;color:#00897b;background-color:#e0f2f1;padding:15px;border-color:#ebccd1;border:1px solid transparent;border-radius:4px;' class='comment-tips'><span>舰娘百科提醒您:<br>评论区内容为访客自发提交,不代表本站观点。如涉及攻略配装等内容,请自行对其内容是否适用加以判断!</span></div>";
    $(".comment-header").after(temp);
})