欢迎来到Minecraft插件百科!
对百科编辑一脸懵逼?
帮助:快速入门
带您快速熟悉百科编辑!
因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289
查看“MediaWiki:Common.js”的源代码
←
MediaWiki:Common.js
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于这些用户组的用户使用:
用户
、
自动确认用户
、
巡查者
该页提供此wiki软件的界面文字,它已被保护以防止恶意修改。如欲修改所有wiki的翻译,请到
translatewiki.net
上的MediaWiki本地化计划。
您可以查看与复制此页面的源代码。
/* 这里的任何JavaScript将在全站加载 * 此代码根据知识共享 署名-非商业性使用-相同方式共享 3.0复制自萌娘百科http://zh.moegirl.org/MediaWiki:Common.css * 版权协定:知识共享 署名-非商业性使用-相同方式共享 3.0 */ (function($, mw) { //使用匿名函数防止污染顶级变量 /* 函数定义体 */ //滚动公告 function AutoScroll(obj) { $(obj).find("ul:first").animate({ marginTop: "-25px" }, 500, function() { $(this).css({ marginTop: "0px" }).find("li:first").appendTo(this); }); } //Tabs function tabs() { $('body').addClass('tab'); $('.Tabs').each(function(i) { if ($(this).find('.TabLabel')[0]) return true; var self = $(this), data = $.extend({ labelPadding: null, labelBorderColor: null, labelColor: null, labelBackgroundColor: $('body').css('background-color'), textPadding: null, textBorderColor: null, textBackgroundColor: null, defaultTab: 1, }, self.attr('class').length > 4 ? { 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' } }[self.attr('class').slice(5)] || {} : {}, this.dataset), tabLabel = self.append('<div class="TabLabel"></div>').find('.TabLabel'), tabContent = self.append('<div class="TabContent"></div>').find('.TabContent'), labelPadding = data.labelPadding, labelBorderColor = data.labelBorderColor, labelBackgroundColor = data.labelBackgroundColor, labelColor = data.labelColor, textPadding = data.textPadding, textBorderColor = data.textBorderColor, textBackgroundColor = data.textBackgroundColor, labelStyleSheet = {}, textStyleSheet = {}, dafaultTab, objectLength = function(obj) { return Object.getOwnPropertyNames(obj).length; }; self.find('.Tab').each(function() { $(this).find('.TabLabelText').appendTo(self.find('.TabLabel')); $(this).find('.TabContentText').appendTo(self.find('.TabContent')); $(this).remove(); }); defaultTab = parseInt(data.defaultTab); if (isNaN(defaultTab) || defaultTab <= 0 || defaultTab > self.find('.TabLabelText').length) defaultTab = 1; self.find('.TabLabelText').bind('click', function() { var label = $(this); label.addClass('selected').siblings().removeClass('selected').css({ 'border-color': 'inherit', 'background-color': 'inherit' }); self.find('.TabContentText').eq(self.find('.TabLabelText').index(label)).addClass('selected').siblings().removeClass('selected').removeAttr('style'); if (objectLength(labelStyleSheet)) label.css(labelStyleSheet); self.find('.TabLabel').height(label.height() + parseFloat(label.css('padding-top')) + parseFloat(label.css('padding-bottom')) + 2); }).eq(defaultTab - 1).click(); if (labelPadding) self.find('.TabLabelText').css('padding', labelPadding); if (labelBorderColor) labelStyleSheet.borderColor = labelBorderColor; if (labelBackgroundColor) labelStyleSheet.backgroundColor = labelBackgroundColor; if (labelColor) labelStyleSheet.borderTopColor = labelColor; else if (labelStyleSheet.borderColor) labelStyleSheet.borderTopColor = 'green'; if (textPadding) textStyleSheet.padding = textPadding; if (textBorderColor) textStyleSheet.borderColor = textBorderColor; if (textBackgroundColor) textStyleSheet.backgroundColor = textBackgroundColor; tabLabel.find('.selected').click(); if (objectLength(textStyleSheet)) tabContent.css(textStyleSheet); if (data.autoWidth == 'yes') self.css('display', 'inline-block'); }); } //子页面页顶链接 function subpage_links() { if (mw.config.values.wgPageName.indexOf('/') != -1 && !$('.subpages')[0] && (mw.config.values.wgNamespaceIds.special != mw.config.values.wgNamespaceNumber || mw.config.values.wgPageName.indexOf('Special:移动页面') != -1)) { var links = mw.config.values.wgPageName.split('/'), link = '', subpages = $('<span class="subpages"></span>').text('<'), length = links.length - 1, index; if (mw.config.values.wgPageName.indexOf('Special:移动页面') != -1) links.splice(0, 1); for (index = 0; index < length; index++) { link += '/' + links[index]; subpages.append($('<a/>', { text: ' ' + links[index], href: link })); if (length - index - 1) subpages.append(" |"); } $('#contentSub').prepend(subpages); } } //由于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(); } //重复文件列表函数 function duplicatedFileList() { if (window.location.href.indexOf("title") == -1) window.location.replace("http://mineplugin.org/index.php?title=Special:ListDuplicatedFiles&limit=500&offset=0"); $('#mw-content-text .mw-spcontent ol').attr("id", "picOl"); $('#picOl').before('<p id="picOlTitle">图片列表:</p>').after('<p id="MP3OlTitle">MP3列表:</p><ol start="1" id="MP3Ol"></ol>'); $("#picOlTitle, #MP3OlTitle").hide(); $("#picOl").find("[href$='.mp3'], [href$='.ogg']").parent().appendTo("#MP3Ol"); if ($("#picOl").find("li").length) $("#picOlTitle").show(); if ($("#MP3Ol").find("li").length) $("#MP3OlTitle").show(); $(".mw-spcontent > p:nth-child(1), .mw-spcontent > p:nth-child(2), .mw-spcontent > p:nth-child(7)").hide(); } /* 函数执行体 */ $(function() { //滚动公告 setInterval(function() { AutoScroll("#scrollDiv"); }, 5000); // Add "mainpage" class to the body element if (mw.config.values.wgMainPageTitle === mw.config.values.wgPageName && mw.config.values.wgAction === 'view') $('body').addClass('mainpage'); //重复文件列表区分图片和音频 if ($(".mw-special-ListDuplicatedFiles").length && $('.mw-spcontent > p').length > 1) duplicatedFileList(); //需要时载入对应的 scripts if (mw.config.values.wgAction == "edit" || mw.config.values.wgAction == "submit" || mw.config.values.wgCanonicalSpecialPageName == 'Search') importScript('MediaWiki:Common.js/edit.js'); // Tabs执行 if ($('.Tabs')[0]) tabs(); //missedhideHideFun执行 var missedHide = $('#mw-content-text').nextAll().filter('.mw-collapsible').not(':has(.mw-collapsible-toggle)'); if (missedHide[0]) missedHideFun(missedHide); //子页面页顶链接 subpage_links(); //以下代码必须在全部内容加载完成后才能正常工作 $(window).bind('load', function() { //语言对应 $('.mw-helplink').each(function() { var linkHref = this.href; if (linkHref.indexOf('/zh') != linkHref.length - 3) this.href += '/zh'; }); }); }); })(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量以防止冲突 document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", '<link rel="shortcut icon" type="image/png" href="/skins/common/Mineplugin_logo.png">'); /* Mobile view */ if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) { if (mw.config.values.wgPageName !== "首页") { document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeend", '<meta name="viewport" content="width=device-width, initial-scale=1.0">'); $(document).ready(function () { $("#mw-panel").hide(); }); $(".mw-body").css("margin-left", "0px"); $("#left-navigation").css("margin-left", "0px"); $("#p-personal ul").css("padding-left", "0px"); $("#footer").css("margin-left", "0px"); $("#mw-head").append('<div id="p-logo" role="banner" style="position: absolute; top: -50px; left: -50px; transform: scale(0.5); z-index: 1;"><a class="mw-wiki-logo" href="/%E9%A6%96%E9%A1%B5" title="Visit the main page"></a></div>'); } }
该页面使用的模板:
模板:Hide
(
查看源代码
)
返回至
MediaWiki:Common.js
。
导航菜单
个人工具
中文(中国大陆)
登录
名字空间
消息
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
编辑相关
百科公告
编辑帮助
互助客栈
贡献分数
测试沙盒
发布条目
插件分类
管理
安全
聊天
编程
经济
修正
娱乐
综合
信息
机械
角色
传送
网页
整地
创世
付费
其它
工具
链入页面
相关更改
特殊页面
页面信息
相关网站
MCMOD百科
Minecraft中文百科
Minecraft中文论坛
Minecraft百度贴吧
虚无世界Wiki