미디어위키:Gadget-protectionLocks.js
둘러보기로 이동
검색으로 이동
- 다른 언어
참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다.
구글 크롬, 파이어폭스, 마이크로소프트 엣지, 사파리: ⇧ Shift키를 홀드한 채로 새로 고침 도구 바 버튼을 누르세요.
- 오페라: 메뉴 → 설정(맥의 경우 오페라 → 환경 설정)으로 이동한 다음 개인 정보 보호 및 보안 → 검색 데이터 지우기 → 캐시한 영상 및 파일을 누름.
다른 브라우저에 대한 자세한 내용과 지침은 위키백과의 캐시 무시하기 문서를 참조해주십시오.
// Page protection indicators
;(function($, mw) {
'use strict';
const i18n = {
protectionLevelDescriptions: {
'autoconfirmed': '이 페이지는 준보호되어있어 로그인 한 사람만 편집할 수 있습니다.',
'directoreditprotected': '이 페이지는 보호되어있어 부관리자 이상만 편집할 수 있습니다.',
'sysop': '이 페이지는 보호되어있어 관리자만 편집할 수 있습니다.',
'interface': '이 페이지는 위키 인터페이스에 쓰이기에 관리자 보호되어 있습니다.'
},
moveProtectionLevelDescriptions: {
'directoreditprotected': '이 페이지는 관리보호되어있어 부관리자 이상만 이동할 수 있습니다.',
'sysop': '이 페이지는 이동보호되어있어 관리자만 이동할 수 있습니다.'
},
uploadProtectionLevelDescriptions: {
'directoreditprotected': '이 페이지는 보호되어있어 부관리자 이상만 재개시할 수 있습니다.',
'sysop': '이 페이지는 이동보호되어있어 관리자만 재개시할 수 있습니다.'
},
protectionLevelLinks: {
'autoconfirmed': 'Minecraft Wiki:일반 사용자',
'directoreditprotected': 'Minecraft Wiki:관리자',
'sysop': 'Minecraft Wiki:관리자',
'interface': 'Minecraft Wiki:관리자'
}
};
const config = mw.config.get([
'wgRestrictionEdit',
'wgRestrictionMove',
'wgRestrictionCreate',
'wgNamespaceNumber',
'wgIsMainPage',
'wgAction'
]);
const editProtectionLevelData = config.wgRestrictionEdit;
const moveProtectionLevelData = config.wgRestrictionMove;
const createProtectionLevelData = config.wgRestrictionCreate;
if (
// Null on nonexistent or special pages. Avoids a crash there.
(!editProtectionLevelData && !createProtectionLevelData) || config.wgIsMainPage ||
// No need to display the indicator when viewing history or editing the page
config.wgAction !== 'view') {
return;
}
function getImageThumbnailURL(name, size) {
const encodedName = mw.util.wikiUrlencode(name);
return 'https://minecraft.wiki/images/' +
encodedName;
}
function mimicIndicator(id, link, imgName, title) {
const encodedLink = mw.util.getUrl(link);
return $('<div class="mw-indicator">').attr({
'id': 'mw-indicator-' + id
}).append($('<div class="mw-parser-output">')
.append($('<span typeof="mw:File">')
.append($('<a>')
.attr({
'href': encodedLink,
'title': title
}).append($('<img>')
.attr({
'alt': title,
'src': getImageThumbnailURL(imgName, 25),
'srcset': getImageThumbnailURL(imgName, 38) +
' 1.5x, ' +
getImageThumbnailURL(imgName, 50) +
' 2x',
'width': '25',
'height': '25'
})
))));
}
const editProtectionLevel = editProtectionLevelData ? editProtectionLevelData[0] : null;
const moveProtectionLevel = moveProtectionLevelData ? moveProtectionLevelData[0] : null;
const createProtectionLevel = createProtectionLevelData ? createProtectionLevelData[0] : null;
if (config.wgNamespaceNumber === 6 && (editProtectionLevel === 'directoreditprotected' || createProtectionLevel === 'directoreditprotected')) { // [[File:Upload-protected page lock.svg]]
mimicIndicator(
'protection-director-upload',
i18n.protectionLevelLinks.directoreditprotected,
'Upload-protected page lock.svg',
i18n.uploadProtectionLevelDescriptions.directoreditprotected
).appendTo($('.mw-indicators'));
} else if (config.wgNamespaceNumber === 6 && (editProtectionLevel === 'sysop' || createProtectionLevel === 'sysop')) {
mimicIndicator(
'protection-full-upload',
i18n.protectionLevelLinks.sysop,
'Upload-protected page lock.svg',
i18n.uploadProtectionLevelDescriptions.sysop
).appendTo($('.mw-indicators'));
} else if (editProtectionLevel === 'autoconfirmed' || createProtectionLevel === 'autoconfirmed') { // [[File:Semi-protected page lock.svg]]
mimicIndicator(
'protection-semi',
i18n.protectionLevelLinks.autoconfirmed,
'Semi-protected page lock.svg',
i18n.protectionLevelDescriptions.autoconfirmed
).appendTo($('.mw-indicators'));
} else if (editProtectionLevel === 'directoreditprotected' || createProtectionLevel === 'directoreditprotected') { // [[File:Director-protected page lock.svg]]
mimicIndicator(
'protection-director',
i18n.protectionLevelLinks.directoreditprotected,
'Director-protected page lock.svg',
i18n.protectionLevelDescriptions.directoreditprotected
).appendTo($('.mw-indicators'));
} else if (editProtectionLevel === 'sysop' || createProtectionLevel === 'sysop') { // [[File:Fully-protected page lock.svg]]
mimicIndicator(
'protection-full',
i18n.protectionLevelLinks.sysop,
'Fully-protected page lock.svg',
i18n.protectionLevelDescriptions.sysop
).appendTo($('.mw-indicators'));
} else if (moveProtectionLevel) { // [[File:Move-protected page lock.svg]]
mimicIndicator(
'protection-move',
i18n.protectionLevelLinks[moveProtectionLevel],
'Move-protected page lock.svg',
i18n.moveProtectionLevelDescriptions[moveProtectionLevel]
).appendTo($('.mw-indicators'));
} else if (config.wgNamespaceNumber === 8) { // [[File:Interface-protected page lock.svg]]
mimicIndicator(
'protection-interface',
i18n.protectionLevelLinks.interface,
'Interface-protected page lock.svg',
i18n.protectionLevelDescriptions.interface
).appendTo($('.mw-indicators'));
}
})(window.jQuery, window.mediaWiki);