跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
帮助
百科公告
编辑帮助
测试沙盒
快速入门
格式规范
分类索引
电影
小说
游戏
项目
语言
语言链接位于页面顶部,标题的另一侧。
DragonWiki翼爪维基
搜索
搜索
中文(中国大陆)
登录
个人工具
登录
愿飞龙常入你梦乡!
欢迎来到DragonWiki翼爪维基 - 关于龙的百科全书!
对百科编辑一脸懵逼?
帮助:快速入门
带您快速熟悉百科编辑!
DragonWiki翼爪维基委员会企鹅群:930677471
我们正在招募百科编辑者,有兴趣的编辑者可以进群了解
查看“MediaWiki:Common.js”的源代码
系统消息
讨论
English
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
常规
链入页面
相关更改
特殊页面
页面信息
←
MediaWiki:Common.js
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
此页面为本wiki上的软件提供界面文本,并受到保护以防止滥用。 如欲修改所有wiki的翻译,请访问
translatewiki.net
上的MediaWiki本地化项目。
您无权编辑此JavaScript页面,因为编辑此页面可能会影响所有访问者。
您可以查看和复制此页面的源代码。
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ /* 这里的任何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("https://zh.furrywiki.cn/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() { mw.loader.using("jquery.client", function() { if ($.client.profile().name === "safari") { $(".heimu").on("click", function() { $(this).toggleClass("off"); }); } }); //滚动公告 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="/resources/assets/wikiicon.png">');
本页使用的模板:
模板:Hide
(
查看源代码
)(受保护)
返回
MediaWiki:Common.js
。
开关有限宽度模式