편집 요약 없음 |
(가독성 개선) |
||
21번째 줄: | 21번째 줄: | ||
var btn = new OO.ui.ButtonOptionWidget({ | var btn = new OO.ui.ButtonOptionWidget({ | ||
data: 1, | data: 1, | ||
label: | label: esEditSummaries[id][0], | ||
title: esEditSummaries[id][2] | title: esEditSummaries[id][2] | ||
}) | }) |
2022년 9월 4일 (일) 12:21 판
/* 한국어 위키백과 미디어위키:Gadget-editsummary.js 호출 */
var buttonSelect;
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 = document.createElement('span');
wpSummaryButtons.id = 'esSummaryButtons';
wpSummary.parentNode.insertBefore(wpSummaryButtons, wpSummary.nextSibling);
buttonSelect = new OO.ui.ButtonSelectWidget({});
$( wpSummaryButtons ).append( buttonSelect.$element );
for (var i = 0; i < esEditSummaries.length; i++) esAppendButton(i);
}
}
function esAppendButton(id) { // 버튼 추가하는 함수
var btn = new OO.ui.ButtonOptionWidget({
data: 1,
label: esEditSummaries[id][0],
title: esEditSummaries[id][2]
})
buttonSelect.addItems(btn);
btn.on('click', function() {esInsertSummary(esEditSummaries[id][1], esEditSummaries[id][3], esEditSummaries[id][4])});
}
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 = new Array(
/*
['버튼 이름', '입력될 편집 요약', '툴팁으로 뜨는 설명(생략 가능)', '사소한 편집 여부(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]
);