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);
 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').childNodes[0].childNodes[1].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;
 citemain.appendChild( addOption );
 citemain.appendChild( addOption );
 citemain.appendChild( addOption );
 citemain.appendChild( addOption );
 citemain.appendChild( addOption );
 citemain.appendChild( addOption );
 citemain.appendChild( addOption );
 document.getElementById('wpTextbox1').parentNode.insertBefore(citemain, document.getElementById('wpTextbox1'));
 else {
 selection = ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 '';
 document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;
 
function addOption {
 option = document.createElement('input');
 option.setAttribute;
 option.setAttribute;
 option.setAttribute;
 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;
 datestr = citeGlobalDateFormat;
 var DT = new Date;
 var zmonth = '';
 var month = DT.getMonth+1;
 if (month < 10) {
 zmonth = "0"+month.toString;
 zmonth = month.toString;
 month = month.toString;
 var zdate = '';
 var date = DT.getDate
 if (date < 10) {
 zdate = "0"+date.toString;
 zdate = date.toString;
 date = date.toString
 datestr = datestr.replace;
 datestr = datestr.replace;
 datestr = datestr.replace;
 datestr = datestr.replace;
 datestr = datestr.replace;
 datestr = datestr.replace;
 return (datestr);
 
function citeWeb {
 citeNewsWeb("웹 인용");
function citeNews {
 citeNewsWeb("뉴스 인용");
 
function citeNewsWeb(templatename) {
 oldFormHide;
 template = templatename;
 var legend;
 if (template == "웹 인용") {
 legend = "웹 인용 자료";
 legend = "뉴스 인용 자료";
 newtime = getTime;
 numforms++;
 form = ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 '';
 document.getElementById('citeselect').innerHTML += form;
 
function citeBook {
 oldFormHide;
 template = "서적 인용";
 numforms++;
 form = ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 '';
 document.getElementById('citeselect').innerHTML += form;
 
function citeJournal {
 oldFormHide;
 template = "저널 인용";
 numforms++;
 form = ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 '';
 document.getElementById('citeselect').innerHTML += form;
 
function addcites(template) {
 cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');
 var citebegin = '<ref';
 var citename = '';
 var citeinner = '';
 for (var i=0; i<cites.length-1; i++) {
 if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id != "template") {
 citeinner += "|" + cites[i].id + "=" + cites[i].value;
 else if (cites[i].value != '' && cites[i].id == "refname" && cites[i].id != "template") {
 citebegin += ' name="' + cites[i].value + '"';
 else if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id == "template") {
 citename = '>";
 $("#wpTextbox1").focus;
 insertTags;
 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 //'
 regex = //gi //'
 var namedrefs = [];
 var i=0;
 var nr=true;
 do {
 ref = regex.exec(text);
 if(ref != null){
 if (ref[5]) {
 namedrefs[i] = ref[5];
 namedrefs[i] = ref[3];
 namedrefs[i] = ref[6];
 i++;
 nr=false;
 return namedrefs;
 
function citeNamedRef {
 namedrefs = getNamedRefs(false);
 if (namedrefs == '') {
 oldFormHide;
 numforms++;
 out = ''+
 '';
 document.getElementById('citeselect').innerHTML += out;
 else {
 oldFormHide;
 numforms++;
 form = ''+
 ''+
 ''+
 ''+
 '';
 for (var i=0;i<namedrefs.length;i++) {
 form+= ''+
 ''+
 '';
 document.getElementById('citeselect').innerHTML += form;
 
function addnamedcite {
 name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;
 ref = '';
 $("#wpTextbox1").focus;
 insertTags;
 document.getElementById('citediv'+numforms).style.display = 'none';
 
function getAllRefs {
 if (typeof(wikEdUseWikEd) != 'undefined') {
 if (wikEdUseWikEd == true) {
 WikEdUpdateTextarea;
 text = document.getElementById('wpTextbox1').value;
 regex = //gim //"
 var allrefs = [];
 var i=0;
 var nr=true;
 do {
 ref = regex.exec(text);
 if(ref != null){
 if (ref[0].search(/[^\s]{150}/) != -1) {
 ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");
 ref[0] = ref[0].replace;
 ref[0] = ref[0].replace;
 allrefs[i] = ref[0];
 i++;
 nr=false;
 return allrefs;
 
function NRcallError {
 for (var i=0; i<namedrefs.length; i++) {
 if (namedrefs[i] == refname) {
 return true;
 return false;
 
function errorCheck {
 var allrefs = getAllRefs;
 var allrefscontent = [];
 var samecontentexclude = [];
 var sx=0;
 var templateexclude = [];
 var tx=0;
 var skipcheck = false;
 var namedrefcalls = getNamedRefs(true);
 for (var i=0; i<allrefs.length; i++) {
 allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/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<allrefs.length; i++) {
 if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {
 errorlist[q] = '';
 errorlist[q] += '';
 q++;
 if (samecontent) {
 for (var d=0; d<samecontentexclude.length; d++) {
 if (allrefscontent[i] == samecontentexclude[d]) {
 skipcheck = true;
 var p=0;
 while (p<allrefs.length && !skipcheck) {
 if (allrefscontent[i] == allrefscontent[p] && i != p) {
 errorlist[q] = '';
 errorlist[q] += '';
 q++;
 samecontentexclude[sx] = allrefscontent[i]
 sx++;
 break;
 p++;
 skipcheck=false;
 if (templates) {
 if (allrefscontent[i].search(/\{\{cite/i) == -1 && allrefscontent[i].search(/\{\{citation/i) == -1 && allrefscontent[i].search(/\{\{Comic (book|strip) reference/i) == -1 && allrefscontent[i].search(/\{\{Editorial cartoon reference/i) == -1 && allrefscontent[i].search(/\{\{harv/i) == -1) {
 for (var x=0; x<templateexclude.length; x++) {
 if (allrefscontent[i] == templateexclude[x]) {
 skipcheck = true;
 if (!skipcheck) {
 errorlist[q] = '';
 errorlist[q] += '';
 q++;
 templateexclude[tx] = allrefscontent[i];
 tx++;
 skipcheck = false;
 if (repeated) {
 var repeatnameexclude = [];
 var rx=0;
 for (var k=0; k<namedrefs.length; k++) {
 for (var d=0; d<repeatnameexclude.length; d++) {
 if (namedrefs[k] == repeatnameexclude[d]) {
 skipcheck = true;
 var z=0;
 while (z<namedrefs.length && !skipcheck) {
 if (namedrefs[k] == namedrefs[z] && k != z) {
 errorlist[q] = '';
 errorlist[q] += '';
 q++;
 repeatnameexclude[rx] = namedrefs[z];
 rx++;
 break;
 z++;
 skipcheck = false;
 if (undef) {
 var undefexclude = [];
 var ux=0;
 for (var p=0; p<namedrefcalls.length; p++) {
 for (var d=0; d<undefexclude.length; d++) {
 if (allrefscontent[i] == undefexclude[d]) {
 skipcheck = true;
 if (!skipcheck) {
 if (!NRcallError) {
 errorlist[q] = '';
 errorlist[q] += '';
 q++;
 undefexclude[ux] = namedrefs[p];
 ux++;
 skipcheck = false;
 if (q > 0) {
 return errorlist;
 return 0;
 
function dispErrors {
 oldFormHide;
 form = ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 ''+
 '';
 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 = ''+
 ''+
 ''+
 '';
 document.getElementById('citeselect').innerHTML += form;