注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
?_=1来访问最新页面。https://zh.moegirl.org.cn/User:Chi_ZJ2/js/MarkRestrict.js?_=1// eslint-disable-next-line no-unused-vars
var _addText = '__NOINDEX__';
$(() => {
const namespace = mw.config.get('wgNamespaceNumber');
const title = mw.config.get('wgTitle');
const username = mw.config.get('wgUserName');
mw.loader.addStyleTag(`
.markrights-autoconfirmed::after {
content: '自';
color: #666;
}
#ca-move a {
display: inline-flex !important;
}
`);
if(!$('#ca-move')[0] && namespace >= 0) {
$('<li>', {
id: 'ca-move',
class: 'mw-list-item',
})
.append($('<a>', {
style: `
pointer-events: none;
color: #666;
font-style: italic;
text-decoration: line-through;
`,
html: '移动'
}))
.prependTo('#p-cactions .vector-menu-content-list:first-child');
}
const mapping = {
'patrolleredit': 'patroller',
'techedit': 'techeditor'
};
let editRestrGroups = mw.config.get('wgRestrictionEdit'),
moveRestrGroups = mw.config.get('wgRestrictionMove');
if(namespace == 8 // MediaWiki
|| namespace == 274 // Widget
|| (namespace == 2 && !title.startsWith(username) && !!title.match(/\.(?:js|css|json)$/)) // User
) {
editRestrGroups.push('interface-admin');
moveRestrGroups.push('interface-admin');
}
editRestrGroups.forEach(function(usergroup) {
$($('#ca-edit')[0] || $('#ca-viewsource')[0]).append($('<sup>', {
class: `markrights-${mapping[usergroup] ?? usergroup}`
}););
});
moveRestrGroups.forEach(function(usergroup) {
$('#ca-move').append($('<sup>', {
class: `markrights-${mapping[usergroup] ?? usergroup}`
}));
});
});