MediaWiki:Common.js:修订间差异
imported>=海豚= 无编辑摘要 |
小 fix |
||
| (未显示3个用户的37个中间版本) | |||
| 第1行: | 第1行: | ||
/* | /* 这里的任何JavaScript将在全站加载 */ | ||
// <nowiki> | // <nowiki> | ||
"use strict"; | "use strict"; | ||
(function($, mw) { //使用匿名函数防止污染顶级变量 | (function($, mw) { //使用匿名函数防止污染顶级变量 | ||
| 第53行: | 第48行: | ||
} | } | ||
autoScroll("#scrollDiv"); | autoScroll("#scrollDiv"); | ||
/* MediaViewer#populateStatsFromXhr 错误屏蔽 */ | /* MediaViewer#populateStatsFromXhr 错误屏蔽 */ | ||
(function() { | (function() { | ||
| 第98行: | 第87行: | ||
$(".mw-mmv-image").off("click")[0].addEventListener("click", function(e) { | $(".mw-mmv-image").off("click")[0].addEventListener("click", function(e) { | ||
if ($(e.target).is("img")) { | if ($(e.target).is("img")) { | ||
window.open($(e.target).attr("src").replace(/(www\.hmoegirl\. | window.open($(e.target).attr("src").replace(/(www\.hmoegirl\.info\/common\/)thumb\/([a-z\d]+\/[a-z\d]+\/)([^/]+)\/\d+px-\3/i, "$1$2$3"), "_blank").focus(); | ||
e.preventDefault(); | e.preventDefault(); | ||
e.stopPropagation(); | e.stopPropagation(); | ||
| 第115行: | 第104行: | ||
}, 137); | }, 137); | ||
} | } | ||
//修复代码编辑器$.ucFirst引用错误 | |||
$.extend({ | |||
ucFirst: function (_s) { | |||
var s = _s + ""; | |||
return s.charAt(0).toUpperCase() + s.substring(1); | |||
}, | |||
}); | |||
//子页面页顶链接 | //子页面页顶链接 | ||
function subpage_links() { | function subpage_links() { | ||
| 第147行: | 第143行: | ||
//重复文件列表函数 | //重复文件列表函数 | ||
function duplicatedFileList() { | function duplicatedFileList() { | ||
if (window.location.href.indexOf("title") === -1) { window.location.replace("http://www.hmoegirl. | if (window.location.href.indexOf("title") === -1) { window.location.replace("http://www.hmoegirl.info/index.php?title=Special:ListDuplicatedFiles&limit=500&offset=0"); } | ||
$("#mw-content-text .mw-spcontent ol").attr("id", | $("#mw-content-text .mw-spcontent ol").attr("id", | ||
"picOl"); | "picOl"); | ||
| 第157行: | 第153行: | ||
$(".mw-spcontent > p:nth-child(1), .mw-spcontent > p:nth-child(2), .mw-spcontent > p:nth-child(7)").hide(); | $(".mw-spcontent > p:nth-child(1), .mw-spcontent > p:nth-child(2), .mw-spcontent > p:nth-child(7)").hide(); | ||
} | } | ||
// | //关键词警告 | ||
function antiAbuseListener(textarea, event) { | function antiAbuseListener(textarea, event) { | ||
var filters = [ | var filters = [ | ||
"{{即将删除", | "{{即将删除", | ||
"{{挂删", | "{{挂删", | ||
"{{模板:即将删除", | "{{模板:即将删除", | ||
"{{template:即将删除", | "{{template:即将删除", | ||
"[[分类:即将删除的页面]]", | |||
"[[分类:即将删除的页面 | "[[category:即将删除的页面]]", | ||
"开发票", | |||
"[[category:即将删除的页面", | "支那", | ||
" | "zhina", | ||
" | |||
" | |||
]; | ]; | ||
var text1 = textarea.value; | var text1 = textarea.value; | ||
| 第198行: | 第182行: | ||
$("body").append(windowManager.$element); | $("body").append(windowManager.$element); | ||
windowManager.addWindows([messageDialog]); | windowManager.addWindows([messageDialog]); | ||
messageDialog.title.$label.html("H萌娘提醒您 | messageDialog.title.$label.html("H萌娘提醒您"); | ||
messageDialog.message.$label.html("<br> | messageDialog.message.$label.html("<br>您提交的内容包含以下违规内容,被禁止提交:<br><br><ul>" + results.map(function (result) { | ||
return "<li>" + result + "</li>"; | return "<li>" + result + "</li>"; | ||
}).join("") + '</ul><br> | }).join("") + '</ul><br>如果您认为您的编辑无误,请在自行保存编辑内容后到讨论版提问!'); | ||
windowManager.openWindow(messageDialog, { | windowManager.openWindow(messageDialog, { | ||
actions: [{ | actions: [{ | ||
| 第295行: | 第279行: | ||
container.append("您虽然无权编辑本页面,但您可以点击右侧按钮在本页的讨论页提出编辑请求,让可以编辑的人代为编辑:"); | container.append("您虽然无权编辑本页面,但您可以点击右侧按钮在本页的讨论页提出编辑请求,让可以编辑的人代为编辑:"); | ||
$("<span/>").addClass("newComment").text("提出编辑请求").on("click", function() { | $("<span/>").addClass("newComment").text("提出编辑请求").on("click", function() { | ||
window.open("https://www.hmoegirl. | window.open("https://www.hmoegirl.info/index.php?action=edit&preload=Template:编辑请求/comment&preloadtitle=编辑请求 - " + mw.config.get("wgUserName") + "§ion=new&title=" + talkpage, "_blank"); | ||
}).appendTo(container); | }).appendTo(container); | ||
$("#mw-content-text").children(".wikiEditor-ui:first, textarea[readonly]:first").before("<hr>").before(container); | $("#mw-content-text").children(".wikiEditor-ui:first, textarea[readonly]:first").before("<hr>").before(container); | ||
| 第356行: | 第340行: | ||
}); | }); | ||
} | } | ||
}); | }); | ||
})(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量以防止冲突 | })(jQuery, mediaWiki); //立即执行匿名函数并传递原始变量以防止冲突 | ||
// </nowiki> | // </nowiki> | ||