사용자:Dus2000/monobook.js

위키백과, 우리 모두의 백과사전.

참고: 설정을 저장한 후에 바뀐 점을 확인하기 위해서는 브라우저의 캐시를 새로 고쳐야 합니다. 구글 크롬, 파이어폭스, 마이크로소프트 엣지, 사파리: ⇧ Shift 키를 누른 채 "새로 고침" 버튼을 클릭하십시오. 더 자세한 정보를 보려면 위키백과:캐시 무시하기 항목을 참고하십시오.

/*
***** 편집 요약 상용구
***** 제작: [[사용자:피첼]]
***** 사용법: 자신의 .js 문서에 복사하여 편집. [[사용자:피첼/editsum.css]]도 잊지 마세요.
*/
 
function SummaryButtons(){
  if (wgAction == 'edit' || wgAction == 'submit' || wgAction == 'editredlink') {
    var wpSummary = document.getElementById('wpSummary')
    if (!wpSummary || (wpSummary.form.wpSection && wpSummary.form.wpSection.value == 'new')) return
    wpSummaryBtn = document.createElement('span')
    wpSummaryBtn.id = 'usrSumBtn'
    wpSummary.parentNode.insertBefore(wpSummaryBtn, wpSummary.nextSibling)
 
/*
 
  addSumButton('버튼 이름', '버튼을 누르면 입력 될 편집 요약', '버튼을 가리키면 툴팁으로 뜨는 설명')
  위와 같은 형식으로 새로운 버튼을 추가 할 수 있습니다.
 
*/
    addSumButton('+', '+', '+')  
    addSumButton('-', '-', '-')  
    addSumButton('인터', '인터위키', '인터위키 추가, 삭제 및 정리')
    addSumButton('{{', '{{', '틀 열기')  
    addSumButton('ㅅ', '[[틀:ㅅ|ㅅ]]|', '삭제 신청 틀')  
    addSumButton('ㅌㅅ', '[[틀:ㅌㅅ|ㅌㅅ|]]|', '특정판 삭제 신청 틀')  
    addSumButton('토막', '토막글', '토막글 틀을 담')
    addSumButton('IP', 'IP사용자의', 'IP사용자의')  
    addSumButton('저작', '저작권', '저작권') 
    addSumButton('장난', '장난', '장난') 
    addSumButton('실수', '실수', '실수') 
    addSumButton('}}', '}}', '틀 닫기') 
    addSumButton('rv', 'rv', '되돌리기') 
    addSumButton('낙서', '>백과사전에 낙서하지 마세요.', '낙서 경고') 
    addSumButton('훼손', '>백과사전 찢지 마세요.', '훼손 경고') 
    addSumButton('낙훼', '>백과사전 찢고 낙서하지 마세요.', '훼손 및 낙서 경고')  
  }
}
 
function addSumButton(name, text, title) {
  var btn = document.createElement('sumBtn')
  btn.appendChild(document.createTextNode(name))
  btn.title = title
  btn.onclick = function() { insertSummary(text) }
  wpSummaryBtn.appendChild(btn)
}
 
function insertSummary(text) {
  var wpSummary = document.getElementById('wpSummary')
  if (wpSummary.value.indexOf(text) != -1) return 
/*  if (wpSummary.value.match(/[^,; \/]$/)) wpSummary.value += ',' 
  if (wpSummary.value.match(/[^ ]$/)) wpSummary.value += ' ' */
  wpSummary.value += text
}
 
$(SummaryButtons)

/* QPreview
*****제작: [[:en:user:Alex Smotrov]]
*****개요: Ajax를 사용한 즉석 미리보기
*/

qPreviewKey = '`';
qPreviewName = '즉석 미리 보기';  
qPreviewAtBottom = true;

if (wgAction == 'edit' || wgAction == 'submit')
	addOnloadHook(addQPreviewButton);
 
 
function addQPreviewButton(){
	if (!window.qPreviewName) qPreviewName = 'QPreview';
	var accesskey = window.qPreviewKey || '';
	if (window.qPreviewAtBottom) 
		addSystemButton(qPreviewName, qPreview, 'btnQPreview', 'Quick Preview', accesskey);
	else
		addToolbarButton(qPreviewName, qPreview, 'btnQPreview', 'Quick Preview', accesskey);
}
 
function qPreview(){
	var divPreview = document.getElementById('wikiPreview');
	if (!divPreview) return;
	var btnQPreview = document.getElementById('btnQPreview');
	var btnWidth = Math.max(btnQPreview.scrollWidth, btnQPreview.offsetWidth);
	if (btnQPreview) btnQPreview.value = window.qPreviewWait || 'Wait...';
	btnQPreview.style.width = btnWidth + 'px';
	a = sajax_init_object();
	a.open('POST', document.editform.action+'&live', true);
	var Boundary = '--------p1415';
	a.setRequestHeader('Content-Type', 'multipart/form-data; boundary='+Boundary);
	var PostData = '--' + Boundary 
		+ '\nContent-Disposition: form-data; name="wpTextbox1"\n\n'
		+ document.getElementById('wpTextbox1').value + '\n--'+Boundary;
	if (a.overrideMimeType) a.overrideMimeType('text/html');
	a.send(PostData);
	a.onreadystatechange = function(){
		if (a.readyState != 4) return;
		var html = a.responseText;
		html = html.replace(/&gt;/g,'>').replace(/&lt;/g,'<').replace(/&quot;/g,'"').replace(/&amp;/g,'&').replace(/&apos;/g,"'");
		divPreview.innerHTML = html;
		if (btnQPreview) btnQPreview.value = qPreviewName;
	};
}
 
function addSystemButton(name, onclick, id, tooltip, accesskey){ 
	var wpPreview = document.getElementById('wpPreview');
	if (!wpPreview) return;
	var btn = document.createElement('input');
	btn.type = 'button'; 
	if (name) btn.value = name; 
	if (onclick) btn.onclick = onclick;
	if (id) btn.id = id;
	if (tooltip) btn.title = tooltip; 
	if (accesskey) { 
		btn.accessKey = accesskey; 
		btn.title += ' [' + tooltipAccessKeyPrefix + btn.accessKey + ']';
	}	
	wpPreview.parentNode.insertBefore(btn, wpPreview);
	return btn;
}
 
 
function addToolbarButton(name, onclick, id, tooltip, accesskey){
	var toolbar = document.getElementById('toolbar');
	if (!toolbar) return;
	var btn = document.createElement('input');
	btn.type = 'button'; 
	btn.style.background = '#adbede';
	btn.style.height = '22px'; 
	btn.style.verticalAlign = 'middle';
	if (name) btn.value = name; 
	if (onclick) btn.onclick = onclick;
	if (id) btn.id = id;
	if (tooltip) btn.title = tooltip; 
	if (accesskey) btn.accessKey = accesskey; 
	toolbar.appendChild(btn);
	return btn;
}

document.write('<script type="text/javascript" src="' 
             + 'http://ko.wikipedia.org/w/index.php?title=User:Dus2000/string-navpop.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');