มีเดียวิกิ: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 = "Insert citation";
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 = "Insert citation";
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 = "Insert citation";
button.classname = "tool tool-button";
buttonimage.style.width = "22px";
buttonimage.style.height = "17px";
buttonimage.style.paddingTop = "5px";
buttonimage.style.paddingLeft = "3px";
button.appendChild(buttonimage);
$('#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()", "Cite web") );
citemain.appendChild( addOption("citeBook()", "Cite book") );
citemain.appendChild( addOption("citeJournal()", "Cite journal") );
citemain.appendChild( addOption("citeNews()", "Cite news") );
citemain.appendChild( addOption("citeNamedRef()", "Named ref") );
citemain.appendChild( addOption("dispErrors()", "Error check") );
citemain.appendChild( addOption("hideInitial()", "Cancel") );
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.getUTCMonth()+1;
if (month ', date);
datestr = datestr.replace(, month);
datestr = datestr.replace(, zdate);
datestr = datestr.replace(, zmonth);
datestr = datestr.replace(, monthsDT.getUTCMonth());
datestr = datestr.replace(, DT.getUTCFullYear().toString());
return (datestr);
}

function citeWeb() {
citeNewsWeb("cite web");
}
function citeNews() {
citeNewsWeb("cite news");
}

function citeNewsWeb(templatename) {
oldFormHide();
template = templatename;
var legend;
if (template == "cite web") {
legend = "Cite web source";
} else {
legend = "Cite news source";
}
newtime = getTime();
numforms++;
form = +
+legend++
+
+
' URL: '+
+
' Title: '+
+
' Last name: '+
+
' First name: '+
+
' Coauthors: '+
+
' Publication date: '+
+
' Work: '+
+
' Publisher: '+
+
' Pages: '+
+
' Language: '+
+
' Access date: '+
+
' Location: '+
+
' Reference name: '+
+
+
+
;
document.getElementById('citeselect').innerHTML += form;
}

function citeBook() {
oldFormHide();
template = "cite book";
numforms++;
form = +
'Cite book source'+
+
+
' Last name: '+
+
' First name: '+
+
' Coauthors: '+
+
' Others: '+
+
' Title: '+
+
' Editor: '+
+
' Publisher: '+
+
' Location: '+
+
' Publication date: '+
+
' Edition: '+
+
' Series: '+
+
' Volume: '+
+
' Pages: '+
+
' Chapter: '+
+
' ISBN: '+
+
' OCLC: '+
+
' URL: '+
+
' Access date: '+
+
' Language: '+
+
' Reference name: '+
+
+
+
;
document.getElementById('citeselect').innerHTML += form;
}

function citeJournal() {
oldFormHide();
template = "cite journal";
numforms++;
form = +
'Cite journal source'+
+
+
' Last name: '+
+
' First name: '+
+
' Coauthors: '+
+
' Publication date: '+
+
' Title: '+
+
' Journal: '+
+
' Publisher: '+
+
' Location: '+
+
' Volume: '+
+
' Issue: '+
+
' Pages: '+
+
' ISSN: '+
+
' OCLC: '+
+
' Language: '+
+
' URL: '+
+
' Access date: '+
+
' Reference name: '+
+
+
+
;
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 = +
'References in textThere are no named refs (';
$("#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 += 'Unclosed '+
' Unclosed '+
' References with the same content'+
' References not using a citation template'+
' Multiple references with the same name'+
' Usage of undefined named references'+
+
;
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 = +
'Error checkingNo errors found.';
document.getElementById('citeselect').innerHTML += out;
}
else {
if (numforms != 0) {
document.getElementById('citediv'+numforms).style.display = 'none';
}
numforms++;
form = +
'Error checking'+
;
for (var i=0; i'+
;
document.getElementById('citeselect').innerHTML += form;
}
}

$( refbuttons );