편집 요약 없음 |
편집 요약 없음 |
||
7번째 줄: | 7번째 줄: | ||
if (!wpSummary || (wpSummary.form.wpSection && wpSummary.form.wpSection.value == 'new')) return; | if (!wpSummary || (wpSummary.form.wpSection && wpSummary.form.wpSection.value == 'new')) return; | ||
wpSummaryButtons = new OO.ui.ButtonGroupWidget({id: "wpSummaryButtons"}); | wpSummaryButtons = new OO.ui.ButtonGroupWidget({id: "wpSummaryButtons"}); | ||
wpSummaryButtons.$element.css({"margin- | wpSummaryButtons.$element.css({"margin-bottom": "1em"}); | ||
$("#wpSummaryLabel .oo-ui-fieldLayout-header").after(wpSummaryButtons.$element); | $("#wpSummaryLabel .oo-ui-fieldLayout-header").after(wpSummaryButtons.$element); | ||
2023년 12월 16일 (토) 15:29 판
/* 한국어 위키백과 미디어위키:Gadget-editsummary.js를 약간 수정함 */
function esEditSummary() {
if (typeof esEditSummaries === 'undefined') return;
var wgAction = mw.config.get('wgAction');
if (wgAction == 'edit' || wgAction == 'submit') {
var wpSummary = document.getElementById('wpSummary');
if (!wpSummary || (wpSummary.form.wpSection && wpSummary.form.wpSection.value == 'new')) return;
wpSummaryButtons = new OO.ui.ButtonGroupWidget({id: "wpSummaryButtons"});
wpSummaryButtons.$element.css({"margin-bottom": "1em"});
$("#wpSummaryLabel .oo-ui-fieldLayout-header").after(wpSummaryButtons.$element);
let ButtonElements = [];
for (let id = 0; id < esEditSummaries.length; id++) {
var btnElement = new OO.ui.ButtonWidget({
data: 1,
label: esEditSummaries[id][0],
title: esEditSummaries[id][2]
}).on('click',
() => { esInsertSummary (esEditSummaries[id][1], esEditSummaries[id][3], esEditSummaries[id][4]);
});
ButtonElements.push(btnElement);
}
wpSummaryButtons.addItems(ButtonElements);
}
}
function esInsertSummary(text, isMinor, clear) {
var wpSummary = document.getElementById('wpSummary');
if (isMinor !== undefined) { $('#wpMinoredit').prop('checked', isMinor, clear); }
if (clear == 1) {
wpSummary.value = text;
return;
}
if (wpSummary.value.indexOf(text) != -1) return;
if (wpSummary.value.match(/[^,; \/]$/)) wpSummary.value += ',';
if (wpSummary.value.match(/[^ ]$/)) wpSummary.value += ' ';
wpSummary.value += text;
}
jQuery(document).ready(esEditSummary);
esEditSummaries = [
/*
['버튼 이름', '입력될 편집 요약', '툴팁으로 뜨는 설명(생략 가능)', '사소한 편집 여부(0/1 혹은 true/false, 생략 가능)', '상용구 넣기 전에 요약 지우기(0/1 혹은 true/false, 생략 가능)']
위와 같은 형식으로 새로운 버튼을 추가할 수 있습니다.
마지막 줄을 제외한 줄 끝에 쉼표가 들어가 있는지 확인해 주세요.
*/
['갱신 ', '문서 정보 갱신', '오래된 문서 정보를 갱신', 0, 1],
['넘겨주기 ', '넘겨주기', '넘겨주기 생성', 1, 1],
['동음이의 ', '동음이의어 문서', '동음이의 문서를 작성', 0, 1],
['분류 ', '분류 추가', '분류 추가', 1, 1],
['삭제 신청 ', '문서 삭제 신청', '삭제 신청 틀', 1, 1],
['오타 ', '오타 수정', '문서에서 오타를 정정', 1, 1],
['답변 ', '의견에 답변', '질문이나 의견에 답변', 1, 0],
['분기 ', '문단 새 문서로 분기 - ', '다른 문서와의 병합을 제안하거나 실행', 0, 1],
['디자인 ', '디자인 수정', '디자인 개선', 0, 1],
['테스트', '테스트', '테스트', 0, 1],
['가독성', '가독성 개선', '가독성 개선', 0, 1]
];