미디어위키:RefToolbarNoDialogs.js

var numforms = 0;
var wikEdAutoUpdateUrl;
function refbuttons() {
if (mw.toolbar && (document.getElementById('toolbar') 
document.getElementById('wikiEditor-section-main'))/* && wikEdAutoUpdateUrl == null*/) {
if (document.getElementById('toolbar')) {
button = document.createElement('a');
button.href = "javascript:easyCiteMain()";
button.title = "인용";
buttonimage = document.createElement('img');
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/0/00/Button_easy_cite_%281%29.png";
buttonimage.alt = "Insert footnote";
button.appendChild(buttonimage);
document.getElementById('toolbar').appendChild(button);
} else {
button = document.createElement('a');
button.href = "#";
button.title = "인용";
button.id = 'reftoolbar-button';
buttonimage = document.createElement('img');
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Curly_Brackets.svg/22px-Curly_Brackets.svg.png";
buttonimage.alt = "인용";
button.classname = "tool tool-button";
buttonimage.style.width = "22px";
buttonimage.style.height = "17px";
buttonimage.style.paddingTop = "5px";
buttonimage.style.paddingLeft = "3px";
button.appendChild(buttonimage);
document.getElementById('wikiEditor-ui-toolbar').childNodes0.childNodes1.appendChild(button);
$('#wikiEditor-section-main .group-insert').append( button );
$(button).click( function() { easyCiteMain(); });
}
if (navigator.userAgent.indexOf('MSIE') == -1) {
citemain = document.createElement('div');
citemain.style.display = 'none';
citemain.setAttribute('Id', 'citeselect');
citemain.appendChild( addOption("citeWeb()", "웹 인용") );
citemain.appendChild( addOption("citeBook()", "서적 인용") );
citemain.appendChild( addOption("citeJournal()", "저널 인용") );
citemain.appendChild( addOption("citeNews()", "뉴스 인용") );
citemain.appendChild( addOption("citeNamedRef()", "이름이 지정된 각주") );
citemain.appendChild( addOption("dispErrors()", "오류 검사") );
citemain.appendChild( addOption("hideInitial()", "취소") );
document.getElementById('wpTextbox1').parentNode.insertBefore(citemain, document.getElementById('wpTextbox1'));
}
else {
selection = +
+
+
+
+
+
;
document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;
}
}
}

function addOption(script, text) {
option = document.createElement('input');
option.setAttribute('type', 'button');
option.setAttribute('onclick', script);
option.setAttribute("value", text);
return option;
}

function hideInitial() {
document.getElementById('citeselect').style.display = 'none';
oldFormHide();
}

function oldFormHide() {
if (numforms != 0) {
document.getElementById('citediv'+numforms).style.display = 'none';
}
if (document.getElementById('errorform') != null) {
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));
}
} 

function easyCiteMain() {
document.getElementById('citeselect').style.display = ;
}

var months = 'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December';
var citeGlobalDateFormat = "--";
function getTime() {
var datestr = ;
if (typeof citeUserDateFormat != 'undefined') {
datestr = citeUserDateFormat;
} else {
datestr = citeGlobalDateFormat;
}
var DT = new Date();
var zmonth = ;
var month = DT.getMonth()+1;
if (month ', date);
datestr = datestr.replace(, month);
datestr = datestr.replace(, zdate);
datestr = datestr.replace(, zmonth);
datestr = datestr.replace(, monthsDT.getMonth());
datestr = datestr.replace(, DT.getFullYear().toString());
return (datestr);
}

function citeWeb() {
citeNewsWeb("웹 인용");
}
function citeNews() {
citeNewsWeb("뉴스 인용");
}

function citeNewsWeb(templatename) {
oldFormHide();
template = templatename;
var legend;
if (template == "웹 인용") {
legend = "웹 인용 자료";
} else {
legend = "뉴스 인용 자료";
}
newtime = getTime();
numforms++;
form = +
+legend++
+
+
' URL: '+
+
' 제목: '+
+
' 성: '+
+
' 이름: '+
+
' 저자: '+
+
' 날짜: '+
+
' 작품: '+
+
' 출판사: '+
+
' 쪽: '+
+
' 언어: '+
+
' 확인 날짜: '+
+
' 위치: '+
+
' 각주 이름: '+
+
+
+
;
document.getElementById('citeselect').innerHTML += form;
}

function citeBook() {
oldFormHide();
template = "서적 인용";
numforms++;
form = +
'서적 인용 자료'+
+
+
' 성: '+
+
' 이름: '+
+
' 저자: '+
+
' 기타: '+
+
' 제목: '+
+
' 편집자: '+
+
' 출판사: '+
+
' 위치: '+
+
' 날짜: '+
+
' 판: '+
+
' 총서: '+
+
' 권: '+
+
' 쪽: '+
+
' 장: '+
+
' ISBN: '+
+
' OCLC: '+
+
' URL: '+
+
' 확인 날짜: '+
+
' 언어: '+
+
' 각주 이름: '+
+
+
+
;
document.getElementById('citeselect').innerHTML += form;
}

function citeJournal() {
oldFormHide();
template = "저널 인용";
numforms++;
form = +
'저널 인용 자료'+
+
+
' 성: '+
+
' 이름: '+
+
' 저자: '+
+
' 날짜: '+
+
' 제목: '+
+
' 저널: '+
+
' 출판사: '+
+
' 위치: '+
+
' 권: '+
+
' 호: '+
+
' 쪽: '+
+
' ISSN: '+
+
' OCLC: '+
+
' 언어: '+
+
' URL: '+
+
' 확인 날짜: '+
+
' 각주 이름: '+
+
+
+
;
document.getElementById('citeselect').innerHTML += form;
}

function addcites(template) {
cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');
var citebegin = '
cite = citebegin + citename + citeinner + "}}";
$("#wpTextbox1").focus();
insertTags(cite, , );
document.getElementById('citediv'+numforms).style.display = 'none';
}

function getNamedRefs(calls) {
if (typeof(wikEdUseWikEd) != 'undefined') {
if (wikEdUseWikEd == true) {
WikEdUpdateTextarea();
}
}
text = document.getElementById('wpTextbox1').value;
var regex;
if (calls) {
regex = //gi //'
} else {
regex = //gi //'
}
var namedrefs = ;
var i=0;
var nr=true;
do {
ref = regex.exec(text);
if(ref != null){
if (ref5) {
namedrefsi = ref5;
} else if (ref3) {
namedrefsi = ref3;
} else {
namedrefsi = ref6;
}
i++;
} else {
nr=false;
}
} while (nr==true);
return namedrefs;
}

function citeNamedRef() {
namedrefs = getNamedRefs(false);
if (namedrefs == ) {
oldFormHide();
numforms++;
out = +
'본문 내 각주문서 내에 이름이 지정된 각주(';
$("#wpTextbox1").focus();
insertTags(ref, , );
document.getElementById('citediv'+numforms).style.display = 'none';
}

function getAllRefs() {
if (typeof(wikEdUseWikEd) != 'undefined') {
if (wikEdUseWikEd == true) {
WikEdUpdateTextarea();
}
}
text = document.getElementById('wpTextbox1').value;
regex = /((.|\n)*?)/gim //"
var allrefs = ;
var i=0;
var nr=true;
do {
ref = regex.exec(text);
if(ref != null){
if (ref0.search(/^\s{150}/) != -1) {
ref0 = ref0.replace(/\|(^\s)/g, "| $1");
}
ref0 = ref0.replace(//g, ">");
allrefsi = ref0;
i++;
} else {
nr=false;
}
} while (nr==true);
return allrefs;
}

function NRcallError(namedrefs, refname) {
for (var i=0; i((.|\n)*?)/gim, "$8");  //"
}
var namedrefs = getNamedRefs(false);
var errorlist = ;
var q=0;
unclosed = document.getElementById('unclosed').checked;
samecontent = document.getElementById('samecontent').checked;
templates = document.getElementById('templates').checked;
repeated = document.getElementById('repeated').checked;
undef = document.getElementById('undef').checked;
for (var i=0; i/) == -1 && unclosed) {
errorlistq = +allrefsi+;
errorlistq += '닫히지 않은 '+
' 닫히지 않은 '+
' 내용이 같은 각주'+
' 인용 틀을 쓰지 않은 각주'+
' 같은 이름을 가진 각주'+
' 이름이 있지만 내용이 정의되지 않은 각주'+
+
;
document.getElementById('citeselect').innerHTML += form;
}

function doErrorCheck() {
var errors = errorCheck();
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));
if (errors == 0) {
if (numforms != 0) {
document.getElementById('citediv'+numforms).style.display = 'none';
}
numforms++;
out = +
'오류 검사하기발견된 오류가 없습니다.';
document.getElementById('citeselect').innerHTML += out;
}
else {
if (numforms != 0) {
document.getElementById('citediv'+numforms).style.display = 'none';
}
numforms++;
form = +
'오류 검사하기'+
;
for (var i=0; i'+
;
document.getElementById('citeselect').innerHTML += form;
}
}

$( refbuttons );