恪別𡧲版𢯢𢷮𧵑「MediaWiki:Gadget-morebits.js」

造張𡤔𢭲內容「// <nowiki> // vim: set noet sts=0 sw=8: /** * morebits.js * =========== * A library full of lots of goodness for user scripts on MediaWiki wikis, including Wikipedia…」
 
n 𠊝替文本-「,」成「、」
𣳔1.493: 𣳔1.493:
returnError: function() {
returnError: function() {
if ( this.errorCode === "badtoken" ) {
if ( this.errorCode === "badtoken" ) {
this.statelem.error( "无效令牌,请刷新页面并重试" );
this.statelem.error( "无效令牌、请刷新页面并重试" );
} else {
} else {
this.statelem.error( this.errorText );
this.statelem.error( this.errorText );
𣳔2.019: 𣳔2.019:
!confirm('您即将编辑全保护页面 "' + ctx.pageName +
!confirm('您即将编辑全保护页面 "' + ctx.pageName +
(ctx.fullyProtected === 'infinity' ? '(永久)' : ('(到期:' + ctx.fullyProtected + ')')) +
(ctx.fullyProtected === 'infinity' ? '(永久)' : ('(到期:' + ctx.fullyProtected + ')')) +
'。\n\n点击确定以确定,或点击取消以取消。')) {
'。\n\n点击确定以确定、或点击取消以取消。')) {
ctx.statusElement.error("对全保护页面的编辑被取消。");
ctx.statusElement.error("对全保护页面的编辑被取消。");
ctx.onSaveFailure(this);
ctx.onSaveFailure(this);
𣳔2.501: 𣳔2.501:
code.style.fontFamily = "monospace";
code.style.fontFamily = "monospace";
code.appendChild(document.createTextNode(blacklist));
code.appendChild(document.createTextNode(blacklist));
ctx.statusElement.error(['不能保存页面,因URL ', code, ' 在垃圾黑名单中。']);
ctx.statusElement.error(['不能保存页面、因URL ', code, ' 在垃圾黑名单中。']);
} else if ( $(xml).find('captcha').length > 0 ) {
} else if ( $(xml).find('captcha').length > 0 ) {
ctx.statusElement.error("不能保存页面,因服务器试图让您完成一个全自动区分计算机和人类的图灵测试。");
ctx.statusElement.error("不能保存页面、因服务器试图让您完成一个全自动区分计算机和人类的图灵测试。");
} else if ( $editNode.attr('code') === 'abusefilter-disallowed' ) {
} else if ( $editNode.attr('code') === 'abusefilter-disallowed' ) {
ctx.statusElement.error('编辑被防滥用过滤器规则“' + $editNode.attr('info').substring(17) + '”阻止。');
ctx.statusElement.error('编辑被防滥用过滤器规则“' + $editNode.attr('info').substring(17) + '”阻止。');
𣳔2.512: 𣳔2.512:
div.style.color = "black";
div.style.color = "black";
div.innerHTML = $editNode.attr('warning');
div.innerHTML = $editNode.attr('warning');
ctx.statusElement.error([ '防滥用过滤器给出了如下警告:', div, '如果您仍希望做出该编辑,请重新提交。此警告不会再次出现。' ]);
ctx.statusElement.error([ '防滥用过滤器给出了如下警告:', div, '如果您仍希望做出该编辑、请重新提交。此警告不会再次出现。' ]);
// XXX provide the user with a way to automatically retry the action if they so choose -
// XXX provide the user with a way to automatically retry the action if they so choose -
// I can't see how to do this without creating a UI dependency on Morebits.wiki.page though -- TTO
// I can't see how to do this without creating a UI dependency on Morebits.wiki.page though -- TTO
𣳔2.539: 𣳔2.539:
};
};


var purgeApi = new Morebits.wiki.api("检测到编辑冲突,更新服务器缓存", purgeQuery, null, ctx.statusElement);
var purgeApi = new Morebits.wiki.api("检测到编辑冲突、更新服务器缓存", purgeQuery, null, ctx.statusElement);
var result = purgeApi.post( { async: false } );  // just wait for it, result is for debugging
var result = purgeApi.post( { async: false } );  // just wait for it, result is for debugging


--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds
--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds


ctx.statusElement.info("检测到编辑冲突,重试修改");
ctx.statusElement.info("检测到编辑冲突、重试修改");
if (fnCanUseMwUserToken('edit')) {
if (fnCanUseMwUserToken('edit')) {
ctx.saveApi.post(); // necessarily append or prepend, so this should work as desired
ctx.saveApi.post(); // necessarily append or prepend, so this should work as desired
𣳔2.555: 𣳔2.555:
} else if ( errorCode === "notoken" && ctx.conflictRetries++ < ctx.maxConflictRetries ) {
} else if ( errorCode === "notoken" && ctx.conflictRetries++ < ctx.maxConflictRetries ) {


ctx.statusElement.info("编辑令牌不可用,重试");
ctx.statusElement.info("编辑令牌不可用、重试");
--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds
--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds
if (fnCanUseMwUserToken('edit')) {
if (fnCanUseMwUserToken('edit')) {
𣳔2.567: 𣳔2.567:


// the error might be transient, so try again
// the error might be transient, so try again
ctx.statusElement.info("保存失败,重试");
ctx.statusElement.info("保存失败、重试");
--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds
--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds
ctx.saveApi.post(); // give it another go!
ctx.saveApi.post(); // give it another go!
𣳔2.608: 𣳔2.608:


if ($(xml).find('page').attr('missing') === "") {
if ($(xml).find('page').attr('missing') === "") {
ctx.statusElement.error("不能移动页面,因其已不存在");
ctx.statusElement.error("不能移动页面、因其已不存在");
ctx.onMoveFailure(this);
ctx.onMoveFailure(this);
return;
return;
𣳔2.619: 𣳔2.619:
!confirm('您即将移动全保护页面“' + ctx.pageName + '”' +
!confirm('您即将移动全保护页面“' + ctx.pageName + '”' +
(editprot.attr('expiry') === 'infinity' ? '(永久)' : ('(到期:' + editprot.attr('expiry') + ')')) +
(editprot.attr('expiry') === 'infinity' ? '(永久)' : ('(到期:' + editprot.attr('expiry') + ')')) +
'。\n\n点击确定以确定,或点击取消以取消。')) {
'。\n\n点击确定以确定、或点击取消以取消。')) {
ctx.statusElement.error("对全保护页面的移动已取消。");
ctx.statusElement.error("对全保护页面的移动已取消。");
ctx.onMoveFailure(this);
ctx.onMoveFailure(this);
𣳔2.668: 𣳔2.668:


if ($(xml).find('page').attr('missing') === "") {
if ($(xml).find('page').attr('missing') === "") {
ctx.statusElement.error("不能删除页面,因其已不存在");
ctx.statusElement.error("不能删除页面、因其已不存在");
ctx.onDeleteFailure(this);
ctx.onDeleteFailure(this);
return;
return;
𣳔2.678: 𣳔2.678:
!confirm('您即将删除全保护页面“' + ctx.pageName + "”" +
!confirm('您即将删除全保护页面“' + ctx.pageName + "”" +
(editprot.attr('expiry') === 'infinity' ? '(永久)' : ('(到期 ' + editprot.attr('expiry') + ')')) +
(editprot.attr('expiry') === 'infinity' ? '(永久)' : ('(到期 ' + editprot.attr('expiry') + ')')) +
'。\n\n点击确定以确定,或点击取消以取消。')) {
'。\n\n点击确定以确定、或点击取消以取消。')) {
ctx.statusElement.error("对全保护页面的删除已取消。");
ctx.statusElement.error("对全保护页面的删除已取消。");
ctx.onDeleteFailure(this);
ctx.onDeleteFailure(this);
𣳔2.717: 𣳔2.717:
if ( errorCode === "internal_api_error_DBQueryError" && ctx.retries++ < ctx.maxRetries ) {
if ( errorCode === "internal_api_error_DBQueryError" && ctx.retries++ < ctx.maxRetries ) {


ctx.statusElement.info("数据库查询错误,重试");
ctx.statusElement.info("数据库查询错误、重试");
--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds
--Morebits.wiki.numberOfActionsLeft;  // allow for normal completion if retry succeeds
ctx.deleteProcessApi.post(); // give it another go!
ctx.deleteProcessApi.post(); // give it another go!
𣳔2.724: 𣳔2.724:
// this is pathetic, but given the current state of Morebits.wiki.page it would
// this is pathetic, but given the current state of Morebits.wiki.page it would
// be a dog's breakfast to try and fix this
// be a dog's breakfast to try and fix this
ctx.statusElement.error("无效令牌,请刷新页面并重试。");
ctx.statusElement.error("无效令牌、请刷新页面并重试。");
if (ctx.onDeleteFailure) {
if (ctx.onDeleteFailure) {
ctx.onDeleteFailure.call(this, this, ctx.deleteProcessApi);
ctx.onDeleteFailure.call(this, this, ctx.deleteProcessApi);
𣳔2.731: 𣳔2.731:
} else if ( errorCode === "missingtitle" ) {
} else if ( errorCode === "missingtitle" ) {


ctx.statusElement.error("不能删除页面,因其已不存在");
ctx.statusElement.error("不能删除页面、因其已不存在");
if (ctx.onDeleteFailure) {
if (ctx.onDeleteFailure) {
ctx.onDeleteFailure.call(this, ctx.deleteProcessApi);  // invoke callback
ctx.onDeleteFailure.call(this, ctx.deleteProcessApi);  // invoke callback
𣳔2.751: 𣳔2.751:
var missing = ($(xml).find('page').attr('missing') === "");
var missing = ($(xml).find('page').attr('missing') === "");
if (((ctx.protectEdit || ctx.protectMove) && missing)) {
if (((ctx.protectEdit || ctx.protectMove) && missing)) {
ctx.statusElement.error("不能保护页面,因其已不存在");
ctx.statusElement.error("不能保护页面、因其已不存在");
ctx.onProtectFailure(this);
ctx.onProtectFailure(this);
return;
return;
}
}
if (ctx.protectCreate && !missing) {
if (ctx.protectCreate && !missing) {
ctx.statusElement.error("不能白纸保护页面,因其已存在");
ctx.statusElement.error("不能白纸保护页面、因其已存在");
ctx.onProtectFailure(this);
ctx.onProtectFailure(this);
return;
return;
𣳔2.828: 𣳔2.828:
var missing = ($(xml).find('page').attr('missing') === "");
var missing = ($(xml).find('page').attr('missing') === "");
if (missing) {
if (missing) {
ctx.statusElement.error("不能保护页面,因其已不存在");
ctx.statusElement.error("不能保护页面、因其已不存在");
ctx.onStabilizeFailure(this);
ctx.onStabilizeFailure(this);
return;
return;
𣳔2.913: 𣳔2.913:
var html = $(xml).find('text').text();
var html = $(xml).find('text').text();
if (!html) {
if (!html) {
apiobj.statelem.error("载入预览失败,或模板被清空");
apiobj.statelem.error("载入预览失败、或模板被清空");
return;
return;
}
}