MediaWiki:Gadget-HotCat.js:修订间差异
删除的内容 添加的内容
创建页面,内容为“/** HotCat V2.46 Ajax-based simple Category manager. Allows adding/removing/changing categories on a page view. Supports multiple category changes, as well as redirect and disambiguation resolution. Also plugs into the upload form. Search engines to use for the suggestion list are configurable, and can be selected interactively. Documentation: https://commons.wikimedia.org/wiki/Help:Gadget-HotCat List of main authors: https://commons.wikimedia.org/wiki/Help:G…” |
同步 Commons V2.47 (监视列表过期修复 + sanitizeInput 去方括号) |
||
第1行:
/**
HotCat V2.
Ajax-based simple Category manager. Allows adding/removing/changing categories on a page view.
第92行:
// Use spaces, not underscores.
// If you don't have that concept on your wiki, set it to null.
HotCat.disambig_category = 'Disambiguation categories';
// Any category in this category is deemed a (soft) redirect to some other category defined by a link
// to another non-blacklisted category. If your wiki doesn't have soft category redirects, set this to null.
第2,275行:
sanitizeInput: function () {
var v = this.text.value || '';
v = v.replace( /^(\s|_)+/, '' ); // Trim leading blanks and underscores▼
// 1. Strip square brackets first (so we can see what's inside)
var re = new RegExp( '^(' + HC.category_regexp + '):' );▼
v = v.replace(/\u200E$/, ''); // Trim ending left-to-right mark▼
// 2. Remove leading/trailing whitespace and underscores
// 3. Strip the Category namespace (handles localized versions)
▲ var re = new RegExp( '^(' + HC.category_regexp + '):', 'i' );
if ( re.test( v ) ) {
// Find the colon, take everything after it, and trim again
v = v.substring( v.indexOf( ':' ) + 1 ).replace( /^(\s|_)+/, '' );
}
// 4. Final cleanup (LTR marks and capitalization)
if ( HC.capitalizePageNames ) v = capitalize( v );
第2,286行 ⟶ 第2,298行:
var cursorPos = this.text.selectionStart;
this.text.value = v;
// Clamp cursor to string length to prevent IE/Edge errors
this.text.setSelectionRange( cursorPos, cursorPos );▼
var newPos = Math.min(cursorPos, v.length);
}
},
| |||