http://it-i.demopaedia.org/w/api.php?action=feedcontributions&user=Nicolas+Brouard&feedformat=atom
Demopædia - Contributi utente [it]
2024-03-28T13:00:02Z
Contributi utente
MediaWiki 1.28.0
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=10353
MediaWiki:Gadgets-definition
2017-06-26T06:54:41Z
<p>Nicolas Brouard: </p>
<hr />
<div>#Editing<br />
* refToolbar[ResourceLoader|default|dependencies=user.options,mediawiki.legacy.wikibits]|refToolbar.js<br />
* refToolbarBase[ResourceLoader|hidden]|refToolbarBase.js<br />
* DotsSyntaxHighlighter[ResourceLoader|default|dependencies=jquery.client]|DotsSyntaxHighlighter.js<br />
<br />
#Interface<br />
* exlinks[ResourceLoader]|exlinks.js<br />
* purgeTab[ResourceLoader]|purgeTab.js<br />
* citations[ResourceLoader]|citations.js</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarLegacy.js&diff=10352
MediaWiki:RefToolbarLegacy.js
2017-06-25T20:07:46Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>var numforms = 0;<br />
var wikEdAutoUpdateUrl;<br />
var citeUserDateFormat;<br />
var refTagURL;<br />
var defaultRefTagURL = '//reftag.appspot.com/';<br />
var refToolDebug;<br />
<br />
String.prototype.trim = function() {<br />
return this.replace(/^\s+|\s+$/g,"");<br />
};<br />
<br />
function refbuttons() {<br />
if (mw.toolbar && document.getElementById('toolbar') ) {<br />
var button = document.createElement('a');<br />
button.href = "javascript:easyCiteMain()";<br />
button.title = "Insert Citation";<br />
var buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/e/ea/Button_easy_cite.png";<br />
buttonimage.alt = "Insert Citation";<br />
button.appendChild(buttonimage);<br />
var toolbar = document.getElementById('toolbar');<br />
if (navigator.userAgent.indexOf('MSIE') == -1) {<br />
toolbar.appendChild(button);<br />
var citemain = document.createElement('div');<br />
citemain.style.display = 'none';<br />
citemain.style.margin = '0 0 6px';<br />
citemain.style.clear = 'both';<br />
citemain.style.height = 'auto';<br />
citemain.setAttribute('Id', 'citeselect');<br />
citemain.appendChild( addOption("citeWeb()", "Web") );<br />
citemain.appendChild( addOption("citeNews()", "News") );<br />
citemain.appendChild( addOption("citeBook()", "Book") );<br />
citemain.appendChild( addOption("citeJournal()", "Journal") );<br />
citemain.appendChild( addOption("citeNamedRef()", "Named references") );<br />
citemain.appendChild( addOption("dispErrors()", "Error check") );<br />
citemain.appendChild( addOption("showMore()", "More") );<br />
citemain.appendChild( addOption("hideInitial()", "Cancel") );<br />
<br />
var citemore = document.createElement('div');<br />
citemore.style.display = 'none';<br />
citemore.setAttribute('Id', 'citemore');<br />
citemore.appendChild( addOption("citeEncyclopedia()", "Encyclopedia") );<br />
citemore.appendChild( addOption("citePressRelease()", "Press release") );<br />
citemore.appendChild( addOption("citeMap()", "Map") );<br />
citemore.appendChild( addOption("showRefSectionOptions()", "Ref Section") );<br />
citemain.appendChild(citemore);<br />
<br />
$( citemain ).insertAfter( $( toolbar ) );<br />
}<br />
else {<br />
toolbar.appendChild(button);<br />
var citeselect = document.createElement('div');<br />
citeselect.id = 'citeselect';<br />
citeselect.style.display = "none";<br />
citeselect.innerHTML = '<input type="button" value="Web" onclick="citeWeb()" />'+<br />
'<input type="button" value="News" onclick="citeNews()" />'+<br />
'<input type="button" value="Book" onclick="citeBook()" />'+<br />
'<input type="button" value="Journal" onclick="citeJournal()" />'+<br />
'<input type="button" value="Named references" onclick="citeNamedRef()" />'+<br />
'<input type="button" value="Error check" onclick="dispErrors()" />'+<br />
'<input type="button" value="More" onclick="showMore()" />'+<br />
'<input type="button" value="Cancel" onclick="hideInitial()" />'+<br />
'<div id="citemore" style="display:none">\<br />
<input type="button" value="Encyclopedia" onclick="citeEncyclopedia()" />\<br />
<input type="button" value="Press release" onclick="citePressRelease()" />\<br />
<input type="button" value="Map" onclick="citeMap()" />\<br />
<input type="button" value="Ref Section" onclick="showRefSectionOptions()" />\<br />
</div>';<br />
document.getElementById('editform').insertBefore(citeselect, document.getElementById('editform').firstChild ) ;<br />
}<br />
var reftoolformarea = document.createElement( 'span' );<br />
reftoolformarea.id = 'refToolFormArea';<br />
document.getElementById('citeselect').appendChild( reftoolformarea );<br />
}<br />
if (typeof EditTools == "object") {<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
EditTools.createEditTools (placeholder);<br />
}<br />
}<br />
<br />
function addOption(script, text) {<br />
var option = document.createElement('input');<br />
option.setAttribute('type', 'button');<br />
option.setAttribute('onclick', script);<br />
option.setAttribute("value", text);<br />
return option;<br />
}<br />
<br />
function hideInitial() {<br />
document.getElementById('citeselect').style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function oldFormHide() {<br />
//if (numforms != 0) {<br />
// document.getElementById('citediv'+numforms).style.display = 'none';<br />
//}<br />
document.getElementById('refToolFormArea').innerHTML = '';<br />
if (document.getElementById('errorform') !== null) {<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
}<br />
}<br />
<br />
function easyCiteMain() {<br />
document.getElementById('citeselect').style.display = '';<br />
document.getElementById('citemore').style.display = 'none';<br />
}<br />
<br />
function showMore() {<br />
document.getElementById('citemore').style.display = '';<br />
}<br />
<br />
var months = ['January', 'February', 'March', 'April', 'May', 'June',<br />
'July', 'August', 'September', 'October', 'November', 'December'];<br />
var citeGlobalDateFormat = "<date> <monthname> <year>";<br />
function getTime() {<br />
var datestr = '';<br />
if (citeUserDateFormat) {<br />
datestr = citeUserDateFormat;<br />
} else {<br />
datestr = citeGlobalDateFormat;<br />
}<br />
var DT = new Date();<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate();<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString();<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[DT.getUTCMonth()]);<br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return (datestr);<br />
}<br />
<br />
function lastNameToRefname() {<br />
//Note: This only works if field 'refname' comes after field 'last', but it always does<br />
var lastName;<br />
var fields = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
for (var i=0; i<fields.length; i++) {<br />
if(fields[i].id == 'last') {<br />
lastName = fields[i].value;<br />
}<br />
else if(fields[i].id == 'refname') {<br />
fields[i].value = lastName.replace(/^\s*(.*?)\s*$/, "$1");<br />
return;<br />
}<br />
}<br />
}<br />
<br />
function setAccessDateToday() {<br />
document.getElementById('accessdate').value = getTime();<br />
/* var fields = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
for (var i=0; i<fields.length; i++) {<br />
if(fields[i].id == 'accessdate') {<br />
fields[i].value = getTime();<br />
return;<br />
}<br />
}<br />
*/<br />
}<br />
<br />
function getLastName(authornum) {<br />
if (/\S/.test(document.getElementById('last'+authornum).value)) {<br />
return document.getElementById('last'+authornum).value;<br />
}<br />
else {<br />
var author = document.getElementById('author'+authornum).value;<br />
var match = /(\S+)\s*$/.exec(author);<br />
if (match) {<br />
return match[1];<br />
}<br />
else {<br />
return '';<br />
}<br />
}<br />
}<br />
<br />
function makeRefname() {<br />
var refname;<br />
if (document.getElementById('last1')) {<br />
refname = document.getElementById('last1').value + document.getElementById('last2').value;<br />
}<br />
else{<br />
refname = document.getElementById('last').value;<br />
}<br />
if (/\S/.test(refname)) {<br />
var date = document.getElementById('date').value;<br />
var match = /[0-9]{4}/.exec(date);<br />
if (match) {<br />
refname += match[0];<br />
}<br />
}<br />
else {<br />
refname = document.getElementById('title').value;<br />
}<br />
document.getElementById('refname').value = refname;<br />
}<br />
<br />
function citeWeb() {<br />
citeNewsWeb("cite web");<br />
}<br />
function citeNews() {<br />
citeNewsWeb("cite news");<br />
}<br />
<br />
function citeNewsWeb(templatename) {<br />
oldFormHide();<br />
var template = templatename;<br />
var legend;<br />
if (template == "cite web") {<br />
legend = "Cite web source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
var newtime = getTime();<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="' + ((template == 'cite news') ? 'For a New York Times article URL, fetch article data and fill in the fields. For other URLs, fetch the page title.' : 'Fetch the page title. Irrelevant parts often have to be removed manually afterwards.') + '" onClick="pullURL(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="url"></span></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="work">&nbsp;' + ((template == 'cite news') ? 'Newspaper' : 'Work') + ': </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="work"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ newtime +'"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>';<br />
if (template == 'cite web') {<br />
form += '<tr><td width="120"><label for="archiveurl">&nbsp;Archive URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="archiveurl"></td>'+<br />
'<td width="120"><label for="archivedate">&nbsp;Archive date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="archivedate"></td></tr>';<br />
}<br />
form += '<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:60%" id="refname"><input type="button" value="<Last name" onClick="lastNameToRefname()"></td></tr>'+<br />
'</table>'+<br />
' <input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeBook() {<br />
oldFormHide();<br />
var template = "cite book";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite book source</legend>';<br />
<br />
form += '<table cellspacing="5" width="100%"> \<br />
<tr><td><label for="title">Title: </label></td> \<br />
<td colspan=5><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>';<br />
for (var i=1;i<=3;i++) {<br />
var i_str = i == 1 ? '': ' '+i;<br />
form += '<tr> \<br />
<td width="130"><label for="last'+i+'">Author'+i_str+' last&nbsp;name: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="last'+i+'"></td> \<br />
<td><label for="first'+i+'">&nbsp;first&nbsp;name: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="first'+i+'"></td> \<br />
<td><label for="authorlink'+i+'">&nbsp;Authorlink: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="authorlink'+i+'"> \<br />
<!--<a id="authorLinkAnchor'+i+'"><img id="authorLinkButton'+i+'" src="static/progress.gif" border="0" style="visibility: hidden" /></a> \<br />
<a href="//en.wikipedia.org/wiki/%s" target="_blank"><img id="authorTryLink'+i+'" src="static/external.png" border="0" style="visibility: hidden" /></a> --> \<br />
</td> \<br />
</tr>';<br />
}<br />
form += '<tr><td><label for="coauthors">Coauthors: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="coauthors"></td> \<br />
<td><label for="editor">&nbsp;Editor: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="editor"></td> \<br />
<td><label for="others">&nbsp;Others: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="others"></td></tr> \<br />
</table> \<br />
<table cellspacing="5" width="100%"> \<br />
<tr><td width="130"><label for="publisher">Publisher: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="publisher"></td> \<br />
<td><label for="location">&nbsp;Location: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="location"></td></tr> \<br />
\<br />
<tr><td><label for="date">Publication&nbsp;date or&nbsp;year: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:140px" id="date"> \<br />
<input id="dmy" name="dateformat" value="dmy" type="radio" tabindex=1 onclick="reformatDates()"><label for="dmy">dmy</label> \<br />
<input id="mdy" name="dateformat" value="mdy" type="radio" tabindex=1 onclick="reformatDates()"><label for="mdy">md, y</label> \<br />
<input id="ymd" name="dateformat" value="ymd" type="radio" tabindex=1 onclick="reformatDates()"><label for="ymd">y-m-d</label> \<br />
</td> \<br />
<td><label for="edition">&nbsp;Edition: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="edition"></td></tr> \<br />
\<br />
<tr><td><label for="series">Series: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="series"></td> \<br />
<td><label for="volume">&nbsp;Volume: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr> \<br />
\<br />
<tr><td><label for="pages">Page number(s):</label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="pages" name="pages" onFocus="this.style.backgroundColor=\'\';"></td> \<br />
<td><label for="chapter">&nbsp;Chapter: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="chapter"></td></tr> \<br />
\<br />
<tr><td><label for="isbn">ISBN: </label></td> \<br />
<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fill in citation data based on ISBN from Diberri\'s tool." onClick="pullISBN(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="isbn"></span></td> \<br />
<td><label for="language">&nbsp;Language: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="language"></td></tr> \<br />
\<br />
<tr><td><label for="url">URL: </label></td> \<br />
<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fill in citation data based on a Google Books URL." onClick="pullJs(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="url"></span></td> \<br />
<td><label for="accessdate">&nbsp;Access&nbsp;date:</label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr> \<br />
\<br />
<tr><td><label for="otherfields">Other&nbsp;fields:</label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="otherfields"></td> \<br />
<td><label for="refname">&nbsp;Ref&nbsp;name: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="refname"></td> \<br />
</tr> \<br />
</table> \<br />
\<br />
<input type="radio" tabindex=1 name="template" id="cite_book" value="cite_book" checked="1"><label for="cite_book">\{\{cite book}}</label> <sup><a href="//en.wikipedia.org/wiki/Template:Cite_book" target="_blank">[doc]</a></sup> \<br />
<input type="radio" tabindex=1 name="template" id="citation" value="citation"><label for="citation">\{\{citation}}</label> <sup><a href="//en.wikipedia.org/wiki/Template:Citation" target="_blank">[doc]</a></sup> \<br />
<input type="radio" tabindex=1 name="template" id="plain" value="plain"><label for="plain">plain wikicode (experimental)</label> \<br />
<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label> \<br />
<input type="checkbox" tabindex=1 name="extraparams" id="extraparams" value="extraparams"><label for="extraparams">Extra parameters</label> \<br />
<br /><input type="button" value="Add citation" onClick="makeCiteBook()"> \<br />
<input type="button" value="Preview citation" onClick="previewCitationBook()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" /> \<br />
\<br />
</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeJournal() {<br />
oldFormHide();<br />
var template = "cite journal";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite journal</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="journal">&nbsp;Journal: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="journal"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td>'+<br />
'<td width="120"><label for="issue">&nbsp;Issue: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issue"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issn"></td></tr>'+<br />
'<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td>'+<br />
'<td width="120"><label for="doi">&nbsp;DOI: </label></td>'+<br />
'<td width="400"><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fetch citation data for a DOI from crossref.org and fill in the other fields." onClick="pullDOI(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="doi"></span></td></tr>'+<br />
'<tr><td width="120"><label for="pmid">&nbsp;PMID: </label></td>'+<br />
'<td width="400"><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fetch citation data for a PMID" onClick="pullPMID(); return false;" style="float:right;visibility:hidden"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="pmid"></span></td>'+<br />
'<td width="120"><label for="quote">&nbsp;Quote: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="quote"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:60%" id="refname"><input type="button" value="<Last name" onClick="lastNameToRefname()"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeEncyclopedia() {<br />
oldFormHide();<br />
var template = "cite encyclopedia";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite encyclopedia source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="editors">&nbsp;Editors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="editors"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Entry title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="encyclopedia">&nbsp;Encyclopedia: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="encyclopedia"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="year">&nbsp;Year: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="year"></td>'+<br />
'<td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citePressRelease() {<br />
oldFormHide();<br />
var template = "cite press release";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite press release</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="date">&nbsp;Date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ getTime() +'"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeMap() {<br />
oldFormHide();<br />
var template = "cite map";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite map</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="edition">&nbsp;Edition: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="edition"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Date or year: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="cartography">&nbsp;Cartography: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="cartography"></td>'+<br />
'<td width="120"><label for="scale">&nbsp;Scale: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="scale"></td></tr>'+<br />
'<tr><td width="120"><label for="series">&nbsp;Series: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="series"></td>'+<br />
'<td width="120"><label for="page">&nbsp;Page: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="page"></td></tr>'+<br />
'<tr><td width="120"><label for="section">&nbsp;Section: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="section"></td>'+<br />
'<td width="120"><label for="inset">&nbsp;Inset: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="inset"></td></tr>'+<br />
'<tr><td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function showRefSectionOptions() {<br />
oldFormHide();<br />
var template = "cite encyclopedia";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Add references section</legend>\<br />
Headline:<br />\<br />
<input id="references" name="headline" type="radio" tabindex=1 checked="checked"><label for="references">== References ==</label><br /> \<br />
<input id="notes" name="headline" type="radio" tabindex=1><label for="notes">== Notes ==</label><br /> \<br />
Type:<br /> \<br />
<input id="type-references" name="type" type="radio" tabindex=1><label for="type-references">&lt;references/&gt;</label><br /> \<br />
<input id="type-reflist" name="type" type="radio" tabindex=1 checked="checked"><label for="type-reflist">\{\{Reflist}}</label><br /> \<br />
<input id="type-reflist2" name="type" type="radio" tabindex=1><label for="type-reflist2">\{\{Reflist|2}}</label><br /> \<br />
<input type="checkbox" tabindex=1 id="ldr"><label for="ldr">List-defined references</label> (<a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#List-defined_references" target="_blank">Info 1</a>, <a href="//en.wikipedia.org/wiki/Help:Footnotes#List-defined_references" target="_blank">Info 2</a>)<br />\<br />
<input type="button" value="Add references section" onClick="addRefSection()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function makeCiteCode() {<br />
cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
var template = '';<br />
var citebegin = '<ref';<br />
var citename = '';<br />
var citeinner = '';<br />
for (var i=0; i<cites.length; i++) {<br />
var citeid = cites[i].id;<br />
var citevalue = cites[i].value;<br />
citevalue = citevalue.trim(); //Trim leading and trailing whitespace<br />
if (citeid == "verbose") {<br />
if (cites[i].checked) {<br />
citeinner = citeinner.replace(/\|/g, "\n|");<br />
}<br />
}<br />
else if (citevalue !== '' && cites[i].type !== 'button' && cites[i].type !== 'image') {<br />
if (citeid === "refname") {<br />
citebegin += ' name="' + citevalue + '"';<br />
}<br />
else if (citeid == "template") {<br />
citename = '>\{\{' + citevalue;<br />
template = citevalue;<br />
}<br />
else {<br />
if (citeid === "pages") {<br />
if (citevalue.match(/^\w+$/) && template != 'cite encyclopedia') {<br />
citeid = "page"; //Use page= instead of pages= if only one page. Makes p. 5 instead of pp. 5.<br />
}<br />
else {<br />
citevalue = citevalue.replace(/-/g, "–"); //Replace hyphens with en dashes [[WP:ENDASH]]<br />
}<br />
}<br />
else if (citeid == "date" && citevalue.match(/^\d\d\d\d$/)) {<br />
citeid = "year"; // Use year= instead of date= if only the year is specified<br />
}<br />
citeinner += "|" + citeid + "=" + citevalue;<br />
}<br />
}<br />
}<br />
cite = citebegin + citename + citeinner + "}}</ref>";<br />
return cite;<br />
}<br />
<br />
function addcites(template) {<br />
var cite = makeCiteCode();<br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', '');<br />
//document.getElementById('citediv'+numforms).style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function addRefSection() {<br />
var wikicode = "\n";<br />
if (document.getElementById('references').checked) {<br />
wikicode += "== References ==\n";<br />
}<br />
else if (document.getElementById('notes').checked) {<br />
wikicode += "== Notes ==\n";<br />
}<br />
else {alert('No headline selected!');}<br />
<br />
if (document.getElementById('type-references').checked) {<br />
if (document.getElementById('ldr').checked) {<br />
wikicode += "<references>\n\n</references>\n";<br />
}<br />
else {<br />
wikicode += "<references/>\n";<br />
}<br />
}<br />
else if (document.getElementById('type-reflist').checked || document.getElementById('type-reflist2').checked) {<br />
var col2 = document.getElementById('type-reflist2').checked ? '|2' : '' ;<br />
if (document.getElementById('ldr').checked) {<br />
wikicode += "\{\{Reflist" + col2 + "|refs=\n\n}}\n";<br />
}<br />
else {<br />
wikicode += "\{\{Reflist" + col2 + "}}\n";<br />
}<br />
}<br />
else {alert('No type selected!');}<br />
$("#wpTextbox1").focus();<br />
insertTags(wikicode, '', '');<br />
document.getElementById('citediv'+numforms).innerHTML = '';<br />
}<br />
<br />
function getNamedRefs(calls) {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
var regex;<br />
if (calls) {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?\/ *?>/gi //'<br />
} else {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?>/gi //'<br />
}<br />
var namedrefs = new Array();<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[5]) {<br />
namedrefs[i] = ref[5];<br />
} else if (ref[3]) {<br />
namedrefs[i] = ref[3];<br />
} else {<br />
namedrefs[i] = ref[6];<br />
}<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return namedrefs;<br />
}<br />
<br />
function citeNamedRef() {<br />
var namedrefs = getNamedRefs(false);<br />
if (namedrefs == '') {<br />
oldFormHide();<br />
numforms++;<br />
var out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>References in text</legend>There are no named refs (<tt>&lt;ref name="Name"&gt;</tt>) in the text</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
oldFormHide();<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>References in article</legend>'+<br />
'<table cellspacing="5">'+<br />
'<tr><td><label for="namedrefs">&nbsp;Named references in text</label></td>'+<br />
'<td><select name="namedrefs" id="namedrefs">';<br />
for (var i=0;i<namedrefs.length;i++) {<br />
form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';<br />
}<br />
form+= '</select>'+<br />
'</td></tr></table>'+<br />
'<input type="button" value="Add citation" onClick="addnamedcite()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function addnamedcite() {<br />
var name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;<br />
var ref = '<ref name="'+name+'" />';<br />
$("#wpTextbox1").focus();<br />
insertTags(ref, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getAllRefs() {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
var text = document.getElementById('wpTextbox1').value;<br />
var regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"<br />
var allrefs = new Array();<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[0].search(/[^\s]{150}/) != -1) {<br />
ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");<br />
}<br />
ref[0] = ref[0].replace(/</g, "&lt;");<br />
ref[0] = ref[0].replace(/>/g, "&gt;");<br />
allrefs[i] = ref[0];<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return allrefs;<br />
}<br />
<br />
function NRcallError(namedrefs, refname) {<br />
for (var i=0; i<namedrefs.length; i++) {<br />
if (namedrefs[i] == refname) {<br />
return true;<br />
}<br />
}<br />
return false;<br />
}<br />
<br />
function errorCheck() {<br />
var allrefs = getAllRefs();<br />
var allrefscontent = new Array();<br />
var samecontentexclude = new Array();<br />
var sx=0;<br />
var templateexclude = new Array();<br />
var tx=0;<br />
var skipcheck = false;<br />
var namedrefcalls = getNamedRefs(true);<br />
for (var i=0; i<allrefs.length; i++) {<br />
allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8"); //"<br />
}<br />
var namedrefs = getNamedRefs(false);<br />
var errorlist = new Array();<br />
var q=0;<br />
var unclosed = document.getElementById('unclosed').checked;<br />
var samecontent = document.getElementById('samecontent').checked;<br />
var templates = document.getElementById('templates').checked;<br />
var repeated = document.getElementById('repeated').checked;<br />
var undef = document.getElementById('undef').checked;<br />
for (var i=0; i<allrefs.length; i++) {<br />
if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Unclosed <tt>&lt;ref&gt;</tt> tag</td></tr>';<br />
q++;<br />
}<br />
if (samecontent) {<br />
for (var d=0; d<samecontentexclude.length; d++) {<br />
if (allrefscontent[i] == samecontentexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var p=0;<br />
while (p<allrefs.length && !skipcheck) {<br />
if (allrefscontent[i] == allrefscontent[p] && i != p) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';<br />
q++;<br />
samecontentexclude[sx] = allrefscontent[i]<br />
sx++;<br />
break;<br />
}<br />
p++;<br />
}<br />
skipcheck=false;<br />
}<br />
if (templates) {<br />
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) {<br />
for (var x=0; x<templateexclude.length; x++) {<br />
if (allrefscontent[i] == templateexclude[x]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Does not use a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a></td></tr>';<br />
q++;<br />
templateexclude[tx] = allrefscontent[i];<br />
tx++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
}<br />
if (repeated) {<br />
var repeatnameexclude = new Array();<br />
var rx=0;<br />
for (var k=0; k<namedrefs.length; k++) {<br />
for (var d=0; d<repeatnameexclude.length; d++) {<br />
if (namedrefs[k] == repeatnameexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var z=0;<br />
while (z<namedrefs.length && !skipcheck) {<br />
if (namedrefs[k] == namedrefs[z] && k != z) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';<br />
q++;<br />
repeatnameexclude[rx] = namedrefs[z];<br />
rx++;<br />
break;<br />
}<br />
z++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (undef) {<br />
var undefexclude = new Array();<br />
var ux=0;<br />
for (var p=0; p<namedrefcalls.length; p++) {<br />
for (var d=0; d<undefexclude.length; d++) {<br />
if (allrefscontent[i] == undefexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
if (!NRcallError(namedrefs, namedrefcalls[p])) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">A <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';<br />
q++;<br />
undefexclude[ux] = namedrefs[p];<br />
ux++;<br />
}<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (q > 0) {<br />
return errorlist;<br />
} else {<br />
return 0;<br />
}<br />
}<br />
<br />
function dispErrors() {<br />
oldFormHide();<br />
var form = '<div id="errorform"><fieldset>'+<br />
'<legend>Error checking</legend>'+<br />
'<b>Check for:</b><br/>'+<br />
'<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+<br />
'<input type="checkbox" id="samecontent" /> References with the same content<br/>'+<br />
'<input type="checkbox" id="templates" /> References not using a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a><br/>'+<br />
'<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+<br />
'<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+<br />
'<input type="button" id="errorchecksubmit" value="Check for selected errors" onclick="doErrorCheck()"/>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function doErrorCheck() {<br />
var errors = errorCheck();<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
if (errors == 0) {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>Error checking</legend>No errors found.</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Error checking</legend>'+<br />
'<table border="1px">';<br />
for (var i=0; i<errors.length; i++) {<br />
form+=errors[i];<br />
}<br />
form+= '</table>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function makeBookCitationCode(callback) {<br />
var cite = '<ref';<br />
var refname = document.getElementById('refname').value;<br />
if (/\S/.test(refname)) {<br />
cite += ' name="' + refname + '"';<br />
}<br />
cite += '>\{\{';<br />
<br />
if (document.getElementById('cite_book').checked || document.getElementById('plain').checked) {<br />
cite += 'cite book';<br />
}<br />
else if (document.getElementById('citation').checked) {<br />
cite += 'citation';<br />
}<br />
else {alert('No template selected.');}<br />
<br />
var authorcite = '';<br />
var prevauthor = 0;<br />
for (var i=3;i>=1;i--) {<br />
//var author = document.getElementById('author' + i).value;<br />
var last = document.getElementById('last' + i).value;<br />
var first = document.getElementById('first' + i).value;<br />
var authorlink = document.getElementById('authorlink' + i).value;<br />
if (i==1 && !prevauthor) { i = ''; }<br />
if (/\S/.test(authorlink)) {<br />
authorcite = '|authorlink' + i + '=' + authorlink + authorcite;<br />
}<br />
if (/\S/.test(last)) {<br />
authorcite = '|last' + i + '=' + last + '|first' + i + '=' + first + authorcite;<br />
prevauthor = 1;<br />
}<br />
/*else if (/\S/.test(author)) {<br />
authorcite = '|author' + i + '=' + author + authorcite;<br />
prevauthor = 1;<br />
}*/<br />
}<br />
cite += authorcite;<br />
<br />
var simplefields = ["coauthors", "editor", "others", "title", "url", "accessdate","edition","series","volume","date","publisher","location","language","isbn","pages","chapter"];<br />
for (var i=0;i<simplefields.length;i++) {<br />
var fieldname = simplefields[i];<br />
var value = document.getElementById(fieldname).value;<br />
if (/\S/.test(value) || fieldname == "title") {<br />
if (fieldname == "pages") {<br />
if (/^\w+$/.test(value)) {<br />
fieldname = "page"; //Use page= instead of pages= if only one page. Makes p. 5 instead of pp. 5.<br />
}<br />
else {<br />
value = value.replace(/-/g, "–"); //Replace hyphens with en dashes [[WP:ENDASH]]<br />
value = value.replace(/,\s*\s?/g, ", "); //One space after each comma<br />
}<br />
}<br />
else if (fieldname == "date" && /^\d\d\d\d$/.test(value)) {<br />
fieldname = "year"; // Use year= instead of date= if only the year is specified<br />
}<br />
cite += '|' + fieldname + '=' + value;<br />
}<br />
}<br />
<br />
<br />
var otherfields = document.getElementById('otherfields').value;<br />
if (/\S/.test(otherfields)) {<br />
cite += '|' + otherfields;<br />
}<br />
<br />
if (document.getElementById('extraparams').checked) {<br />
cite += '|authormask=';<br />
if (!document.getElementById('citation').checked) {<br />
cite += '|trans_title=';<br />
}<br />
cite += '|format=';<br />
cite += '|origyear=';<br />
cite += '|oclc=';<br />
cite += '|doi=';<br />
cite += '|bibcode=';<br />
cite += '|id=';<br />
if (/\S/.test(document.getElementById('chapter').value)) {<br />
if (!document.getElementById('citation').checked) {<br />
cite += '|trans_chapter=';<br />
} <br />
cite += '|chapterurl=';<br />
}<br />
cite += '|quote=';<br />
cite += '|laysummary=';<br />
cite += '|laydate=';<br />
}<br />
<br />
cite += "}}</ref>";<br />
<br />
<br />
if (document.getElementById('plain').checked) {<br />
var match = /^(.*?)(\{\{.*}})(.*?)$/.exec(cite);<br />
if (match) {<br />
var citebeg = match[1];<br />
var citemid = match[2];<br />
var citeend = match[3];<br />
citemid = citemid.replace(/cite book/, "Vancite book");<br />
//alert(citebeg + ':::' + citemid + ':::' + citeend);<br />
//document.getElementById('fullcite').value = 'Updating...';<br />
var url = 'api.php?action=expandtemplates&format=xml&text=' + encodeURIComponent(citemid);<br />
document.getElementById('progress').style.visibility = "visible";<br />
var xmlhttpExpand = new XMLHttpRequest();<br />
xmlhttpExpand.onreadystatechange=function() {<br />
if(xmlhttpExpand.readyState==4) { <br />
if(xmlhttpExpand.status==200) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
var xmlDoc=xmlhttpExpand.responseXML.documentElement;<br />
var expanded = xmlDoc.getElementsByTagName("expandtemplates")[0].textContent;<br />
if (expanded == undefined) {<br />
expanded = xmlDoc.getElementsByTagName("expandtemplates")[0].childNodes[0].nodeValue;<br />
}<br />
expanded = expanded.replace(/<span.*?>/ig, '');<br />
expanded = expanded.replace(/<\/span>/ig, '');<br />
expanded = expanded.replace(/<nowiki\/?>/ig, '');<br />
expanded = expanded.replace(/\&\#32\;/ig, ' ');<br />
expanded = expanded.replace(/\&\#59\;/ig, ';');<br />
expanded = expanded.replace(/\&\#91\;/ig, '[');<br />
expanded = expanded.replace(/\&\#93\;/ig, ']');<br />
<br />
plaincite = citebeg + expanded + citeend;<br />
//alert(plaincite);<br />
callback(plaincite);<br />
}<br />
else<br />
alert('The query returned an error.');<br />
}<br />
}<br />
xmlhttpExpand.open("GET",url,true);<br />
xmlhttpExpand.send(null);<br />
}<br />
else {alert('Error A1');}<br />
}<br />
else {<br />
if (document.getElementById('verbose').checked) {<br />
cite = cite.replace(/\|/g, "\n|");<br />
}<br />
callback(cite);<br />
}<br />
}<br />
<br />
function makeCiteBook() {<br />
makeBookCitationCode(function(cite) { <br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', ''); <br />
if (!refToolDebug) { oldFormHide(); }<br />
});<br />
}<br />
<br />
function formatDate(datein, dateformat) {<br />
if (dateformat == '') {return (datein);}<br />
datein = datein.replace(/^\s*(.*?)\s*$/, "$1"); //Trim whitespace<br />
var year = -1;<br />
var month = -1;<br />
var date = -1;<br />
var match = /^(\d\d\d\d)-(\d\d?)(-(\d\d?))?$/.exec(datein);<br />
if(match) {<br />
//alert(' match[1]=' + match[1] + ' match[2]=#' + match[2] + '# match[3]=' + match[3] + ' match[4]=' + match[4] );<br />
year = parseInt(match[1], 10); //10 forces decimal conversion<br />
month = parseInt(match[2], 10);<br />
if (match[4]) {<br />
date = parseInt(match[4], 10);<br />
}<br />
}<br />
else if (/^\d\d? \w+ \d\d\d\d$/.test(datein) || /^\w+ \d\d?, \d\d\d\d$/.test(datein)) {<br />
var DT = new Date(datein);<br />
year = DT.getUTCFullYear();<br />
month = DT.getUTCMonth()+1;<br />
date = DT.getUTCDate()+1;<br />
}<br />
else if (datein == 'today') {<br />
var DT = new Date();<br />
year = DT.getUTCFullYear();<br />
month = DT.getUTCMonth()+1;<br />
date = DT.getUTCDate();<br />
}<br />
else {return (datein);}<br />
//alert('datein=' + datein + ', y=' + year + ', m=' + month + ', d=' + date);<br />
<br />
var zmonth = '';<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
if (date > -1) {<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString()<br />
}<br />
else { date = ''; }<br />
<br />
var datestr = dateformat;<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[month-1]);<br />
datestr = datestr.replace('<year>', year.toString());<br />
datestr = datestr.replace(/\s+/, ' ').replace(/^\s+/, '').replace(/(\D),/, '$1').replace(/-$/, '');<br />
return (datestr);<br />
}<br />
<br />
<br />
function getDateFormat() {<br />
var dateformat = '';<br />
if (document.getElementById('dmy')){<br />
if (document.getElementById('dmy').checked) {dateformat = '<date> <monthname> <year>'}<br />
else if (document.getElementById('mdy').checked) {dateformat = '<monthname> <date>, <year>'}<br />
else if (document.getElementById('ymd').checked) {dateformat = '<year>-<zmonth>-<zdate>'}<br />
}<br />
else if (citeUserDateFormat) {<br />
dateformat = citeUserDateFormat;<br />
} else {<br />
dateformat = citeGlobalDateFormat;<br />
}<br />
return (dateformat);<br />
}<br />
<br />
function reformatDates() {<br />
var dateformat = getDateFormat();<br />
//alert(':' + dateformat + ':');<br />
document.getElementById('accessdate').value = formatDate(document.getElementById('accessdate').value, dateformat);<br />
document.getElementById('date').value = formatDate(document.getElementById('date').value, dateformat);<br />
//document.getElementById('dateformat_hidden').value = getDateFormatShort();<br />
}<br />
<br />
/*function updateGetButton() {<br />
document.getElementById('urlget').disabled = document.getElementById('url').value == '';<br />
}*/<br />
<br />
function preview(wikitext) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
wikitext += '<references />';<br />
var url = "api.php?action=parse&format=xml&prop=text&text=" + encodeURIComponent(wikitext);<br />
var xmlhttp = new XMLHttpRequest();<br />
xmlhttp.onreadystatechange = function () {<br />
if (xmlhttp.readyState==4) {<br />
if(xmlhttp.status==200) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
var xmlDoc=xmlhttp.responseXML.documentElement;<br />
var previewHTML = xmlDoc.getElementsByTagName("text")[0].textContent;<br />
if (previewHTML == undefined) {<br />
previewHTML = xmlDoc.getElementsByTagName("text")[0].childNodes[0].nodeValue;<br />
}<br />
//alert(previewHTML);<br />
previewHTML = previewHTML.replace(/href="\//gi, 'href="//en.wikipedia.org/');<br />
document.getElementById('previewSpan').innerHTML = '<fieldset><legend>Citation preview</legend>' + previewHTML + '</fieldset>';<br />
}<br />
else<br />
alert('The query returned an error.');<br />
}<br />
};<br />
xmlhttp.open("GET", url, true);<br />
xmlhttp.send(null)<br />
}<br />
<br />
function previewCitationBook() {<br />
makeBookCitationCode(preview);<br />
}<br />
<br />
function previewCitationDefault() {<br />
var wikitext = makeCiteCode();<br />
preview(wikitext);<br />
}<br />
<br />
function pullJs() {<br />
var book_url = document.getElementById('url').value;<br />
if (book_url) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
var book_url_enc = encodeURIComponent(book_url);<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'googlebooksjs.py';<br />
var url = baseurl + '?book_url=' + book_url_enc + '&callback=setFormValues';<br />
/*var script = document.createElement("script"); <br />
script.setAttribute("src",url);<br />
script.setAttribute("type","text/javascript"); <br />
document.body.appendChild(script);*/<br />
JsonRequest(url);<br />
}else{<br />
alert('No URL.');<br />
}<br />
}<br />
<br />
function pullISBN() {<br />
var isbn = document.getElementById('isbn').value;<br />
isbn = isbn.replace(/[^0-9]/g,""); //Digits only<br />
if (isbn) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'getdiberri.py';<br />
var url = baseurl + '?isbn=' + isbn + '&callback=useDiberriData';<br />
/*var script = document.createElement("script");<br />
script.setAttribute("src",url);<br />
script.setAttribute("type","text/javascript");<br />
document.body.appendChild(script);*/<br />
JsonRequest(url);<br />
}else{<br />
alert('No ISBN.');<br />
}<br />
}<br />
<br />
function pullDOI() {<br />
var doi = document.getElementById('doi').value;<br />
if (doi) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'doifetchjs.py';<br />
var url = baseurl + '?doi=' + encodeURIComponent(doi) + '&callback=useDoiData';<br />
JsonRequest(url);<br />
}else{<br />
alert('No DOI.');<br />
}<br />
}<br />
<br />
function pullPMID() {<br />
alert('Not implemented yet...');<br />
/*var doi = document.getElementById('doi').value;<br />
if (doi) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'doifetchjs.py';<br />
var url = baseurl + '?doi=' + encodeURIComponent(doi) + '&callback=useDoiData';<br />
JsonRequest(url);<br />
}else{<br />
alert('No DOI.');<br />
}*/<br />
}<br />
<br />
function pullURL() {<br />
var url = document.getElementById('url').value;<br />
if (url) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'urlfetchjs.py';<br />
var url = baseurl + '?url=' + encodeURIComponent(url) + '&callback=useUrlData';<br />
JsonRequest(url);<br />
}else{<br />
alert('No URl.');<br />
}<br />
}<br />
<br />
function JsonRequest(url) {<br />
//importScriptURI(url) //Bad: does not import the same script more than once<br />
var script = document.createElement("script"); <br />
script.setAttribute("src",url);<br />
script.setAttribute("type","text/javascript"); <br />
//document.body.appendChild(script);<br />
document.getElementsByTagName('head')[0].appendChild(script);<br />
}<br />
<br />
function setFormValues(bookdata) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
//alert(bookdata);<br />
//alert(bookdata.page);<br />
if (bookdata.title.length != 0) { document.getElementById('title').value = bookdata.title; }<br />
if (bookdata.isbn.length != 0) { document.getElementById('isbn').value = bookdata.isbn; }<br />
if (bookdata.publisher.length != 0) { document.getElementById('publisher').value = bookdata.publisher; }<br />
if (bookdata.pages.length != 0) { <br />
document.getElementById('pages').value = bookdata.pages; <br />
document.getElementById('pages').style.backgroundColor = '#FFFF99';<br />
}<br />
if (bookdata.url.length != 0) { document.getElementById('url').value = bookdata.url; }<br />
if (bookdata.date.length != 0) { document.getElementById('date').value = bookdata.date; }<br />
<br />
for (var i=0;i<bookdata.authors.length && i<=2;i++) {<br />
authorn = i+1;<br />
var author = bookdata.authors[i];<br />
var match = /(.+)\s+(.+)/.exec(author);<br />
if (match) {<br />
document.getElementById('first' + authorn).value = match[1];<br />
document.getElementById('last' + authorn).value = match[2];<br />
}<br />
else {<br />
document.getElementById('last' + authorn).value = author;<br />
}<br />
}<br />
document.getElementById('coauthors').value = bookdata.authors.splice(3).join(', ')<br />
setAccessDateToday()<br />
makeRefname()<br />
}<br />
<br />
function useDiberriData(bookdata) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
if (bookdata.title.length != 0) { document.getElementById('title').value = bookdata.title; }<br />
if (bookdata.isbn.length != 0) { document.getElementById('isbn').value = bookdata.isbn; }<br />
if (bookdata.publisher.length != 0) { document.getElementById('publisher').value = bookdata.publisher; }<br />
if (bookdata.location.length != 0) { document.getElementById('location').value = bookdata.location; }<br />
if (bookdata.year.length != 0) { document.getElementById('date').value = bookdata.year; }<br />
if (bookdata.authors.length != 0) {<br />
authors = bookdata.authors.split(';', 4);<br />
for (var i=0;i<authors.length && i<=2;i++) {<br />
authorn = i+1;<br />
nameparts = authors[i].split(',', 2);<br />
document.getElementById('last' + authorn).value = nameparts[0].trim();<br />
if (nameparts.length == 2) {<br />
document.getElementById('first' + authorn).value = nameparts[1].trim();<br />
}<br />
}<br />
if (authors[3]) { document.getElementById('coauthors').value = authors[3].trim(); }<br />
}<br />
makeRefname() <br />
}<br />
<br />
function useDoiData(bookdata) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
if (bookdata.title) { document.getElementById('title').value = bookdata.title; }<br />
//if (bookdata.isbn.length != 0) { document.getElementById('isbn').value = bookdata.isbn; }<br />
//if (bookdata.publisher.length != 0) { document.getElementById('publisher').value = bookdata.publisher; }<br />
//if (bookdata.location.length != 0) { document.getElementById('location').value = bookdata.location; }<br />
if (bookdata.year) { document.getElementById('date').value = bookdata.year; }<br />
if (bookdata.issn) { document.getElementById('issn').value = bookdata.issn; }<br />
if (bookdata.journal) { document.getElementById('journal').value = bookdata.journal; }<br />
if (bookdata.volume) { document.getElementById('volume').value = bookdata.volume; }<br />
if (bookdata.issue) { document.getElementById('issue').value = bookdata.issue; }<br />
if (bookdata.pages) { document.getElementById('pages').value = bookdata.pages; }<br />
<br />
if (bookdata.authors) {<br />
var coauthors = [];<br />
for (var i=0;i<bookdata.authors.length;i++) {<br />
var authorn = i+1;<br />
var author = bookdata.authors[i];<br />
if (authorn == 1) {<br />
if (author.last) { document.getElementById('last').value = author.last.trim(); }<br />
if (author.first) { document.getElementById('first').value = author.first.trim(); }<br />
}<br />
else {<br />
var authorparts = [];<br />
if (author.first) { authorparts.push( author.first.trim() ); }<br />
if (author.last) { authorparts.push( author.last.trim() ); }<br />
coauthors.push(authorparts.join(' '));<br />
}<br />
}<br />
if (coauthors[0]) { document.getElementById('coauthors').value = coauthors.join(', '); }<br />
}<br />
makeRefname();<br />
}<br />
<br />
function useUrlData(data) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
if (data.title) { document.getElementById('title').value = data.title; }<br />
if (data.work) { document.getElementById('work').value = data.work; }<br />
if (data.page) { document.getElementById('pages').value = data.page; }<br />
if (data.date) {<br />
document.getElementById('date').value = formatDate(data.date, getDateFormat());<br />
}<br />
/*if (data.author) {<br />
var authors = data.author.replace(/ [Aa]nd /, ', ');<br />
var match = /(.+),\s*(.+)/.exec(authors);<br />
var firstauthor = '';<br />
if (match) {<br />
firstauthor = match[1];<br />
var coauthors = match[2];<br />
document.getElementById('coauthors').value = coauthors;<br />
}<br />
else {<br />
firstauthor = data.author;<br />
}<br />
var match = /(.+)\s+(.+)/.exec(firstauthor);<br />
if (match) {<br />
document.getElementById('first').value = match[1];<br />
document.getElementById('last').value = match[2];<br />
}<br />
else {<br />
document.getElementById('last').value = author;<br />
}<br />
}*/<br />
if (data.authors) {<br />
var coauthors = [];<br />
for (var i=0;i<data.authors.length;i++) {<br />
var authorn = i+1;<br />
var author = data.authors[i];<br />
if (authorn == 1) {<br />
var match = /(.+)\s+(.+)/.exec(author);<br />
if (match) {<br />
document.getElementById('first').value = match[1].trim();<br />
document.getElementById('last').value = match[2].trim();<br />
}<br />
else {<br />
document.getElementById('last').value = author.trim();<br />
}<br />
}<br />
else {<br />
coauthors.push(author);<br />
}<br />
}<br />
if (coauthors[0]) { document.getElementById('coauthors').value = coauthors.join(', '); }<br />
}<br />
}<br />
<br />
$( refbuttons );</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations&diff=10338
MediaWiki:Gadget-citations
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>[[WP:Citation expander|Citation expander]]: Automatically expand and format citations (uses "[[WP:UCB|Citation bot]]").<br />
<!--<br />
* A link in the toolbox will activate [[User:Citation bot]] on the page that you are currently viewing. The bot will expand, format and tidy all references on that page.<br />
<br />
* A button underneath the edit box (next to "Show Changes") will send the contents of the edit box to the bot, which will process them and return the expanded version. This has two possible uses:<br />
** It allows the manual checking of the bot's output before an article is modified<br />
** You can type a partial citation in to an article (e.g. <code><nowiki>{{cite journal|pmid=12345}}</nowiki></code>), then have the bot expand this to a complete citation before you save the page.<br />
<br />
<br />
For more information about the functions performed by [[User:Citation bot|Citation bot]], see [[User:Citation bot|its user page]] or [[WP:UCB|an introductory page]]. For information about the gadget's script, see [[User:Smith609/citation]].<br />
--></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-wikEd.js&diff=10340
MediaWiki:Gadget-wikEd.js
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor<br />
importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'<br />
+ '&action=raw&ctype=text/javascript');</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Template:NonRefTerm&diff=10342
Template:NonRefTerm
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div><i>{{{1}}}</i><noinclude><!--'''Template:NonRefTerm'''--><br />
[[Category:NonRefTerm]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Template:Note&diff=10344
Template:Note
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div><!--'''Template:Note'''-->* <font size="-1">{{{1}}}. {{{2}}}</font></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Template:NoteTerm&diff=10346
Template:NoteTerm
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div><!--'''Template:NoteTerm'''--><b>{{{1}}}</b>{{<br />
#if: {{{2|}}} |({{{2}}})|}}<noinclude><br />
[[Category:Index]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Template:TextTerm&diff=10348
Template:TextTerm
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div><!--'''Template:TextTerm'''-->{{<br />
#if: {{{IndexEntry|}}} |<br />
<b>[[{{{IndexEntry}}}|{{{1}}}]]</b>|<br />
<b>[[{{{1}}}]]</b>}}<sup>{{{2}}}</sup>{{<br />
#if: {{{EnglishEntry|}}} |({{{EnglishEntry}}})|}}<noinclude><br />
[[Category:Dictionary]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Template:RefNumber&diff=10350
Template:RefNumber
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div><!--'''Template:RefNumber'''-->{{<br />
#if: {{{Page|}}} |<br />
[[{{{Page}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]|<br />
[[{{{1}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]}}</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=10328
MediaWiki:Edittools
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div><div id="editpage-specialchars" style="margin-top: 15px; border: 1px solid #aaaaaa; padding: 2px;" class="edittools-text edittools-version-045"><!-- INCREMENT THIS VERSION NUMBER TO MAKE CHANGES TO [[MediaWiki:Edittools.js]] LIVE --><br />
<!--<br />
This div gets automatically replaced with the actual edit tools by the code in [[MediaWiki:Edittools.js]]. Please make any changes there. Any content is this div is only shown to users with JavaScript turned off (or unsupported).<br />
--><br />
'''Copy and paste:''' – — ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ ← → · § &nbsp; '''Sign your posts on talk pages:''' <nowiki>~~~~</nowiki><br />
----<br />
<small><br />
Special Multilingual Demographic Dictionary :<br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}<br />
<pre><br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}</pre><br />
<charinsert><nowiki>{{</nowiki>TextTerm|+|}} <nowiki>{{</nowiki>RefNumber|+||}} <nowiki>{{</nowiki>Note|+|}} <nowiki>{{</nowiki>NoteTerm|}}</charinsert><br />
<nowiki>{{}}</nowiki> &nbsp; <nowiki>{{{}}}</nowiki> &nbsp; | &nbsp; <nowiki>[]</nowiki> &nbsp; <nowiki>[[]]</nowiki> &nbsp; <nowiki>[[Category:]]</nowiki> &nbsp; <nowiki>#REDIRECT [[]]</nowiki> &nbsp; &amp;nbsp; &nbsp; &lt;s>&lt;/s> &nbsp; &lt;sup>&lt;/sup> &nbsp; &lt;sub>&lt;/sub> &nbsp; &lt;code>&lt;/code> &nbsp; &lt;pre>&lt;/pre> &nbsp; &lt;blockquote>&lt;/blockquote> &nbsp; &lt;ref>&lt;/ref> &nbsp; <nowiki><br />
{{Reflist}}</nowiki> &nbsp; &lt;references/> &nbsp; &lt;includeonly>&lt;/includeonly> &nbsp; &lt;noinclude>&lt;/noinclude> &nbsp; <nowiki>{{DEFAULTSORT:}}</nowiki> &nbsp; &lt;nowiki>&lt;/nowiki> &nbsp; &lt;!-- --> &nbsp; &lt;span class="plainlinks">&lt;/span><br />
</small><br />
----<br />
<small><br />
'''Symbols:''' ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶ &nbsp; # ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞ &nbsp; ‘ ’ “ ” «» &nbsp; ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥ &nbsp; ♠ ♣ ♥ ♦ &nbsp; m² m³ &nbsp; ♭ ♯ ♮ &nbsp; © ® ™<br /><br />
'''Latin:''' A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ &nbsp; B b &nbsp; C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç &nbsp; D d Ď ď Đ đ Ḍ ḍ Ð ð &nbsp; E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ə ə &nbsp; F f &nbsp; G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ &nbsp; H h Ĥ ĥ Ħ ħ Ḥ ḥ &nbsp; I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į &nbsp; J j Ĵ ĵ &nbsp; K k Ķ ķ &nbsp; L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ &nbsp; M m Ṃ ṃ &nbsp; N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ &nbsp; O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ &nbsp; P p &nbsp; Q q &nbsp; R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ &nbsp; S s Ś ś Ŝ ŝ Š š Ş ş Ș ș Ṣ ṣ ß &nbsp; T t Ť ť Ţ ţ Ț ț Ṭ ṭ Þ þ &nbsp; U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ &nbsp; V v &nbsp; W w Ŵ ŵ &nbsp; X x &nbsp; Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ &nbsp; Z z Ź ź Ż ż Ž ž &nbsp; ß Ð ð Þ þ Ə ə &nbsp; <nowiki>{{Unicode|}}</nowiki> <br /><br />
'''Greek:''' Ά ά Έ έ Ή ή Ί ί Ό ό Ύ ύ Ώ ώ &nbsp; Α α Β β Γ γ Δ δ &nbsp; Ε ε Ζ ζ Η η Θ θ &nbsp; Ι ι Κ κ Λ λ Μ μ &nbsp; Ν ν Ξ ξ Ο ο Π π &nbsp; Ρ ρ Σ σ ς Τ τ Υ υ &nbsp; Φ φ Χ χ Ψ ψ Ω ω &nbsp; <nowiki>{{Polytonic|}}</nowiki> <br /><br />
'''Cyrillic:''' А а Б б В в Г г &nbsp; Ґ ґ Ѓ ѓ Д д Ђ ђ &nbsp; Е е Ё ё Є є Ж ж &nbsp; З з Ѕ ѕ И и І і &nbsp; Ї ї Й й Ј ј К к &nbsp; Ќ ќ Л л Љ љ М м &nbsp; Н н Њ њ О о П п &nbsp; Р р С с Т т Ћ ћ &nbsp; У у Ў ў Ф ф Х х &nbsp; Ц ц Ч ч Џ џ Ш ш &nbsp; Щ щ Ъ ъ Ы ы Ь ь &nbsp; Э э Ю ю Я я &nbsp; ́ <br /><br />
'''IPA:''' t̪ d̪ ʈ ɖ ɟ ɡ ɢ ʡ ʔ &nbsp; ɸ ʃ ʒ ɕ ʑ ʂ ʐ ʝ ɣ ʁ ʕ ʜ ʢ ɦ &nbsp; ɱ ɳ ɲ ŋ ɴ &nbsp; ʋ ɹ ɻ ɰ &nbsp; ʙ ʀ ɾ ɽ &nbsp; ɫ ɬ ɮ ɺ ɭ ʎ ʟ &nbsp; ɥ ʍ ɧ &nbsp; ɓ ɗ ʄ ɠ ʛ &nbsp; ʘ ǀ ǃ ǂ ǁ &nbsp; ɨ ʉ ɯ &nbsp; ɪ ʏ ʊ &nbsp; ɘ ɵ ɤ &nbsp; ə ɚ &nbsp; ɛ ɜ ɝ ɞ ʌ ɔ &nbsp; ɐ ɶ ɑ ɒ &nbsp; ʰ ʷ ʲ ˠ ˤ ⁿ ˡ &nbsp; ˈ ˌ ː ˑ ̪ &nbsp; <nowiki>{{IPA|}}</nowiki><br />
</small><br />
<!--<br />
Everything up to here gets automatically replaced with the JavaScript edit tools for users with JavaScript enabled.<br />
--><br />
</div><br />
<br />
<div style="margin-top: 1em;" id="editpage-copywarn2"><br />
<strong style="font-size: 130%;">Please note:</strong><br />
* When you click Save page, your changes will immediately become visible to everyone. If you wish to run a test, please edit the [[Wikipedia:Sandbox|Sandbox]] instead.<br />
*Please post only [[Wikipedia:Wikipedia is an encyclopedia|encyclopedic]] information that can be [[Wikipedia:Verifiability|verified]] by external sources. Please maintain a [[Wikipedia:Neutral point of view|neutral]], unbiased point of view.<br />
* Please [[Wikipedia:Copy-paste|do not copy and paste]] from copyrighted websites – only [[Wikipedia:public domain|public domain]] resources can be copied without permission.<br />
</div></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarBaseTextTerm.js&diff=10330
MediaWiki:RefToolbarBaseTextTerm.js
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>// Global object<br />
if (typeof CiteTB == 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
if (typeof mw.usability == 'undefined') {<br />
mw.usability = {};<br />
mw.usability.getMsg = function(m) { return mw.messages.get(m); }<br />
mw.usability.addMessages = function(msgs) { mw.messages.set(msgs); };<br />
}<br />
<br />
// Object for cite templates<br />
function citeTemplate(templatename, shortform, basicfields, expandedfields) {<br />
// Properties<br />
this.templatename = templatename; // The template name - "cite web", "cite book", etc.<br />
this.shortform = shortform; // A short form, used for the dropdown box<br />
this.basic = basicfields; // Basic fields - author, title, publisher...<br />
// Less common - quote, archiveurl - should be everything the template supports minus the basic ones<br />
this.extra = expandedfields;<br />
<br />
// Add it to the list<br />
CiteTB.Templates[this.templatename] = this;<br />
// Methods<br />
this.makeFormInner = function(fields) {<br />
var i=0;<br />
var trs = new Array();<br />
for (i=0; i<fields.length; i++) {<br />
var fieldobj = fields[i];<br />
var field = fieldobj.field;<br />
var ad = false;<br />
if ($j.inArray(field, CiteTB.getOption('autodate fields')) != -1 ) {<br />
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Nuvola_apps_date.svg/20px-Nuvola_apps_date.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-insert-date')).attr('title', mw.usability.getMsg('cite-insert-date'));<br />
var ad = $j('<a />').attr('href', '#');<br />
ad.append(im);<br />
ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field);<br />
$j('#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field).live('click', CiteTB.fillAccessdate);<br />
}<br />
<br />
if (fieldobj.autofillid) {<br />
var autotype = fieldobj.autofillid;<br />
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/1/17/System-search.svg/20px-System-search.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-autofill-alt')).attr('title', mw.usability.getMsg('cite-autofill-alt'));<br />
var ad = $j('<a />').attr('href', '#');<br />
ad.append(im);<br />
ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype);<br />
$j('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype).live('click', CiteTB.initAutofill); <br />
}<br />
<br />
var display = mw.usability.getMsg('cite-'+field+'-label');<br />
var tooltip = fieldobj.tooltip ? $j('<abbr />').attr('title', mw.usability.getMsg(fieldobj.tooltip)).text('*') : false;<br />
<br />
var input = '';<br />
if (ad) {<br />
input = $j('<input tabindex="1" style="width:85%" type="text" />');<br />
} else {<br />
input = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
}<br />
input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field);<br />
if (fieldobj.autofillprop) {<br />
input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop);<br />
}<br />
var label = $j('<label />');<br />
label.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field).text(display);<br />
if (tooltip) {<br />
label.append(tooltip);<br />
}<br />
var style = 'text-align:right; width:20%;';<br />
if (i%2 == 1) {<br />
style += ' padding-left:1em;';<br />
} else {<br />
var tr = $j('<tr />');<br />
}<br />
var td1 = $j('<td class="cite-form-td" />').attr('style', style);<br />
td1.append(label);<br />
tr.append(td1);<br />
var td2 = $j('<td class="cite-form-td" style="width:30%" />');<br />
td2.append(input);<br />
if (ad) {<br />
td2.append(ad);<br />
}<br />
tr.append(td2);<br />
if (i%2 == 0) {<br />
trs.push(tr);<br />
}<br />
}<br />
return trs;<br />
<br />
}<br />
<br />
// gives a little bit of HTML so the open form can be identified<br />
this.getInitial = function() {<br />
var hidden = $j('<input type="hidden" class="cite-template" />');<br />
hidden.val(this.templatename);<br />
return hidden;<br />
}<br />
<br />
// makes the form used in the dialog boxes<br />
this.getForm = function() {<br />
var main = $j("<div class='cite-form-container' />");<br />
var form1 = $j('<table style="width:100%; background-color:transparent;" class="cite-basic-fields" />');<br />
var i=0;<br />
var trs = this.makeFormInner(this.basic);<br />
for (var i=0; i<trs.length; i++) {<br />
form1.append(trs[i]);<br />
}<br />
<br />
var form2 = $j('<table style="width:100%; background-color:transparent; display:none" class="cite-extra-fields">');<br />
trs = this.makeFormInner(this.extra);<br />
for (var i=0; i<trs.length; i++) {<br />
form2.append(trs[i]);<br />
} <br />
main.append(form1).append(form2);<br />
<br />
var form3 = $j('<table style="width:100%; background-color:transparent;padding-top:1em" class="cite-other-fields">');<br />
var tr = $j('<tr />');<br />
var td1 = $j('<td class="cite-form-td" style="text-align:right; width:20%" />');<br />
var label1 = $j('<label />');<br />
label1.attr('for', "cite-"+CiteTB.escStr(this.shortform)+'-name').text(mw.usability.getMsg('cite-name-label'));<br />
td1.append(label1);<br />
var td2 = $j('<td class="cite-form-td" style="width:30%" />');<br />
var input1 = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
input1.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-name');<br />
td2.append(input1);<br />
var td3 = $j('<td class="cite-form-td" style="text-align:right; padding-left:1em; width:20%">');<br />
var label2 = $j('<label />');<br />
label2.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-group').text(mw.usability.getMsg('cite-group-label'));<br />
td3.append(label2);<br />
var td4 = $j('<td class="cite-form-td" style="width:30%" />');<br />
var input2 = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
input2.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-group');<br />
td4.append(input2);<br />
tr.append(td1).append(td2).append(td3).append(td4);<br />
form3.append(tr);<br />
main.append(form3);<br />
var extras = $j('<div />');<br />
extras.append('<input type="hidden" class="cite-form-status" value="closed" />');<br />
var hidden = $j('<input type="hidden" class="cite-template" />');<br />
hidden.val(this.templatename);<br />
extras.append(hidden);<br />
var span1 = $j('<span class="cite-preview-label" style="display:none;" />');<br />
span1.text(mw.usability.getMsg('cite-raw-preview'));<br />
extras.append(span1).append('<div class="cite-ref-preview" style="padding:0.5em; font-size:110%" />');<br />
var span2 = $j('<span class="cite-prev-parsed-label" style="display:none;" />');<br />
span2.text(mw.usability.getMsg('cite-parsed-label'));<br />
extras.append(span2).append('<div class="cite-preview-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $j('<a href="#" class="cite-prev-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.text(mw.usability.getMsg('cite-form-parse'));<br />
extras.append(link); <br />
main.append(extras);<br />
<br />
return main;<br />
}<br />
}<br />
<br />
/* Class for error checks<br />
FIXME: DOCS OUT OF DATE<br />
type - type of error check - current options:<br />
* 'refcheck' - apply a function on each ref individually<br />
* function should accept a ref object, return a string<br />
* 'reflist' - apply a function on the entire ref list<br />
* function should accept an array of ref objects, return an array of strings<br />
* 'search' - apply a function ro the page text<br />
* function should accept the page text as a string, return an array of strings<br />
The strings returned by the function should be valid HTML<br />
<br />
func - The function described above<br />
testname - Name of the error check, must not contain spaces<br />
desc - A short description of the test<br />
*/<br />
<br />
function citeErrorCheck(obj) {<br />
this.obj = obj<br />
CiteTB.ErrorChecks[this.obj.testname] = this;<br />
<br />
this.run = function() {<br />
var errors = [];<br />
switch(this.obj['type']) {<br />
case "refcheck":<br />
CiteTB.loadRefs();<br />
for(var i=0; i<CiteTB.mainRefList.length; i++) {<br />
var e = this.obj.func(CiteTB.mainRefList[i]);<br />
if (e) {<br />
errors.push(e);<br />
}<br />
}<br />
break;<br />
case "reflist":<br />
CiteTB.loadRefs();<br />
errors = this.obj.func(CiteTB.mainRefList);<br />
break;<br />
case "search":<br />
var func = this.obj.func<br />
CiteTB.getPageText(function(text) {<br />
errors = func(text);<br />
});<br />
break;<br />
}<br />
return errors;<br />
}<br />
<br />
this.getRow = function() {<br />
var row = $j("<li />");<br />
var check = $j("<input type='checkbox' name='cite-err-test' />");<br />
check.attr('value', this.obj.testname);<br />
var label = $j("<label />").html(mw.usability.getMsg(this.obj.desc));<br />
label.attr('for', this.obj.testname); <br />
row.append(check).append(' &ndash; ').append(label);<br />
return row;<br />
}<br />
}<br />
$j('head').trigger('reftoolbarbase');</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&diff=10332
MediaWiki:RefToolbarTextTerm.js
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>/*jshint smarttabs:true, loopfunc:true,forin:false*/<br />
/*global mw, $, importScript */<br />
// TODO: make autodate an option in the CiteTemplate object, not a preference<br />
<br />
// Global object<br />
// TODO:<br />
// * Remove this once the page is moved to a module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase'<br />
if (typeof CiteTB === 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
// Only execute on edit, unless it is a user JS/CSS page<br />
// TODO: Remove tests already done by [[MediaWiki:Gadget-refToolbar.js]]<br />
if (<br />
( mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit' ) &&<br />
( ( mw.config.get('wgNamespaceNumber') !== 2 && mw.config.get('wgNamespaceNumber') !== 4 ) ||<br />
( mw.config.get('wgPageName').indexOf('.js') === -1 && mw.config.get('wgPageName').indexOf('.css') === -1 ) )<br />
) {<br />
<br />
// TODO: Move this to [[MediaWiki:Gadget-refToolbarDialogs.css]] and add it to the definition of module 'ext.gadget.refToolbarDialogs'<br />
mw.util.addCSS(".cite-form-td {"+<br />
"height: 0 !important;"+<br />
"padding: 0.1em !important;"+<br />
"}"); <br />
<br />
// Default options, these mainly exist so the script won't break if a new option is added<br />
CiteTB.DefaultOptions = {<br />
"date format" : "<year>-<zmonth>-<zdate>",<br />
"autodate fields" : [],<br />
"months" : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],<br />
"modal" : true,<br />
"autoparse" : false,<br />
"expandtemplates": false<br />
};<br />
<br />
// Get an option - user settings override global which override defaults<br />
CiteTB.getOption = function(opt) {<br />
if (CiteTB.UserOptions[opt] !== undefined) {<br />
return CiteTB.UserOptions[opt];<br />
} else if (CiteTB.Options[opt] !== undefined) {<br />
return CiteTB.Options[opt];<br />
}<br />
return CiteTB.DefaultOptions[opt];<br />
};<br />
<br />
CiteTB.init = function() {<br />
/* Main stuff, build the actual toolbar structure<br />
* 1. get the template list, make the dropdown list and set up the template dialog boxes<br />
* 2. actually build the toolbar:<br />
* * A section for cites<br />
* ** dropdown for the templates (previously defined)<br />
* ** button for named refs with a dialog box<br />
* ** button for errorcheck<br />
* 3. add the whole thing to the main toolbar<br />
*/<br />
<br />
if (typeof $('div[rel=cites]')[0] !== 'undefined') { // Mystery IE bug workaround<br />
return;<br />
}<br />
$('head').trigger('reftoolbarbase');<br />
var $target = $('#wpTextbox1');<br />
var temlist = {};<br />
for (var t in CiteTB.Templates) {<br />
var tem = CiteTB.Templates[t];<br />
var sform = CiteTB.escStr(tem.shortform);<br />
var actionobj = { <br />
type: 'dialog',<br />
module: 'cite-dialog-'+sform<br />
};<br />
var dialogobj = {};<br />
dialogobj['cite-dialog-'+sform] = {<br />
resizeme: false,<br />
titleMsg: 'cite-dialog-'+sform, <br />
id: 'citetoolbar-'+sform,<br />
init: function() {}, <br />
html: tem.getInitial(), <br />
dialog: {<br />
width:675,<br />
open: function() { <br />
$(this).html(CiteTB.getOpenTemplate().getForm());<br />
/** @param {jQuery.Event} e */<br />
$('.cite-prev-parse').bind( 'click', function ( e ) {<br />
e.preventDefault();<br />
CiteTB.prevParseClick();<br />
});<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var ref = CiteTB.getRef(false, true);<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: ref<br />
}<br />
}, $(this) );<br />
},<br />
'cite-form-showhide': CiteTB.showHideExtra,<br />
'cite-refpreview': function() { <br />
var ref = CiteTB.getRef(false, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-preview-label').show();<br />
div.find('.cite-ref-preview').text(ref).show();<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.prevParseClick();<br />
} else {<br />
div.find('.cite-prev-parse').show();<br />
div.find('.cite-prev-parsed-label').hide();<br />
div.find('.cite-preview-parsed').html('');<br />
} <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
},<br />
'cite-form-reset': function() {<br />
CiteTB.resetForm();<br />
}<br />
}<br />
} <br />
};<br />
$target.wikiEditor('addDialog', dialogobj);<br />
//if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-'+sform).dialog('option', 'modal', false);<br />
//}<br />
temlist[sform] = {label: tem.templatename, action: actionobj }; <br />
}<br />
<br />
var refsection = {<br />
'sections': {<br />
'cites': { <br />
type: 'toolbar', <br />
labelMsg: 'cite-section-label',<br />
groups: { <br />
'template': {<br />
tools: {<br />
'template': {<br />
type: 'select',<br />
labelMsg: 'cite-template-list',<br />
list: temlist<br />
} <br />
}<br />
},<br />
'namedrefs': {<br />
labelMsg: 'cite-named-refs-label',<br />
tools: {<br />
'nrefs': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-namedrefs'<br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/be/Nuvola_clipboard_lined.svg/22px-Nuvola_clipboard_lined.svg.png',<br />
section: 'cites',<br />
group: 'namedrefs',<br />
labelMsg: 'cite-named-refs-button'<br />
}<br />
}<br />
},<br />
'errorcheck': {<br />
labelMsg: 'cite-errorcheck-label',<br />
tools: {<br />
'echeck': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-errorcheck' <br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Nuvola_apps_korganizer-NO.png/22px-Nuvola_apps_korganizer-NO.png',<br />
section: 'cites',<br />
group: 'errorcheck',<br />
labelMsg: 'cite-errorcheck-button'<br />
}<br />
}<br />
}<br />
} <br />
} <br />
} <br />
};<br />
<br />
var defaultdialogs = { <br />
'cite-toolbar-errorcheck': {<br />
titleMsg: 'cite-errorcheck-label',<br />
id: 'citetoolbar-errorcheck',<br />
resizeme: false,<br />
init: function() {},<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
dialog: {<br />
width:550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-errorcheck-submit': function() {<br />
var errorchecks = $("input[name='cite-err-test']:checked");<br />
var errors = [];<br />
for (var i=0; i<errorchecks.length; i++) {<br />
errors = errors.concat(CiteTB.ErrorChecks[$(errorchecks[i]).val()].run());<br />
}<br />
CiteTB.displayErrors(errors);<br />
$(this).dialog( 'close' ); <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
}<br />
}<br />
}<br />
},<br />
'cite-toolbar-namedrefs': {<br />
titleMsg: 'cite-named-refs-title',<br />
resizeme: false,<br />
id: 'citetoolbar-namedrefs',<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
init: function() {},<br />
dialog: {<br />
width: 550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var refname = $("#cite-namedref-select").val();<br />
if (refname === '') {<br />
return;<br />
}<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: CiteTB.getNamedRef(refname, true)<br />
}<br />
}, $(this) );<br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
} <br />
}<br />
} <br />
}<br />
};<br />
<br />
$target.wikiEditor('addDialog', defaultdialogs);<br />
$('#citetoolbar-namedrefs').unbind('dialogopen');<br />
if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-namedrefs').dialog('option', 'modal', false);<br />
//$('#citetoolbar-errorcheck').dialog('option', 'modal', false);<br />
mw.util.addCSS(".ui-widget-overlay {"+<br />
"display:none !important;"+<br />
"}"); <br />
}<br />
$target.wikiEditor('addToToolbar', refsection);<br />
};<br />
<br />
// Load local data - messages, cite templates, etc.<br />
$(document).ready( function() {<br />
switch( mw.config.get('wgUserLanguage') ) {<br />
case 'de': // German<br />
importScript('MediaWiki:RefToolbarMessages-de.js');<br />
break;<br />
default: // English<br />
importScript('MediaWiki:RefToolbarMessages-en.js');<br />
}<br />
});<br />
<br />
// Setup the main object<br />
CiteTB.mainRefList = [];<br />
CiteTB.refsLoaded = false;<br />
<br />
// REF FUNCTIONS<br />
// Actually assemble a ref from user input<br />
CiteTB.getRef = function(inneronly, forinsert) {<br />
var i;<br />
var template = CiteTB.getOpenTemplate();<br />
var templatename = template.templatename;<br />
var res = '';<br />
var refobj = {'shorttag':false};<br />
if (!inneronly) {<br />
var group = $('#cite-'+CiteTB.escStr(template.shortform)+'-group').val();<br />
var refname = $('#cite-'+CiteTB.escStr(template.shortform)+'-name').val();<br />
res += '<ref';<br />
if (refname) {<br />
refname = $.trim(refname);<br />
res+=' name='+CiteTB.getQuotedString(refname);<br />
refobj.refname = refname;<br />
}<br />
if (group) {<br />
group = $.trim(group);<br />
res+=' group='+CiteTB.getQuotedString(group);<br />
refobj.refgroup = group;<br />
}<br />
res+='>';<br />
}<br />
var content ='{{'+templatename;<br />
for( g in template.incrementables ) {<br />
group = template.incrementables[g];<br />
for (i=1; i<=group.val; i++) {<br />
for (j=0; j<group.fields.length; j++) {<br />
var fieldname = group.fields[j].field;<br />
var fieldid = fieldname.replace('<N>', i.toString());<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldid).val();<br />
if (field) {<br />
content+='|'+fieldid+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
}<br />
for( i=0; i<template.basic.length; i++ ) {<br />
if (template.basic[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.basic[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
if ($('#cite-form-status').val() !== 'closed') {<br />
for( i=0; i<template.extra.length; i++ ) {<br />
if (template.extra[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.extra[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
content+= '}}';<br />
res+=content;<br />
refobj.content = content;<br />
if (!inneronly) {<br />
res+= '</ref>';<br />
}<br />
if (forinsert) {<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
return res;<br />
};<br />
<br />
// Make a reference to a named ref<br />
CiteTB.getNamedRef = function(refname, forinsert) {<br />
if (forinsert) {<br />
CiteTB.mainRefList.push( {'shorttag':true, 'refname':refname} );<br />
}<br />
return '<ref name='+CiteTB.getQuotedString(refname)+' />'; <br />
};<br />
<br />
// Function to load the ref list<br />
CiteTB.loadRefs = function() {<br />
if (CiteTB.refsLoaded) {<br />
return;<br />
}<br />
CiteTB.getPageText(CiteTB.loadRefsInternal);<br />
};<br />
<br />
// Function that actually loads the list from the page text<br />
CiteTB.loadRefsInternal = function(text) { <br />
// What this does: extract first name/group extract second name/group shorttag inner content<br />
var refsregex = /< *ref(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?:\/ *>|>((?:.|\n)*?)< *\/ *ref *>)/gim;<br />
// This should work regardless of the quoting used for names/groups and for linebreaks in the inner content <br />
while (true) {<br />
var ref = refsregex.exec(text);<br />
if (ref === null) {<br />
break;<br />
}<br />
var refobj = {};<br />
if (ref[9]) { // Content + short tag check<br />
//alert('"'+ref[9]+'"');<br />
refobj.content = ref[9]; <br />
refobj.shorttag = false;<br />
} else {<br />
refobj.shorttag = true;<br />
}<br />
if (ref[1] !== '') { // First name/group<br />
if (ref[2]) {<br />
refobj['ref'+ref[1]] = ref[2];<br />
} else if (ref[3]) {<br />
refobj['ref'+ref[1]] = ref[3];<br />
} else {<br />
refobj['ref'+ref[1]] = ref[4];<br />
}<br />
}<br />
if (ref[5] !== '') { // Second name/group<br />
if (ref[6]) {<br />
refobj['ref'+ref[5]] = ref[6];<br />
} else if (ref[7]) {<br />
refobj['ref'+ref[5]] = ref[7];<br />
} else {<br />
refobj['ref'+ref[5]] = ref[8];<br />
}<br />
}<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
CiteTB.refsLoaded = true;<br />
CiteTB.setupErrorCheck();<br />
CiteTB.setupNamedRefs();<br />
};<br />
<br />
// AJAX FUNCTIONS<br />
// Parse some wikitext and hand it off to a callback function<br />
CiteTB.parse = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'parse', title:mw.config.get('wgPageName'), text:text, prop:'text', format:'json'},<br />
function(data) {<br />
var html = data.parse.text['*'];<br />
callback(html);<br />
},<br />
'json'<br />
); <br />
};<br />
<br />
// Use the API to expand templates on some text<br />
CiteTB.expandtemplates = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'expandtemplates', title:mw.config.get('wgPageName'), text:text, format:'json'},<br />
function(data) {<br />
var restext = data.expandtemplates['*'];<br />
callback(restext);<br />
},<br />
'json'<br />
);<br />
};<br />
<br />
// Function to get the page text<br />
CiteTB.getPageText = function(callback) {<br />
var section = $("input[name='wpSection']").val();<br />
if ( section !== '' ) {<br />
var postdata = {action:'query', prop:'revisions', rvprop:'content', pageids:mw.config.get('wgArticleId'), format:'json'};<br />
if (CiteTB.getOption('expandtemplates')) {<br />
postdata.rvexpandtemplates = '1';<br />
}<br />
$.get( mw.util.wikiScript( 'api' ),<br />
postdata,<br />
function(data) {<br />
var pagetext = data.query.pages[mw.config.get('wgArticleId').toString()].revisions[0]['*'];<br />
callback(pagetext);<br />
},<br />
'json'<br />
);<br />
} else {<br />
if (CiteTB.getOption('expandtemplates')) {<br />
CiteTB.expandtemplates($('#wpTextbox1').wikiEditor('getContents').text(), callback);<br />
} else {<br />
callback($('#wpTextbox1').wikiEditor('getContents').text());<br />
}<br />
}<br />
};<br />
<br />
// Autofill a template from an ID (ISBN, DOI, PMID, URL)<br />
CiteTB.initAutofill = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-auto\-(.*?)\-(.*)\-(.*)$/.exec(elemid);<br />
var tem = res[1];<br />
var field = res[2];<br />
var autotype = res[3];<br />
var id = $('#cite-'+tem+'-'+field).val();<br />
if (!id) {<br />
return false;<br />
}<br />
var url = '//tools.wmflabs.org/reftoolbar/lookup.php?';<br />
url+=autotype+'='+encodeURIComponent(id);<br />
url+='&template='+encodeURIComponent(tem);<br />
var s = document.createElement('script');<br />
s.setAttribute('src', url);<br />
s.setAttribute('type', 'text/javascript');<br />
document.getElementsByTagName('head')[0].appendChild(s);<br />
return false;<br />
};<br />
<br />
// Callback for autofill<br />
//TODO: Autofill the URL, at least for DOI<br />
CiteTB.autoFill = function(data, template, type) {<br />
var cl = 'cite-'+template+'-';<br />
var i,j, coauthors;<br />
$('.'+cl+'title').val(data.title);<br />
// Fill in authors<br />
if (data.authors && data.authors.length > 0) {<br />
if ($('.'+cl+'last-incr-1').length != 0) {<br />
var classes = $('.'+cl+'last-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'last-incr-1').val(data.authors[0][0])<br />
$('.'+cl+'first-incr-1').val(data.authors[0][1])<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'last-incr-'+i.toString()).val(data.authors[i-1][0])<br />
$('.'+cl+'first-incr-'+i.toString()).val(data.authors[i-1][1])<br />
}<br />
} else if ($('.'+cl+'author-incr-1').length != 0) {<br />
var classes = $('.'+cl+'author-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'author-incr-1').val(data.authors[0].join(', '))<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'author-incr-'+i.toString()).val(data.authors[i-1].join(', '))<br />
}<br />
} else if ($('.'+cl+'last1').length != 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'last'+(i+1)).length) {<br />
$('.'+cl+'last'+(i+1)).val(data.authors[i][0]);<br />
$('.'+cl+'first'+(i+1)).val(data.authors[i][1]);<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else if($('.'+cl+'author1').length !== 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'author'+(i+1)).length) {<br />
$('.'+cl+'author'+(i+1)).val(data.authors[i].join(', '));<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else {<br />
var authors = [];<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
authors.push(data.authors[i].join(', '));<br />
}<br />
$('.'+cl+'authors').val(authors.join('; '));<br />
}<br />
}<br />
<br />
if (type === 'pmid' || type === 'doi') {<br />
if (data.date && (data.fulldate || !$('.'+cl+'month').length)) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date);<br />
var usemonth = /\d{4}-\d{2}/.test(data.date);<br />
$('.'+cl+'date').val(CiteTB.formatDate(DT, useday, usemonth));<br />
} else if (!data.fulldate && $('.'+cl+'month').length && $('.'+cl+'year').length) {<br />
if (data.month) { // lookup.php sets month to false if it isn't provided<br />
$('.'+cl+'month').val( CiteTB.getOption('months')[parseInt(data.month)-1] );<br />
}<br />
$('.'+cl+'year').val(data.year);<br />
} else {<br />
$('.'+cl+'date').val(data.date);<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
} else if (type === 'isbn') {<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'location').val(data.location);<br />
$('.'+cl+'year').val(data.year);<br />
$('.'+cl+'edition').val(data.edition);<br />
} else if (type === 'url') {<br />
if (data.date) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date) && template !== 'book';<br />
var usemonth = /\d{4}-\d{2}/.test(data.date) && template !== 'book';<br />
var yearOrDate = (template === 'book') ? 'year' : 'date';<br />
$('.'+cl+yearOrDate).val(CiteTB.formatDate(DT, useday, usemonth));<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'edition').val(data.edition);<br />
$('.'+cl+'isbn').val(data.isbn);<br />
$('.'+cl+'issn').val(data.issn);<br />
$('.'+cl+'doi').val(data.doi);<br />
// "en-US" isn't a valid value for the language parameter<br />
if (data.language && data.language !== 'en-US' && data.language !== 'en-GB') {<br />
$('.'+cl+'language').val(data.language);<br />
}<br />
$('.'+cl+'chapter').val(data.chapter);<br />
}<br />
};<br />
<br />
// FORM DIALOG FUNCTIONS<br />
// Add new incrementable fields<br />
CiteTB.incrementFields = function() {<br />
template = CiteTB.getOpenTemplate();<br />
var currentrow = $(this).parents('tr')[0];<br />
$(this).prev().css('width', '100%')<br />
$(this).detach();<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-incr\-(.*?)\-(.*)$/.exec(elemid);<br />
group = res[2];<br />
increments = template.incrementables[group];<br />
fields = increments.fields;<br />
incrval = increments.val+1;<br />
template.incrementables[group].val += 1;<br />
trs = template.makeFormInner(fields, false);<br />
trs.reverse();<br />
for (var i=0; i<trs.length; i++) {<br />
$(currentrow).after(trs[i]);<br />
}<br />
};<br />
<br />
// fill the accessdate param with the current date<br />
CiteTB.fillAccessdate = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-date\-(.*?)\-(.*)$/.exec(elemid);<br />
var id = res[1];<br />
var field = res[2];<br />
var DT = new Date();<br />
var datestr = CiteTB.formatDate(DT);<br />
$('#cite-'+id+'-'+field).val(datestr);<br />
return false;<br />
};<br />
<br />
CiteTB.formatDate = function(DT, useday, usemonth) {<br />
if (typeof useday == "undefined") {<br />
useday = true; <br />
}<br />
if (typeof usemonth == "undefined") {<br />
usemonth = true; <br />
}<br />
var datestr = CiteTB.getOption('date format');<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate();<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString();<br />
if (useday) {<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
} else {<br />
datestr = datestr.replace('<date>', '');<br />
datestr = datestr.replace('<zdate>', '');<br />
}<br />
if (usemonth) {<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', CiteTB.getOption('months')[DT.getUTCMonth()]);<br />
} else {<br />
datestr = datestr.replace('<month>', '');<br />
datestr = datestr.replace('<zmonth>', '');<br />
datestr = datestr.replace('<monthname>', '');<br />
} <br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return datestr.replace(/^[ \/\-\,\.]*(.*?)[ \/\-\,\.]*$/g, "$1"); // Cleanup any dangling spaces or connectors that might result from omitting date/month<br />
};<br />
<br />
// Function called after the ref list is loaded, to actually set the contents of the named ref dialog<br />
// Until the list is loaded, its just a "Loading" placeholder<br />
CiteTB.setupNamedRefs = function() {<br />
var names = [], i;<br />
for( i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname) {<br />
names.push(CiteTB.mainRefList[i]);<br />
}<br />
}<br />
var stuff = $('<div>');<br />
$('#citetoolbar-namedrefs').html( stuff );<br />
if (names.length === 0) {<br />
stuff.html(mw.usability.getMsg('cite-no-namedrefs'));<br />
} else {<br />
stuff.html(mw.usability.getMsg('cite-namedrefs-intro'));<br />
var select = $('<select id="cite-namedref-select">');<br />
select.append($('<option value="" />').text(mw.usability.getMsg('cite-named-refs-dropdown')));<br />
for(i=0; i<names.length; i++) {<br />
select.append($('<option />').text(names[i].refname));<br />
}<br />
stuff.after(select);<br />
select.before('<br />'); <br />
var prevlabel = $('<div id="cite-nref-preview-label" style="display:none;" />').html(mw.usability.getMsg('cite-raw-preview'));<br />
select.after(prevlabel);<br />
prevlabel.before("<br /><br />");<br />
prevlabel.after('<div id="cite-namedref-preview" style="padding:0.5em; font-size:110%" />');<br />
var parselabel = $('<span id="cite-parsed-label" style="display:none;" />').html(mw.usability.getMsg('cite-parsed-label'));<br />
$('#cite-namedref-preview').after(parselabel);<br />
parselabel.after('<div id="cite-namedref-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $('<a href="#" id="cite-nref-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.html(mw.usability.getMsg('cite-form-parse'));<br />
$('#cite-namedref-parsed').after(link);<br />
<br />
$("#cite-namedref-select").bind( 'change', CiteTB.namedRefSelectClick);<br />
$('#cite-nref-parse').bind( 'click', CiteTB.nrefParseClick);<br />
} <br />
};<br />
<br />
// Function to get the errorcheck form HTML<br />
CiteTB.setupErrorCheck = function() {<br />
var form = $('<div id="cite-errorcheck-heading" />').html(mw.usability.getMsg('cite-errorcheck-heading'));<br />
var ul = $("<ul id='cite-errcheck-list' />");<br />
var test;<br />
for (var t in CiteTB.ErrorChecks) {<br />
test = CiteTB.ErrorChecks[t];<br />
ul.append(test.getRow());<br />
}<br />
form.append(ul);<br />
$('#citetoolbar-errorcheck').html(form);<br />
};<br />
<br />
// Callback function for parsed preview<br />
CiteTB.fillNrefPreview = function(parsed) {<br />
$('#cite-parsed-label').show();<br />
$('#cite-namedref-parsed').html(parsed);<br />
};<br />
<br />
// Click handler for the named-ref parsed preview<br />
CiteTB.nrefParseClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (choice === '') {<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
return false;<br />
}<br />
$('#cite-nref-parse').hide();<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
CiteTB.parse(CiteTB.mainRefList[i].content, CiteTB.fillNrefPreview);<br />
return false;<br />
}<br />
} <br />
};<br />
<br />
// Click handler for the named-ref dropdown<br />
CiteTB.lastnamedrefchoice = '';<br />
CiteTB.namedRefSelectClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (CiteTB.lastnamedrefchoice == choice) {<br />
return;<br />
}<br />
CiteTB.lastnamedrefchoice = choice;<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
if (choice === '') {<br />
$('#cite-nref-preview-label').hide();<br />
$('#cite-namedref-preview').text('');<br />
$('#cite-nref-parse').hide();<br />
return;<br />
}<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
$('#cite-nref-preview-label').show();<br />
$('#cite-namedref-preview').text(CiteTB.mainRefList[i].content);<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.nrefParseClick();<br />
} else {<br />
$('#cite-nref-parse').show();<br />
}<br />
}<br />
}<br />
};<br />
<br />
// callback function for parsed preview<br />
CiteTB.fillTemplatePreview = function(text) {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parsed-label').show();<br />
div.find('.cite-preview-parsed').html(text);<br />
};<br />
<br />
// Click handler for template parsed preview<br />
CiteTB.prevParseClick = function() {<br />
var ref = CiteTB.getRef(true, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parse').hide();<br />
CiteTB.parse(ref, CiteTB.fillTemplatePreview);<br />
};<br />
<br />
// Show/hide the extra fields in the dialog box<br />
CiteTB.showHideExtra = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
var setting = div.find(".cite-form-status").val();<br />
if ( setting === 'closed' ) {<br />
div.find(".cite-form-status").val('open');<br />
div.find('.cite-extra-fields').show(1, function() {<br />
// jQuery adds "display:block", which screws things up<br />
div.find('.cite-extra-fields').attr('style', 'width:100%; background-color:transparent;'); <br />
});<br />
} else {<br />
div.find(".cite-form-status").val('closed');<br />
div.find('.cite-extra-fields').hide();<br />
} <br />
};<br />
<br />
// Resets form fields and previews<br />
// Resets form fields and previews<br />
CiteTB.resetForm = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.html(template.getForm());<br />
};<br />
<br />
// STRING UTILITY FUNCTIONS<br />
// Returns a string quoted as necessary for name/group attributes<br />
CiteTB.getQuotedString = function(s) {<br />
var sq = /\'/.test(s); // single quotes<br />
var dq = /\"/.test(s); // double quotes<br />
if (!sq && !dq) { // Always quotes for non-latin alphabet<br />
return '"'+s+'"';<br />
} else if (!dq) { // Can use double quotes<br />
return '"'+s+'"';<br />
} else if (!sq) { // Can use single quotes<br />
return "'"+s+"'";<br />
} else { // Has double and single quotes<br />
s = s.replace(/\"/g, '\'');<br />
return '"'+s+'"';<br />
}<br />
};<br />
<br />
// Fix up strings for output - capitalize first char, replace underscores with spaces<br />
CiteTB.fixStr = function(s) {<br />
s = s.slice(0,1).toUpperCase() + s.slice(1);<br />
s = s.replace('_',' ');<br />
return s;<br />
};<br />
<br />
// Escape spaces and quotes for use in HTML classes/ids<br />
CiteTB.escStr = function(s) {<br />
return s.replace(' ', '-').replace("'", "\'").replace('"', '\"');<br />
};<br />
<br />
// MISC FUNCTIONS<br />
// Determine which template form is open, and get the template object for it<br />
CiteTB.getOpenTemplate = function() {<br />
var dialogs = $(".ui-dialog-content.ui-widget-content:visible");<br />
var templatename = $(dialogs[0]).find(".cite-template").val();<br />
return CiteTB.Templates[templatename];<br />
};<br />
<br />
// Display the report for the error checks<br />
CiteTB.displayErrors = function(errors) {<br />
$('#cite-err-report').remove();<br />
var table = $('<table id="cite-err-report" style="width:100%; border:1px solid #A9A9A9; background-color:#FFEFD5; padding:0.25em; margin-top:0.5em" />');<br />
$('#editpage-copywarn').before(table);<br />
var tr;<br />
var tr1 = $('<tr style="width:100%" />');<br />
var th1 = $('<th style="width:60%; font-size:110%" />').html(mw.usability.getMsg('cite-err-report-heading'));<br />
var th2 = $('<th style="text-align:right; width:40%" />');<br />
var im = $('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/5/55/Gtk-stop.svg/20px-Gtk-stop.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-err-report-close')).attr('title', mw.usability.getMsg('cite-err-report-close'));<br />
var ad = $('<a id="cite-err-check-close" />').attr('href', '#');<br />
ad.append(im);<br />
th2.append(ad);<br />
tr1.append(th1).append(th2);<br />
table.append(tr1);<br />
$('#cite-err-check-close').bind('click', function() { $('#cite-err-report').remove(); });<br />
if (errors.length === 0) {<br />
tr = $('<tr style="width:100%;" />');<br />
var td = $('<td style="text-align:center; margin:1.5px;" />').html(mw.usability.getMsg('cite-err-report-empty'));<br />
tr.append(td);<br />
table.append(tr);<br />
<br />
return;<br />
}<br />
for(var e in errors) {<br />
var err = errors[e];<br />
tr = $('<tr style="width:100%;" />');<br />
var td1 = $('<td style="border: 1px solid black; margin:1.5px; width:60%" />').html(err.err);<br />
var td2 = $('<td style="border: 1px solid black; margin:1.5px; width:40%" />').html(mw.usability.getMsg(err.msg));<br />
tr.append(td1).append(td2);<br />
table.append(tr);<br />
}<br />
};<br />
<br />
} // End of code loaded only on edit</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Editpage.js&diff=10334
MediaWiki:Editpage.js
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>//dynamically load Commons-style Edittools<br />
function createEdittoolsLink(){<br />
//get div.mw-editTools<br />
var box = document.getElementById('wpTextbox1')<br />
while (box && box.className!='mw-editTools') box=box.nextSibling<br />
if (!box) return<br />
//create a link<br />
var lnk = document.createElement('a')<br />
lnk.href = 'javascript:loadCommonsTools()'<br />
lnk.title = 'Load Commons-style Edittools' <br />
lnk.id = 'loadCommonsEdittoos'<br />
lnk.appendChild(document.createTextNode('[load edittools]'))<br />
lnk.style.cssText = 'float:right'<br />
box.appendChild(lnk)<br />
}<br />
function loadCommonsTools(){<br />
importScript('MediaWiki:Edittools.js')<br />
var lnk = document.getElementById('loadCommonsEdittoos')<br />
if (lnk) lnk.parentNode.removeChild(lnk)<br />
}<br />
if (doneOnloadHook) createEdittoolsLink()<br />
else addOnloadHook(createEdittoolsLink)</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations.js&diff=10336
MediaWiki:Gadget-citations.js
2017-06-25T19:59:51Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>/* _____________________________________________________________________________<br />
* | |<br />
* | === WARNING: GLOBAL GADGET FILE === |<br />
* | Changes to this page affect many users. |<br />
* | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |<br />
* |_____________________________________________________________________________|<br />
*<br />
* Imported from version 1.0 as of 17:18, 9 April 2011 (UTC) from [[User:Smith609/citations.js]]<br />
* Adds a "Citation bot" link to the toolbox, and a button beneath edit fields, see [[User:Smith609/citations]]<br />
*/<br />
<br />
// @Version 1.0 - Adds an "Expand citations" link to the toolbox, and a button beneath edit fields.<br />
<br />
function addCBToToolbox() {<br />
if (wgCanonicalNamespace != "Special") {<br />
var pTb = document.getElementById("p-tb");<br />
if( !pTb ) return;<br />
var escPageName = encodeURIComponent(wgPageName);<br />
<br />
addPortletLink("p-tb", "http://toolserver.org/~verisimilus/Bot/citation-bot/doibot.php?edit=toolbar&slow=1&user="+encodeURIComponent(wgUserName)+"&page="+escPageName, 'Expand citations', '', "Expand citations and fix common formatting errors");<br />
}<br />
}<br />
<br />
// Add a citation bot button<br />
function addCitationBot() {<br />
if (document.getElementById('wpDiff')){<br />
var diff = document.getElementById('wpDiff');<br />
var cbButton = document.createElement("input");<br />
cbButton.value="Citations";<br />
cbButton.type="submit";<br />
originalAction=document.getElementById('editform').getAttribute('action');<br />
cbButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
cbButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
diff.setAttribute("onmousedown", originalAction);<br />
diff.setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onkeydown", originalAction);<br />
diff.parentNode.insertBefore(cbButton, diff.nextSibling);<br />
}<br />
<br />
}<br />
addOnloadHook(addCitationBot);<br />
if( skin == "myskin" || skin == "simple" || skin == "monobook" || skin == "modern" || skin == "chick" || skin == "vector") {<br />
addOnloadHook(addCBToToolbox);<br />
}</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&diff=10318
MediaWiki:RefToolbarConfig.js
2017-06-25T19:59:50Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>/* Sitewide options for the the Cite toolbar button:<br />
* All options should be specified<br />
*<br />
* "date format" sets the date format used for the function to insert the current date<br />
* Current available options:<br />
* date - the day of the month<br />
* zdate - day of the month, zero padded to 2 digits<br />
* monthname - The month name<br />
* month - The numberic month (1-12)<br />
* zmonth - numeric month, zero padded to 2 digits<br />
* year - The full year (4 digits)<br />
*<br />
* "autodate fields" is a list of template fields that should have a button to insert the current date<br />
* <br />
* "months" is a list of localized month names<br />
*<br />
* "modal" - if true, the dialogs will be modal windows, blocking access to the rest of the window.<br />
* See http://en.wikipedia.org/wiki/Modal_window<br />
* All dialogs in the toolbar are modal by default<br />
*<br />
* "autoparse" - if true, previewing a ref will automatically trigger a preview of the parsed wikitext.<br />
* It is not recommended to set this to true as a global setting as it may slow the script down for<br />
* people with slow connections.<br />
*<br />
* "expandtemplates" - if true, templates and parser functions will be expanded when getting page text<br />
* (templates inside of ref tags will not be expanded). This will allow references inside of templates or<br />
* references using {{#tag:ref}} to be listed in the named refs dialog and searched by error checks.<br />
* This may slow loading the named refs and error check dialogs.<br />
*/<br />
<br />
CiteTB.Options = {<br />
"date format" : "<date> <monthname> <year>",<br />
"autodate fields" : ['accessdate'],<br />
"months" : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],<br />
"modal" : true,<br />
"autoparse" : true,<br />
"expandtemplates" : false<br />
};<br />
<br />
// Cite template definitions<br />
new citeTemplate('cite web', 'web',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "website", "autofillprop":"journal"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite news', 'news',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "work", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},<br />
{"field": "agency"},<br />
{"field": "issue"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite book', 'book',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "date", "autofillprop":"year"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location", "autofillprop":"location"},<br />
{"field": "isbn", "autofillid":"isbn", "autofillprop":"isbn"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "edition", "autofillprop":"edition"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "chapter", "autofillprop":"chapter"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite journal', 'journal',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "journal", "autofillprop":"journal"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "volume", "autofillprop":"volume"},<br />
{"field": "issue", "autofillprop":"issue"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "pmid", "autofillid":"pmid"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"},<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "series"},<br />
{"field": "at", "tooltip":"cite-at-tooltip"},<br />
{"field": "trans-title"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "issn", "autofillprop":"issn"},<br />
{"field": "pmc"},<br />
{"field": "oclc"},<br />
{"field": "bibcode"},<br />
{"field": "id"},<br />
{"field": "quote"},<br />
{"field": "postscript", "tooltip":"cite-postscript-tooltip"}<br />
]);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': 'cite-samecontent-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag) {<br />
if ($.inArray(reflist[i].content, refs2) != -1) {<br />
if ($.inArray(reflist[i].content, errors) == -1) {<br />
errors.push(reflist[i].content);<br />
}<br />
} else {<br />
refs2.push(reflist[i].content);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-samecontent-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'repeated', 'desc':'cite-repeated-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
if ($.inArray(reflist[i].refname, refs2) != -1) {<br />
if ($.inArray(reflist[i].refname, errors) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
} else {<br />
refs2.push(reflist[i].refname);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-repeated-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'undefined', 'desc':'cite-undefined-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var longrefs = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
longrefs.push(reflist[i].refname);<br />
}<br />
}<br />
for(var j=0; i<reflist.length; j++) {<br />
if (reflist[i].shorttag && $.inArray(reflist[i].refname, errors) == -1 && $.inArray(reflist[i].refname, longrefs) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-undefined-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
CiteTB.init();</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=10320
MediaWiki:Gadgets-definition
2017-06-25T19:59:50Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>#Editing<br />
* wikEd[ResourceLoader]|wikEd.js<br />
* refToolbar[ResourceLoader|default|dependencies=user.options,mediawiki.legacy.wikibits]|refToolbar.js<br />
* refToolbarBase[ResourceLoader|hidden]|refToolbarBase.js<br />
* DotsSyntaxHighlighter[ResourceLoader|default|dependencies=jquery.client]|DotsSyntaxHighlighter.js<br />
<br />
#Interface<br />
* exlinks[ResourceLoader]|exlinks.js<br />
* purgeTab[ResourceLoader]|purgeTab.js<br />
* citations[ResourceLoader]|citations.js</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=10322
MediaWiki:Common.js
2017-06-25T19:59:50Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>/**<br />
* Keep code in MediaWiki:Common.js to a minimum as it is unconditionally<br />
* loaded for all users on every wiki page. If possible create a gadget that is<br />
* enabled by default instead of adding it here (since gadgets are fully<br />
* optimized ResourceLoader modules with possibility to add dependencies etc.)<br />
*<br />
* Since Common.js isn't a gadget, there is no place to declare its<br />
* dependencies, so we have to lazy load them with mw.loader.using on demand and<br />
* then execute the rest in the callback. In most cases these dependencies will<br />
* be loaded (or loading) already and the callback will not be delayed. In case a<br />
* dependency hasn't arrived yet it'll make sure those are loaded before this.<br />
*/</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js/edit.js&diff=10324
MediaWiki:Common.js/edit.js
2017-06-25T19:59:50Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>/* Any JavaScript here will be loaded for all users on every page load. */<br />
/** Extra toolbar options ******************************************************<br />
* <br />
* Description: Adds extra buttons to the editing toolbar.<br />
* <br />
* To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/vector.js]].<br />
* <br />
* Maintainers: [[User:MarkS]], [[User:Voice of All]], [[User:R. Koot]]<br />
*/<br />
<br />
if (mwCustomEditButtons) {<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",<br />
"speedTip": "Redirect",<br />
"tagOpen": "#REDIRECT [[",<br />
"tagClose": "]]",<br />
"sampleText": "Target page name"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",<br />
"speedTip": "Strike",<br />
"tagOpen": "<s>",<br />
"tagClose": "</s>",<br />
"sampleText": "Strike-through text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",<br />
"speedTip": "Line break",<br />
"tagOpen": "<br />",<br />
"tagClose": "",<br />
"sampleText": ""<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",<br />
"speedTip": "Superscript",<br />
"tagOpen": "<sup>",<br />
"tagClose": "</sup>",<br />
"sampleText": "Superscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",<br />
"speedTip": "Subscript",<br />
"tagOpen": "<sub>",<br />
"tagClose": "</sub>",<br />
"sampleText": "Subscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",<br />
"speedTip": "Small",<br />
"tagOpen": "<small>",<br />
"tagClose": "</small>",<br />
"sampleText": "Small Text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",<br />
"speedTip": "Insert hidden Comment",<br />
"tagOpen": "<!-- ",<br />
"tagClose": " -->",<br />
"sampleText": "Comment"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",<br />
"speedTip": "Insert a picture gallery",<br />
"tagOpen": "\n<gallery>\n",<br />
"tagClose": "\n</gallery>",<br />
"sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",<br />
"speedTip": "Insert block of quoted text",<br />
"tagOpen": "<blockquote>\n",<br />
"tagClose": "\n</blockquote>",<br />
"sampleText": "Block quote"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",<br />
"speedTip": "Insert a table",<br />
"tagOpen": '{| class="wikitable"\n|',<br />
"tagClose": "\n|}",<br />
"sampleText": "-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",<br />
"speedTip": "Insert a reference",<br />
"tagOpen": "<ref>",<br />
"tagClose": "</ref>",<br />
"sampleText": "Insert footnote text here"<br />
});<br />
}<br />
<br />
<br />
/** Fix edit summary prompt for undo ******************************************<br />
* Fixes the fact that the undo function combined with the "no edit summary prompter"<br />
* causes problems if leaving the edit summary unchanged.<br />
* Added by [[User:Deskana]], code by [[User:Tra]].<br />
* See also [[bugzilla:8912]].<br />
*/<br />
$(function () {<br />
if (document.location.search.indexOf("undo=") != -1 && document.getElementsByName('wpAutoSummary')[0]) {<br />
document.getElementsByName('wpAutoSummary')[0].value='1';<br />
}<br />
});<br />
<br />
<br />
/** Edittools javascript loader ************************************************<br />
*<br />
* Description: Pulls in [[MediaWiki:Edittools.js]]. Includes a cache-bypassing<br />
* version number in the URL in order to allow any changes to the edittools to<br />
* be rapidly deployed to users.<br />
*<br />
* Note that, by default, this function does nothing unless the element with<br />
* the ID "editpage-specialchars" (which contains the old edittools code in<br />
* [[MediaWiki:Edittools]], and will be retained as a placeholder in the new<br />
* implementation) has a class named "edittools-version-NNN", where NNN is a<br />
* number. If the class name has "test" before the number, the code will only<br />
* run for users who have set "window.testJsEdittools = true" in their user JS.<br />
* The "test" should be retained in the class name until the new edittools<br />
* implementation is ready and fully tested, and until at least 30 days have<br />
* passed since this loader stub was added (which will be in 27 June 2008).<br />
*<br />
* For compatibility with Alex Smotrov's original implementation, on which this<br />
* code is loosely based (see [[mw:User talk:Alex Smotrov/edittools.js]]), this<br />
* loader can also be disabled by setting "window.noDefaultEdittools = true".<br />
*<br />
* Maintainers: [[User:Ilmari Karonen]]<br />
*/<br />
<br />
//Prevent the static edittools from flashing before the compact edittools below is loaded.<br />
mw.util.addCSS('div.edittools-text { display:none; }');<br />
<br />
$(function () {<br />
// needs to be deferred until the DOM has fully loaded<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder || window.noDefaultEdittools) {<br />
//Show the static edittools again for users with "window.noDefaultEdittools=true".<br />
mw.util.addCSS('div.edittools-text { display:block; }');<br />
return;<br />
}<br />
var match = /(?:^| )edittools-version-(\d+)(?: |$)/.exec(placeholder.className);<br />
console.log("Common.js/edit.js match =" + match);<br />
// set window.testJsEdittools = true to enable testing before full deployment<br />
if (!match && window.testJsEdittools)<br />
match = /(?:^| )edittools-version-(test\d+)(?: |$)/.exec(placeholder.className);<br />
<br />
if (!match) return;<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=' + match[1];<br />
importScriptURI(url);<br />
});<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript';<br />
importScriptURI(url);</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools.js&diff=10326
MediaWiki:Edittools.js
2017-06-25T19:59:50Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>// copied from [[mw:User:Alex Smotrov/edittools.js]], modified for use on the English Wikipedia.<br />
// enableForAllFields() feature from [[commons:MediaWiki:Edittools.js]]<br />
// combined and modified by [[User:Ilmari Karonen]]<br />
// after making changes to this page and testing them, update the number after "edittools-version-" in [[MediaWiki:Edittools]] to purge the cache for everyone<br />
<br />
if (typeof (EditTools_set_focus) == 'undefined')<br />
var EditTools_set_focus = true;<br />
<br />
if (typeof (EditTools_set_focus_initially) == 'undefined')<br />
var EditTools_set_focus_initially = EditTools_set_focus;<br />
<br />
var EditTools =<br />
{<br />
charinsert : {<br />
'Insert': ' – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § Sign_your_posts_on_talk_pages: ~~\~~ Cite_your_sources: <ref>+</ref>',<br />
'Wiki markup': 'Insert: – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § ~~\~~ <ref>+</ref> Wiki_markup: {\{+}} {\{\{+}}} | {\{TextTerm|demography|1+}} {\{RefNumber|+13|0|1}} {\{NonRefTerm|+}} {\{Note|+|}} {\{NoteTerm|+}} [+] [\[+]] [\[Category:+]] #REDIRECT.[\[+]] &nbsp; <s>+</s> <sup>+</sup> <sub>+</sub> <code>+</code> <pre>+</pre> <blockquote>+</blockquote> <ref.name="+"/> {\{#tag:ref|+|group="nb"}} {\{Reflist}} <references/> <includeonly>+</includeonly> <noinclude>+</noinclude> {\{DEFAULTSORT:+}} <nowiki>+</nowiki> <!--.+_--> <span.class="plainlinks">+</span>',<br />
'Symbols': '~ | ¡¿†‡↔↑↓•¶ # ½⅓⅔¼¾⅛⅜⅝⅞∞ ‘+’ “+” ‹+› «+» ⟨+⟩ ¤₳฿₵¢₡₢$₫₯€₠₣ƒ₴₭₤ℳ₥₦№₧₰£៛₨₪৳₮₩¥ ♠♣♥♦ m² m³ ♭♯♮ ©®™ ◌ {\{Unicode|+}}', <br />
'Latin': 'A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ B b C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç D d Ď ď Đ đ Ḍ ḍ Ð ð E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ɛ ɛ Ə ə F f G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ H h Ĥ ĥ Ħ ħ Ḥ ḥ I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į J j Ĵ ĵ K k Ķ ķ L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ M m Ṃ ṃ N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ Ŋ ŋ O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ Ɔ ɔ P p Q q R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ S s Ś ś Ŝ ŝ Š š Ş ş Ṣ ṣ ß T t Ť ť Ţ ţ Ṭ ṭ Þ þ U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ V v W w Ŵ ŵ X x Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ Z z Ź ź Ż ż Ž ž ß Ð ð Þ þ Ŋ ŋ Ə ə {\{Unicode|+}}',<br />
'Greek': 'ΆάΈέΉήΊίΌόΎύΏώ ΑαΒβΓγΔδ ΕεΖζΗηΘθ ΙιΚκΛλΜμ ΝνΞξΟοΠπ ΡρΣσςΤτΥυ ΦφΧχΨψΩω ᾼᾳᾴᾺὰᾲᾶᾷἈἀᾈᾀἉἁᾉᾁἌἄᾌᾄἊἂᾊᾂἎἆᾎᾆἍἅᾍᾅἋἃᾋᾃἏἇᾏᾇ ῈὲἘἐἙἑἜἔἚἒἝἕἛἓ ῌῃῄῊὴῂῆῇἨἠᾘᾐἩἡᾙᾑἬἤᾜᾔἪἢᾚᾒἮἦᾞᾖἭἥᾝᾕἫἣᾛᾓἯἧᾟᾗ ῚὶῖἸἰἹἱἼἴἺἲἾἶἽἵἻἳἿἷ ῸὸὈὀὉὁὌὄὊὂὍὅὋὃ ῤῬῥ ῪὺῦὐὙὑὔὒὖὝὕὛὓὟὗ ῼῳῴῺὼῲῶῷὨὠᾨᾠὩὡᾩᾡὬὤᾬᾤὪὢᾪᾢὮὦᾮᾦὭὥᾭᾥὫὣᾫᾣὯὧᾯᾧ {\{Polytonic|+}}',<br />
'Cyrillic': 'АаБбВвГг ҐґЃѓДдЂђ ЕеЁёЄєЖж ЗзЅѕИиІі ЇїЙйЈјКк ЌќЛлЉљМм НнЊњОоПп РрСсТтЋћ УуЎўФфХх ЦцЧчЏџШш ЩщЪъЫыЬь ЭэЮюЯя ӘәӨөҒғҖҗ ҚқҜҝҢңҮү ҰұҲҳҸҹҺһ ҔҕӢӣӮӯҘҙ ҠҡҤҥҪҫӐӑ ӒӓӔӕӖӗӰӱ ӲӳӸӹӀ ҞҟҦҧҨҩҬҭ ҴҵҶҷҼҽҾҿ ӁӂӃӄӇӈӋӌ ӚӛӜӝӞӟӠӡ ӤӥӦӧӪӫӴӵ ́',<br />
'Hebrew': 'אבגדהוזחטיךכלםמןנסעףפץצקרשת ׳ ״ װױײ',<br />
'Arabic': ' Transcription: ʾ ṯ ḥ ḫ ẖ ḏ š ṣ ḍ ṭ ẓ ʿ ġ ẗ ا ﺁ ب ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه ة و ي ى ء أ إ ؤ ئ',<br />
'IPA (English)': 'ˈ ˌ ŋ ɡ tʃ dʒ ʃ ʒ θ ð ʔ iː ɪ uː ʊ ʌ ɜr eɪ ɛ æ oʊ ɒ ɔː ɔɪ ɔr ɑː ɑr aɪ aʊ ə ər ɨ ɵ ʉ {\{IPA-en|+}} {\{IPA|/+/}} ‹+›',<br />
'IPA': 'ʈɖɟɡɢʡʔ ɸβθðʃʒɕʑʂʐçʝɣχʁħʕʜʢɦ ɱɳɲŋɴ ʋɹɻɰ ʙⱱʀɾɽ ɬ ɮ ɺ ɭʎʟ ʍɥɧ ʼ ɓɗʄɠʛ ʘǀǃǂǁ ɨʉɯ ɪʏʊ øɘɵɤ ə ɛœɜɞʌɔ æ ɐ ɶɑɒ ʰʱʷʲˠˤˀ ᵊ k̚ ⁿˡ ˈˌːˑ t̪ d̪ s̺ s̻ θ̼ s̬ n̥ ŋ̊ a̤ a̰ β̞ ˕ r̝ ˔ o˞ ɚ ɝ e̘ e̙ u̟ i̠ ɪ̈ e̽ ɔ̹ ɔ̜ n̩ ə̆ ə̯ ə̃ ȷ̃ ɫ z̴ ə̋ ə́ ə̄ ə̀ ə̏ ə̌ ə̂ ə᷄ ə᷅ ə᷇ ə᷆ ə᷈ ə᷉ t͡ʃ d͡ʒ t͜ɬ ‿ ˥ ˦ ˧ ˨ ˩ ꜛ ꜜ | ‖ ↗ ↘ k͈ s͎ {\{IPA|+}}',<br />
'Math and logic': '− × ÷ ⋅ ° ∗ ∘ ± ∓ ≤ ≥ ≠ ≡ ≅ ≜ ≝ ≐ ≃ ≈ ⊕ ⊗ ⇐ ⇔ ⇒ ∞ ← ↔ → ≪ ≫ ∝ √ ∤ ≀ ◅ ▻ ⋉ ⋊ ⋈ ∴ ∵ ↦ ¬ ∧ ∨ ⊻ ∀ ∃ ∈ ∉ ∋ ⊆ ⊈ ⊊ ⊂ ⊄ ⊇ ⊉ ⊋ ⊃ ⊅ ∪ ∩ ∑ ∏ ∐ ′ ∫ ∬ ∭ ∮ ∇ ∂ ∆ ∅ ℂ ℍ ℕ ℙ ℚ ℝ ℤ ℵ ⌊ ⌋ ⌈ ⌉ ⊤ ⊥ ⊢ ⊣ ⊧ □ ∠ ⟨ ⟩ {\{frac|+|}} &nbsp; &minus; <math>+</math> {\{math|+}}'<br />
},<br />
<br />
charinsertDivider : "\240",<br />
<br />
extraCSS : '\<br />
#editpage-specialchars {\<br />
margin-top: 15px;\<br />
border-width: 1px;\<br />
border-style: solid;\<br />
border-color: #aaaaaa;\<br />
padding: 2px;\<br />
}\<br />
#editpage-specialchars a {\<br />
}\<br />
#editpage-specialchars a:hover {\<br />
}\<br />
',<br />
<br />
appendExtraCSS : function ()<br />
{<br />
appendCSS(EditTools.extraCSS);<br />
},<br />
<br />
<br />
cookieName : 'edittoolscharsubset',<br />
<br />
createEditTools : function (placeholder)<br />
{<br />
var box = document.createElement("div");<br />
box.id = "editpage-specialchars";<br />
box.title = 'Click on the character or tag to insert it into the edit window';<br />
<br />
//append user-defined sets<br />
if (window.charinsertCustom)<br />
for (id in charinsertCustom)<br />
if (EditTools.charinsert[id]) EditTools.charinsert[id] += ' ' + charinsertCustom[id];<br />
else EditTools.charinsert[id] = charinsertCustom[id];<br />
<br />
//create drop-down select<br />
var prevSubset = 0, curSubset = 0;<br />
var sel = document.createElement('select'), id;<br />
for (id in EditTools.charinsert)<br />
sel.options[sel.options.length] = new Option(id, id);<br />
sel.selectedIndex = 0;<br />
sel.style.cssFloat = sel.style.styleFloat = 'left';<br />
sel.style.marginRight = '5px';<br />
sel.title = 'Choose character subset';<br />
sel.onchange = sel.onkeyup = selectSubset;<br />
box.appendChild(sel);<br />
<br />
//create "recall" switch<br />
if (window.editToolsRecall) {<br />
var recall = document.createElement('span');<br />
recall.appendChild(document.createTextNode('↕')); // ↔<br />
recall.onclick = function () {<br />
sel.selectedIndex = prevSubset;<br />
selectSubset();<br />
}<br />
with (recall.style) { cssFloat = styleFloat = 'left'; marginRight = '5px'; cursor = 'pointer'; }<br />
box.appendChild(recall);<br />
}<br />
<br />
// load latest selection from cookies<br />
try {<br />
var cookieRe = new RegExp ("(?:^|;)\\s*" + EditTools.cookieName + "=(\\d+)\\s*(?:;|$)");<br />
var m = cookieRe.exec(document.cookie);<br />
if (m && m.length > 1 && parseInt(m[1]) < sel.options.length)<br />
sel.selectedIndex = parseInt(m[1]);<br />
} catch (err) { /* ignore */ }<br />
<br />
placeholder.parentNode.replaceChild(box, placeholder);<br />
selectSubset();<br />
return;<br />
<br />
function selectSubset ()<br />
{<br />
//remember previous (for "recall" button)<br />
prevSubset = curSubset;<br />
curSubset = sel.selectedIndex;<br />
//save into cookies for persistence<br />
try {<br />
var expires = new Date ();<br />
expires.setTime( expires.getTime() + 30 * 24 * 60 * 60 * 1000 ); // + 30 days<br />
document.cookie = EditTools.cookieName + "=" + curSubset + ";path=/;expires=" + expires.toUTCString();<br />
} catch (err) { /* ignore */ }<br />
//hide other subsets<br />
var pp = box.getElementsByTagName('p') ;<br />
for (var i=0; i<pp.length; i++)<br />
pp[i].style.display = 'none';<br />
//show/create current subset<br />
var id = sel.options[curSubset].value;<br />
var p = document.getElementById(id);<br />
if (!p){<br />
p = document.createElement('p');<br />
p.id = id;<br />
if (id == 'Arabic' || id == 'Hebrew'){ p.style.fontSize = '120%'; p.dir = 'rtl'; }<br />
EditTools.createTokens(p, EditTools.charinsert[id]);<br />
box.appendChild(p);<br />
}<br />
p.style.display = 'inline';<br />
} <br />
},<br />
createTokens : function (paragraph, str)<br />
{<br />
var tokens = str.split(' '), token, i, n;<br />
for (i = 0; i < tokens.length; i++) {<br />
token = tokens[i];<br />
n = token.indexOf('+');<br />
if (token == '' || token == '_')<br />
addText(EditTools.charinsertDivider + ' ');<br />
else if (token == '\n')<br />
paragraph.appendChild(document.createElement('br'));<br />
else if (token == '___')<br />
paragraph.appendChild(document.createElement('hr'));<br />
else if (token.charAt(token.length-1) == ':') // : at the end means just text<br />
addBold(token);<br />
else if (n == 0) // +<tag> -> <tag>+</tag><br />
addLink(token.substring(1), '</' + token.substring(2), token.substring(1));<br />
else if (n > 0) // <tag>+</tag><br />
addLink(token.substring(0,n), token.substring(n+1));<br />
else if (token.length > 2 && token.charCodeAt(0) > 127) //a string of insertable characters<br />
for (var j=0; j < token.length; j++) addLink(token.charAt(j), '');<br />
else<br />
addLink(token, '');<br />
}<br />
return;<br />
<br />
function addLink (tagOpen, tagClose, name)<br />
{<br />
var a = document.createElement('a');<br />
tagOpen = tagOpen.replace(/\./g,' ');<br />
tagClose = tagClose ? tagClose.replace(/_/g,' ') : '';<br />
name = name || tagOpen + tagClose;<br />
name = name.replace(/\\n/g,'');<br />
a.appendChild(document.createTextNode(name));<br />
a.href = "#";<br />
addHandler( a, 'click', new Function( "evt", "insertTags('" + tagOpen + "', '" + tagClose + "', ''); return killEvt( evt );" ) );<br />
paragraph.appendChild(a);<br />
addText(' ');<br />
}<br />
function addBold (text)<br />
{<br />
var b = document.createElement('b');<br />
b.appendChild(document.createTextNode(text.replace(/_/g,' ')));<br />
paragraph.appendChild(b);<br />
addText(' ');<br />
} <br />
function addText (txt)<br />
{<br />
paragraph.appendChild(document.createTextNode(txt));<br />
}<br />
},<br />
<br />
<br />
enableForAllFields : function ()<br />
{<br />
if (typeof (insertTags) != 'function' || window.WikEdInsertTags) return;<br />
// insertTags from the site-wide /skins-1.5/common/edit.js just inserts in the first<br />
// textarea in the document. Evidently, that's not good if we have multiple textareas.<br />
// My first idea was to simply add a hidden textarea as the first one, and redefine<br />
// insertTags such that it copied first the last active textareas contents over to that hidden<br />
// field, set the cursor or selection there, let the standard insertTags do its thing, and<br />
// then copy the hidden field's text, cursor position and selection back to the currently<br />
// active field. Unfortunately, that is just as complex as simply copying the whole code<br />
// from wikibits to here and let it work on the right text field in the first place.<br />
var texts = document.getElementsByTagName ('textarea'); <br />
for (var i = 0; i < texts.length; i++) {<br />
addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
// While we're at it, also enable it for input fields<br />
texts = document.getElementsByTagName ('input');<br />
for (var i = 0; i < texts.length; i++) {<br />
if (texts[i].type == 'text') addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
insertTags = EditTools.insertTags; // Redefine the global insertTags<br />
},<br />
<br />
last_active_textfield : null,<br />
<br />
registerTextField : function (evt)<br />
{<br />
var e = evt || window.event;<br />
var node = e.target || e.srcElement;<br />
if (!node) return;<br />
EditTools.last_active_textfield = node.id;<br />
return true;<br />
},<br />
<br />
getTextArea : function ()<br />
{<br />
var txtarea = null;<br />
if (EditTools.last_active_textfield && EditTools.last_active_textfield != "")<br />
txtarea = document.getElementById (EditTools.last_active_textfield);<br />
if (!txtarea) {<br />
// Fallback option: old behaviour<br />
if (document.editform) {<br />
txtarea = document.editform.wpTextbox1;<br />
} else {<br />
// Some alternate form? Take the first one we can find<br />
txtarea = document.getElementsByTagName ('textarea');<br />
if (txtarea.length > 0) txtarea = txtarea[0]; else txtarea = null;<br />
}<br />
}<br />
return txtarea;<br />
},<br />
<br />
insertTags : function (tagOpen, tagClose, sampleText)<br />
{<br />
var txtarea = EditTools.getTextArea ();<br />
if (!txtarea) return;<br />
<br />
<br />
/* Usability initiative compatibility */<br />
if ( typeof $j != 'undefined' && typeof $j.fn.textSelection != 'undefined' ) {<br />
$j( txtarea ).textSelection(<br />
'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }<br />
);<br />
return;<br />
}<br />
<br />
<br />
var selText, isSample = false;<br />
<br />
function checkSelectedText ()<br />
{<br />
if (!selText) {<br />
selText = sampleText; isSample = true;<br />
} else if (selText.charAt (selText.length - 1) == ' ') { // Exclude ending space char<br />
selText = selText.substring (0, selText.length - 1);<br />
tagClose += ' ';<br />
} <br />
}<br />
<br />
if (document.selection && document.selection.createRange) { // IE/Opera<br />
// Save window scroll position<br />
var winScroll = 0;<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
winScroll = document.documentElement.scrollTop;<br />
else if (document.body)<br />
winScroll = document.body.scrollTop;<br />
// Get current selection <br />
txtarea.focus();<br />
var range = document.selection.createRange();<br />
selText = range.text;<br />
// Insert tags<br />
checkSelectedText ();<br />
range.text = tagOpen + selText + tagClose;<br />
// Mark sample text as selected<br />
if (isSample && range.moveStart) {<br />
if (window.opera) tagClose = tagClose.replace (/\n/g, "");<br />
range.moveStart( 'character', - tagClose.length - selText.length); <br />
range.moveEnd ('character', - tagClose.length); <br />
}<br />
range.select (); <br />
// Restore window scroll position<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
document.documentElement.scrollTop = winScroll;<br />
else if (document.body)<br />
document.body.scrollTop = winScroll;<br />
} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla<br />
// Save textarea scroll position<br />
var textScroll = txtarea.scrollTop;<br />
// Get current selection<br />
txtarea.focus();<br />
var startPos = txtarea.selectionStart;<br />
var endPos = txtarea.selectionEnd;<br />
selText = txtarea.value.substring (startPos, endPos);<br />
// Insert tags<br />
checkSelectedText ();<br />
txtarea.value = txtarea.value.substring (0, startPos)<br />
+ tagOpen + selText + tagClose<br />
+ txtarea.value.substring (endPos);<br />
// Set new selection<br />
if (isSample) {<br />
txtarea.selectionStart = startPos + tagOpen.length;<br />
txtarea.selectionEnd = startPos + tagOpen.length + selText.length;<br />
} else {<br />
txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length;<br />
txtarea.selectionEnd = txtarea.selectionStart;<br />
}<br />
// Restore textarea scroll position<br />
txtarea.scrollTop = textScroll;<br />
}<br />
}, // end insertTags<br />
<br />
setup : function ()<br />
{<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder) return; // has this already been run once?<br />
EditTools.appendExtraCSS ();<br />
EditTools.createEditTools (placeholder);<br />
EditTools.enableForAllFields ();<br />
}<br />
<br />
}; // end EditTools<br />
<br />
// No need to hook this, as the loading of this page is itself hooked.<br />
EditTools.setup();</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&diff=10310
MediaWiki:Gadget-DotsSyntaxHighlighter.js
2017-06-25T19:59:49Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>//Syntax highlighter with various advantages See [[User:Remember the<br />
//dot/Syntax highlighter]] for more information<br />
/*<br />
MediaWiki:Gadget-DotsSyntaxHighlighter<br />
[https://www.mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter Adapted from Syntax highlighter]: Make syntax stand out colourfully in the edit box and especially with Demopaedia TextTerm etc.<br />
<br />
MediaWiki:Gadget-DotsSyntaxHighlighter.js<br />
<br />
*/<br />
//in the edit box and especially with Demopaedia TextTerm etc.<br />
/* This file may be used under the terms of any of the following<br />
licenses, as well as any later version of the same licenses:<br />
<br />
GNU General Public License 2.0<br />
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html><br />
<br />
Creative Commons Attribution-ShareAlike 3.0 Unported License<br />
<https://creativecommons.org/licenses/by-sa/3.0/><br />
<br />
GNU Free Documentation License 1.2<br />
<https://www.gnu.org/licenses/old-licenses/fdl-1.2.html><br />
Modified by Nicolas Brouard for Demopaedia.org 12 June 2017<br />
*/<br />
<br />
(function () {<br />
"use strict";<br />
<br />
//variables that are preserved between function calls<br />
var wpTextbox0;<br />
var wpTextbox1;<br />
var syntaxStyleTextNode;<br />
var lastText;<br />
var maxSpanNumber = -1; //the number of the last span available, used to tell if creating additional spans is necessary<br />
var highlightSyntaxIfNeededIntervalID;<br />
var attributeObserver;<br />
var parentObserver;<br />
<br />
/* Define context-specific regexes, one for every common token that ends the<br />
current context.<br />
<br />
An attempt has been made to search for the most common syntaxes first,<br />
thus maximizing performance. Syntaxes that begin with the same character<br />
are searched for at the same time.<br />
<br />
Supported wiki syntaxes from most common to least common:<br />
[[internal link]] [http:// named external link]<br />
{{template}} {{{template parameter}}} {| table |}<br />
<tag> <!-- comment --><br />
http:// bare external link<br />
=Heading= * unordered list # ordered list : indent ; small heading ---- horizontal line<br />
''italic'' '''bold'''<br />
three tildes username four tildes signature five tildes timestamp<br />
&entity;<br />
<br />
The tag-matching regex follows the XML standard closely so that users<br />
won't feel like they have to escape sequences that MediaWiki will never<br />
consider to be tags.<br />
<br />
Only entities for characters which need to be escaped or cannot be<br />
unambiguously represented in a monospace font are highlighted, such as<br />
Greek letters that strongly resemble Latin letters. Use of other entities<br />
is discouraged as a matter of style. For the same reasons, numeric<br />
entities should be in hexadecimal (giving character codes in decimal only<br />
adds confusion).<br />
<br />
Newlines are sucked up into ending tokens (including comments, bare<br />
external links, lists, horizontal lines, signatures, entities, etc.) to<br />
avoid creating spans with nothing but newlines in them.<br />
<br />
Flags: g for global search, m for make ^ match the beginning of each line<br />
and $ the end of each line<br />
*/<br />
var wgUrlProtocols = mw.config.get("wgUrlProtocols");<br />
var entityRegexBase = "&(?:(?:n(?:bsp|dash)|m(?:dash|inus)|lt|e[mn]sp|thinsp|amp|quot|gt|shy|zwn?j|lrm|rlm|Alpha|Beta|Epsilon|Zeta|Eta|Iota|Kappa|[Mm]u|micro|Nu|[Oo]micron|[Rr]ho|Tau|Upsilon|Chi)|#x[0-9a-fA-F]+);\n*";<br />
var breakerRegexBase = "\\[(?:\\[|(?:" + wgUrlProtocols + "))|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-\\.\u00B7\u0300-\u036F\u203F-\u203F-\u2040]*(?=/?>| |\n)|!--[^]*?-->\n*)|(?:" + wgUrlProtocols.replace("|\\/\\/", "") + ")[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|" + entityRegexBase;<br />
function breakerRegexWithPrefix(prefix)<br />
{<br />
//the stop token has to be at the beginning of the regex so that it takes precedence over substrings of itself.<br />
return new RegExp("(" + prefix + ")\n*|" + breakerRegexBase, "gm");<br />
}<br />
function nowikiTagBreakerRegex(tagName)<br />
{<br />
return new RegExp("(</" + tagName + ">)\n*|" + entityRegexBase, "gm");<br />
}<br />
var defaultBreakerRegex = new RegExp(breakerRegexBase, "gm");<br />
var wikilinkBreakerRegex = breakerRegexWithPrefix("]][a-zA-Z]*");<br />
var namedExternalLinkBreakerRegex = breakerRegexWithPrefix("]");<br />
var parameterBreakerRegex = breakerRegexWithPrefix("}}}");<br />
var templateBreakerRegex = breakerRegexWithPrefix("}}");<br />
var templateArgBreakerRegex = breakerRegexWithPrefix("[\\|}]");<br />
var tableBreakerRegex = breakerRegexWithPrefix("\\|}");<br />
var headingBreakerRegex = breakerRegexWithPrefix("\n");<br />
var tagBreakerRegexCache = {};<br />
var nowikiTagBreakerRegexCache = {};<br />
<br />
function highlightSyntax()<br />
{<br />
lastText = wpTextbox1.value;<br />
/* Backslashes and apostrophes are CSS-escaped at the beginning and all<br />
parsing regexes and functions are designed to match. On the other hand,<br />
newlines are not escaped until written so that in the regexes ^ and $<br />
work for both newlines and the beginning or end of the string. */<br />
var text = lastText.replace(/['\\]/g, "\\$&") + "\n"; //add a newline to fix scrolling and parsing issues<br />
var i = 0; //the location of the parser as it goes through var text<br />
<br />
var css = "";<br />
var spanNumber = 0;<br />
var lastColor;<br />
var before = true;<br />
<br />
//writes text into to-be-created span elements of wpTextbox0 using :before and :after pseudo-elements<br />
//both :before and :after are used because using two pseudo-elements per span is significantly faster than doubling the number of spans required<br />
function writeText(text, color)<br />
{<br />
//no need to use another span if using the same color<br />
if (color != lastColor)<br />
{<br />
//whitespace is omitted in the hope of increasing performance<br />
css += "'}#s" + spanNumber; //spans will be created with IDs s0 through sN<br />
if (before)<br />
{<br />
css += ":before{";<br />
before = false;<br />
}<br />
else<br />
{<br />
css += ":after{";<br />
before = true;<br />
++spanNumber;<br />
}<br />
if (color)<br />
{<br />
//"background-color" is 6 characters longer than "background" but the browser processes it faster<br />
css += "background-color:" + color + ";";<br />
}<br />
css += "content:'";<br />
lastColor = color;<br />
}<br />
css += text;<br />
}<br />
<br />
/* About assumedBold and assumedItalic:<br />
<br />
Highlighting bold or italic markup presents a special challenge<br />
because the actual MediaWiki parser uses multiple passes to determine<br />
which ticks represent start tags and which represent end tags.<br />
Because that would be too slow for us here, we instead keep track of<br />
what kinds of unclosed opening ticks have been encountered and use<br />
that to make a good guess as to whether the next ticks encountered<br />
are an opening tag or a closing tag.<br />
<br />
The major downsides to this method are that '''apostrophe italic''<br />
and ''italic apostrophe''' are not highlighted correctly, and bold<br />
and italic are both highlighted in the same color.<br />
<br />
To permit ''The best<ref>''Reference Title''</ref> book ever'',<br />
assumedBold and assumedItalic are saved on the stack and reset to<br />
undefined (essentially, false) when recursing into a new block. */<br />
<br />
function highlightBlock(color, breakerRegex, assumedBold, assumedItalic)<br />
{<br />
var match;<br />
<br />
for (breakerRegex.lastIndex = i; match = breakerRegex.exec(text); breakerRegex.lastIndex = i)<br />
{<br />
// console.log(" breakerRegex.lastIndex="+breakerRegex.lastIndex);<br />
// console.log(" breakerRegex.source="+breakerRegex.source);<br />
//console.log(" match.input="+match.input);<br />
// if (match[1])<br />
// //console.log(" match1=" + match[1]+ " match0=" +match[0]);<br />
// else<br />
// //console.log(" unmatch1=" + match[1]+ " match0=" +match[0]);<br />
if (match[1])<br />
{<br />
//end token found, we are within a coloured zone <br />
writeText(text.substring(i, breakerRegex.lastIndex), color);<br />
//console.log(" breaker Regex i="+ i + " breakerRegex.lastIndex=" +breakerRegex.lastIndex + " t="+text.substring(i, breakerRegex.lastIndex) + " return highlight" );<br />
i = breakerRegex.lastIndex; /* end of zone */<br />
<br />
return; /* returns after the break ie for with a defautregex in order to search again */<br />
}<br />
<br />
var endIndexOfLastColor = breakerRegex.lastIndex - match[0].length; /* Not including the match? */<br />
if (i < endIndexOfLastColor) //avoid calling writeText with text == "" to improve performance<br />
{<br />
writeText(text.substring(i, endIndexOfLastColor), color); /* Includes i (from 0), excludes endIndexOfLastColor */<br />
//console.log(" substring i="+ i + " endIndexOfLastColor=" + endIndexOfLastColor );<br />
<br />
}<br />
<br />
i = breakerRegex.lastIndex; /* Out of coloured zone */ /* Dot is first position after the search "{{." */<br />
<br />
switch (match[0].charAt(0)) //cases in this switch should be arranged from most common to least common<br />
{<br />
case "[":<br />
if (match[0].charAt(1) == "[")<br />
{<br />
//wikilink<br />
writeText("[[", syntaxHighlighterConfig.wikilinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.wikilinkColor || color, wikilinkBreakerRegex);<br />
}<br />
else<br />
{<br />
//named external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.externalLinkColor || color, namedExternalLinkBreakerRegex);<br />
}<br />
break;<br />
case "{":<br />
if (match[0].charAt(1) == "{")<br />
{<br />
if (match[0].length == 3)<br />
{<br />
//parameter<br />
writeText("{{{", syntaxHighlighterConfig.parameterColor || color);<br />
highlightBlock(syntaxHighlighterConfig.parameterColor || color, parameterBreakerRegex);<br />
}<br />
else<br />
{<br />
//template<br />
//some other kind of template, search for its end<br />
//writeText("{{", syntaxHighlighterConfig.templateColor || color);<br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templEnd = text.indexOf("}", i) + 1; /* Just before first } +1*/<br />
var templTextTermEnd = text.indexOf("|", i); /* char from 0 to index "{{Note|" is position 6 (7th char); just after first | if any*/<br />
var iv=text.indexOf("|", i);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
var ib=text.indexOf("}", i);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
var nbarg=0;<br />
var templTextTermEnd ;<br />
var templTextTermEndClose;<br />
if( (ib < iv) || (iv == -1) ){<br />
nbarg=0;<br />
templTextTermEndClose=templTextTermEnd = ib ;/* Just at } if any */ /* no argument */<br />
}else{<br />
nbarg=1;<br />
templTextTermEnd = iv ; /* Just at second | if any */<br />
}<br />
//{{Current status}}<br />
if(nbarg==1){<br />
iv=text.indexOf("|", templTextTermEnd+1);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
ib=text.indexOf("}", templTextTermEnd+1);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
if( (ib < iv) || (iv == -1) ){<br />
templTextTermEndClose= ib ;/* Just at } if any */<br />
}else{<br />
nbarg=2;<br />
templTextTermEndClose = iv ; /* Just at second | if any {{Note|1| */<br />
}<br />
}<br />
//console.log("templ1 TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// Be careful with scrolling and asynchronous generated by console.log see<br />
// https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Scroll-linked_effects<br />
//console.log("templ End :" + templEnd + " noarg=", noarg); // Ok before }}<br />
// console.log("templ TextTermEnd :" + templTextTermEnd); // Ok before |<br />
//console.log("templ TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// La {{TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ...}} s’occupe<br />
//de la {{NonRefTerm|structure}} <br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templText = text.substring(i+2 - match[0].length, templEnd-1);<br />
//TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ..<br />
//NonRefTerm|structure<br />
var templTextType = text.substring(i+2 - match[0].length, templTextTermEnd); /* Excluding char at TermEnd | or } */<br />
//TextTerm<br />
//NonRefTerm<br />
//var templTextTermall = text.substring(templTextTermEnd, templEnd); /* Just after termination | or }*/<br />
//démographie historique|1|102|OtherIndexEntry=historique. démographie ...<br />
//NonRefTerm|structure<br />
var templTextTerm;<br />
if(nbarg >0)<br />
templTextTerm = text.substring(templTextTermEnd+1,templTextTermEndClose); //excluding terminaison | or }<br />
else<br />
templTextTerm="";<br />
//templTextTermall.substring(0, templTextTermall.indexOf("|"));<br />
//démographie historique<br />
//structure<br />
var TypeTemplateColor=syntaxHighlighterConfig.templateColor;<br />
var TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text1TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text2TemplateColor=syntaxHighlighterConfig.templateColor;<br />
if((templTextType=="TextTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor=TemplateColor ;<br />
}else if ( (templTextType=="Note") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTypeNoteColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
}else if ( (templTextType=="NoteTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
}else if (templTextType=="NewTextTerm" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeNewTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ( templTextType=="RefNumber" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
TemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ((templTextType=="NonRefTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
}<br />
//writeText("{{", TemplateColor || color);<br />
writeText("{{", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
writeText(templTextType, TypeTemplateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd;<br />
if(nbarg>=1){<br />
writeText( "|", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
//writeText(templTextType+"|", syntaxHighlighterConfig.templateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd+1;<br />
//writeText(templTextTerm, syntaxHighlighterConfig.tagColor || color); //struture<br />
writeText(templTextTerm, Text1TemplateColor || color); //struture<br />
i=templTextTermEndClose; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
if(nbarg==2){<br />
writeText("|",Text2TemplateColor || color);<br />
i=templTextTermEndClose+1; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
//console.log(" i="+ i );<br />
//highlightBlock(syntaxHighlighterConfig.templateColor || color, templateBreakerRegex);<br />
highlightBlock(TemplateColor || color, templateBreakerRegex);<br />
}<br />
}<br />
else //|<br />
{<br />
//table<br />
writeText("{|", syntaxHighlighterConfig.tableColor || color);<br />
highlightBlock(syntaxHighlighterConfig.tableColor || color, tableBreakerRegex);<br />
}<br />
break;<br />
case "<":<br />
if (match[0].charAt(1) == "!")<br />
{<br />
//comment tag<br />
writeText(match[0], syntaxHighlighterConfig.commentColor || color);<br />
break;<br />
}<br />
else<br />
{<br />
//some other kind of tag, search for its end<br />
//the search is made easier because XML attributes may not contain the character ">"<br />
var tagEnd = text.indexOf(">", i) + 1;<br />
if (tagEnd == 0)<br />
{<br />
//not a tag, just a "<" with some text after it<br />
writeText("<", color);<br />
i = i - match[0].length + 1;<br />
break;<br />
}<br />
<br />
if (text.charAt(tagEnd - 2) == "/")<br />
{<br />
//empty tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
}<br />
else<br />
{<br />
var tagName = match[0].substring(1);<br />
<br />
if (syntaxHighlighterConfig.sourceTags.indexOf(tagName) != -1)<br />
{<br />
//tag that contains text in a different programming language<br />
var stopAfter = "</" + tagName + ">";<br />
var endIndex = text.indexOf(stopAfter, i);<br />
if (endIndex == -1)<br />
{<br />
endIndex = text.length;<br />
}<br />
else<br />
{<br />
endIndex += stopAfter.length;<br />
}<br />
writeText(text.substring(i - match[0].length, endIndex), syntaxHighlighterConfig.tagColor || color);<br />
i = endIndex;<br />
}<br />
else if (syntaxHighlighterConfig.nowikiTags.indexOf(tagName) != -1)<br />
{<br />
//tag that can contain only HTML entities<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, nowikiTagBreakerRegexCache[tagName]);<br />
}<br />
else<br />
{<br />
//ordinary tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
if (!tagBreakerRegexCache[tagName])<br />
{<br />
tagBreakerRegexCache[tagName] = breakerRegexWithPrefix("</" + tagName + ">");<br />
}<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, tagBreakerRegexCache[tagName]);<br />
}<br />
}<br />
}<br />
break;<br />
case "=":<br />
if (/[^=]=+$/.test(text.substring(i, text.indexOf("\n", i)))) //the line begins and ends with an equals sign and has something else in the middle<br />
{<br />
//heading<br />
writeText("=", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
}<br />
else<br />
{<br />
writeText("=", color); //move on, process this line as regular wikitext<br />
}<br />
break;<br />
case "*":<br />
case "#":<br />
case ":":<br />
//unordered list, ordered list, indent, small heading<br />
//just highlight the marker<br />
writeText(match[0], syntaxHighlighterConfig.listOrIndentColor || color);<br />
break;<br />
case ";":<br />
//small heading<br />
writeText(";", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
break;<br />
case "-":<br />
//horizontal line<br />
writeText(match[0], syntaxHighlighterConfig.hrColor || color);<br />
break;<br />
case "\\":<br />
writeText(match[0], syntaxHighlighterConfig.boldOrItalicColor || color);<br />
if (match[0].length == 6)<br />
{<br />
//bold<br />
if (assumedBold)<br />
{<br />
//end tag<br />
if (assumedItalic)<br />
{<br />
//end of bold part of bold-italic block<br />
//block is now italic-only<br />
assumedBold = false;<br />
}<br />
else<br />
{<br />
//end of bold block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedItalic)<br />
{<br />
//start of bold part of previously italic-only block<br />
//block is now bold-italic<br />
assumedBold = true;<br />
}<br />
else<br />
{<br />
//start of bold block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, true, false);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
//italic<br />
if (assumedItalic)<br />
{<br />
//end tag<br />
if (assumedBold)<br />
{<br />
//end of italic part of bold-italic block<br />
//block is now bold-only<br />
assumedItalic = false;<br />
}<br />
else<br />
{<br />
//end of italic block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedBold)<br />
{<br />
//start of italic part of previously bold-only block<br />
//block is now bold-italic<br />
assumedItalic = true;<br />
}<br />
else<br />
{<br />
//start of italic block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, false, true);<br />
}<br />
}<br />
}<br />
break;<br />
case "&":<br />
//entity<br />
writeText(match[0], syntaxHighlighterConfig.entityColor || color);<br />
break;<br />
case "~":<br />
//username, signature, timestamp<br />
writeText(match[0], syntaxHighlighterConfig.signatureColor || color);<br />
break;<br />
default:<br />
//bare external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
}<br />
}<br />
}<br />
<br />
<br />
//start!<br />
var startTime = Date.now();<br />
highlightBlock("", defaultBreakerRegex);<br />
<br />
//output the leftovers (if any) to make sure whitespace etc. matches<br />
if (i < text.length)<br />
{<br />
writeText(text.substring(i), "");<br />
}<br />
<br />
//if highlighting took too long, disable it.<br />
var endTime = Date.now();<br />
/*if (typeof(bestTime) == "undefined")<br />
{<br />
window.bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntax, 250);<br />
}<br />
else<br />
{<br />
if (endTime - startTime < bestTime)<br />
{<br />
bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
}<br />
}//*/<br />
if (endTime - startTime > syntaxHighlighterConfig.timeout)<br />
{<br />
clearInterval(highlightSyntaxIfNeededIntervalID);<br />
wpTextbox1.removeEventListener("input", highlightSyntax);<br />
wpTextbox1.removeEventListener("scroll", syncScrollX);<br />
wpTextbox1.removeEventListener("scroll", syncScrollY);<br />
attributeObserver.disconnect();<br />
parentObserver.disconnect();<br />
syntaxStyleTextNode.nodeValue = "";<br />
<br />
var errorMessage = {<br />
ca: "S'ha desactivat el remarcar de sintaxi en aquesta pàgina perquè ha trigat massa temps. El temps màxim permès per a remarcar és $1ms, i el vostre ordinador ha trigat $2ms. Proveu tancar algunes pestanyes i programes i fer clic en \"Mostra la previsualització\" o \"Mostra els canvis\". Si no funciona això, proveu un altre navegador web, i si això no funciona, proveu un ordinador més ràpid.",<br />
de: "Die Syntaxhervorhebung wurde auf dieser Seite deaktiviert, da diese zu lange gedauert hat. Die maximal erlaubte Zeit zur Hervorhebung beträgt $1ms und dein Computer benötigte $2ms. Versuche einige Tabs und Programme zu schließen und klicke \"Vorschau zeigen\" oder \"Änderungen zeigen\". Wenn das nicht funktioniert, probiere einen anderen Webbrowser und wenn immer noch nicht, probiere einen schnelleren Computer.",<br />
el: "Η έμφαση σύνταξης έχει απενεργοποιηθεί σε αυτήν τη σελίδα γιατί αργούσε πολύ. Ο μέγιστος επιτρεπτός χρόνος για την έμφαση σύνταξης είναι $1ms και ο υπολογιστής σας έκανε $2ms. Δοκιμάστε να κλείσετε μερικές καρτέλες και προγράμματα και να κάνετε κλικ στην «Εμφάνιση προεπισκόπησης» ή στην «Εμφάνιση αλλαγών». Αν αυτό δεν δουλέψει, δοκιμάστε έναν διαφορετικό περιηγητή και αν ούτε αυτό δουλέψει, δοκιμάστε έναν ταχύτερο υπολογιστή.",<br />
en: "Syntax highlighting on this page was disabled because it took too long. The maximum allowed highlighting time is $1ms, and your computer took $2ms. Try closing some tabs and programs and clicking \"Show preview\" or \"Show changes\". If that doesn't work, try a different web browser, and if that doesn't work, try a faster computer.",<br />
es: "Se desactivó el resaltar de sintaxis en esta página porque tardó demasiado. El tiempo máximo permitido para resaltar es $1ms, y tu ordenador tardó $2ms. Prueba cerrar algunas pestañas y programas y hacer clic en \"Mostrar previsualización\" o \"Mostrar cambios\". Si no funciona esto, prueba otro navegador web, y si eso no funciona, prueba un ordenador más rápido.",<br />
fa: "از آنجایی که زمان زیادی صرف آن میشد، برجستهسازی نحو در این صفحه غیرفعال شده است. بیشینهٔ زمان برجستهسازی برای ابزار $1ms تعریف شده در حالی که رایانهٔ شما $2ms زمان نیاز داشت. میتوانید بستن برخی سربرگها و برنامهها و سپس کلیککردن دکمهٔ «پیشنمایش» یا «نمایش تغییرات» را بیازمایید. اگر جواب نداد مرورگر دیگری را امتحان کنید؛ و اگر باز هم جواب نداد، رایانهٔ سریعتری را بیازمایید.",<br />
fr: "La coloration syntaxique a été désactivée sur cette page en raison d'un temps de chargement trop important ($2ms). Le temps maximum autorisé est $1ms. Vous pouvez essayer de fermer certains onglets et programmes et cliquez sur \"Prévisualisation\" ou \"Voir mes modifications\". Si cela ne fonctionne pas, essayez un autre navigateur web, et si cela ne fonctionne toujours pas, essayez un ordinateur plus rapide.",<br />
hy: "Շարադասության ընդգծումը այս էջում անջատվել է, քանի որ այն չափից շատ է տևել։ Ընդգծման թույլատրելի առավելագույն ժամանակը $1 միլիվայրկյան է, բայց այս էջում տևել է $2 միլիվայրկյան։ Փորձեք անջատել որոշ ներդիրներ կամ ծրագրեր և սեղմել «Նախադիտել» կամ «Կատարված փոփոխությունները»։ Կրկին չաշխատելու դեպքում փորձեք այլ վեբ դիտարկիչ, եթե կրկին չաշխատի, փորձեք ավելի արագ համակարգիչ։",<br />
io: "Sintaxo-hailaitar en ca pagino esis nekapabligata pro ke konsumis tro multa tempo. La maxima permisata hailaitala tempo es $1ms, e tua ordinatro konsumis $2ms. Probez klozar kelka tabi e programi e kliktar \"Previdar\" o \"Montrez chanji\". Se to ne funcionas, probez altra brauzero, e se to ne funcionas, probez plu rapida ordinatro.",<br />
it: "L'evidenziazione delle sintassi su questa pagina è stata disabilitata perché ha richiesto troppo tempo. Il tempo massimo per l'evidenziazione è di $1ms e al tuo computer sono serviti $2ms. Prova a chiudere alcune schede e programmi e ricarica la pagina cliccando su \"Visualizza anteprima\" o \"Mostra modifiche\". Se non funziona ancora, prova con un web browser differente e, in ultima alternativa, prova ad utilizzare un computer più veloce.",<br />
ko: "이 문서에서의 문법 강조가 너무 오래 걸러서 해제되었습니다. 최대로 할당된 강조 시간은 $1ms인데, 당신의 컴퓨터는 $2ms이나 걸렸습니다. 탭과 프로그램을 일부 닫으신 후에 \"미리 보기\"나 \"차이 보기\"를 클릭하시기 바랍니다. 만약 작동하지 않으면 다른 웹 브라우저로 시도해보시고, 그래도 안되면 더 빠른 컴퓨터를 이용하십시오",<br />
pt: "O marcador de sintaxe foi desativado nesta página porque demorou demais. O tempo máximo permitido para marcar é de $1ms, e seu computador demorou $2ms. Tente fechar algumas abas e programas e clique em \"Mostrar previsão\" ou \"Mostrar alterações\". Se isso não funcionar, tente usar um outro navegador web, e se ainda não funcionar, tente em um computador mais rápido.",<br />
ru: "Подсветка синтаксиса на странице была отключена, так как заняла слишком долго. Максимальное допустимое время операции - $1мс, сейчас на вашем компьютере она заняла $2мс. Попробуйте закрыть несколько вкладок и программ, затем нажать «Предварительный просмотр» или «Внесённые изменения». Если это не поможет, попробуйте другой браузер; если и это не поможет, используйте более быстрый компьютер.",<br />
sr: "Истицање синтаксе на овој страници је онемогућено јер се одвија предуго. Максимално дозвољено време истицања је $1ms, а на Вашем рачунару траје $2ms. Покушајте затворити неке картице и програме или кликните на „Прикажи претпреглед” или „Прикажи измене”. Ако то не ради, покушајте са другим веб-прегледачем, а ако и тада не ради, покушајте са бржим рачунаром.",<br />
};<br />
var wgUserLanguage = mw.config.get("wgUserLanguage");<br />
<br />
errorMessage = errorMessage[wgUserLanguage] || errorMessage[wgUserLanguage.substring(0, wgUserLanguage.indexOf("-"))] || errorMessage.en;<br />
<br />
wpTextbox1.style.backgroundColor = "";<br />
wpTextbox1.style.marginTop = wpTextbox0.style.marginTop;<br />
wpTextbox0.removeAttribute("dir");<br />
wpTextbox0.removeAttribute("lang");<br />
wpTextbox0.setAttribute("style", "color:red; font-size:small");<br />
<br />
wpTextbox0.textContent = errorMessage.replace("$1", syntaxHighlighterConfig.timeout).replace("$2", endTime - startTime);<br />
return;<br />
}<br />
<br />
//do we have enough span elements to match the generated CSS?<br />
//this step isn't included in the above benchmark because it takes a highly variable amount of time<br />
if (maxSpanNumber < spanNumber)<br />
{<br />
var fragment = document.createDocumentFragment();<br />
do<br />
{<br />
fragment.appendChild(document.createElement("span")).id = "s" + ++maxSpanNumber;<br />
}<br />
while (maxSpanNumber < spanNumber);<br />
wpTextbox0.appendChild(fragment);<br />
}<br />
<br />
/* finish CSS: move the extra '} from the beginning to the end and CSS-<br />
escape newlines. CSS ignores the space after the hex code of the<br />
escaped character */<br />
syntaxStyleTextNode.nodeValue = css.substring(2).replace(/\n/g, "\\A ") + "'}";<br />
}<br />
<br />
function syncScrollX()<br />
{<br />
//console.log("syncScrollX");<br />
wpTextbox0.scrollLeft = wpTextbox1.scrollLeft;<br />
}<br />
<br />
function syncScrollY()<br />
{<br />
//console.log("syncScrollY");<br />
wpTextbox0.scrollTop = wpTextbox1.scrollTop;<br />
}<br />
<br />
function syncTextDirection()<br />
{<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
}<br />
<br />
function syncParent()<br />
{<br />
if (wpTextbox1.previousSibling != wpTextbox0)<br />
{<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
parentObserver.disconnect();<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
}<br />
}<br />
<br />
//this function runs once every 500ms to detect changes to wpTextbox1's text that the input event does not catch<br />
//this happens when another script changes the text without knowing that the syntax highlighter needs to be informed<br />
function highlightSyntaxIfNeeded()<br />
{<br />
if (wpTextbox1.value != lastText)<br />
{<br />
highlightSyntax();<br />
}<br />
if (wpTextbox1.scrollLeft != wpTextbox0.scrollLeft)<br />
{<br />
//console.log("Box1syncScrollX");<br />
syncScrollX();<br />
}<br />
if (wpTextbox1.scrollTop != wpTextbox0.scrollTop)<br />
{<br />
//console.log("Box1syncScrollY");<br />
syncScrollY();<br />
}<br />
if (wpTextbox1.offsetHeight != wpTextbox0.offsetHeight)<br />
{<br />
var height = wpTextbox1.offsetHeight + "px";<br />
wpTextbox0.style.height = height;<br />
wpTextbox1.style.marginTop = "-" + height;<br />
}<br />
}<br />
<br />
function setup()<br />
{<br />
function configureColor(parameterName, hardcodedFallback, defaultOk)<br />
{<br />
if (typeof(syntaxHighlighterConfig[parameterName]) == "undefined")<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterSiteConfig[parameterName];<br />
}<br />
<br />
if (syntaxHighlighterConfig[parameterName] == "normal")<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
else if (typeof(syntaxHighlighterConfig[parameterName]) != "undefined")<br />
{<br />
return;<br />
}<br />
else if (typeof(syntaxHighlighterConfig.defaultColor) != "undefined" && defaultOk)<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterConfig.defaultColor;<br />
}<br />
else<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
}<br />
<br />
window.syntaxHighlighterSiteConfig = window.syntaxHighlighterSiteConfig || {};<br />
window.syntaxHighlighterConfig = window.syntaxHighlighterConfig || {};<br />
<br />
//use 3-digit colors instead of 6-digit colors for performance<br />
// See for example http://maettig.com/?page=PHP/CSS_Color_Converter<br />
configureColor("backgroundColor", "#FFF", false); //white<br />
configureColor("foregroundColor", "#000", false); //black<br />
configureColor("boldOrItalicColor", "#EEE", true); //gray<br />
configureColor("commentColor", "#EFE", true); //green<br />
configureColor("entityColor", "#DFD", true); //green<br />
configureColor("externalLinkColor", "#EFF", true); //cyan<br />
configureColor("headingColor", "#EEE", true); //gray<br />
configureColor("hrColor", "#EEE", true); //gray<br />
configureColor("listOrIndentColor", "#EFE", true); //green<br />
configureColor("parameterColor", "#FC6", true); //orange<br />
configureColor("signatureColor", "#FC6", true); //orange<br />
configureColor("tagColor", "#FEF", true); //pink<br />
configureColor("tableColor", "#FFC", true); //yellow<br />
configureColor("templateColor", "#FFC", true); //gray <br />
configureColor("templTextTermColor", "#888", true); //gray<br />
configureColor("templTypeTextTermColor", "#888", true); //gray<br />
configureColor("templNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templTypeNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templNonRefTermColor", "#FEF", true); //pink<br />
configureColor("templRefNumberColor", "#E9E", true); //pink<br />
configureColor("templNoteColor", "#EFE", true); //green<br />
configureColor("templNoteTermColor", "#484", true); //green<br />
configureColor("templTypeNoteColor", "#7C7", true); //green<br />
configureColor("wikilinkColor", "#EEF", true); //blue<br />
<br />
//tag lists are ordered from most common to least common<br />
syntaxHighlighterConfig.nowikiTags = syntaxHighlighterConfig.nowikiTags || syntaxHighlighterSiteConfig.nowikiTags || ["nowiki", "pre"];<br />
syntaxHighlighterConfig.sourceTags = syntaxHighlighterConfig.sourceTags || syntaxHighlighterSiteConfig.sourceTags || ["math", "syntaxhighlight", "source", "timeline", "hiero"];<br />
syntaxHighlighterConfig.timeout = syntaxHighlighterConfig.timeout || syntaxHighlighterSiteConfig.timeout || 50;<br />
<br />
syntaxHighlighterConfig.nowikiTags.forEach(function(tagName) {<br />
nowikiTagBreakerRegexCache[tagName] = nowikiTagBreakerRegex(tagName);<br />
});<br />
<br />
wpTextbox0 = document.createElement("div");<br />
wpTextbox1 = document.getElementById("wpTextbox1");<br />
<br />
var syntaxStyleElement = document.createElement("style");<br />
syntaxStyleTextNode = syntaxStyleElement.appendChild(document.createTextNode(""));<br />
<br />
//the styling of the textbox and the background div must be kept very similar<br />
var wpTextbox1Style = window.getComputedStyle(wpTextbox1);<br />
<br />
//horizontal resize would look horribly choppy, better to make the user resize the browser window instead<br />
var resize = (wpTextbox1Style.resize == "vertical" || wpTextbox1Style.resize == "both" ? "vertical" : "none");<br />
<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
wpTextbox0.id = "wpTextbox0";<br />
wpTextbox0.lang = wpTextbox1.lang; //lang determines which font "monospace" is<br />
wpTextbox0.style.backgroundColor = syntaxHighlighterConfig.backgroundColor;<br />
wpTextbox0.style.border = "1px solid transparent";<br />
wpTextbox0.style.boxSizing = "border-box";<br />
wpTextbox0.style.clear = wpTextbox1Style.clear;<br />
wpTextbox0.style.color = "transparent"; //makes it look just a little bit smoother<br />
wpTextbox0.style.fontFamily = wpTextbox1Style.fontFamily;<br />
wpTextbox0.style.fontSize = wpTextbox1Style.fontSize;<br />
wpTextbox0.style.lineHeight = "normal";<br />
wpTextbox0.style.marginBottom = "0";<br />
wpTextbox0.style.marginLeft = "0";<br />
wpTextbox0.style.marginRight = "0";<br />
wpTextbox0.style.marginTop = wpTextbox1Style.marginTop;<br />
wpTextbox0.style.overflowX = "auto";<br />
wpTextbox0.style.overflowY = "scroll";<br />
wpTextbox0.style.resize = resize;<br />
wpTextbox0.style.tabSize = wpTextbox1Style.tabSize;<br />
wpTextbox0.style.whiteSpace = "pre-wrap";<br />
wpTextbox0.style.width = "100%";<br />
wpTextbox0.style.wordWrap = "normal"; //see below<br />
<br />
wpTextbox1.style.backgroundColor = "transparent";<br />
wpTextbox1.style.border = "1px inset gray";<br />
wpTextbox1.style.boxSizing = "border-box";<br />
wpTextbox1.style.color = syntaxHighlighterConfig.foregroundColor;<br />
wpTextbox1.style.fontSize = wpTextbox1Style.fontSize; //resolves alignment problems on mobile chrome<br />
wpTextbox1.style.lineHeight = "normal";<br />
wpTextbox1.style.marginBottom = wpTextbox1Style.marginBottom; //lock to pixel value because the top margin was also locked to a pixel value when it was moved to wpTextbox0<br />
wpTextbox1.style.marginLeft = "0";<br />
wpTextbox1.style.marginRight = "0";<br />
wpTextbox1.style.overflowX = "auto";<br />
wpTextbox1.style.overflowY = "scroll";<br />
wpTextbox1.style.padding = "0";<br />
wpTextbox1.style.resize = resize;<br />
wpTextbox1.style.width = "100%";<br />
wpTextbox1.style.wordWrap = "normal"; //overall more visually appealing<br />
<br />
// https://bugzilla.mozilla.org/show_bug.cgi?id=1301290<br />
if (layoutEngine == "gecko")<br />
{<br />
wpTextbox0.style.isolation = "isolate";<br />
wpTextbox1.style.isolation = "isolate";<br />
}<br />
<br />
//lock both heights to pixel values so that the browser zoom feature works better<br />
wpTextbox1.style.height = wpTextbox0.style.height = wpTextbox1.offsetHeight + "px";<br />
<br />
//insert wpTextbox0 underneath wpTextbox1<br />
wpTextbox1.style.marginTop = -wpTextbox1.offsetHeight + "px";<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
<br />
document.head.appendChild(syntaxStyleElement);<br />
<br />
wpTextbox1.addEventListener("input", highlightSyntax);<br />
//console.log("Box1ListenersyncScroll");<br />
wpTextbox1.addEventListener("scroll", syncScrollX);<br />
wpTextbox1.addEventListener("scroll", syncScrollY);<br />
attributeObserver = new MutationObserver(syncTextDirection);<br />
attributeObserver.observe(wpTextbox1, {attributes: true});<br />
parentObserver = new MutationObserver(syncParent);<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntaxIfNeeded, 500);<br />
highlightSyntax();<br />
}<br />
<br />
<br />
//enable the highlighter only when editing wikitext pages<br />
//in the future a separate parser could be added for CSS and JS pages<br />
//blacklist Internet Explorer and Edge, they're just too broken<br />
var wgAction = mw.config.get("wgAction");<br />
var layoutEngine = $.client.profile().layout;<br />
if ((wgAction == "edit" || wgAction == "submit") && mw.config.get("wgPageContentModel") == "wikitext" && layoutEngine != "trident" && layoutEngine != "edge")<br />
{<br />
//give other scripts an opportunity to set syntaxHighlighterConfig<br />
if (document.readyState == "complete")<br />
{<br />
setup();<br />
}<br />
else<br />
{<br />
$(window).load(setup);<br />
}<br />
}<br />
})();</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarNoDialogsTextTerm.js&diff=10312
MediaWiki:RefToolbarNoDialogsTextTerm.js
2017-06-25T19:59:49Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>var numforms = 0;<br />
var wikEdAutoUpdateUrl;<br />
function refbuttons() {<br />
if (mw.toolbar && (document.getElementById('toolbar') || document.getElementById('wikiEditor-section-main'))/* && wikEdAutoUpdateUrl == null*/) {<br />
if (document.getElementById('toolbar')) {<br />
button = document.createElement('a');<br />
button.href = "javascript:easyCiteMain()";<br />
button.title = "Insert citation";<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/0/00/Button_easy_cite_%281%29.png";<br />
buttonimage.alt = "Insert footnote";<br />
button.appendChild(buttonimage);<br />
document.getElementById('toolbar').appendChild(button);<br />
} else {<br />
button = document.createElement('a');<br />
button.href = "#";<br />
button.title = "Insert citation";<br />
button.id = 'reftoolbar-button';<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Curly_Brackets.svg/22px-Curly_Brackets.svg.png";<br />
buttonimage.alt = "Insert citation";<br />
button.classname = "tool tool-button";<br />
buttonimage.style.width = "22px";<br />
buttonimage.style.height = "17px";<br />
buttonimage.style.paddingTop = "5px";<br />
buttonimage.style.paddingLeft = "3px";<br />
button.appendChild(buttonimage);<br />
//document.getElementById('wikiEditor-ui-toolbar').childNodes[0].childNodes[1].appendChild(button);<br />
////document.getElementById('reftoolbar-button').onclick = easyCiteMain;<br />
//$j('#reftoolbar-button').live('click', function() { easyCiteMain(); });<br />
$('#wikiEditor-section-main .group-insert').append( button );<br />
$(button).click( function() { easyCiteMain(); });<br />
<br />
}<br />
if (navigator.userAgent.indexOf('MSIE') == -1) {<br />
//alert("NO MSIE");<br />
citemain = document.createElement('div');<br />
citemain.style.display = 'none';<br />
citemain.setAttribute('Id', 'citeselect');<br />
citemain.appendChild( addOption("citeWeb()", "Cite web") );<br />
citemain.appendChild( addOption("citeBook()", "Cite book") );<br />
citemain.appendChild( addOption("citeJournal()", "Cite journal") );<br />
citemain.appendChild( addOption("citeNews()", "Cite news") );<br />
citemain.appendChild( addOption("citeNamedRef()", "Named ref") );<br />
citemain.appendChild( addOption("dispErrors()", "Error check") );<br />
citemain.appendChild( addOption("hideInitial()", "Cancel") );<br />
citemain.appendChild( addOption("textTerm()", "TextTerm") );<br />
document.getElementById('wpTextbox1').parentNode.insertBefore(citemain, document.getElementById('wpTextbox1'));<br />
}<br />
else {<br />
selection = '<div id="citeselect" style="display:none"><input type="button" value="Cite web" onclick="citeWeb()" />'+<br />
'<input type="button" value="Cite book" onclick="citeBook()" />'+<br />
'<input type="button" value="Cite journal" onclick="citeJournal()" />'+<br />
'<input type="button" value="Cite news" onclick="citeNews()" />'+<br />
'<input type="button" value="Named ref" onclick="citeNamedRef()" />'+<br />
'<input type="button" value="Error check" onclick="dispErrors()" />'+<br />
'<input type="button" value="Cancel" onclick="hideInitial()" />'+<br />
'<input type="button" value="TextTerm" onclick="textTerm()" /></div>';<br />
document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;<br />
}<br />
}<br />
}<br />
<br />
function addOption(script, text) {<br />
option = document.createElement('input');<br />
option.setAttribute('type', 'button');<br />
option.setAttribute('onclick', script);<br />
option.setAttribute("value", text);<br />
return option;<br />
}<br />
<br />
function hideInitial() {<br />
document.getElementById('citeselect').style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function oldFormHide() {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
if (document.getElementById('errorform') != null) {<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
}<br />
} <br />
<br />
function easyCiteMain() {<br />
document.getElementById('citeselect').style.display = '';<br />
}<br />
<br />
var months = ['January', 'February', 'March', 'April', 'May', 'June',<br />
'July', 'August', 'September', 'October', 'November', 'December'];<br />
var citeGlobalDateFormat = "<date> <monthname> <year>";<br />
function getTime() {<br />
var datestr = '';<br />
if (typeof citeUserDateFormat != 'undefined') {<br />
datestr = citeUserDateFormat;<br />
} else {<br />
datestr = citeGlobalDateFormat;<br />
}<br />
var DT = new Date();<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate()<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString()<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[DT.getUTCMonth()]);<br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return (datestr);<br />
}<br />
<br />
function citeWeb() {<br />
citeNewsWeb("cite web");<br />
}<br />
function citeNews() {<br />
citeNewsWeb("cite news");<br />
}<br />
<br />
function textTerm() {<br />
textTermf();<br />
} <br />
<br />
var texttermall = new Array();<br />
var texttermcur = new Array();<br />
var textterminput = new Array();<br />
var poffset=null, prange=null, noffset=null, nrange=null;<br />
var section = '';<br />
var subnote = '';<br />
<br />
function textTermf() {<br />
textTermform(null,null);<br />
}<br />
<br />
function nexttextterm() {<br />
//console.log("nexttexterm before noffset :" + noffset + " nrange=" + nrange);<br />
savetextterms(); // Save if changed<br />
if(noffset){ // If there is a next<br />
textTermform(noffset, nrange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
function previoustextterm() {<br />
//console.log("previoustexterm before poffset :" + poffset + " prange=" + prange);<br />
savetextterms();<br />
if(poffset){ // If there is a next<br />
textTermform(poffset, prange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
<br />
<br />
<br />
function texttermfill(subtext) {<br />
var ref = new Array();<br />
this.term = '';<br />
this.note= '';<br />
this.section= '';<br />
if(section != '')<br />
this.section = section;<br />
this.subnote = '';<br />
if(subnote != '')<br />
this.subnote = subnote;<br />
this.englishentry= '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
<br />
var j=0;<br />
var nr=true;<br />
regexbar= /\|([^|]*)/gm <br />
//regexbar =/\|((.)*?)(?=[\||\n])/gm //"|programmes de population|1|933|IndexEntry=programme de population|OtherIndexEntry=population, programme de"<br />
do {<br />
ref = regexbar.exec(subtext);<br />
//console.log(" subtext=" + subtext);<br />
//console.log(" ref=" + ref);<br />
if(ref != null){<br />
switch (j)<br />
{<br />
case 0 : this.term = ref[1]; break;<br />
case 1 : this.note = ref[1]; break;<br />
case 2 : this.section = ref[1]; break;<br />
default :<br />
if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?IndexEntry *?= *?(.*) *?$/))<br />
this.indexentry = ref[1].replace(/^ *?IndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntry *?= *?(.*) *?$/))<br />
this.otherindexentry = ref[1].replace(/^ *?OtherIndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/))<br />
this.otherindexentrytwo = ref[1].replace(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/))<br />
this.otherindexentrythree = ref[1].replace(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/))<br />
this.otherindexentryfour = ref[1].replace(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/))<br />
this.otherindexentryfive = ref[1].replace(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(j==3){<br />
this.subnote = ref[1];<br />
}else{<br />
alert("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
//console.log("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
}<br />
}<br />
j++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
//console.log("j=" + j + " term=" + this.term + " note=" + this.note + " section=" + this.section +" subnote=" + this.subnote +" indexentry=" + this.indexentry + " otherindexentry=" + this.otherindexentry);<br />
}<br />
<br />
<br />
function textTermform(offset,range){<br />
<br />
// We search for TextTerm in wptexbox1 from cursor position (offset) and if selected (range)<br />
// If called by a previous or next, they are not null {{TextTerm<-......>}}<br />
// if outside of a TextTerm template, we will fill with the term with the selection<br />
// in any case we compute the previous nextstart and previus end and next offset not real.<br />
// if inside a TextTerm we fill the form<br />
// if saveterm is necessary, we save and exit.<br />
// if previous or next, we save if necessary and we call textTermform with a new offset >0 (next) or <0 (previous) and range<br />
// <br />
var textarea= document.getElementById('wpTextbox1');<br />
if ('selectionStart' in textarea) {<br />
if (offset == null){ // range should be null too<br />
offset = textarea.selectionStart;<br />
range = textarea.selectionEnd - textarea.selectionStart;<br />
<br />
var lstxtterm = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("{{TextTerm") ; // Just before the string. No regex<br />
var lstcltxtterm = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("}}") ; //might be for another purpose than TextTerm<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section |" + section);<br />
//textarea.value.substring(0,textarea.selectionStart). search(new RegExp("((({{TextTerm[^}]+)[^{]+)+)");<br />
<br />
if ( (-1 == lstxtterm) || ((-1 < lstxtterm) && (lstxtterm < lstcltxtterm)) ) { // @{{TextTerm ...@}}...(...).. <br />
// {{Refnumber }} ....! <br />
// alert("We are after outside a previous TextTerm or no TextTerm before:" + textarea.value.substring(0,textarea.selectionStart ));<br />
texttermcur = new texttermfill("|" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
//console.log(" We want to fill with the selection=" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// On se retrouve avec du texte à ajouter et le curseur inchangé à textarea.selectionStart <br />
} else if ( (lstxtterm > lstcltxtterm) && (lstcltxtterm > -1) ) { // @}}... @{{TextTerm ... (...).. <br />
//alert("We are within a TextTerm or no closing }}:" + textarea.value.substring(lstcltxtterm, lstxtterm));<br />
<br />
// ( textarea.value.substring(lstxtterm, textarea.selectionStart). search(new RegExp("}}")) == -1) {<br />
var endtxterm= textarea.value.substring(textarea.selectionStart, textarea.length). search("}}");<br />
if( endtxterm == -1)<br />
error(" Error no closing TextTerm; should be fixed:" + textarea.value.substring(textarea.selectionStart, textarea.length));<br />
else{<br />
endtxterm = endtxterm + textarea.selectionStart +2 ; // }} included<br />
// Looking for @{{TextTerm....}}@<br />
// alert("We are within textterm " + lstxtterm + " to " + endtxterm + " soit:" + textarea.value.substring(lstxtterm,endtxterm) );<br />
//console.log(" Replacing with form result:" + textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length) );<br />
// On devrait remplacer {{TextTerm ...}} par la forme, soit de lstxtterm endtxtterm<br />
// On se fout de la sélection originale et la repositionne sur toute l'étendue du textterm.<br />
// alert("After null before textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = lstxtterm;<br />
textarea.selectionEnd = endtxterm;<br />
// alert("After null textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is now:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
} //en endtxtterm<br />
} // end @}}... @{{TextTerm ... (...).. <br />
}else{ // coming from a previous or next<br />
// alert("After Next textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" After next selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert("Coming from a previous or next modifing selectionStart start is an offsetstart =" + offset + " and range=" + range)<br />
// Previous<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<-range-------->! <br />
// #<-offset--------->! <br />
// Next<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--range------->! <br />
// #<-offset--------->! <br />
// alert(" Before textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//alert(" Before is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = (offset > 0 ? textarea.selectionEnd + offset : textarea.selectionStart + offset -range);<br />
textarea.selectionEnd = textarea.selectionStart + range;<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section Other |" + section);<br />
<br />
// alert(" After is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert(" After textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//console.log("textterm cur is:" + textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length) );<br />
}<br />
}else{<br />
alert("No selectionStart Internet Explorer < 9?");<br />
} <br />
// Looking for previous and next<br />
// Previous<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// poffset<br />
// < prange ><<br />
// >< ><<br />
// pstart pend<br />
// !<--------offsetpstart------------>! <br />
// #<-offsetpsend---->! <br />
<br />
var pstart = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("{{TextTerm"); <br />
if ( pstart == -1) { // No previous<br />
// alert( "NO previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
poffset = null;<br />
prange = null;<br />
}else{<br />
// alert( "Previous pstart=" + pstart + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
var pend = textarea.value.substring(pstart,textarea.selectionStart). search("}}") ; // Regex ?<br />
// alert( "Previous pstart=" + pstart + " pend= " + pend + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
if ( pend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
}else{<br />
prange = pend + 2; // }} included<br />
poffset = pstart + prange - textarea.selectionStart; // should be negative<br />
// alert( " prange =" + prange + " poffset=" + poffset);<br />
}<br />
}<br />
// Next<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--------offsetnend-------------->! <br />
// #<-offsetnstart--->! <br />
// noffset<br />
// >< nrange ><br />
// #<-offsetnstart--->! <br />
var nstart = textarea.value.substring(textarea.selectionEnd,textarea.length). search("{{TextTerm") <br />
if ( nstart == -1) { // No next<br />
// alert( "NO next TextTerm : " + textarea.value.substring(textarea.selectionEnd,textarea.length));<br />
noffset = null;<br />
nrange = null;<br />
}else{<br />
var nend = textarea.value.substring(textarea.selectionEnd + nstart,textarea.length). search("}}") ;<br />
if ( nend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(textarea.selectionEnd,textarea.length)) ;<br />
}else{<br />
noffset = nstart ;<br />
nrange = nend +2 ;// }}<br />
}<br />
}<br />
<br />
<br />
// We do have offset or null, as well formfilled with a selection.<br />
<br />
oldFormHide();<br />
template = "TextTerm";<br />
var legend;<br />
if (template == "TextTerm") {<br />
legend = "TextTerm source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td><label for="term">&nbsp;*Term or expression: </label></td>'+<br />
'<td colspan="3"><input type="text" tabindex=1 style="width:100%" id="term" value= "' +<br />
texttermcur.term + '"></tr>'+<br />
'<tr><td width="100"><label for="note">&nbsp;*Note number (1, 2 etc .): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="note" value= "' +<br />
texttermcur.note + '"></td>'+<br />
'<td width="100"><label for="subnote">&nbsp;Subnote (2): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="subnote" value= "' +<br />
texttermcur.subnote + '"></td></tr>'+<br />
'<tr><td width="300"><label for="section">&nbsp;Section (102, 933 etc.): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="section" value= "' +<br />
texttermcur.section + '"></td>'+<br />
'<td width="120"><label for="indexentry">&nbsp;IndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="indexentry" value= "' +<br />
texttermcur.indexentry + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentry">&nbsp;OtherIndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentry" value= "' +<br />
texttermcur.otherindexentry + '"></td>'+<br />
'<td width="120"><label for="otherindexentrytwo">&nbsp;OtherIndexEntryTwo: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrytwo" value= "' +<br />
texttermcur.otherindexentrytwo + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentrythree">&nbsp;OtherIndexEntryThree: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrythree" value= "' +<br />
texttermcur.otherindexentrythree + '"></td>'+<br />
'<td width="120"><label for="otherindexentryfour">&nbsp;OtherIndexEntryFour: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfour" value= "' +<br />
texttermcur.otherindexentryfour + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentryfive">&nbsp;OtherIndexEntryFive: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfive" value= "' +<br />
texttermcur.otherindexentryfive + '"></td>'+<br />
'<td width="120"><label for="englishentry">&nbsp;EnglishEntry (for Chinese and Japanese): </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="englishentry" value= "' +<br />
texttermcur.englishentry + '"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" id="previous" value="(save &) previous TextTerm" onClick="previoustextterm()">'+<br />
'<input type="button" value="(save &) exit" onClick="savetextterms()">'+<br />
'<input type="button" id="next" value="(save &) next TextTerm" onClick="nexttextterm()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
<br />
function citeNewsWeb(templatename) {<br />
oldFormHide();<br />
template = templatename;<br />
var legend;<br />
if (template == "cite web") {<br />
legend = "Cite web source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="work">&nbsp;Work: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="work"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ newtime +'"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeBook() {<br />
oldFormHide();<br />
template = "cite book";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite book source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="others">&nbsp;Others: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="others"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="editor">&nbsp;Editor: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="editor"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td>'+<br />
'<td width="120"><label for="edition">&nbsp;Edition: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="edition"></td></tr>'+<br />
'<tr><td width="120"><label for="series">&nbsp;Series: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="series"></td>'+<br />
'<td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="chapter">&nbsp;Chapter: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="chapter"></td></tr>'+<br />
'<tr><td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td>'+<br />
'<td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeJournal() {<br />
oldFormHide();<br />
template = "cite journal";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite journal source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="journal">&nbsp;Journal: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="journal"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td>'+<br />
'<td width="120"><label for="issue">&nbsp;Issue: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issue"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issn"></td></tr>'+<br />
'<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function saveinput(terminput) {<br />
// terminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
this.term = '';<br />
this.note= '';<br />
this.section = '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
this.englishentry = '';<br />
<br />
for (var i=0; i<terminput.length-1; i++) {<br />
if (terminput[i].id == "template" ){<br />
;<br />
}else if (terminput[i].id == "term" ){<br />
this.term = terminput[i].value;<br />
}else if(terminput[i].id == "note"){<br />
this.note = terminput[i].value;<br />
}else if(terminput[i].id == "section"){<br />
this.section = terminput[i].value;<br />
}else if(terminput[i].id == "subnote"){<br />
this.subnote = terminput[i].value;<br />
}else if(terminput[i].id == "indexentry"){<br />
this.indexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentry"){<br />
this.otherindexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrytwo"){<br />
this.otherindexentrytwo = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrythree"){<br />
this.otherindexentrythree = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfour"){<br />
this.otherindexentryfour = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfive"){<br />
this.otherindexentryfive = terminput[i].value;<br />
}else if(terminput[i].id == "englishentry"){<br />
this.englishentry = terminput[i].value;<br />
}else{<br />
;;//alert(" SaveInput terminput[i].id = " + terminput[i].id + " terminput[i].value =" + terminput[i].value);<br />
}<br />
<br />
}<br />
}<br />
<br />
function savetextterms(template) {<br />
var txtterminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
textterminput = new saveinput(txtterminput);<br />
//alert("texttermcur=" + texttermcur);<br />
//alert("textterminput=" + textterminput);<br />
// Testing<br />
var different = false;<br />
if((textterminput.term != texttermcur.term) || (textterminput.note != texttermcur.note) ||<br />
(textterminput.section != texttermcur.section) ||<br />
(textterminput.subnote != texttermcur.subnote) ||<br />
(textterminput.indexentry != texttermcur.indexentry) ||<br />
(textterminput.otherindexentry != texttermcur.otherindexentry) || <br />
(textterminput.otherindexentrytwo != texttermcur.otherindexentrytwo) ||<br />
(textterminput.otherindexentrythree != texttermcur.otherindexentrythree) ||<br />
(textterminput.otherindexentryfour != texttermcur.otherindexentryfour) ||<br />
(textterminput.otherindexentryfive != texttermcur.otherindexentryfive) ||<br />
(textterminput.englishentry != texttermcur.englishentry) )<br />
different = true;<br />
<br />
if (different){<br />
// alert(" They are different, have to save" );<br />
var texttermchain="{{TextTerm";<br />
texttermchain += '|' + (textterminput.term ? textterminput.term : '');<br />
texttermchain += '|' + (textterminput.note ? textterminput.note : '');<br />
texttermchain += (textterminput.section ? '|' + textterminput.section : '');<br />
texttermchain += (textterminput.subnote ? '|' + textterminput.subnote : '');<br />
texttermchain += (textterminput.indexentry ? '|IndexEntry='+ textterminput.indexentry : '');<br />
texttermchain += (textterminput.otherindexentry ? '|OtherIndexEntry='+ textterminput.otherindexentry : '');<br />
texttermchain += (textterminput.otherindexentrytwo ? '|OtherIndexEntryTwo='+ textterminput.otherindexentrytwo : '');<br />
texttermchain += (textterminput.otherindexentrythree ? '|OtherIndexEntryThree='+ textterminput.otherindexentrythree : '');<br />
texttermchain += (textterminput.otherindexentryfour ? '|OtherIndexEntryFour='+ textterminput.otherindexentryfour : '');<br />
texttermchain += (textterminput.otherindexentryfive ? '|OtherIndexEntryFive='+ textterminput.otherindexentryfive : '');<br />
texttermchain += (textterminput.englishentry ? '|EnglishEntry='+ textterminput.englishentry : '');<br />
texttermchain += "}}";<br />
<br />
var textarea= document.getElementById('wpTextbox1');<br />
var savepos= textarea.selectionStart;<br />
if ('selectionStart' in textarea) {<br />
textarea.value=textarea.value.substring(0,textarea.selectionStart) + texttermchain + textarea.value.substring(textarea.selectionEnd, textarea.length); <br />
//insertTags(texttermchain, '', '');<br />
textarea.selectionStart = savepos;<br />
textarea.selectionEnd = savepos + texttermchain.length;<br />
}<br />
else{<br />
alert("No selectionStart firefox");<br />
}<br />
}<br />
else{<br />
;//alert(" They are similar, don't save" );<br />
}<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
<br />
}<br />
<br />
function addcites(template) {<br />
cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
var citebegin = '<ref';<br />
var citename = '';<br />
var citeinner = '';<br />
for (var i=0; i<cites.length-1; i++) {<br />
if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id != "template") {<br />
citeinner += "|" + cites[i].id + "=" + cites[i].value;<br />
}<br />
else if (cites[i].value != '' && cites[i].id == "refname" && cites[i].id != "template") {<br />
citebegin += ' name="' + cites[i].value + '"';<br />
}<br />
else if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id == "template") {<br />
citename = '>{{' + cites[i].value;<br />
}<br />
}<br />
cite = citebegin + citename + citeinner + "}}</ref>";<br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getNamedRefs(calls) {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
var regex;<br />
if (calls) {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?\/ *?>/gi //'<br />
} else {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?>/gi //'<br />
}<br />
var namedrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[5]) {<br />
namedrefs[i] = ref[5];<br />
} else if (ref[3]) {<br />
namedrefs[i] = ref[3];<br />
} else {<br />
namedrefs[i] = ref[6];<br />
}<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return namedrefs;<br />
}<br />
<br />
function citeNamedRef() {<br />
namedrefs = getNamedRefs(false);<br />
if (namedrefs == '') {<br />
oldFormHide();<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>References in text</legend>There are no named refs (<tt>&lt;ref name="Name"&gt;</tt>) in the text</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
oldFormHide();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>References in article</legend>'+<br />
'<table cellspacing="5">'+<br />
'<tr><td><label for="namedrefs">&nbsp;Named references in text</label></td>'+<br />
'<td><select name="namedrefs" id="namedrefs">';<br />
for (var i=0;i<namedrefs.length;i++) {<br />
form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';<br />
}<br />
form+= '</select>'+<br />
'</td></tr></table>'+<br />
'<input type="button" value="Add citation" onClick="addnamedcite()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function addnamedcite() {<br />
name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;<br />
ref = '<ref name="'+name+'" />';<br />
$("#wpTextbox1").focus();<br />
insertTags(ref, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getAllRefs() {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"<br />
var allrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[0].search(/[^\s]{150}/) != -1) {<br />
ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");<br />
}<br />
ref[0] = ref[0].replace(/</g, "&lt;");<br />
ref[0] = ref[0].replace(/>/g, "&gt;");<br />
allrefs[i] = ref[0];<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return allrefs;<br />
}<br />
<br />
function NRcallError(namedrefs, refname) {<br />
for (var i=0; i<namedrefs.length; i++) {<br />
if (namedrefs[i] == refname) {<br />
return true;<br />
}<br />
}<br />
return false;<br />
}<br />
<br />
function errorCheck() {<br />
var allrefs = getAllRefs();<br />
var allrefscontent = [];<br />
var samecontentexclude = [];<br />
var sx=0;<br />
var templateexclude = [];<br />
var tx=0;<br />
var skipcheck = false;<br />
var namedrefcalls = getNamedRefs(true);<br />
for (var i=0; i<allrefs.length; i++) {<br />
allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8"); //"<br />
}<br />
var namedrefs = getNamedRefs(false);<br />
var errorlist = [];<br />
var q=0;<br />
unclosed = document.getElementById('unclosed').checked;<br />
samecontent = document.getElementById('samecontent').checked;<br />
templates = document.getElementById('templates').checked;<br />
repeated = document.getElementById('repeated').checked;<br />
undef = document.getElementById('undef').checked;<br />
for (var i=0; i<allrefs.length; i++) {<br />
if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Unclosed <tt>&lt;ref&gt;</tt> tag</td></tr>';<br />
q++;<br />
}<br />
if (samecontent) {<br />
for (var d=0; d<samecontentexclude.length; d++) {<br />
if (allrefscontent[i] == samecontentexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var p=0;<br />
while (p<allrefs.length && !skipcheck) {<br />
if (allrefscontent[i] == allrefscontent[p] && i != p) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';<br />
q++;<br />
samecontentexclude[sx] = allrefscontent[i]<br />
sx++;<br />
break;<br />
}<br />
p++;<br />
}<br />
skipcheck=false;<br />
}<br />
if (templates) {<br />
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) {<br />
for (var x=0; x<templateexclude.length; x++) {<br />
if (allrefscontent[i] == templateexclude[x]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Does not use a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a></td></tr>';<br />
q++;<br />
templateexclude[tx] = allrefscontent[i];<br />
tx++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
}<br />
if (repeated) {<br />
var repeatnameexclude = [];<br />
var rx=0;<br />
for (var k=0; k<namedrefs.length; k++) {<br />
for (var d=0; d<repeatnameexclude.length; d++) {<br />
if (namedrefs[k] == repeatnameexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var z=0;<br />
while (z<namedrefs.length && !skipcheck) {<br />
if (namedrefs[k] == namedrefs[z] && k != z) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';<br />
q++;<br />
repeatnameexclude[rx] = namedrefs[z];<br />
rx++;<br />
break;<br />
}<br />
z++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (undef) {<br />
var undefexclude = [];<br />
var ux=0;<br />
for (var p=0; p<namedrefcalls.length; p++) {<br />
for (var d=0; d<undefexclude.length; d++) {<br />
if (allrefscontent[i] == undefexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
if (!NRcallError(namedrefs, namedrefcalls[p])) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">A <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';<br />
q++;<br />
undefexclude[ux] = namedrefs[p];<br />
ux++;<br />
}<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (q > 0) {<br />
return errorlist;<br />
} else {<br />
return 0;<br />
}<br />
}<br />
<br />
function dispErrors() {<br />
oldFormHide();<br />
form = '<div id="errorform"><fieldset>'+<br />
'<legend>Error checking</legend>'+<br />
'<b>Check for:</b><br/>'+<br />
'<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+<br />
'<input type="checkbox" id="samecontent" /> References with the same content<br/>'+<br />
'<input type="checkbox" id="templates" /> References not using a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a><br/>'+<br />
'<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+<br />
'<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+<br />
'<input type="button" id="errorchecksubmit" value="Check for selected errors" onclick="doErrorCheck()"/>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function doErrorCheck() {<br />
var errors = errorCheck();<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
if (errors == 0) {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>Error checking</legend>No errors found.</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Error checking</legend>'+<br />
'<table border="1px">';<br />
for (var i=0; i<errors.length; i++) {<br />
form+=errors[i];<br />
}<br />
form+= '</table>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
$( refbuttons );</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&diff=10314
MediaWiki:Gadget-refToolbar.js
2017-06-25T19:59:49Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>/**<br />
* RefToolbar<br />
*<br />
* Adds tools for citing references to the edit toolbar.<br />
* See [[Wikipedia:RefToolbar]] for further documentation. One of<br />
* three possible versions will load (Reftoolbar 2.0b, Reftoolbar 2.0a,<br />
* or Reftoolbar 1.0) depending on the user preferences (the<br />
* usebetatoolbar and usebetatoolbar-cgd parameters).<br />
*<br />
* @see: [[Wikipedia:RefToolbar]]<br />
* @see: [[MediaWiki:RefToolbar.js]]<br />
* @see: [[MediaWiki:RefToolbarConfig.js]]<br />
* @see: [[MediaWiki:RefToolbarLegacy.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-en.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-de.js]]<br />
* @see: [[MediaWiki:RefToolbarNoDialogs.js]]<br />
* @see: [[MediaWiki:Gadget-refToolbarBase.js]]<br />
* @author: [[User:Mr.Z-man]]<br />
* @author: [[User:Kaldari]]<br />
*/<br />
/*jshint browser: true, camelcase: true, curly: true, eqeqeq: true */<br />
/*global jQuery, mediaWiki, importScript */<br />
( function ( mw, $ ) {<br />
'use strict';<br />
function initializeRefTools() {<br />
if ( window.refToolbarInstalled || $( '#wpTextbox1[readonly]' ).length ){<br />
return;<br />
}<br />
// using weak comparison because ("0") is true, but ("0" == true) is false <br />
if ( mw.user.options.get( 'usebetatoolbar' ) == true ) {<br />
// Enhanced editing toolbar is on. Going to load RefToolbar 2.0a or 2.0b.<br />
if ( mw.user.options.get( 'usebetatoolbar-cgd' ) == true ) {<br />
// Dialogs are on. Loading 2.0b. (standard)<br />
// TODO:<br />
// * Explicitly declare global variables from [[MediaWiki:RefToolbar.js]] using window.*<br />
// * Move [[MediaWiki:RefToolbar.js]] to [[MediaWiki:Gadget-refToolbarDialogs.js]]<br />
// * Create the module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase' and 'ext.wikiEditor.toolbar'<br />
// * Replace the code below by mw.loader.load( 'ext.gadget.refToolbarDialogs' );<br />
mw.loader.using( [ 'ext.gadget.refToolbarBase', 'ext.wikiEditor.toolbar' ], function () {<br />
importScript( 'MediaWiki:RefToolbar.js' );<br />
} );<br />
} else {<br />
// Dialogs are off. Loading 2.0a.<br />
mw.loader.using( 'ext.wikiEditor.toolbar', function () {<br />
importScript( 'MediaWiki:RefToolbarNoDialogsTextTerm.js' );<br />
} );<br />
}<br />
} else if ( mw.user.options.get( 'showtoolbar' ) ) {<br />
// Enhanced editing toolbar is off. Loading RefToolbar 1.0. (legacy)<br />
importScript( 'MediaWiki:RefToolbarLegacy.js' );<br />
} else {<br />
return;<br />
}<br />
window.refToolbarInstalled = true;<br />
}<br />
<br />
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {<br />
// Double check if user.options is loaded, to prevent errors when copy pasted accross installations<br />
$.when( mw.loader.using( ['user.options'] ), $.ready ).done( initializeRefTools );<br />
}<br />
<br />
}( mediaWiki, jQuery ) );</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar&diff=10316
MediaWiki:Gadget-refToolbar
2017-06-25T19:59:49Z
<p>Nicolas Brouard: una versione importata</p>
<hr />
<div>[[:en:Wikipedia:RefToolbar|refTools]], adds a "cite" button to the editing toolbar for quick and easy addition of commonly used citation templates. It also adds a TextTerm icon</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=10319
MediaWiki:Gadgets-definition
2017-06-25T16:00:27Z
<p>Nicolas Brouard: </p>
<hr />
<div>#Editing<br />
* wikEd[ResourceLoader]|wikEd.js<br />
* refToolbar[ResourceLoader|default|dependencies=user.options,mediawiki.legacy.wikibits]|refToolbar.js<br />
* refToolbarBase[ResourceLoader|hidden]|refToolbarBase.js<br />
* DotsSyntaxHighlighter[ResourceLoader|default|dependencies=jquery.client]|DotsSyntaxHighlighter.js<br />
<br />
#Interface<br />
* exlinks[ResourceLoader]|exlinks.js<br />
* purgeTab[ResourceLoader]|purgeTab.js<br />
* citations[ResourceLoader]|citations.js</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=10321
MediaWiki:Common.js
2017-06-25T15:00:10Z
<p>Nicolas Brouard: Back to minimum</p>
<hr />
<div>/**<br />
* Keep code in MediaWiki:Common.js to a minimum as it is unconditionally<br />
* loaded for all users on every wiki page. If possible create a gadget that is<br />
* enabled by default instead of adding it here (since gadgets are fully<br />
* optimized ResourceLoader modules with possibility to add dependencies etc.)<br />
*<br />
* Since Common.js isn't a gadget, there is no place to declare its<br />
* dependencies, so we have to lazy load them with mw.loader.using on demand and<br />
* then execute the rest in the callback. In most cases these dependencies will<br />
* be loaded (or loading) already and the callback will not be delayed. In case a<br />
* dependency hasn't arrived yet it'll make sure those are loaded before this.<br />
*/</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&diff=10309
MediaWiki:Gadget-DotsSyntaxHighlighter.js
2017-06-20T10:18:31Z
<p>Nicolas Brouard: modified</p>
<hr />
<div>//Syntax highlighter with various advantages See [[User:Remember the<br />
//dot/Syntax highlighter]] for more information<br />
/*<br />
MediaWiki:Gadget-DotsSyntaxHighlighter<br />
[https://www.mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter Adapted from Syntax highlighter]: Make syntax stand out colourfully in the edit box and especially with Demopaedia TextTerm etc.<br />
<br />
MediaWiki:Gadget-DotsSyntaxHighlighter.js<br />
<br />
*/<br />
//in the edit box and especially with Demopaedia TextTerm etc.<br />
/* This file may be used under the terms of any of the following<br />
licenses, as well as any later version of the same licenses:<br />
<br />
GNU General Public License 2.0<br />
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html><br />
<br />
Creative Commons Attribution-ShareAlike 3.0 Unported License<br />
<https://creativecommons.org/licenses/by-sa/3.0/><br />
<br />
GNU Free Documentation License 1.2<br />
<https://www.gnu.org/licenses/old-licenses/fdl-1.2.html><br />
Modified by Nicolas Brouard for Demopaedia.org 12 June 2017<br />
*/<br />
<br />
(function () {<br />
"use strict";<br />
<br />
//variables that are preserved between function calls<br />
var wpTextbox0;<br />
var wpTextbox1;<br />
var syntaxStyleTextNode;<br />
var lastText;<br />
var maxSpanNumber = -1; //the number of the last span available, used to tell if creating additional spans is necessary<br />
var highlightSyntaxIfNeededIntervalID;<br />
var attributeObserver;<br />
var parentObserver;<br />
<br />
/* Define context-specific regexes, one for every common token that ends the<br />
current context.<br />
<br />
An attempt has been made to search for the most common syntaxes first,<br />
thus maximizing performance. Syntaxes that begin with the same character<br />
are searched for at the same time.<br />
<br />
Supported wiki syntaxes from most common to least common:<br />
[[internal link]] [http:// named external link]<br />
{{template}} {{{template parameter}}} {| table |}<br />
<tag> <!-- comment --><br />
http:// bare external link<br />
=Heading= * unordered list # ordered list : indent ; small heading ---- horizontal line<br />
''italic'' '''bold'''<br />
three tildes username four tildes signature five tildes timestamp<br />
&entity;<br />
<br />
The tag-matching regex follows the XML standard closely so that users<br />
won't feel like they have to escape sequences that MediaWiki will never<br />
consider to be tags.<br />
<br />
Only entities for characters which need to be escaped or cannot be<br />
unambiguously represented in a monospace font are highlighted, such as<br />
Greek letters that strongly resemble Latin letters. Use of other entities<br />
is discouraged as a matter of style. For the same reasons, numeric<br />
entities should be in hexadecimal (giving character codes in decimal only<br />
adds confusion).<br />
<br />
Newlines are sucked up into ending tokens (including comments, bare<br />
external links, lists, horizontal lines, signatures, entities, etc.) to<br />
avoid creating spans with nothing but newlines in them.<br />
<br />
Flags: g for global search, m for make ^ match the beginning of each line<br />
and $ the end of each line<br />
*/<br />
var wgUrlProtocols = mw.config.get("wgUrlProtocols");<br />
var entityRegexBase = "&(?:(?:n(?:bsp|dash)|m(?:dash|inus)|lt|e[mn]sp|thinsp|amp|quot|gt|shy|zwn?j|lrm|rlm|Alpha|Beta|Epsilon|Zeta|Eta|Iota|Kappa|[Mm]u|micro|Nu|[Oo]micron|[Rr]ho|Tau|Upsilon|Chi)|#x[0-9a-fA-F]+);\n*";<br />
var breakerRegexBase = "\\[(?:\\[|(?:" + wgUrlProtocols + "))|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-\\.\u00B7\u0300-\u036F\u203F-\u203F-\u2040]*(?=/?>| |\n)|!--[^]*?-->\n*)|(?:" + wgUrlProtocols.replace("|\\/\\/", "") + ")[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|" + entityRegexBase;<br />
function breakerRegexWithPrefix(prefix)<br />
{<br />
//the stop token has to be at the beginning of the regex so that it takes precedence over substrings of itself.<br />
return new RegExp("(" + prefix + ")\n*|" + breakerRegexBase, "gm");<br />
}<br />
function nowikiTagBreakerRegex(tagName)<br />
{<br />
return new RegExp("(</" + tagName + ">)\n*|" + entityRegexBase, "gm");<br />
}<br />
var defaultBreakerRegex = new RegExp(breakerRegexBase, "gm");<br />
var wikilinkBreakerRegex = breakerRegexWithPrefix("]][a-zA-Z]*");<br />
var namedExternalLinkBreakerRegex = breakerRegexWithPrefix("]");<br />
var parameterBreakerRegex = breakerRegexWithPrefix("}}}");<br />
var templateBreakerRegex = breakerRegexWithPrefix("}}");<br />
var templateArgBreakerRegex = breakerRegexWithPrefix("[\\|}]");<br />
var tableBreakerRegex = breakerRegexWithPrefix("\\|}");<br />
var headingBreakerRegex = breakerRegexWithPrefix("\n");<br />
var tagBreakerRegexCache = {};<br />
var nowikiTagBreakerRegexCache = {};<br />
<br />
function highlightSyntax()<br />
{<br />
lastText = wpTextbox1.value;<br />
/* Backslashes and apostrophes are CSS-escaped at the beginning and all<br />
parsing regexes and functions are designed to match. On the other hand,<br />
newlines are not escaped until written so that in the regexes ^ and $<br />
work for both newlines and the beginning or end of the string. */<br />
var text = lastText.replace(/['\\]/g, "\\$&") + "\n"; //add a newline to fix scrolling and parsing issues<br />
var i = 0; //the location of the parser as it goes through var text<br />
<br />
var css = "";<br />
var spanNumber = 0;<br />
var lastColor;<br />
var before = true;<br />
<br />
//writes text into to-be-created span elements of wpTextbox0 using :before and :after pseudo-elements<br />
//both :before and :after are used because using two pseudo-elements per span is significantly faster than doubling the number of spans required<br />
function writeText(text, color)<br />
{<br />
//no need to use another span if using the same color<br />
if (color != lastColor)<br />
{<br />
//whitespace is omitted in the hope of increasing performance<br />
css += "'}#s" + spanNumber; //spans will be created with IDs s0 through sN<br />
if (before)<br />
{<br />
css += ":before{";<br />
before = false;<br />
}<br />
else<br />
{<br />
css += ":after{";<br />
before = true;<br />
++spanNumber;<br />
}<br />
if (color)<br />
{<br />
//"background-color" is 6 characters longer than "background" but the browser processes it faster<br />
css += "background-color:" + color + ";";<br />
}<br />
css += "content:'";<br />
lastColor = color;<br />
}<br />
css += text;<br />
}<br />
<br />
/* About assumedBold and assumedItalic:<br />
<br />
Highlighting bold or italic markup presents a special challenge<br />
because the actual MediaWiki parser uses multiple passes to determine<br />
which ticks represent start tags and which represent end tags.<br />
Because that would be too slow for us here, we instead keep track of<br />
what kinds of unclosed opening ticks have been encountered and use<br />
that to make a good guess as to whether the next ticks encountered<br />
are an opening tag or a closing tag.<br />
<br />
The major downsides to this method are that '''apostrophe italic''<br />
and ''italic apostrophe''' are not highlighted correctly, and bold<br />
and italic are both highlighted in the same color.<br />
<br />
To permit ''The best<ref>''Reference Title''</ref> book ever'',<br />
assumedBold and assumedItalic are saved on the stack and reset to<br />
undefined (essentially, false) when recursing into a new block. */<br />
<br />
function highlightBlock(color, breakerRegex, assumedBold, assumedItalic)<br />
{<br />
var match;<br />
<br />
for (breakerRegex.lastIndex = i; match = breakerRegex.exec(text); breakerRegex.lastIndex = i)<br />
{<br />
// console.log(" breakerRegex.lastIndex="+breakerRegex.lastIndex);<br />
// console.log(" breakerRegex.source="+breakerRegex.source);<br />
//console.log(" match.input="+match.input);<br />
// if (match[1])<br />
// //console.log(" match1=" + match[1]+ " match0=" +match[0]);<br />
// else<br />
// //console.log(" unmatch1=" + match[1]+ " match0=" +match[0]);<br />
if (match[1])<br />
{<br />
//end token found, we are within a coloured zone <br />
writeText(text.substring(i, breakerRegex.lastIndex), color);<br />
//console.log(" breaker Regex i="+ i + " breakerRegex.lastIndex=" +breakerRegex.lastIndex + " t="+text.substring(i, breakerRegex.lastIndex) + " return highlight" );<br />
i = breakerRegex.lastIndex; /* end of zone */<br />
<br />
return; /* returns after the break ie for with a defautregex in order to search again */<br />
}<br />
<br />
var endIndexOfLastColor = breakerRegex.lastIndex - match[0].length; /* Not including the match? */<br />
if (i < endIndexOfLastColor) //avoid calling writeText with text == "" to improve performance<br />
{<br />
writeText(text.substring(i, endIndexOfLastColor), color); /* Includes i (from 0), excludes endIndexOfLastColor */<br />
//console.log(" substring i="+ i + " endIndexOfLastColor=" + endIndexOfLastColor );<br />
<br />
}<br />
<br />
i = breakerRegex.lastIndex; /* Out of coloured zone */ /* Dot is first position after the search "{{." */<br />
<br />
switch (match[0].charAt(0)) //cases in this switch should be arranged from most common to least common<br />
{<br />
case "[":<br />
if (match[0].charAt(1) == "[")<br />
{<br />
//wikilink<br />
writeText("[[", syntaxHighlighterConfig.wikilinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.wikilinkColor || color, wikilinkBreakerRegex);<br />
}<br />
else<br />
{<br />
//named external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.externalLinkColor || color, namedExternalLinkBreakerRegex);<br />
}<br />
break;<br />
case "{":<br />
if (match[0].charAt(1) == "{")<br />
{<br />
if (match[0].length == 3)<br />
{<br />
//parameter<br />
writeText("{{{", syntaxHighlighterConfig.parameterColor || color);<br />
highlightBlock(syntaxHighlighterConfig.parameterColor || color, parameterBreakerRegex);<br />
}<br />
else<br />
{<br />
//template<br />
//some other kind of template, search for its end<br />
//writeText("{{", syntaxHighlighterConfig.templateColor || color);<br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templEnd = text.indexOf("}", i) + 1; /* Just before first } +1*/<br />
var templTextTermEnd = text.indexOf("|", i); /* char from 0 to index "{{Note|" is position 6 (7th char); just after first | if any*/<br />
var iv=text.indexOf("|", i);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
var ib=text.indexOf("}", i);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
var nbarg=0;<br />
var templTextTermEnd ;<br />
var templTextTermEndClose;<br />
if( (ib < iv) || (iv == -1) ){<br />
nbarg=0;<br />
templTextTermEndClose=templTextTermEnd = ib ;/* Just at } if any */ /* no argument */<br />
}else{<br />
nbarg=1;<br />
templTextTermEnd = iv ; /* Just at second | if any */<br />
}<br />
//{{Current status}}<br />
if(nbarg==1){<br />
iv=text.indexOf("|", templTextTermEnd+1);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
ib=text.indexOf("}", templTextTermEnd+1);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
if( (ib < iv) || (iv == -1) ){<br />
templTextTermEndClose= ib ;/* Just at } if any */<br />
}else{<br />
nbarg=2;<br />
templTextTermEndClose = iv ; /* Just at second | if any {{Note|1| */<br />
}<br />
}<br />
//console.log("templ1 TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// Be careful with scrolling and asynchronous generated by console.log see<br />
// https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Scroll-linked_effects<br />
//console.log("templ End :" + templEnd + " noarg=", noarg); // Ok before }}<br />
// console.log("templ TextTermEnd :" + templTextTermEnd); // Ok before |<br />
//console.log("templ TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// La {{TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ...}} s’occupe<br />
//de la {{NonRefTerm|structure}} <br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templText = text.substring(i+2 - match[0].length, templEnd-1);<br />
//TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ..<br />
//NonRefTerm|structure<br />
var templTextType = text.substring(i+2 - match[0].length, templTextTermEnd); /* Excluding char at TermEnd | or } */<br />
//TextTerm<br />
//NonRefTerm<br />
//var templTextTermall = text.substring(templTextTermEnd, templEnd); /* Just after termination | or }*/<br />
//démographie historique|1|102|OtherIndexEntry=historique. démographie ...<br />
//NonRefTerm|structure<br />
var templTextTerm;<br />
if(nbarg >0)<br />
templTextTerm = text.substring(templTextTermEnd+1,templTextTermEndClose); //excluding terminaison | or }<br />
else<br />
templTextTerm="";<br />
//templTextTermall.substring(0, templTextTermall.indexOf("|"));<br />
//démographie historique<br />
//structure<br />
var TypeTemplateColor=syntaxHighlighterConfig.templateColor;<br />
var TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text1TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text2TemplateColor=syntaxHighlighterConfig.templateColor;<br />
if((templTextType=="TextTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor=TemplateColor ;<br />
}else if ( (templTextType=="Note") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTypeNoteColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
}else if ( (templTextType=="NoteTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
}else if (templTextType=="NewTextTerm" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeNewTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ( templTextType=="RefNumber" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
TemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ((templTextType=="NonRefTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
}<br />
//writeText("{{", TemplateColor || color);<br />
writeText("{{", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
writeText(templTextType, TypeTemplateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd;<br />
if(nbarg>=1){<br />
writeText( "|", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
//writeText(templTextType+"|", syntaxHighlighterConfig.templateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd+1;<br />
//writeText(templTextTerm, syntaxHighlighterConfig.tagColor || color); //struture<br />
writeText(templTextTerm, Text1TemplateColor || color); //struture<br />
i=templTextTermEndClose; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
if(nbarg==2){<br />
writeText("|",Text2TemplateColor || color);<br />
i=templTextTermEndClose+1; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
//console.log(" i="+ i );<br />
//highlightBlock(syntaxHighlighterConfig.templateColor || color, templateBreakerRegex);<br />
highlightBlock(TemplateColor || color, templateBreakerRegex);<br />
}<br />
}<br />
else //|<br />
{<br />
//table<br />
writeText("{|", syntaxHighlighterConfig.tableColor || color);<br />
highlightBlock(syntaxHighlighterConfig.tableColor || color, tableBreakerRegex);<br />
}<br />
break;<br />
case "<":<br />
if (match[0].charAt(1) == "!")<br />
{<br />
//comment tag<br />
writeText(match[0], syntaxHighlighterConfig.commentColor || color);<br />
break;<br />
}<br />
else<br />
{<br />
//some other kind of tag, search for its end<br />
//the search is made easier because XML attributes may not contain the character ">"<br />
var tagEnd = text.indexOf(">", i) + 1;<br />
if (tagEnd == 0)<br />
{<br />
//not a tag, just a "<" with some text after it<br />
writeText("<", color);<br />
i = i - match[0].length + 1;<br />
break;<br />
}<br />
<br />
if (text.charAt(tagEnd - 2) == "/")<br />
{<br />
//empty tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
}<br />
else<br />
{<br />
var tagName = match[0].substring(1);<br />
<br />
if (syntaxHighlighterConfig.sourceTags.indexOf(tagName) != -1)<br />
{<br />
//tag that contains text in a different programming language<br />
var stopAfter = "</" + tagName + ">";<br />
var endIndex = text.indexOf(stopAfter, i);<br />
if (endIndex == -1)<br />
{<br />
endIndex = text.length;<br />
}<br />
else<br />
{<br />
endIndex += stopAfter.length;<br />
}<br />
writeText(text.substring(i - match[0].length, endIndex), syntaxHighlighterConfig.tagColor || color);<br />
i = endIndex;<br />
}<br />
else if (syntaxHighlighterConfig.nowikiTags.indexOf(tagName) != -1)<br />
{<br />
//tag that can contain only HTML entities<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, nowikiTagBreakerRegexCache[tagName]);<br />
}<br />
else<br />
{<br />
//ordinary tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
if (!tagBreakerRegexCache[tagName])<br />
{<br />
tagBreakerRegexCache[tagName] = breakerRegexWithPrefix("</" + tagName + ">");<br />
}<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, tagBreakerRegexCache[tagName]);<br />
}<br />
}<br />
}<br />
break;<br />
case "=":<br />
if (/[^=]=+$/.test(text.substring(i, text.indexOf("\n", i)))) //the line begins and ends with an equals sign and has something else in the middle<br />
{<br />
//heading<br />
writeText("=", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
}<br />
else<br />
{<br />
writeText("=", color); //move on, process this line as regular wikitext<br />
}<br />
break;<br />
case "*":<br />
case "#":<br />
case ":":<br />
//unordered list, ordered list, indent, small heading<br />
//just highlight the marker<br />
writeText(match[0], syntaxHighlighterConfig.listOrIndentColor || color);<br />
break;<br />
case ";":<br />
//small heading<br />
writeText(";", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
break;<br />
case "-":<br />
//horizontal line<br />
writeText(match[0], syntaxHighlighterConfig.hrColor || color);<br />
break;<br />
case "\\":<br />
writeText(match[0], syntaxHighlighterConfig.boldOrItalicColor || color);<br />
if (match[0].length == 6)<br />
{<br />
//bold<br />
if (assumedBold)<br />
{<br />
//end tag<br />
if (assumedItalic)<br />
{<br />
//end of bold part of bold-italic block<br />
//block is now italic-only<br />
assumedBold = false;<br />
}<br />
else<br />
{<br />
//end of bold block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedItalic)<br />
{<br />
//start of bold part of previously italic-only block<br />
//block is now bold-italic<br />
assumedBold = true;<br />
}<br />
else<br />
{<br />
//start of bold block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, true, false);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
//italic<br />
if (assumedItalic)<br />
{<br />
//end tag<br />
if (assumedBold)<br />
{<br />
//end of italic part of bold-italic block<br />
//block is now bold-only<br />
assumedItalic = false;<br />
}<br />
else<br />
{<br />
//end of italic block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedBold)<br />
{<br />
//start of italic part of previously bold-only block<br />
//block is now bold-italic<br />
assumedItalic = true;<br />
}<br />
else<br />
{<br />
//start of italic block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, false, true);<br />
}<br />
}<br />
}<br />
break;<br />
case "&":<br />
//entity<br />
writeText(match[0], syntaxHighlighterConfig.entityColor || color);<br />
break;<br />
case "~":<br />
//username, signature, timestamp<br />
writeText(match[0], syntaxHighlighterConfig.signatureColor || color);<br />
break;<br />
default:<br />
//bare external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
}<br />
}<br />
}<br />
<br />
<br />
//start!<br />
var startTime = Date.now();<br />
highlightBlock("", defaultBreakerRegex);<br />
<br />
//output the leftovers (if any) to make sure whitespace etc. matches<br />
if (i < text.length)<br />
{<br />
writeText(text.substring(i), "");<br />
}<br />
<br />
//if highlighting took too long, disable it.<br />
var endTime = Date.now();<br />
/*if (typeof(bestTime) == "undefined")<br />
{<br />
window.bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntax, 250);<br />
}<br />
else<br />
{<br />
if (endTime - startTime < bestTime)<br />
{<br />
bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
}<br />
}//*/<br />
if (endTime - startTime > syntaxHighlighterConfig.timeout)<br />
{<br />
clearInterval(highlightSyntaxIfNeededIntervalID);<br />
wpTextbox1.removeEventListener("input", highlightSyntax);<br />
wpTextbox1.removeEventListener("scroll", syncScrollX);<br />
wpTextbox1.removeEventListener("scroll", syncScrollY);<br />
attributeObserver.disconnect();<br />
parentObserver.disconnect();<br />
syntaxStyleTextNode.nodeValue = "";<br />
<br />
var errorMessage = {<br />
ca: "S'ha desactivat el remarcar de sintaxi en aquesta pàgina perquè ha trigat massa temps. El temps màxim permès per a remarcar és $1ms, i el vostre ordinador ha trigat $2ms. Proveu tancar algunes pestanyes i programes i fer clic en \"Mostra la previsualització\" o \"Mostra els canvis\". Si no funciona això, proveu un altre navegador web, i si això no funciona, proveu un ordinador més ràpid.",<br />
de: "Die Syntaxhervorhebung wurde auf dieser Seite deaktiviert, da diese zu lange gedauert hat. Die maximal erlaubte Zeit zur Hervorhebung beträgt $1ms und dein Computer benötigte $2ms. Versuche einige Tabs und Programme zu schließen und klicke \"Vorschau zeigen\" oder \"Änderungen zeigen\". Wenn das nicht funktioniert, probiere einen anderen Webbrowser und wenn immer noch nicht, probiere einen schnelleren Computer.",<br />
el: "Η έμφαση σύνταξης έχει απενεργοποιηθεί σε αυτήν τη σελίδα γιατί αργούσε πολύ. Ο μέγιστος επιτρεπτός χρόνος για την έμφαση σύνταξης είναι $1ms και ο υπολογιστής σας έκανε $2ms. Δοκιμάστε να κλείσετε μερικές καρτέλες και προγράμματα και να κάνετε κλικ στην «Εμφάνιση προεπισκόπησης» ή στην «Εμφάνιση αλλαγών». Αν αυτό δεν δουλέψει, δοκιμάστε έναν διαφορετικό περιηγητή και αν ούτε αυτό δουλέψει, δοκιμάστε έναν ταχύτερο υπολογιστή.",<br />
en: "Syntax highlighting on this page was disabled because it took too long. The maximum allowed highlighting time is $1ms, and your computer took $2ms. Try closing some tabs and programs and clicking \"Show preview\" or \"Show changes\". If that doesn't work, try a different web browser, and if that doesn't work, try a faster computer.",<br />
es: "Se desactivó el resaltar de sintaxis en esta página porque tardó demasiado. El tiempo máximo permitido para resaltar es $1ms, y tu ordenador tardó $2ms. Prueba cerrar algunas pestañas y programas y hacer clic en \"Mostrar previsualización\" o \"Mostrar cambios\". Si no funciona esto, prueba otro navegador web, y si eso no funciona, prueba un ordenador más rápido.",<br />
fa: "از آنجایی که زمان زیادی صرف آن میشد، برجستهسازی نحو در این صفحه غیرفعال شده است. بیشینهٔ زمان برجستهسازی برای ابزار $1ms تعریف شده در حالی که رایانهٔ شما $2ms زمان نیاز داشت. میتوانید بستن برخی سربرگها و برنامهها و سپس کلیککردن دکمهٔ «پیشنمایش» یا «نمایش تغییرات» را بیازمایید. اگر جواب نداد مرورگر دیگری را امتحان کنید؛ و اگر باز هم جواب نداد، رایانهٔ سریعتری را بیازمایید.",<br />
fr: "La coloration syntaxique a été désactivée sur cette page en raison d'un temps de chargement trop important ($2ms). Le temps maximum autorisé est $1ms. Vous pouvez essayer de fermer certains onglets et programmes et cliquez sur \"Prévisualisation\" ou \"Voir mes modifications\". Si cela ne fonctionne pas, essayez un autre navigateur web, et si cela ne fonctionne toujours pas, essayez un ordinateur plus rapide.",<br />
hy: "Շարադասության ընդգծումը այս էջում անջատվել է, քանի որ այն չափից շատ է տևել։ Ընդգծման թույլատրելի առավելագույն ժամանակը $1 միլիվայրկյան է, բայց այս էջում տևել է $2 միլիվայրկյան։ Փորձեք անջատել որոշ ներդիրներ կամ ծրագրեր և սեղմել «Նախադիտել» կամ «Կատարված փոփոխությունները»։ Կրկին չաշխատելու դեպքում փորձեք այլ վեբ դիտարկիչ, եթե կրկին չաշխատի, փորձեք ավելի արագ համակարգիչ։",<br />
io: "Sintaxo-hailaitar en ca pagino esis nekapabligata pro ke konsumis tro multa tempo. La maxima permisata hailaitala tempo es $1ms, e tua ordinatro konsumis $2ms. Probez klozar kelka tabi e programi e kliktar \"Previdar\" o \"Montrez chanji\". Se to ne funcionas, probez altra brauzero, e se to ne funcionas, probez plu rapida ordinatro.",<br />
it: "L'evidenziazione delle sintassi su questa pagina è stata disabilitata perché ha richiesto troppo tempo. Il tempo massimo per l'evidenziazione è di $1ms e al tuo computer sono serviti $2ms. Prova a chiudere alcune schede e programmi e ricarica la pagina cliccando su \"Visualizza anteprima\" o \"Mostra modifiche\". Se non funziona ancora, prova con un web browser differente e, in ultima alternativa, prova ad utilizzare un computer più veloce.",<br />
ko: "이 문서에서의 문법 강조가 너무 오래 걸러서 해제되었습니다. 최대로 할당된 강조 시간은 $1ms인데, 당신의 컴퓨터는 $2ms이나 걸렸습니다. 탭과 프로그램을 일부 닫으신 후에 \"미리 보기\"나 \"차이 보기\"를 클릭하시기 바랍니다. 만약 작동하지 않으면 다른 웹 브라우저로 시도해보시고, 그래도 안되면 더 빠른 컴퓨터를 이용하십시오",<br />
pt: "O marcador de sintaxe foi desativado nesta página porque demorou demais. O tempo máximo permitido para marcar é de $1ms, e seu computador demorou $2ms. Tente fechar algumas abas e programas e clique em \"Mostrar previsão\" ou \"Mostrar alterações\". Se isso não funcionar, tente usar um outro navegador web, e se ainda não funcionar, tente em um computador mais rápido.",<br />
ru: "Подсветка синтаксиса на странице была отключена, так как заняла слишком долго. Максимальное допустимое время операции - $1мс, сейчас на вашем компьютере она заняла $2мс. Попробуйте закрыть несколько вкладок и программ, затем нажать «Предварительный просмотр» или «Внесённые изменения». Если это не поможет, попробуйте другой браузер; если и это не поможет, используйте более быстрый компьютер.",<br />
sr: "Истицање синтаксе на овој страници је онемогућено јер се одвија предуго. Максимално дозвољено време истицања је $1ms, а на Вашем рачунару траје $2ms. Покушајте затворити неке картице и програме или кликните на „Прикажи претпреглед” или „Прикажи измене”. Ако то не ради, покушајте са другим веб-прегледачем, а ако и тада не ради, покушајте са бржим рачунаром.",<br />
};<br />
var wgUserLanguage = mw.config.get("wgUserLanguage");<br />
<br />
errorMessage = errorMessage[wgUserLanguage] || errorMessage[wgUserLanguage.substring(0, wgUserLanguage.indexOf("-"))] || errorMessage.en;<br />
<br />
wpTextbox1.style.backgroundColor = "";<br />
wpTextbox1.style.marginTop = wpTextbox0.style.marginTop;<br />
wpTextbox0.removeAttribute("dir");<br />
wpTextbox0.removeAttribute("lang");<br />
wpTextbox0.setAttribute("style", "color:red; font-size:small");<br />
<br />
wpTextbox0.textContent = errorMessage.replace("$1", syntaxHighlighterConfig.timeout).replace("$2", endTime - startTime);<br />
return;<br />
}<br />
<br />
//do we have enough span elements to match the generated CSS?<br />
//this step isn't included in the above benchmark because it takes a highly variable amount of time<br />
if (maxSpanNumber < spanNumber)<br />
{<br />
var fragment = document.createDocumentFragment();<br />
do<br />
{<br />
fragment.appendChild(document.createElement("span")).id = "s" + ++maxSpanNumber;<br />
}<br />
while (maxSpanNumber < spanNumber);<br />
wpTextbox0.appendChild(fragment);<br />
}<br />
<br />
/* finish CSS: move the extra '} from the beginning to the end and CSS-<br />
escape newlines. CSS ignores the space after the hex code of the<br />
escaped character */<br />
syntaxStyleTextNode.nodeValue = css.substring(2).replace(/\n/g, "\\A ") + "'}";<br />
}<br />
<br />
function syncScrollX()<br />
{<br />
//console.log("syncScrollX");<br />
wpTextbox0.scrollLeft = wpTextbox1.scrollLeft;<br />
}<br />
<br />
function syncScrollY()<br />
{<br />
//console.log("syncScrollY");<br />
wpTextbox0.scrollTop = wpTextbox1.scrollTop;<br />
}<br />
<br />
function syncTextDirection()<br />
{<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
}<br />
<br />
function syncParent()<br />
{<br />
if (wpTextbox1.previousSibling != wpTextbox0)<br />
{<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
parentObserver.disconnect();<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
}<br />
}<br />
<br />
//this function runs once every 500ms to detect changes to wpTextbox1's text that the input event does not catch<br />
//this happens when another script changes the text without knowing that the syntax highlighter needs to be informed<br />
function highlightSyntaxIfNeeded()<br />
{<br />
if (wpTextbox1.value != lastText)<br />
{<br />
highlightSyntax();<br />
}<br />
if (wpTextbox1.scrollLeft != wpTextbox0.scrollLeft)<br />
{<br />
//console.log("Box1syncScrollX");<br />
syncScrollX();<br />
}<br />
if (wpTextbox1.scrollTop != wpTextbox0.scrollTop)<br />
{<br />
//console.log("Box1syncScrollY");<br />
syncScrollY();<br />
}<br />
if (wpTextbox1.offsetHeight != wpTextbox0.offsetHeight)<br />
{<br />
var height = wpTextbox1.offsetHeight + "px";<br />
wpTextbox0.style.height = height;<br />
wpTextbox1.style.marginTop = "-" + height;<br />
}<br />
}<br />
<br />
function setup()<br />
{<br />
function configureColor(parameterName, hardcodedFallback, defaultOk)<br />
{<br />
if (typeof(syntaxHighlighterConfig[parameterName]) == "undefined")<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterSiteConfig[parameterName];<br />
}<br />
<br />
if (syntaxHighlighterConfig[parameterName] == "normal")<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
else if (typeof(syntaxHighlighterConfig[parameterName]) != "undefined")<br />
{<br />
return;<br />
}<br />
else if (typeof(syntaxHighlighterConfig.defaultColor) != "undefined" && defaultOk)<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterConfig.defaultColor;<br />
}<br />
else<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
}<br />
<br />
window.syntaxHighlighterSiteConfig = window.syntaxHighlighterSiteConfig || {};<br />
window.syntaxHighlighterConfig = window.syntaxHighlighterConfig || {};<br />
<br />
//use 3-digit colors instead of 6-digit colors for performance<br />
// See for example http://maettig.com/?page=PHP/CSS_Color_Converter<br />
configureColor("backgroundColor", "#FFF", false); //white<br />
configureColor("foregroundColor", "#000", false); //black<br />
configureColor("boldOrItalicColor", "#EEE", true); //gray<br />
configureColor("commentColor", "#EFE", true); //green<br />
configureColor("entityColor", "#DFD", true); //green<br />
configureColor("externalLinkColor", "#EFF", true); //cyan<br />
configureColor("headingColor", "#EEE", true); //gray<br />
configureColor("hrColor", "#EEE", true); //gray<br />
configureColor("listOrIndentColor", "#EFE", true); //green<br />
configureColor("parameterColor", "#FC6", true); //orange<br />
configureColor("signatureColor", "#FC6", true); //orange<br />
configureColor("tagColor", "#FEF", true); //pink<br />
configureColor("tableColor", "#FFC", true); //yellow<br />
configureColor("templateColor", "#FFC", true); //gray <br />
configureColor("templTextTermColor", "#888", true); //gray<br />
configureColor("templTypeTextTermColor", "#888", true); //gray<br />
configureColor("templNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templTypeNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templNonRefTermColor", "#FEF", true); //pink<br />
configureColor("templRefNumberColor", "#E9E", true); //pink<br />
configureColor("templNoteColor", "#EFE", true); //green<br />
configureColor("templNoteTermColor", "#484", true); //green<br />
configureColor("templTypeNoteColor", "#7C7", true); //green<br />
configureColor("wikilinkColor", "#EEF", true); //blue<br />
<br />
//tag lists are ordered from most common to least common<br />
syntaxHighlighterConfig.nowikiTags = syntaxHighlighterConfig.nowikiTags || syntaxHighlighterSiteConfig.nowikiTags || ["nowiki", "pre"];<br />
syntaxHighlighterConfig.sourceTags = syntaxHighlighterConfig.sourceTags || syntaxHighlighterSiteConfig.sourceTags || ["math", "syntaxhighlight", "source", "timeline", "hiero"];<br />
syntaxHighlighterConfig.timeout = syntaxHighlighterConfig.timeout || syntaxHighlighterSiteConfig.timeout || 50;<br />
<br />
syntaxHighlighterConfig.nowikiTags.forEach(function(tagName) {<br />
nowikiTagBreakerRegexCache[tagName] = nowikiTagBreakerRegex(tagName);<br />
});<br />
<br />
wpTextbox0 = document.createElement("div");<br />
wpTextbox1 = document.getElementById("wpTextbox1");<br />
<br />
var syntaxStyleElement = document.createElement("style");<br />
syntaxStyleTextNode = syntaxStyleElement.appendChild(document.createTextNode(""));<br />
<br />
//the styling of the textbox and the background div must be kept very similar<br />
var wpTextbox1Style = window.getComputedStyle(wpTextbox1);<br />
<br />
//horizontal resize would look horribly choppy, better to make the user resize the browser window instead<br />
var resize = (wpTextbox1Style.resize == "vertical" || wpTextbox1Style.resize == "both" ? "vertical" : "none");<br />
<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
wpTextbox0.id = "wpTextbox0";<br />
wpTextbox0.lang = wpTextbox1.lang; //lang determines which font "monospace" is<br />
wpTextbox0.style.backgroundColor = syntaxHighlighterConfig.backgroundColor;<br />
wpTextbox0.style.border = "1px solid transparent";<br />
wpTextbox0.style.boxSizing = "border-box";<br />
wpTextbox0.style.clear = wpTextbox1Style.clear;<br />
wpTextbox0.style.color = "transparent"; //makes it look just a little bit smoother<br />
wpTextbox0.style.fontFamily = wpTextbox1Style.fontFamily;<br />
wpTextbox0.style.fontSize = wpTextbox1Style.fontSize;<br />
wpTextbox0.style.lineHeight = "normal";<br />
wpTextbox0.style.marginBottom = "0";<br />
wpTextbox0.style.marginLeft = "0";<br />
wpTextbox0.style.marginRight = "0";<br />
wpTextbox0.style.marginTop = wpTextbox1Style.marginTop;<br />
wpTextbox0.style.overflowX = "auto";<br />
wpTextbox0.style.overflowY = "scroll";<br />
wpTextbox0.style.resize = resize;<br />
wpTextbox0.style.tabSize = wpTextbox1Style.tabSize;<br />
wpTextbox0.style.whiteSpace = "pre-wrap";<br />
wpTextbox0.style.width = "100%";<br />
wpTextbox0.style.wordWrap = "normal"; //see below<br />
<br />
wpTextbox1.style.backgroundColor = "transparent";<br />
wpTextbox1.style.border = "1px inset gray";<br />
wpTextbox1.style.boxSizing = "border-box";<br />
wpTextbox1.style.color = syntaxHighlighterConfig.foregroundColor;<br />
wpTextbox1.style.fontSize = wpTextbox1Style.fontSize; //resolves alignment problems on mobile chrome<br />
wpTextbox1.style.lineHeight = "normal";<br />
wpTextbox1.style.marginBottom = wpTextbox1Style.marginBottom; //lock to pixel value because the top margin was also locked to a pixel value when it was moved to wpTextbox0<br />
wpTextbox1.style.marginLeft = "0";<br />
wpTextbox1.style.marginRight = "0";<br />
wpTextbox1.style.overflowX = "auto";<br />
wpTextbox1.style.overflowY = "scroll";<br />
wpTextbox1.style.padding = "0";<br />
wpTextbox1.style.resize = resize;<br />
wpTextbox1.style.width = "100%";<br />
wpTextbox1.style.wordWrap = "normal"; //overall more visually appealing<br />
<br />
// https://bugzilla.mozilla.org/show_bug.cgi?id=1301290<br />
if (layoutEngine == "gecko")<br />
{<br />
wpTextbox0.style.isolation = "isolate";<br />
wpTextbox1.style.isolation = "isolate";<br />
}<br />
<br />
//lock both heights to pixel values so that the browser zoom feature works better<br />
wpTextbox1.style.height = wpTextbox0.style.height = wpTextbox1.offsetHeight + "px";<br />
<br />
//insert wpTextbox0 underneath wpTextbox1<br />
wpTextbox1.style.marginTop = -wpTextbox1.offsetHeight + "px";<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
<br />
document.head.appendChild(syntaxStyleElement);<br />
<br />
wpTextbox1.addEventListener("input", highlightSyntax);<br />
//console.log("Box1ListenersyncScroll");<br />
wpTextbox1.addEventListener("scroll", syncScrollX);<br />
wpTextbox1.addEventListener("scroll", syncScrollY);<br />
attributeObserver = new MutationObserver(syncTextDirection);<br />
attributeObserver.observe(wpTextbox1, {attributes: true});<br />
parentObserver = new MutationObserver(syncParent);<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntaxIfNeeded, 500);<br />
highlightSyntax();<br />
}<br />
<br />
<br />
//enable the highlighter only when editing wikitext pages<br />
//in the future a separate parser could be added for CSS and JS pages<br />
//blacklist Internet Explorer and Edge, they're just too broken<br />
var wgAction = mw.config.get("wgAction");<br />
var layoutEngine = $.client.profile().layout;<br />
if ((wgAction == "edit" || wgAction == "submit") && mw.config.get("wgPageContentModel") == "wikitext" && layoutEngine != "trident" && layoutEngine != "edge")<br />
{<br />
//give other scripts an opportunity to set syntaxHighlighterConfig<br />
if (document.readyState == "complete")<br />
{<br />
setup();<br />
}<br />
else<br />
{<br />
$(window).load(setup);<br />
}<br />
}<br />
})();</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&diff=10313
MediaWiki:Gadget-refToolbar.js
2017-06-09T09:42:02Z
<p>Nicolas Brouard: Adding TextTerm</p>
<hr />
<div>/**<br />
* RefToolbar<br />
*<br />
* Adds tools for citing references to the edit toolbar.<br />
* See [[Wikipedia:RefToolbar]] for further documentation. One of<br />
* three possible versions will load (Reftoolbar 2.0b, Reftoolbar 2.0a,<br />
* or Reftoolbar 1.0) depending on the user preferences (the<br />
* usebetatoolbar and usebetatoolbar-cgd parameters).<br />
*<br />
* @see: [[Wikipedia:RefToolbar]]<br />
* @see: [[MediaWiki:RefToolbar.js]]<br />
* @see: [[MediaWiki:RefToolbarConfig.js]]<br />
* @see: [[MediaWiki:RefToolbarLegacy.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-en.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-de.js]]<br />
* @see: [[MediaWiki:RefToolbarNoDialogs.js]]<br />
* @see: [[MediaWiki:Gadget-refToolbarBase.js]]<br />
* @author: [[User:Mr.Z-man]]<br />
* @author: [[User:Kaldari]]<br />
*/<br />
/*jshint browser: true, camelcase: true, curly: true, eqeqeq: true */<br />
/*global jQuery, mediaWiki, importScript */<br />
( function ( mw, $ ) {<br />
'use strict';<br />
function initializeRefTools() {<br />
if ( window.refToolbarInstalled || $( '#wpTextbox1[readonly]' ).length ){<br />
return;<br />
}<br />
// using weak comparison because ("0") is true, but ("0" == true) is false <br />
if ( mw.user.options.get( 'usebetatoolbar' ) == true ) {<br />
// Enhanced editing toolbar is on. Going to load RefToolbar 2.0a or 2.0b.<br />
if ( mw.user.options.get( 'usebetatoolbar-cgd' ) == true ) {<br />
// Dialogs are on. Loading 2.0b. (standard)<br />
// TODO:<br />
// * Explicitly declare global variables from [[MediaWiki:RefToolbar.js]] using window.*<br />
// * Move [[MediaWiki:RefToolbar.js]] to [[MediaWiki:Gadget-refToolbarDialogs.js]]<br />
// * Create the module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase' and 'ext.wikiEditor.toolbar'<br />
// * Replace the code below by mw.loader.load( 'ext.gadget.refToolbarDialogs' );<br />
mw.loader.using( [ 'ext.gadget.refToolbarBase', 'ext.wikiEditor.toolbar' ], function () {<br />
importScript( 'MediaWiki:RefToolbar.js' );<br />
} );<br />
} else {<br />
// Dialogs are off. Loading 2.0a.<br />
mw.loader.using( 'ext.wikiEditor.toolbar', function () {<br />
importScript( 'MediaWiki:RefToolbarNoDialogsTextTerm.js' );<br />
} );<br />
}<br />
} else if ( mw.user.options.get( 'showtoolbar' ) ) {<br />
// Enhanced editing toolbar is off. Loading RefToolbar 1.0. (legacy)<br />
importScript( 'MediaWiki:RefToolbarLegacy.js' );<br />
} else {<br />
return;<br />
}<br />
window.refToolbarInstalled = true;<br />
}<br />
<br />
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {<br />
// Double check if user.options is loaded, to prevent errors when copy pasted accross installations<br />
$.when( mw.loader.using( ['user.options'] ), $.ready ).done( initializeRefTools );<br />
}<br />
<br />
}( mediaWiki, jQuery ) );</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&diff=10331
MediaWiki:RefToolbarTextTerm.js
2017-06-09T09:41:07Z
<p>Nicolas Brouard: Identical to new RefToolbar.js</p>
<hr />
<div>/*jshint smarttabs:true, loopfunc:true,forin:false*/<br />
/*global mw, $, importScript */<br />
// TODO: make autodate an option in the CiteTemplate object, not a preference<br />
<br />
// Global object<br />
// TODO:<br />
// * Remove this once the page is moved to a module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase'<br />
if (typeof CiteTB === 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
// Only execute on edit, unless it is a user JS/CSS page<br />
// TODO: Remove tests already done by [[MediaWiki:Gadget-refToolbar.js]]<br />
if (<br />
( mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit' ) &&<br />
( ( mw.config.get('wgNamespaceNumber') !== 2 && mw.config.get('wgNamespaceNumber') !== 4 ) ||<br />
( mw.config.get('wgPageName').indexOf('.js') === -1 && mw.config.get('wgPageName').indexOf('.css') === -1 ) )<br />
) {<br />
<br />
// TODO: Move this to [[MediaWiki:Gadget-refToolbarDialogs.css]] and add it to the definition of module 'ext.gadget.refToolbarDialogs'<br />
mw.util.addCSS(".cite-form-td {"+<br />
"height: 0 !important;"+<br />
"padding: 0.1em !important;"+<br />
"}"); <br />
<br />
// Default options, these mainly exist so the script won't break if a new option is added<br />
CiteTB.DefaultOptions = {<br />
"date format" : "<year>-<zmonth>-<zdate>",<br />
"autodate fields" : [],<br />
"months" : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],<br />
"modal" : true,<br />
"autoparse" : false,<br />
"expandtemplates": false<br />
};<br />
<br />
// Get an option - user settings override global which override defaults<br />
CiteTB.getOption = function(opt) {<br />
if (CiteTB.UserOptions[opt] !== undefined) {<br />
return CiteTB.UserOptions[opt];<br />
} else if (CiteTB.Options[opt] !== undefined) {<br />
return CiteTB.Options[opt];<br />
}<br />
return CiteTB.DefaultOptions[opt];<br />
};<br />
<br />
CiteTB.init = function() {<br />
/* Main stuff, build the actual toolbar structure<br />
* 1. get the template list, make the dropdown list and set up the template dialog boxes<br />
* 2. actually build the toolbar:<br />
* * A section for cites<br />
* ** dropdown for the templates (previously defined)<br />
* ** button for named refs with a dialog box<br />
* ** button for errorcheck<br />
* 3. add the whole thing to the main toolbar<br />
*/<br />
<br />
if (typeof $('div[rel=cites]')[0] !== 'undefined') { // Mystery IE bug workaround<br />
return;<br />
}<br />
$('head').trigger('reftoolbarbase');<br />
var $target = $('#wpTextbox1');<br />
var temlist = {};<br />
for (var t in CiteTB.Templates) {<br />
var tem = CiteTB.Templates[t];<br />
var sform = CiteTB.escStr(tem.shortform);<br />
var actionobj = { <br />
type: 'dialog',<br />
module: 'cite-dialog-'+sform<br />
};<br />
var dialogobj = {};<br />
dialogobj['cite-dialog-'+sform] = {<br />
resizeme: false,<br />
titleMsg: 'cite-dialog-'+sform, <br />
id: 'citetoolbar-'+sform,<br />
init: function() {}, <br />
html: tem.getInitial(), <br />
dialog: {<br />
width:675,<br />
open: function() { <br />
$(this).html(CiteTB.getOpenTemplate().getForm());<br />
/** @param {jQuery.Event} e */<br />
$('.cite-prev-parse').bind( 'click', function ( e ) {<br />
e.preventDefault();<br />
CiteTB.prevParseClick();<br />
});<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var ref = CiteTB.getRef(false, true);<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: ref<br />
}<br />
}, $(this) );<br />
},<br />
'cite-form-showhide': CiteTB.showHideExtra,<br />
'cite-refpreview': function() { <br />
var ref = CiteTB.getRef(false, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-preview-label').show();<br />
div.find('.cite-ref-preview').text(ref).show();<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.prevParseClick();<br />
} else {<br />
div.find('.cite-prev-parse').show();<br />
div.find('.cite-prev-parsed-label').hide();<br />
div.find('.cite-preview-parsed').html('');<br />
} <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
},<br />
'cite-form-reset': function() {<br />
CiteTB.resetForm();<br />
}<br />
}<br />
} <br />
};<br />
$target.wikiEditor('addDialog', dialogobj);<br />
//if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-'+sform).dialog('option', 'modal', false);<br />
//}<br />
temlist[sform] = {label: tem.templatename, action: actionobj }; <br />
}<br />
<br />
var refsection = {<br />
'sections': {<br />
'cites': { <br />
type: 'toolbar', <br />
labelMsg: 'cite-section-label',<br />
groups: { <br />
'template': {<br />
tools: {<br />
'template': {<br />
type: 'select',<br />
labelMsg: 'cite-template-list',<br />
list: temlist<br />
} <br />
}<br />
},<br />
'namedrefs': {<br />
labelMsg: 'cite-named-refs-label',<br />
tools: {<br />
'nrefs': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-namedrefs'<br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/be/Nuvola_clipboard_lined.svg/22px-Nuvola_clipboard_lined.svg.png',<br />
section: 'cites',<br />
group: 'namedrefs',<br />
labelMsg: 'cite-named-refs-button'<br />
}<br />
}<br />
},<br />
'errorcheck': {<br />
labelMsg: 'cite-errorcheck-label',<br />
tools: {<br />
'echeck': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-errorcheck' <br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Nuvola_apps_korganizer-NO.png/22px-Nuvola_apps_korganizer-NO.png',<br />
section: 'cites',<br />
group: 'errorcheck',<br />
labelMsg: 'cite-errorcheck-button'<br />
}<br />
}<br />
}<br />
} <br />
} <br />
} <br />
};<br />
<br />
var defaultdialogs = { <br />
'cite-toolbar-errorcheck': {<br />
titleMsg: 'cite-errorcheck-label',<br />
id: 'citetoolbar-errorcheck',<br />
resizeme: false,<br />
init: function() {},<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
dialog: {<br />
width:550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-errorcheck-submit': function() {<br />
var errorchecks = $("input[name='cite-err-test']:checked");<br />
var errors = [];<br />
for (var i=0; i<errorchecks.length; i++) {<br />
errors = errors.concat(CiteTB.ErrorChecks[$(errorchecks[i]).val()].run());<br />
}<br />
CiteTB.displayErrors(errors);<br />
$(this).dialog( 'close' ); <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
}<br />
}<br />
}<br />
},<br />
'cite-toolbar-namedrefs': {<br />
titleMsg: 'cite-named-refs-title',<br />
resizeme: false,<br />
id: 'citetoolbar-namedrefs',<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
init: function() {},<br />
dialog: {<br />
width: 550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var refname = $("#cite-namedref-select").val();<br />
if (refname === '') {<br />
return;<br />
}<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: CiteTB.getNamedRef(refname, true)<br />
}<br />
}, $(this) );<br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
} <br />
}<br />
} <br />
}<br />
};<br />
<br />
$target.wikiEditor('addDialog', defaultdialogs);<br />
$('#citetoolbar-namedrefs').unbind('dialogopen');<br />
if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-namedrefs').dialog('option', 'modal', false);<br />
//$('#citetoolbar-errorcheck').dialog('option', 'modal', false);<br />
mw.util.addCSS(".ui-widget-overlay {"+<br />
"display:none !important;"+<br />
"}"); <br />
}<br />
$target.wikiEditor('addToToolbar', refsection);<br />
};<br />
<br />
// Load local data - messages, cite templates, etc.<br />
$(document).ready( function() {<br />
switch( mw.config.get('wgUserLanguage') ) {<br />
case 'de': // German<br />
importScript('MediaWiki:RefToolbarMessages-de.js');<br />
break;<br />
default: // English<br />
importScript('MediaWiki:RefToolbarMessages-en.js');<br />
}<br />
});<br />
<br />
// Setup the main object<br />
CiteTB.mainRefList = [];<br />
CiteTB.refsLoaded = false;<br />
<br />
// REF FUNCTIONS<br />
// Actually assemble a ref from user input<br />
CiteTB.getRef = function(inneronly, forinsert) {<br />
var i;<br />
var template = CiteTB.getOpenTemplate();<br />
var templatename = template.templatename;<br />
var res = '';<br />
var refobj = {'shorttag':false};<br />
if (!inneronly) {<br />
var group = $('#cite-'+CiteTB.escStr(template.shortform)+'-group').val();<br />
var refname = $('#cite-'+CiteTB.escStr(template.shortform)+'-name').val();<br />
res += '<ref';<br />
if (refname) {<br />
refname = $.trim(refname);<br />
res+=' name='+CiteTB.getQuotedString(refname);<br />
refobj.refname = refname;<br />
}<br />
if (group) {<br />
group = $.trim(group);<br />
res+=' group='+CiteTB.getQuotedString(group);<br />
refobj.refgroup = group;<br />
}<br />
res+='>';<br />
}<br />
var content ='{{'+templatename;<br />
for( g in template.incrementables ) {<br />
group = template.incrementables[g];<br />
for (i=1; i<=group.val; i++) {<br />
for (j=0; j<group.fields.length; j++) {<br />
var fieldname = group.fields[j].field;<br />
var fieldid = fieldname.replace('<N>', i.toString());<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldid).val();<br />
if (field) {<br />
content+='|'+fieldid+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
}<br />
for( i=0; i<template.basic.length; i++ ) {<br />
if (template.basic[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.basic[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
if ($('#cite-form-status').val() !== 'closed') {<br />
for( i=0; i<template.extra.length; i++ ) {<br />
if (template.extra[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.extra[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
content+= '}}';<br />
res+=content;<br />
refobj.content = content;<br />
if (!inneronly) {<br />
res+= '</ref>';<br />
}<br />
if (forinsert) {<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
return res;<br />
};<br />
<br />
// Make a reference to a named ref<br />
CiteTB.getNamedRef = function(refname, forinsert) {<br />
if (forinsert) {<br />
CiteTB.mainRefList.push( {'shorttag':true, 'refname':refname} );<br />
}<br />
return '<ref name='+CiteTB.getQuotedString(refname)+' />'; <br />
};<br />
<br />
// Function to load the ref list<br />
CiteTB.loadRefs = function() {<br />
if (CiteTB.refsLoaded) {<br />
return;<br />
}<br />
CiteTB.getPageText(CiteTB.loadRefsInternal);<br />
};<br />
<br />
// Function that actually loads the list from the page text<br />
CiteTB.loadRefsInternal = function(text) { <br />
// What this does: extract first name/group extract second name/group shorttag inner content<br />
var refsregex = /< *ref(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?:\/ *>|>((?:.|\n)*?)< *\/ *ref *>)/gim;<br />
// This should work regardless of the quoting used for names/groups and for linebreaks in the inner content <br />
while (true) {<br />
var ref = refsregex.exec(text);<br />
if (ref === null) {<br />
break;<br />
}<br />
var refobj = {};<br />
if (ref[9]) { // Content + short tag check<br />
//alert('"'+ref[9]+'"');<br />
refobj.content = ref[9]; <br />
refobj.shorttag = false;<br />
} else {<br />
refobj.shorttag = true;<br />
}<br />
if (ref[1] !== '') { // First name/group<br />
if (ref[2]) {<br />
refobj['ref'+ref[1]] = ref[2];<br />
} else if (ref[3]) {<br />
refobj['ref'+ref[1]] = ref[3];<br />
} else {<br />
refobj['ref'+ref[1]] = ref[4];<br />
}<br />
}<br />
if (ref[5] !== '') { // Second name/group<br />
if (ref[6]) {<br />
refobj['ref'+ref[5]] = ref[6];<br />
} else if (ref[7]) {<br />
refobj['ref'+ref[5]] = ref[7];<br />
} else {<br />
refobj['ref'+ref[5]] = ref[8];<br />
}<br />
}<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
CiteTB.refsLoaded = true;<br />
CiteTB.setupErrorCheck();<br />
CiteTB.setupNamedRefs();<br />
};<br />
<br />
// AJAX FUNCTIONS<br />
// Parse some wikitext and hand it off to a callback function<br />
CiteTB.parse = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'parse', title:mw.config.get('wgPageName'), text:text, prop:'text', format:'json'},<br />
function(data) {<br />
var html = data.parse.text['*'];<br />
callback(html);<br />
},<br />
'json'<br />
); <br />
};<br />
<br />
// Use the API to expand templates on some text<br />
CiteTB.expandtemplates = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'expandtemplates', title:mw.config.get('wgPageName'), text:text, format:'json'},<br />
function(data) {<br />
var restext = data.expandtemplates['*'];<br />
callback(restext);<br />
},<br />
'json'<br />
);<br />
};<br />
<br />
// Function to get the page text<br />
CiteTB.getPageText = function(callback) {<br />
var section = $("input[name='wpSection']").val();<br />
if ( section !== '' ) {<br />
var postdata = {action:'query', prop:'revisions', rvprop:'content', pageids:mw.config.get('wgArticleId'), format:'json'};<br />
if (CiteTB.getOption('expandtemplates')) {<br />
postdata.rvexpandtemplates = '1';<br />
}<br />
$.get( mw.util.wikiScript( 'api' ),<br />
postdata,<br />
function(data) {<br />
var pagetext = data.query.pages[mw.config.get('wgArticleId').toString()].revisions[0]['*'];<br />
callback(pagetext);<br />
},<br />
'json'<br />
);<br />
} else {<br />
if (CiteTB.getOption('expandtemplates')) {<br />
CiteTB.expandtemplates($('#wpTextbox1').wikiEditor('getContents').text(), callback);<br />
} else {<br />
callback($('#wpTextbox1').wikiEditor('getContents').text());<br />
}<br />
}<br />
};<br />
<br />
// Autofill a template from an ID (ISBN, DOI, PMID, URL)<br />
CiteTB.initAutofill = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-auto\-(.*?)\-(.*)\-(.*)$/.exec(elemid);<br />
var tem = res[1];<br />
var field = res[2];<br />
var autotype = res[3];<br />
var id = $('#cite-'+tem+'-'+field).val();<br />
if (!id) {<br />
return false;<br />
}<br />
var url = '//tools.wmflabs.org/reftoolbar/lookup.php?';<br />
url+=autotype+'='+encodeURIComponent(id);<br />
url+='&template='+encodeURIComponent(tem);<br />
var s = document.createElement('script');<br />
s.setAttribute('src', url);<br />
s.setAttribute('type', 'text/javascript');<br />
document.getElementsByTagName('head')[0].appendChild(s);<br />
return false;<br />
};<br />
<br />
// Callback for autofill<br />
//TODO: Autofill the URL, at least for DOI<br />
CiteTB.autoFill = function(data, template, type) {<br />
var cl = 'cite-'+template+'-';<br />
var i,j, coauthors;<br />
$('.'+cl+'title').val(data.title);<br />
// Fill in authors<br />
if (data.authors && data.authors.length > 0) {<br />
if ($('.'+cl+'last-incr-1').length != 0) {<br />
var classes = $('.'+cl+'last-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'last-incr-1').val(data.authors[0][0])<br />
$('.'+cl+'first-incr-1').val(data.authors[0][1])<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'last-incr-'+i.toString()).val(data.authors[i-1][0])<br />
$('.'+cl+'first-incr-'+i.toString()).val(data.authors[i-1][1])<br />
}<br />
} else if ($('.'+cl+'author-incr-1').length != 0) {<br />
var classes = $('.'+cl+'author-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'author-incr-1').val(data.authors[0].join(', '))<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'author-incr-'+i.toString()).val(data.authors[i-1].join(', '))<br />
}<br />
} else if ($('.'+cl+'last1').length != 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'last'+(i+1)).length) {<br />
$('.'+cl+'last'+(i+1)).val(data.authors[i][0]);<br />
$('.'+cl+'first'+(i+1)).val(data.authors[i][1]);<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else if($('.'+cl+'author1').length !== 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'author'+(i+1)).length) {<br />
$('.'+cl+'author'+(i+1)).val(data.authors[i].join(', '));<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else {<br />
var authors = [];<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
authors.push(data.authors[i].join(', '));<br />
}<br />
$('.'+cl+'authors').val(authors.join('; '));<br />
}<br />
}<br />
<br />
if (type === 'pmid' || type === 'doi') {<br />
if (data.date && (data.fulldate || !$('.'+cl+'month').length)) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date);<br />
var usemonth = /\d{4}-\d{2}/.test(data.date);<br />
$('.'+cl+'date').val(CiteTB.formatDate(DT, useday, usemonth));<br />
} else if (!data.fulldate && $('.'+cl+'month').length && $('.'+cl+'year').length) {<br />
if (data.month) { // lookup.php sets month to false if it isn't provided<br />
$('.'+cl+'month').val( CiteTB.getOption('months')[parseInt(data.month)-1] );<br />
}<br />
$('.'+cl+'year').val(data.year);<br />
} else {<br />
$('.'+cl+'date').val(data.date);<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
} else if (type === 'isbn') {<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'location').val(data.location);<br />
$('.'+cl+'year').val(data.year);<br />
$('.'+cl+'edition').val(data.edition);<br />
} else if (type === 'url') {<br />
if (data.date) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date) && template !== 'book';<br />
var usemonth = /\d{4}-\d{2}/.test(data.date) && template !== 'book';<br />
var yearOrDate = (template === 'book') ? 'year' : 'date';<br />
$('.'+cl+yearOrDate).val(CiteTB.formatDate(DT, useday, usemonth));<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'edition').val(data.edition);<br />
$('.'+cl+'isbn').val(data.isbn);<br />
$('.'+cl+'issn').val(data.issn);<br />
$('.'+cl+'doi').val(data.doi);<br />
// "en-US" isn't a valid value for the language parameter<br />
if (data.language && data.language !== 'en-US' && data.language !== 'en-GB') {<br />
$('.'+cl+'language').val(data.language);<br />
}<br />
$('.'+cl+'chapter').val(data.chapter);<br />
}<br />
};<br />
<br />
// FORM DIALOG FUNCTIONS<br />
// Add new incrementable fields<br />
CiteTB.incrementFields = function() {<br />
template = CiteTB.getOpenTemplate();<br />
var currentrow = $(this).parents('tr')[0];<br />
$(this).prev().css('width', '100%')<br />
$(this).detach();<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-incr\-(.*?)\-(.*)$/.exec(elemid);<br />
group = res[2];<br />
increments = template.incrementables[group];<br />
fields = increments.fields;<br />
incrval = increments.val+1;<br />
template.incrementables[group].val += 1;<br />
trs = template.makeFormInner(fields, false);<br />
trs.reverse();<br />
for (var i=0; i<trs.length; i++) {<br />
$(currentrow).after(trs[i]);<br />
}<br />
};<br />
<br />
// fill the accessdate param with the current date<br />
CiteTB.fillAccessdate = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-date\-(.*?)\-(.*)$/.exec(elemid);<br />
var id = res[1];<br />
var field = res[2];<br />
var DT = new Date();<br />
var datestr = CiteTB.formatDate(DT);<br />
$('#cite-'+id+'-'+field).val(datestr);<br />
return false;<br />
};<br />
<br />
CiteTB.formatDate = function(DT, useday, usemonth) {<br />
if (typeof useday == "undefined") {<br />
useday = true; <br />
}<br />
if (typeof usemonth == "undefined") {<br />
usemonth = true; <br />
}<br />
var datestr = CiteTB.getOption('date format');<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate();<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString();<br />
if (useday) {<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
} else {<br />
datestr = datestr.replace('<date>', '');<br />
datestr = datestr.replace('<zdate>', '');<br />
}<br />
if (usemonth) {<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', CiteTB.getOption('months')[DT.getUTCMonth()]);<br />
} else {<br />
datestr = datestr.replace('<month>', '');<br />
datestr = datestr.replace('<zmonth>', '');<br />
datestr = datestr.replace('<monthname>', '');<br />
} <br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return datestr.replace(/^[ \/\-\,\.]*(.*?)[ \/\-\,\.]*$/g, "$1"); // Cleanup any dangling spaces or connectors that might result from omitting date/month<br />
};<br />
<br />
// Function called after the ref list is loaded, to actually set the contents of the named ref dialog<br />
// Until the list is loaded, its just a "Loading" placeholder<br />
CiteTB.setupNamedRefs = function() {<br />
var names = [], i;<br />
for( i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname) {<br />
names.push(CiteTB.mainRefList[i]);<br />
}<br />
}<br />
var stuff = $('<div>');<br />
$('#citetoolbar-namedrefs').html( stuff );<br />
if (names.length === 0) {<br />
stuff.html(mw.usability.getMsg('cite-no-namedrefs'));<br />
} else {<br />
stuff.html(mw.usability.getMsg('cite-namedrefs-intro'));<br />
var select = $('<select id="cite-namedref-select">');<br />
select.append($('<option value="" />').text(mw.usability.getMsg('cite-named-refs-dropdown')));<br />
for(i=0; i<names.length; i++) {<br />
select.append($('<option />').text(names[i].refname));<br />
}<br />
stuff.after(select);<br />
select.before('<br />'); <br />
var prevlabel = $('<div id="cite-nref-preview-label" style="display:none;" />').html(mw.usability.getMsg('cite-raw-preview'));<br />
select.after(prevlabel);<br />
prevlabel.before("<br /><br />");<br />
prevlabel.after('<div id="cite-namedref-preview" style="padding:0.5em; font-size:110%" />');<br />
var parselabel = $('<span id="cite-parsed-label" style="display:none;" />').html(mw.usability.getMsg('cite-parsed-label'));<br />
$('#cite-namedref-preview').after(parselabel);<br />
parselabel.after('<div id="cite-namedref-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $('<a href="#" id="cite-nref-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.html(mw.usability.getMsg('cite-form-parse'));<br />
$('#cite-namedref-parsed').after(link);<br />
<br />
$("#cite-namedref-select").bind( 'change', CiteTB.namedRefSelectClick);<br />
$('#cite-nref-parse').bind( 'click', CiteTB.nrefParseClick);<br />
} <br />
};<br />
<br />
// Function to get the errorcheck form HTML<br />
CiteTB.setupErrorCheck = function() {<br />
var form = $('<div id="cite-errorcheck-heading" />').html(mw.usability.getMsg('cite-errorcheck-heading'));<br />
var ul = $("<ul id='cite-errcheck-list' />");<br />
var test;<br />
for (var t in CiteTB.ErrorChecks) {<br />
test = CiteTB.ErrorChecks[t];<br />
ul.append(test.getRow());<br />
}<br />
form.append(ul);<br />
$('#citetoolbar-errorcheck').html(form);<br />
};<br />
<br />
// Callback function for parsed preview<br />
CiteTB.fillNrefPreview = function(parsed) {<br />
$('#cite-parsed-label').show();<br />
$('#cite-namedref-parsed').html(parsed);<br />
};<br />
<br />
// Click handler for the named-ref parsed preview<br />
CiteTB.nrefParseClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (choice === '') {<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
return false;<br />
}<br />
$('#cite-nref-parse').hide();<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
CiteTB.parse(CiteTB.mainRefList[i].content, CiteTB.fillNrefPreview);<br />
return false;<br />
}<br />
} <br />
};<br />
<br />
// Click handler for the named-ref dropdown<br />
CiteTB.lastnamedrefchoice = '';<br />
CiteTB.namedRefSelectClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (CiteTB.lastnamedrefchoice == choice) {<br />
return;<br />
}<br />
CiteTB.lastnamedrefchoice = choice;<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
if (choice === '') {<br />
$('#cite-nref-preview-label').hide();<br />
$('#cite-namedref-preview').text('');<br />
$('#cite-nref-parse').hide();<br />
return;<br />
}<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
$('#cite-nref-preview-label').show();<br />
$('#cite-namedref-preview').text(CiteTB.mainRefList[i].content);<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.nrefParseClick();<br />
} else {<br />
$('#cite-nref-parse').show();<br />
}<br />
}<br />
}<br />
};<br />
<br />
// callback function for parsed preview<br />
CiteTB.fillTemplatePreview = function(text) {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parsed-label').show();<br />
div.find('.cite-preview-parsed').html(text);<br />
};<br />
<br />
// Click handler for template parsed preview<br />
CiteTB.prevParseClick = function() {<br />
var ref = CiteTB.getRef(true, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parse').hide();<br />
CiteTB.parse(ref, CiteTB.fillTemplatePreview);<br />
};<br />
<br />
// Show/hide the extra fields in the dialog box<br />
CiteTB.showHideExtra = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
var setting = div.find(".cite-form-status").val();<br />
if ( setting === 'closed' ) {<br />
div.find(".cite-form-status").val('open');<br />
div.find('.cite-extra-fields').show(1, function() {<br />
// jQuery adds "display:block", which screws things up<br />
div.find('.cite-extra-fields').attr('style', 'width:100%; background-color:transparent;'); <br />
});<br />
} else {<br />
div.find(".cite-form-status").val('closed');<br />
div.find('.cite-extra-fields').hide();<br />
} <br />
};<br />
<br />
// Resets form fields and previews<br />
// Resets form fields and previews<br />
CiteTB.resetForm = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.html(template.getForm());<br />
};<br />
<br />
// STRING UTILITY FUNCTIONS<br />
// Returns a string quoted as necessary for name/group attributes<br />
CiteTB.getQuotedString = function(s) {<br />
var sq = /\'/.test(s); // single quotes<br />
var dq = /\"/.test(s); // double quotes<br />
if (!sq && !dq) { // Always quotes for non-latin alphabet<br />
return '"'+s+'"';<br />
} else if (!dq) { // Can use double quotes<br />
return '"'+s+'"';<br />
} else if (!sq) { // Can use single quotes<br />
return "'"+s+"'";<br />
} else { // Has double and single quotes<br />
s = s.replace(/\"/g, '\'');<br />
return '"'+s+'"';<br />
}<br />
};<br />
<br />
// Fix up strings for output - capitalize first char, replace underscores with spaces<br />
CiteTB.fixStr = function(s) {<br />
s = s.slice(0,1).toUpperCase() + s.slice(1);<br />
s = s.replace('_',' ');<br />
return s;<br />
};<br />
<br />
// Escape spaces and quotes for use in HTML classes/ids<br />
CiteTB.escStr = function(s) {<br />
return s.replace(' ', '-').replace("'", "\'").replace('"', '\"');<br />
};<br />
<br />
// MISC FUNCTIONS<br />
// Determine which template form is open, and get the template object for it<br />
CiteTB.getOpenTemplate = function() {<br />
var dialogs = $(".ui-dialog-content.ui-widget-content:visible");<br />
var templatename = $(dialogs[0]).find(".cite-template").val();<br />
return CiteTB.Templates[templatename];<br />
};<br />
<br />
// Display the report for the error checks<br />
CiteTB.displayErrors = function(errors) {<br />
$('#cite-err-report').remove();<br />
var table = $('<table id="cite-err-report" style="width:100%; border:1px solid #A9A9A9; background-color:#FFEFD5; padding:0.25em; margin-top:0.5em" />');<br />
$('#editpage-copywarn').before(table);<br />
var tr;<br />
var tr1 = $('<tr style="width:100%" />');<br />
var th1 = $('<th style="width:60%; font-size:110%" />').html(mw.usability.getMsg('cite-err-report-heading'));<br />
var th2 = $('<th style="text-align:right; width:40%" />');<br />
var im = $('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/5/55/Gtk-stop.svg/20px-Gtk-stop.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-err-report-close')).attr('title', mw.usability.getMsg('cite-err-report-close'));<br />
var ad = $('<a id="cite-err-check-close" />').attr('href', '#');<br />
ad.append(im);<br />
th2.append(ad);<br />
tr1.append(th1).append(th2);<br />
table.append(tr1);<br />
$('#cite-err-check-close').bind('click', function() { $('#cite-err-report').remove(); });<br />
if (errors.length === 0) {<br />
tr = $('<tr style="width:100%;" />');<br />
var td = $('<td style="text-align:center; margin:1.5px;" />').html(mw.usability.getMsg('cite-err-report-empty'));<br />
tr.append(td);<br />
table.append(tr);<br />
<br />
return;<br />
}<br />
for(var e in errors) {<br />
var err = errors[e];<br />
tr = $('<tr style="width:100%;" />');<br />
var td1 = $('<td style="border: 1px solid black; margin:1.5px; width:60%" />').html(err.err);<br />
var td2 = $('<td style="border: 1px solid black; margin:1.5px; width:40%" />').html(mw.usability.getMsg(err.msg));<br />
tr.append(td1).append(td2);<br />
table.append(tr);<br />
}<br />
};<br />
<br />
} // End of code loaded only on edit</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarNoDialogsTextTerm.js&diff=10311
MediaWiki:RefToolbarNoDialogsTextTerm.js
2017-06-09T09:28:43Z
<p>Nicolas Brouard: New mw28 version</p>
<hr />
<div>var numforms = 0;<br />
var wikEdAutoUpdateUrl;<br />
function refbuttons() {<br />
if (mw.toolbar && (document.getElementById('toolbar') || document.getElementById('wikiEditor-section-main'))/* && wikEdAutoUpdateUrl == null*/) {<br />
if (document.getElementById('toolbar')) {<br />
button = document.createElement('a');<br />
button.href = "javascript:easyCiteMain()";<br />
button.title = "Insert citation";<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/0/00/Button_easy_cite_%281%29.png";<br />
buttonimage.alt = "Insert footnote";<br />
button.appendChild(buttonimage);<br />
document.getElementById('toolbar').appendChild(button);<br />
} else {<br />
button = document.createElement('a');<br />
button.href = "#";<br />
button.title = "Insert citation";<br />
button.id = 'reftoolbar-button';<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Curly_Brackets.svg/22px-Curly_Brackets.svg.png";<br />
buttonimage.alt = "Insert citation";<br />
button.classname = "tool tool-button";<br />
buttonimage.style.width = "22px";<br />
buttonimage.style.height = "17px";<br />
buttonimage.style.paddingTop = "5px";<br />
buttonimage.style.paddingLeft = "3px";<br />
button.appendChild(buttonimage);<br />
//document.getElementById('wikiEditor-ui-toolbar').childNodes[0].childNodes[1].appendChild(button);<br />
////document.getElementById('reftoolbar-button').onclick = easyCiteMain;<br />
//$j('#reftoolbar-button').live('click', function() { easyCiteMain(); });<br />
$('#wikiEditor-section-main .group-insert').append( button );<br />
$(button).click( function() { easyCiteMain(); });<br />
<br />
}<br />
if (navigator.userAgent.indexOf('MSIE') == -1) {<br />
//alert("NO MSIE");<br />
citemain = document.createElement('div');<br />
citemain.style.display = 'none';<br />
citemain.setAttribute('Id', 'citeselect');<br />
citemain.appendChild( addOption("citeWeb()", "Cite web") );<br />
citemain.appendChild( addOption("citeBook()", "Cite book") );<br />
citemain.appendChild( addOption("citeJournal()", "Cite journal") );<br />
citemain.appendChild( addOption("citeNews()", "Cite news") );<br />
citemain.appendChild( addOption("citeNamedRef()", "Named ref") );<br />
citemain.appendChild( addOption("dispErrors()", "Error check") );<br />
citemain.appendChild( addOption("hideInitial()", "Cancel") );<br />
citemain.appendChild( addOption("textTerm()", "TextTerm") );<br />
document.getElementById('wpTextbox1').parentNode.insertBefore(citemain, document.getElementById('wpTextbox1'));<br />
}<br />
else {<br />
selection = '<div id="citeselect" style="display:none"><input type="button" value="Cite web" onclick="citeWeb()" />'+<br />
'<input type="button" value="Cite book" onclick="citeBook()" />'+<br />
'<input type="button" value="Cite journal" onclick="citeJournal()" />'+<br />
'<input type="button" value="Cite news" onclick="citeNews()" />'+<br />
'<input type="button" value="Named ref" onclick="citeNamedRef()" />'+<br />
'<input type="button" value="Error check" onclick="dispErrors()" />'+<br />
'<input type="button" value="Cancel" onclick="hideInitial()" />'+<br />
'<input type="button" value="TextTerm" onclick="textTerm()" /></div>';<br />
document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;<br />
}<br />
}<br />
}<br />
<br />
function addOption(script, text) {<br />
option = document.createElement('input');<br />
option.setAttribute('type', 'button');<br />
option.setAttribute('onclick', script);<br />
option.setAttribute("value", text);<br />
return option;<br />
}<br />
<br />
function hideInitial() {<br />
document.getElementById('citeselect').style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function oldFormHide() {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
if (document.getElementById('errorform') != null) {<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
}<br />
} <br />
<br />
function easyCiteMain() {<br />
document.getElementById('citeselect').style.display = '';<br />
}<br />
<br />
var months = ['January', 'February', 'March', 'April', 'May', 'June',<br />
'July', 'August', 'September', 'October', 'November', 'December'];<br />
var citeGlobalDateFormat = "<date> <monthname> <year>";<br />
function getTime() {<br />
var datestr = '';<br />
if (typeof citeUserDateFormat != 'undefined') {<br />
datestr = citeUserDateFormat;<br />
} else {<br />
datestr = citeGlobalDateFormat;<br />
}<br />
var DT = new Date();<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate()<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString()<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[DT.getUTCMonth()]);<br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return (datestr);<br />
}<br />
<br />
function citeWeb() {<br />
citeNewsWeb("cite web");<br />
}<br />
function citeNews() {<br />
citeNewsWeb("cite news");<br />
}<br />
<br />
function textTerm() {<br />
textTermf();<br />
} <br />
<br />
var texttermall = new Array();<br />
var texttermcur = new Array();<br />
var textterminput = new Array();<br />
var poffset=null, prange=null, noffset=null, nrange=null;<br />
var section = '';<br />
var subnote = '';<br />
<br />
function textTermf() {<br />
textTermform(null,null);<br />
}<br />
<br />
function nexttextterm() {<br />
//console.log("nexttexterm before noffset :" + noffset + " nrange=" + nrange);<br />
savetextterms(); // Save if changed<br />
if(noffset){ // If there is a next<br />
textTermform(noffset, nrange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
function previoustextterm() {<br />
//console.log("previoustexterm before poffset :" + poffset + " prange=" + prange);<br />
savetextterms();<br />
if(poffset){ // If there is a next<br />
textTermform(poffset, prange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
<br />
<br />
<br />
function texttermfill(subtext) {<br />
var ref = new Array();<br />
this.term = '';<br />
this.note= '';<br />
this.section= '';<br />
if(section != '')<br />
this.section = section;<br />
this.subnote = '';<br />
if(subnote != '')<br />
this.subnote = subnote;<br />
this.englishentry= '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
<br />
var j=0;<br />
var nr=true;<br />
regexbar= /\|([^|]*)/gm <br />
//regexbar =/\|((.)*?)(?=[\||\n])/gm //"|programmes de population|1|933|IndexEntry=programme de population|OtherIndexEntry=population, programme de"<br />
do {<br />
ref = regexbar.exec(subtext);<br />
//console.log(" subtext=" + subtext);<br />
//console.log(" ref=" + ref);<br />
if(ref != null){<br />
switch (j)<br />
{<br />
case 0 : this.term = ref[1]; break;<br />
case 1 : this.note = ref[1]; break;<br />
case 2 : this.section = ref[1]; break;<br />
default :<br />
if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?IndexEntry *?= *?(.*) *?$/))<br />
this.indexentry = ref[1].replace(/^ *?IndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntry *?= *?(.*) *?$/))<br />
this.otherindexentry = ref[1].replace(/^ *?OtherIndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/))<br />
this.otherindexentrytwo = ref[1].replace(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/))<br />
this.otherindexentrythree = ref[1].replace(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/))<br />
this.otherindexentryfour = ref[1].replace(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/))<br />
this.otherindexentryfive = ref[1].replace(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(j==3){<br />
this.subnote = ref[1];<br />
}else{<br />
alert("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
//console.log("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
}<br />
}<br />
j++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
//console.log("j=" + j + " term=" + this.term + " note=" + this.note + " section=" + this.section +" subnote=" + this.subnote +" indexentry=" + this.indexentry + " otherindexentry=" + this.otherindexentry);<br />
}<br />
<br />
<br />
function textTermform(offset,range){<br />
<br />
// We search for TextTerm in wptexbox1 from cursor position (offset) and if selected (range)<br />
// If called by a previous or next, they are not null {{TextTerm<-......>}}<br />
// if outside of a TextTerm template, we will fill with the term with the selection<br />
// in any case we compute the previous nextstart and previus end and next offset not real.<br />
// if inside a TextTerm we fill the form<br />
// if saveterm is necessary, we save and exit.<br />
// if previous or next, we save if necessary and we call textTermform with a new offset >0 (next) or <0 (previous) and range<br />
// <br />
var textarea= document.getElementById('wpTextbox1');<br />
if ('selectionStart' in textarea) {<br />
if (offset == null){ // range should be null too<br />
offset = textarea.selectionStart;<br />
range = textarea.selectionEnd - textarea.selectionStart;<br />
<br />
var lstxtterm = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("{{TextTerm") ; // Just before the string. No regex<br />
var lstcltxtterm = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("}}") ; //might be for another purpose than TextTerm<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section |" + section);<br />
//textarea.value.substring(0,textarea.selectionStart). search(new RegExp("((({{TextTerm[^}]+)[^{]+)+)");<br />
<br />
if ( (-1 == lstxtterm) || ((-1 < lstxtterm) && (lstxtterm < lstcltxtterm)) ) { // @{{TextTerm ...@}}...(...).. <br />
// {{Refnumber }} ....! <br />
// alert("We are after outside a previous TextTerm or no TextTerm before:" + textarea.value.substring(0,textarea.selectionStart ));<br />
texttermcur = new texttermfill("|" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
//console.log(" We want to fill with the selection=" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// On se retrouve avec du texte à ajouter et le curseur inchangé à textarea.selectionStart <br />
} else if ( (lstxtterm > lstcltxtterm) && (lstcltxtterm > -1) ) { // @}}... @{{TextTerm ... (...).. <br />
//alert("We are within a TextTerm or no closing }}:" + textarea.value.substring(lstcltxtterm, lstxtterm));<br />
<br />
// ( textarea.value.substring(lstxtterm, textarea.selectionStart). search(new RegExp("}}")) == -1) {<br />
var endtxterm= textarea.value.substring(textarea.selectionStart, textarea.length). search("}}");<br />
if( endtxterm == -1)<br />
error(" Error no closing TextTerm; should be fixed:" + textarea.value.substring(textarea.selectionStart, textarea.length));<br />
else{<br />
endtxterm = endtxterm + textarea.selectionStart +2 ; // }} included<br />
// Looking for @{{TextTerm....}}@<br />
// alert("We are within textterm " + lstxtterm + " to " + endtxterm + " soit:" + textarea.value.substring(lstxtterm,endtxterm) );<br />
//console.log(" Replacing with form result:" + textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length) );<br />
// On devrait remplacer {{TextTerm ...}} par la forme, soit de lstxtterm endtxtterm<br />
// On se fout de la sélection originale et la repositionne sur toute l'étendue du textterm.<br />
// alert("After null before textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = lstxtterm;<br />
textarea.selectionEnd = endtxterm;<br />
// alert("After null textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is now:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
} //en endtxtterm<br />
} // end @}}... @{{TextTerm ... (...).. <br />
}else{ // coming from a previous or next<br />
// alert("After Next textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" After next selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert("Coming from a previous or next modifing selectionStart start is an offsetstart =" + offset + " and range=" + range)<br />
// Previous<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<-range-------->! <br />
// #<-offset--------->! <br />
// Next<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--range------->! <br />
// #<-offset--------->! <br />
// alert(" Before textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//alert(" Before is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = (offset > 0 ? textarea.selectionEnd + offset : textarea.selectionStart + offset -range);<br />
textarea.selectionEnd = textarea.selectionStart + range;<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section Other |" + section);<br />
<br />
// alert(" After is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert(" After textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//console.log("textterm cur is:" + textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length) );<br />
}<br />
}else{<br />
alert("No selectionStart Internet Explorer < 9?");<br />
} <br />
// Looking for previous and next<br />
// Previous<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// poffset<br />
// < prange ><<br />
// >< ><<br />
// pstart pend<br />
// !<--------offsetpstart------------>! <br />
// #<-offsetpsend---->! <br />
<br />
var pstart = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("{{TextTerm"); <br />
if ( pstart == -1) { // No previous<br />
// alert( "NO previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
poffset = null;<br />
prange = null;<br />
}else{<br />
// alert( "Previous pstart=" + pstart + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
var pend = textarea.value.substring(pstart,textarea.selectionStart). search("}}") ; // Regex ?<br />
// alert( "Previous pstart=" + pstart + " pend= " + pend + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
if ( pend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
}else{<br />
prange = pend + 2; // }} included<br />
poffset = pstart + prange - textarea.selectionStart; // should be negative<br />
// alert( " prange =" + prange + " poffset=" + poffset);<br />
}<br />
}<br />
// Next<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--------offsetnend-------------->! <br />
// #<-offsetnstart--->! <br />
// noffset<br />
// >< nrange ><br />
// #<-offsetnstart--->! <br />
var nstart = textarea.value.substring(textarea.selectionEnd,textarea.length). search("{{TextTerm") <br />
if ( nstart == -1) { // No next<br />
// alert( "NO next TextTerm : " + textarea.value.substring(textarea.selectionEnd,textarea.length));<br />
noffset = null;<br />
nrange = null;<br />
}else{<br />
var nend = textarea.value.substring(textarea.selectionEnd + nstart,textarea.length). search("}}") ;<br />
if ( nend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(textarea.selectionEnd,textarea.length)) ;<br />
}else{<br />
noffset = nstart ;<br />
nrange = nend +2 ;// }}<br />
}<br />
}<br />
<br />
<br />
// We do have offset or null, as well formfilled with a selection.<br />
<br />
oldFormHide();<br />
template = "TextTerm";<br />
var legend;<br />
if (template == "TextTerm") {<br />
legend = "TextTerm source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td><label for="term">&nbsp;*Term or expression: </label></td>'+<br />
'<td colspan="3"><input type="text" tabindex=1 style="width:100%" id="term" value= "' +<br />
texttermcur.term + '"></tr>'+<br />
'<tr><td width="100"><label for="note">&nbsp;*Note number (1, 2 etc .): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="note" value= "' +<br />
texttermcur.note + '"></td>'+<br />
'<td width="100"><label for="subnote">&nbsp;Subnote (2): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="subnote" value= "' +<br />
texttermcur.subnote + '"></td></tr>'+<br />
'<tr><td width="300"><label for="section">&nbsp;Section (102, 933 etc.): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="section" value= "' +<br />
texttermcur.section + '"></td>'+<br />
'<td width="120"><label for="indexentry">&nbsp;IndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="indexentry" value= "' +<br />
texttermcur.indexentry + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentry">&nbsp;OtherIndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentry" value= "' +<br />
texttermcur.otherindexentry + '"></td>'+<br />
'<td width="120"><label for="otherindexentrytwo">&nbsp;OtherIndexEntryTwo: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrytwo" value= "' +<br />
texttermcur.otherindexentrytwo + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentrythree">&nbsp;OtherIndexEntryThree: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrythree" value= "' +<br />
texttermcur.otherindexentrythree + '"></td>'+<br />
'<td width="120"><label for="otherindexentryfour">&nbsp;OtherIndexEntryFour: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfour" value= "' +<br />
texttermcur.otherindexentryfour + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentryfive">&nbsp;OtherIndexEntryFive: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfive" value= "' +<br />
texttermcur.otherindexentryfive + '"></td>'+<br />
'<td width="120"><label for="englishentry">&nbsp;EnglishEntry (for Chinese and Japanese): </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="englishentry" value= "' +<br />
texttermcur.englishentry + '"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" id="previous" value="(save &) previous TextTerm" onClick="previoustextterm()">'+<br />
'<input type="button" value="(save &) exit" onClick="savetextterms()">'+<br />
'<input type="button" id="next" value="(save &) next TextTerm" onClick="nexttextterm()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
<br />
function citeNewsWeb(templatename) {<br />
oldFormHide();<br />
template = templatename;<br />
var legend;<br />
if (template == "cite web") {<br />
legend = "Cite web source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="work">&nbsp;Work: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="work"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ newtime +'"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeBook() {<br />
oldFormHide();<br />
template = "cite book";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite book source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="others">&nbsp;Others: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="others"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="editor">&nbsp;Editor: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="editor"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td>'+<br />
'<td width="120"><label for="edition">&nbsp;Edition: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="edition"></td></tr>'+<br />
'<tr><td width="120"><label for="series">&nbsp;Series: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="series"></td>'+<br />
'<td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="chapter">&nbsp;Chapter: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="chapter"></td></tr>'+<br />
'<tr><td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td>'+<br />
'<td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeJournal() {<br />
oldFormHide();<br />
template = "cite journal";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite journal source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="journal">&nbsp;Journal: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="journal"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td>'+<br />
'<td width="120"><label for="issue">&nbsp;Issue: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issue"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issn"></td></tr>'+<br />
'<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function saveinput(terminput) {<br />
// terminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
this.term = '';<br />
this.note= '';<br />
this.section = '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
this.englishentry = '';<br />
<br />
for (var i=0; i<terminput.length-1; i++) {<br />
if (terminput[i].id == "template" ){<br />
;<br />
}else if (terminput[i].id == "term" ){<br />
this.term = terminput[i].value;<br />
}else if(terminput[i].id == "note"){<br />
this.note = terminput[i].value;<br />
}else if(terminput[i].id == "section"){<br />
this.section = terminput[i].value;<br />
}else if(terminput[i].id == "subnote"){<br />
this.subnote = terminput[i].value;<br />
}else if(terminput[i].id == "indexentry"){<br />
this.indexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentry"){<br />
this.otherindexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrytwo"){<br />
this.otherindexentrytwo = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrythree"){<br />
this.otherindexentrythree = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfour"){<br />
this.otherindexentryfour = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfive"){<br />
this.otherindexentryfive = terminput[i].value;<br />
}else if(terminput[i].id == "englishentry"){<br />
this.englishentry = terminput[i].value;<br />
}else{<br />
;;//alert(" SaveInput terminput[i].id = " + terminput[i].id + " terminput[i].value =" + terminput[i].value);<br />
}<br />
<br />
}<br />
}<br />
<br />
function savetextterms(template) {<br />
var txtterminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
textterminput = new saveinput(txtterminput);<br />
//alert("texttermcur=" + texttermcur);<br />
//alert("textterminput=" + textterminput);<br />
// Testing<br />
var different = false;<br />
if((textterminput.term != texttermcur.term) || (textterminput.note != texttermcur.note) ||<br />
(textterminput.section != texttermcur.section) ||<br />
(textterminput.subnote != texttermcur.subnote) ||<br />
(textterminput.indexentry != texttermcur.indexentry) ||<br />
(textterminput.otherindexentry != texttermcur.otherindexentry) || <br />
(textterminput.otherindexentrytwo != texttermcur.otherindexentrytwo) ||<br />
(textterminput.otherindexentrythree != texttermcur.otherindexentrythree) ||<br />
(textterminput.otherindexentryfour != texttermcur.otherindexentryfour) ||<br />
(textterminput.otherindexentryfive != texttermcur.otherindexentryfive) ||<br />
(textterminput.englishentry != texttermcur.englishentry) )<br />
different = true;<br />
<br />
if (different){<br />
// alert(" They are different, have to save" );<br />
var texttermchain="{{TextTerm";<br />
texttermchain += '|' + (textterminput.term ? textterminput.term : '');<br />
texttermchain += '|' + (textterminput.note ? textterminput.note : '');<br />
texttermchain += (textterminput.section ? '|' + textterminput.section : '');<br />
texttermchain += (textterminput.subnote ? '|' + textterminput.subnote : '');<br />
texttermchain += (textterminput.indexentry ? '|IndexEntry='+ textterminput.indexentry : '');<br />
texttermchain += (textterminput.otherindexentry ? '|OtherIndexEntry='+ textterminput.otherindexentry : '');<br />
texttermchain += (textterminput.otherindexentrytwo ? '|OtherIndexEntryTwo='+ textterminput.otherindexentrytwo : '');<br />
texttermchain += (textterminput.otherindexentrythree ? '|OtherIndexEntryThree='+ textterminput.otherindexentrythree : '');<br />
texttermchain += (textterminput.otherindexentryfour ? '|OtherIndexEntryFour='+ textterminput.otherindexentryfour : '');<br />
texttermchain += (textterminput.otherindexentryfive ? '|OtherIndexEntryFive='+ textterminput.otherindexentryfive : '');<br />
texttermchain += (textterminput.englishentry ? '|EnglishEntry='+ textterminput.englishentry : '');<br />
texttermchain += "}}";<br />
<br />
var textarea= document.getElementById('wpTextbox1');<br />
var savepos= textarea.selectionStart;<br />
if ('selectionStart' in textarea) {<br />
textarea.value=textarea.value.substring(0,textarea.selectionStart) + texttermchain + textarea.value.substring(textarea.selectionEnd, textarea.length); <br />
//insertTags(texttermchain, '', '');<br />
textarea.selectionStart = savepos;<br />
textarea.selectionEnd = savepos + texttermchain.length;<br />
}<br />
else{<br />
alert("No selectionStart firefox");<br />
}<br />
}<br />
else{<br />
;//alert(" They are similar, don't save" );<br />
}<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
<br />
}<br />
<br />
function addcites(template) {<br />
cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
var citebegin = '<ref';<br />
var citename = '';<br />
var citeinner = '';<br />
for (var i=0; i<cites.length-1; i++) {<br />
if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id != "template") {<br />
citeinner += "|" + cites[i].id + "=" + cites[i].value;<br />
}<br />
else if (cites[i].value != '' && cites[i].id == "refname" && cites[i].id != "template") {<br />
citebegin += ' name="' + cites[i].value + '"';<br />
}<br />
else if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id == "template") {<br />
citename = '>{{' + cites[i].value;<br />
}<br />
}<br />
cite = citebegin + citename + citeinner + "}}</ref>";<br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getNamedRefs(calls) {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
var regex;<br />
if (calls) {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?\/ *?>/gi //'<br />
} else {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?>/gi //'<br />
}<br />
var namedrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[5]) {<br />
namedrefs[i] = ref[5];<br />
} else if (ref[3]) {<br />
namedrefs[i] = ref[3];<br />
} else {<br />
namedrefs[i] = ref[6];<br />
}<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return namedrefs;<br />
}<br />
<br />
function citeNamedRef() {<br />
namedrefs = getNamedRefs(false);<br />
if (namedrefs == '') {<br />
oldFormHide();<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>References in text</legend>There are no named refs (<tt>&lt;ref name="Name"&gt;</tt>) in the text</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
oldFormHide();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>References in article</legend>'+<br />
'<table cellspacing="5">'+<br />
'<tr><td><label for="namedrefs">&nbsp;Named references in text</label></td>'+<br />
'<td><select name="namedrefs" id="namedrefs">';<br />
for (var i=0;i<namedrefs.length;i++) {<br />
form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';<br />
}<br />
form+= '</select>'+<br />
'</td></tr></table>'+<br />
'<input type="button" value="Add citation" onClick="addnamedcite()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function addnamedcite() {<br />
name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;<br />
ref = '<ref name="'+name+'" />';<br />
$("#wpTextbox1").focus();<br />
insertTags(ref, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getAllRefs() {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"<br />
var allrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[0].search(/[^\s]{150}/) != -1) {<br />
ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");<br />
}<br />
ref[0] = ref[0].replace(/</g, "&lt;");<br />
ref[0] = ref[0].replace(/>/g, "&gt;");<br />
allrefs[i] = ref[0];<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return allrefs;<br />
}<br />
<br />
function NRcallError(namedrefs, refname) {<br />
for (var i=0; i<namedrefs.length; i++) {<br />
if (namedrefs[i] == refname) {<br />
return true;<br />
}<br />
}<br />
return false;<br />
}<br />
<br />
function errorCheck() {<br />
var allrefs = getAllRefs();<br />
var allrefscontent = [];<br />
var samecontentexclude = [];<br />
var sx=0;<br />
var templateexclude = [];<br />
var tx=0;<br />
var skipcheck = false;<br />
var namedrefcalls = getNamedRefs(true);<br />
for (var i=0; i<allrefs.length; i++) {<br />
allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8"); //"<br />
}<br />
var namedrefs = getNamedRefs(false);<br />
var errorlist = [];<br />
var q=0;<br />
unclosed = document.getElementById('unclosed').checked;<br />
samecontent = document.getElementById('samecontent').checked;<br />
templates = document.getElementById('templates').checked;<br />
repeated = document.getElementById('repeated').checked;<br />
undef = document.getElementById('undef').checked;<br />
for (var i=0; i<allrefs.length; i++) {<br />
if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Unclosed <tt>&lt;ref&gt;</tt> tag</td></tr>';<br />
q++;<br />
}<br />
if (samecontent) {<br />
for (var d=0; d<samecontentexclude.length; d++) {<br />
if (allrefscontent[i] == samecontentexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var p=0;<br />
while (p<allrefs.length && !skipcheck) {<br />
if (allrefscontent[i] == allrefscontent[p] && i != p) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';<br />
q++;<br />
samecontentexclude[sx] = allrefscontent[i]<br />
sx++;<br />
break;<br />
}<br />
p++;<br />
}<br />
skipcheck=false;<br />
}<br />
if (templates) {<br />
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) {<br />
for (var x=0; x<templateexclude.length; x++) {<br />
if (allrefscontent[i] == templateexclude[x]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Does not use a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a></td></tr>';<br />
q++;<br />
templateexclude[tx] = allrefscontent[i];<br />
tx++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
}<br />
if (repeated) {<br />
var repeatnameexclude = [];<br />
var rx=0;<br />
for (var k=0; k<namedrefs.length; k++) {<br />
for (var d=0; d<repeatnameexclude.length; d++) {<br />
if (namedrefs[k] == repeatnameexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var z=0;<br />
while (z<namedrefs.length && !skipcheck) {<br />
if (namedrefs[k] == namedrefs[z] && k != z) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';<br />
q++;<br />
repeatnameexclude[rx] = namedrefs[z];<br />
rx++;<br />
break;<br />
}<br />
z++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (undef) {<br />
var undefexclude = [];<br />
var ux=0;<br />
for (var p=0; p<namedrefcalls.length; p++) {<br />
for (var d=0; d<undefexclude.length; d++) {<br />
if (allrefscontent[i] == undefexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
if (!NRcallError(namedrefs, namedrefcalls[p])) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">A <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';<br />
q++;<br />
undefexclude[ux] = namedrefs[p];<br />
ux++;<br />
}<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (q > 0) {<br />
return errorlist;<br />
} else {<br />
return 0;<br />
}<br />
}<br />
<br />
function dispErrors() {<br />
oldFormHide();<br />
form = '<div id="errorform"><fieldset>'+<br />
'<legend>Error checking</legend>'+<br />
'<b>Check for:</b><br/>'+<br />
'<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+<br />
'<input type="checkbox" id="samecontent" /> References with the same content<br/>'+<br />
'<input type="checkbox" id="templates" /> References not using a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a><br/>'+<br />
'<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+<br />
'<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+<br />
'<input type="button" id="errorchecksubmit" value="Check for selected errors" onclick="doErrorCheck()"/>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function doErrorCheck() {<br />
var errors = errorCheck();<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
if (errors == 0) {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>Error checking</legend>No errors found.</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Error checking</legend>'+<br />
'<table border="1px">';<br />
for (var i=0; i<errors.length; i++) {<br />
form+=errors[i];<br />
}<br />
form+= '</table>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
$( refbuttons );</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarLegacy.js&diff=10351
MediaWiki:RefToolbarLegacy.js
2017-06-09T08:46:57Z
<p>Nicolas Brouard: From https://en.wikipedia.org/w/index.php?title=MediaWiki:RefToolbarLegacy.js&oldid=773919858</p>
<hr />
<div>var numforms = 0;<br />
var wikEdAutoUpdateUrl;<br />
var citeUserDateFormat;<br />
var refTagURL;<br />
var defaultRefTagURL = '//reftag.appspot.com/';<br />
var refToolDebug;<br />
<br />
String.prototype.trim = function() {<br />
return this.replace(/^\s+|\s+$/g,"");<br />
};<br />
<br />
function refbuttons() {<br />
if (mw.toolbar && document.getElementById('toolbar') ) {<br />
var button = document.createElement('a');<br />
button.href = "javascript:easyCiteMain()";<br />
button.title = "Insert Citation";<br />
var buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/e/ea/Button_easy_cite.png";<br />
buttonimage.alt = "Insert Citation";<br />
button.appendChild(buttonimage);<br />
var toolbar = document.getElementById('toolbar');<br />
if (navigator.userAgent.indexOf('MSIE') == -1) {<br />
toolbar.appendChild(button);<br />
var citemain = document.createElement('div');<br />
citemain.style.display = 'none';<br />
citemain.style.margin = '0 0 6px';<br />
citemain.style.clear = 'both';<br />
citemain.style.height = 'auto';<br />
citemain.setAttribute('Id', 'citeselect');<br />
citemain.appendChild( addOption("citeWeb()", "Web") );<br />
citemain.appendChild( addOption("citeNews()", "News") );<br />
citemain.appendChild( addOption("citeBook()", "Book") );<br />
citemain.appendChild( addOption("citeJournal()", "Journal") );<br />
citemain.appendChild( addOption("citeNamedRef()", "Named references") );<br />
citemain.appendChild( addOption("dispErrors()", "Error check") );<br />
citemain.appendChild( addOption("showMore()", "More") );<br />
citemain.appendChild( addOption("hideInitial()", "Cancel") );<br />
<br />
var citemore = document.createElement('div');<br />
citemore.style.display = 'none';<br />
citemore.setAttribute('Id', 'citemore');<br />
citemore.appendChild( addOption("citeEncyclopedia()", "Encyclopedia") );<br />
citemore.appendChild( addOption("citePressRelease()", "Press release") );<br />
citemore.appendChild( addOption("citeMap()", "Map") );<br />
citemore.appendChild( addOption("showRefSectionOptions()", "Ref Section") );<br />
citemain.appendChild(citemore);<br />
<br />
$( citemain ).insertAfter( $( toolbar ) );<br />
}<br />
else {<br />
toolbar.appendChild(button);<br />
var citeselect = document.createElement('div');<br />
citeselect.id = 'citeselect';<br />
citeselect.style.display = "none";<br />
citeselect.innerHTML = '<input type="button" value="Web" onclick="citeWeb()" />'+<br />
'<input type="button" value="News" onclick="citeNews()" />'+<br />
'<input type="button" value="Book" onclick="citeBook()" />'+<br />
'<input type="button" value="Journal" onclick="citeJournal()" />'+<br />
'<input type="button" value="Named references" onclick="citeNamedRef()" />'+<br />
'<input type="button" value="Error check" onclick="dispErrors()" />'+<br />
'<input type="button" value="More" onclick="showMore()" />'+<br />
'<input type="button" value="Cancel" onclick="hideInitial()" />'+<br />
'<div id="citemore" style="display:none">\<br />
<input type="button" value="Encyclopedia" onclick="citeEncyclopedia()" />\<br />
<input type="button" value="Press release" onclick="citePressRelease()" />\<br />
<input type="button" value="Map" onclick="citeMap()" />\<br />
<input type="button" value="Ref Section" onclick="showRefSectionOptions()" />\<br />
</div>';<br />
document.getElementById('editform').insertBefore(citeselect, document.getElementById('editform').firstChild ) ;<br />
}<br />
var reftoolformarea = document.createElement( 'span' );<br />
reftoolformarea.id = 'refToolFormArea';<br />
document.getElementById('citeselect').appendChild( reftoolformarea );<br />
}<br />
if (typeof EditTools == "object") {<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
EditTools.createEditTools (placeholder);<br />
}<br />
}<br />
<br />
function addOption(script, text) {<br />
var option = document.createElement('input');<br />
option.setAttribute('type', 'button');<br />
option.setAttribute('onclick', script);<br />
option.setAttribute("value", text);<br />
return option;<br />
}<br />
<br />
function hideInitial() {<br />
document.getElementById('citeselect').style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function oldFormHide() {<br />
//if (numforms != 0) {<br />
// document.getElementById('citediv'+numforms).style.display = 'none';<br />
//}<br />
document.getElementById('refToolFormArea').innerHTML = '';<br />
if (document.getElementById('errorform') !== null) {<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
}<br />
}<br />
<br />
function easyCiteMain() {<br />
document.getElementById('citeselect').style.display = '';<br />
document.getElementById('citemore').style.display = 'none';<br />
}<br />
<br />
function showMore() {<br />
document.getElementById('citemore').style.display = '';<br />
}<br />
<br />
var months = ['January', 'February', 'March', 'April', 'May', 'June',<br />
'July', 'August', 'September', 'October', 'November', 'December'];<br />
var citeGlobalDateFormat = "<date> <monthname> <year>";<br />
function getTime() {<br />
var datestr = '';<br />
if (citeUserDateFormat) {<br />
datestr = citeUserDateFormat;<br />
} else {<br />
datestr = citeGlobalDateFormat;<br />
}<br />
var DT = new Date();<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate();<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString();<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[DT.getUTCMonth()]);<br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return (datestr);<br />
}<br />
<br />
function lastNameToRefname() {<br />
//Note: This only works if field 'refname' comes after field 'last', but it always does<br />
var lastName;<br />
var fields = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
for (var i=0; i<fields.length; i++) {<br />
if(fields[i].id == 'last') {<br />
lastName = fields[i].value;<br />
}<br />
else if(fields[i].id == 'refname') {<br />
fields[i].value = lastName.replace(/^\s*(.*?)\s*$/, "$1");<br />
return;<br />
}<br />
}<br />
}<br />
<br />
function setAccessDateToday() {<br />
document.getElementById('accessdate').value = getTime();<br />
/* var fields = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
for (var i=0; i<fields.length; i++) {<br />
if(fields[i].id == 'accessdate') {<br />
fields[i].value = getTime();<br />
return;<br />
}<br />
}<br />
*/<br />
}<br />
<br />
function getLastName(authornum) {<br />
if (/\S/.test(document.getElementById('last'+authornum).value)) {<br />
return document.getElementById('last'+authornum).value;<br />
}<br />
else {<br />
var author = document.getElementById('author'+authornum).value;<br />
var match = /(\S+)\s*$/.exec(author);<br />
if (match) {<br />
return match[1];<br />
}<br />
else {<br />
return '';<br />
}<br />
}<br />
}<br />
<br />
function makeRefname() {<br />
var refname;<br />
if (document.getElementById('last1')) {<br />
refname = document.getElementById('last1').value + document.getElementById('last2').value;<br />
}<br />
else{<br />
refname = document.getElementById('last').value;<br />
}<br />
if (/\S/.test(refname)) {<br />
var date = document.getElementById('date').value;<br />
var match = /[0-9]{4}/.exec(date);<br />
if (match) {<br />
refname += match[0];<br />
}<br />
}<br />
else {<br />
refname = document.getElementById('title').value;<br />
}<br />
document.getElementById('refname').value = refname;<br />
}<br />
<br />
function citeWeb() {<br />
citeNewsWeb("cite web");<br />
}<br />
function citeNews() {<br />
citeNewsWeb("cite news");<br />
}<br />
<br />
function citeNewsWeb(templatename) {<br />
oldFormHide();<br />
var template = templatename;<br />
var legend;<br />
if (template == "cite web") {<br />
legend = "Cite web source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
var newtime = getTime();<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="' + ((template == 'cite news') ? 'For a New York Times article URL, fetch article data and fill in the fields. For other URLs, fetch the page title.' : 'Fetch the page title. Irrelevant parts often have to be removed manually afterwards.') + '" onClick="pullURL(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="url"></span></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="work">&nbsp;' + ((template == 'cite news') ? 'Newspaper' : 'Work') + ': </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="work"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ newtime +'"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>';<br />
if (template == 'cite web') {<br />
form += '<tr><td width="120"><label for="archiveurl">&nbsp;Archive URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="archiveurl"></td>'+<br />
'<td width="120"><label for="archivedate">&nbsp;Archive date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="archivedate"></td></tr>';<br />
}<br />
form += '<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:60%" id="refname"><input type="button" value="<Last name" onClick="lastNameToRefname()"></td></tr>'+<br />
'</table>'+<br />
' <input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeBook() {<br />
oldFormHide();<br />
var template = "cite book";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite book source</legend>';<br />
<br />
form += '<table cellspacing="5" width="100%"> \<br />
<tr><td><label for="title">Title: </label></td> \<br />
<td colspan=5><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>';<br />
for (var i=1;i<=3;i++) {<br />
var i_str = i == 1 ? '': ' '+i;<br />
form += '<tr> \<br />
<td width="130"><label for="last'+i+'">Author'+i_str+' last&nbsp;name: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="last'+i+'"></td> \<br />
<td><label for="first'+i+'">&nbsp;first&nbsp;name: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="first'+i+'"></td> \<br />
<td><label for="authorlink'+i+'">&nbsp;Authorlink: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="authorlink'+i+'"> \<br />
<!--<a id="authorLinkAnchor'+i+'"><img id="authorLinkButton'+i+'" src="static/progress.gif" border="0" style="visibility: hidden" /></a> \<br />
<a href="//en.wikipedia.org/wiki/%s" target="_blank"><img id="authorTryLink'+i+'" src="static/external.png" border="0" style="visibility: hidden" /></a> --> \<br />
</td> \<br />
</tr>';<br />
}<br />
form += '<tr><td><label for="coauthors">Coauthors: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="coauthors"></td> \<br />
<td><label for="editor">&nbsp;Editor: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="editor"></td> \<br />
<td><label for="others">&nbsp;Others: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="others"></td></tr> \<br />
</table> \<br />
<table cellspacing="5" width="100%"> \<br />
<tr><td width="130"><label for="publisher">Publisher: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="publisher"></td> \<br />
<td><label for="location">&nbsp;Location: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="location"></td></tr> \<br />
\<br />
<tr><td><label for="date">Publication&nbsp;date or&nbsp;year: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:140px" id="date"> \<br />
<input id="dmy" name="dateformat" value="dmy" type="radio" tabindex=1 onclick="reformatDates()"><label for="dmy">dmy</label> \<br />
<input id="mdy" name="dateformat" value="mdy" type="radio" tabindex=1 onclick="reformatDates()"><label for="mdy">md, y</label> \<br />
<input id="ymd" name="dateformat" value="ymd" type="radio" tabindex=1 onclick="reformatDates()"><label for="ymd">y-m-d</label> \<br />
</td> \<br />
<td><label for="edition">&nbsp;Edition: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="edition"></td></tr> \<br />
\<br />
<tr><td><label for="series">Series: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="series"></td> \<br />
<td><label for="volume">&nbsp;Volume: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr> \<br />
\<br />
<tr><td><label for="pages">Page number(s):</label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="pages" name="pages" onFocus="this.style.backgroundColor=\'\';"></td> \<br />
<td><label for="chapter">&nbsp;Chapter: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="chapter"></td></tr> \<br />
\<br />
<tr><td><label for="isbn">ISBN: </label></td> \<br />
<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fill in citation data based on ISBN from Diberri\'s tool." onClick="pullISBN(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="isbn"></span></td> \<br />
<td><label for="language">&nbsp;Language: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="language"></td></tr> \<br />
\<br />
<tr><td><label for="url">URL: </label></td> \<br />
<td><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fill in citation data based on a Google Books URL." onClick="pullJs(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="url"></span></td> \<br />
<td><label for="accessdate">&nbsp;Access&nbsp;date:</label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr> \<br />
\<br />
<tr><td><label for="otherfields">Other&nbsp;fields:</label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="otherfields"></td> \<br />
<td><label for="refname">&nbsp;Ref&nbsp;name: </label></td> \<br />
<td><input type="text" tabindex=1 style="width:100%" id="refname"></td> \<br />
</tr> \<br />
</table> \<br />
\<br />
<input type="radio" tabindex=1 name="template" id="cite_book" value="cite_book" checked="1"><label for="cite_book">\{\{cite book}}</label> <sup><a href="//en.wikipedia.org/wiki/Template:Cite_book" target="_blank">[doc]</a></sup> \<br />
<input type="radio" tabindex=1 name="template" id="citation" value="citation"><label for="citation">\{\{citation}}</label> <sup><a href="//en.wikipedia.org/wiki/Template:Citation" target="_blank">[doc]</a></sup> \<br />
<input type="radio" tabindex=1 name="template" id="plain" value="plain"><label for="plain">plain wikicode (experimental)</label> \<br />
<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label> \<br />
<input type="checkbox" tabindex=1 name="extraparams" id="extraparams" value="extraparams"><label for="extraparams">Extra parameters</label> \<br />
<br /><input type="button" value="Add citation" onClick="makeCiteBook()"> \<br />
<input type="button" value="Preview citation" onClick="previewCitationBook()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" /> \<br />
\<br />
</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeJournal() {<br />
oldFormHide();<br />
var template = "cite journal";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite journal</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="journal">&nbsp;Journal: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="journal"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td>'+<br />
'<td width="120"><label for="issue">&nbsp;Issue: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issue"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issn"></td></tr>'+<br />
'<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td>'+<br />
'<td width="120"><label for="doi">&nbsp;DOI: </label></td>'+<br />
'<td width="400"><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fetch citation data for a DOI from crossref.org and fill in the other fields." onClick="pullDOI(); return false;" style="float:right"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="doi"></span></td></tr>'+<br />
'<tr><td width="120"><label for="pmid">&nbsp;PMID: </label></td>'+<br />
'<td width="400"><input type="image" src="//upload.wikimedia.org/wikipedia/commons/6/62/Arrow_out_condensed.png" tabindex=1 alt="Fetch" title="Fetch citation data for a PMID" onClick="pullPMID(); return false;" style="float:right;visibility:hidden"><span style="display: block;overflow: hidden;"><input type="text" tabindex=1 style="width:97%" id="pmid"></span></td>'+<br />
'<td width="120"><label for="quote">&nbsp;Quote: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="quote"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:60%" id="refname"><input type="button" value="<Last name" onClick="lastNameToRefname()"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeEncyclopedia() {<br />
oldFormHide();<br />
var template = "cite encyclopedia";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite encyclopedia source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="editors">&nbsp;Editors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="editors"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Entry title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="encyclopedia">&nbsp;Encyclopedia: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="encyclopedia"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="year">&nbsp;Year: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="year"></td>'+<br />
'<td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citePressRelease() {<br />
oldFormHide();<br />
var template = "cite press release";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite press release</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="date">&nbsp;Date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ getTime() +'"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function citeMap() {<br />
oldFormHide();<br />
var template = "cite map";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite map</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="edition">&nbsp;Edition: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="edition"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Date or year: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="cartography">&nbsp;Cartography: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="cartography"></td>'+<br />
'<td width="120"><label for="scale">&nbsp;Scale: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="scale"></td></tr>'+<br />
'<tr><td width="120"><label for="series">&nbsp;Series: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="series"></td>'+<br />
'<td width="120"><label for="page">&nbsp;Page: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="page"></td></tr>'+<br />
'<tr><td width="120"><label for="section">&nbsp;Section: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="section"></td>'+<br />
'<td width="120"><label for="inset">&nbsp;Inset: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="inset"></td></tr>'+<br />
'<tr><td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
' <input type="button" value="Preview citation" onClick="previewCitationDefault()"> \<br />
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+<br />
'<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+<br />
'<span style="float:right"><a href="//en.wikipedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+<br />
'</fieldset><span id="previewSpan"></span></div>';<br />
document.getElementById('refToolFormArea').innerHTML = form;<br />
}<br />
<br />
function showRefSectionOptions() {<br />
oldFormHide();<br />
var template = "cite encyclopedia";<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Add references section</legend>\<br />
Headline:<br />\<br />
<input id="references" name="headline" type="radio" tabindex=1 checked="checked"><label for="references">== References ==</label><br /> \<br />
<input id="notes" name="headline" type="radio" tabindex=1><label for="notes">== Notes ==</label><br /> \<br />
Type:<br /> \<br />
<input id="type-references" name="type" type="radio" tabindex=1><label for="type-references">&lt;references/&gt;</label><br /> \<br />
<input id="type-reflist" name="type" type="radio" tabindex=1 checked="checked"><label for="type-reflist">\{\{Reflist}}</label><br /> \<br />
<input id="type-reflist2" name="type" type="radio" tabindex=1><label for="type-reflist2">\{\{Reflist|2}}</label><br /> \<br />
<input type="checkbox" tabindex=1 id="ldr"><label for="ldr">List-defined references</label> (<a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#List-defined_references" target="_blank">Info 1</a>, <a href="//en.wikipedia.org/wiki/Help:Footnotes#List-defined_references" target="_blank">Info 2</a>)<br />\<br />
<input type="button" value="Add references section" onClick="addRefSection()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function makeCiteCode() {<br />
cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
var template = '';<br />
var citebegin = '<ref';<br />
var citename = '';<br />
var citeinner = '';<br />
for (var i=0; i<cites.length; i++) {<br />
var citeid = cites[i].id;<br />
var citevalue = cites[i].value;<br />
citevalue = citevalue.trim(); //Trim leading and trailing whitespace<br />
if (citeid == "verbose") {<br />
if (cites[i].checked) {<br />
citeinner = citeinner.replace(/\|/g, "\n|");<br />
}<br />
}<br />
else if (citevalue !== '' && cites[i].type !== 'button' && cites[i].type !== 'image') {<br />
if (citeid === "refname") {<br />
citebegin += ' name="' + citevalue + '"';<br />
}<br />
else if (citeid == "template") {<br />
citename = '>\{\{' + citevalue;<br />
template = citevalue;<br />
}<br />
else {<br />
if (citeid === "pages") {<br />
if (citevalue.match(/^\w+$/) && template != 'cite encyclopedia') {<br />
citeid = "page"; //Use page= instead of pages= if only one page. Makes p. 5 instead of pp. 5.<br />
}<br />
else {<br />
citevalue = citevalue.replace(/-/g, "–"); //Replace hyphens with en dashes [[WP:ENDASH]]<br />
}<br />
}<br />
else if (citeid == "date" && citevalue.match(/^\d\d\d\d$/)) {<br />
citeid = "year"; // Use year= instead of date= if only the year is specified<br />
}<br />
citeinner += "|" + citeid + "=" + citevalue;<br />
}<br />
}<br />
}<br />
cite = citebegin + citename + citeinner + "}}</ref>";<br />
return cite;<br />
}<br />
<br />
function addcites(template) {<br />
var cite = makeCiteCode();<br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', '');<br />
//document.getElementById('citediv'+numforms).style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function addRefSection() {<br />
var wikicode = "\n";<br />
if (document.getElementById('references').checked) {<br />
wikicode += "== References ==\n";<br />
}<br />
else if (document.getElementById('notes').checked) {<br />
wikicode += "== Notes ==\n";<br />
}<br />
else {alert('No headline selected!');}<br />
<br />
if (document.getElementById('type-references').checked) {<br />
if (document.getElementById('ldr').checked) {<br />
wikicode += "<references>\n\n</references>\n";<br />
}<br />
else {<br />
wikicode += "<references/>\n";<br />
}<br />
}<br />
else if (document.getElementById('type-reflist').checked || document.getElementById('type-reflist2').checked) {<br />
var col2 = document.getElementById('type-reflist2').checked ? '|2' : '' ;<br />
if (document.getElementById('ldr').checked) {<br />
wikicode += "\{\{Reflist" + col2 + "|refs=\n\n}}\n";<br />
}<br />
else {<br />
wikicode += "\{\{Reflist" + col2 + "}}\n";<br />
}<br />
}<br />
else {alert('No type selected!');}<br />
$("#wpTextbox1").focus();<br />
insertTags(wikicode, '', '');<br />
document.getElementById('citediv'+numforms).innerHTML = '';<br />
}<br />
<br />
function getNamedRefs(calls) {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
var regex;<br />
if (calls) {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?\/ *?>/gi //'<br />
} else {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?>/gi //'<br />
}<br />
var namedrefs = new Array();<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[5]) {<br />
namedrefs[i] = ref[5];<br />
} else if (ref[3]) {<br />
namedrefs[i] = ref[3];<br />
} else {<br />
namedrefs[i] = ref[6];<br />
}<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return namedrefs;<br />
}<br />
<br />
function citeNamedRef() {<br />
var namedrefs = getNamedRefs(false);<br />
if (namedrefs == '') {<br />
oldFormHide();<br />
numforms++;<br />
var out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>References in text</legend>There are no named refs (<tt>&lt;ref name="Name"&gt;</tt>) in the text</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
oldFormHide();<br />
numforms++;<br />
var form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>References in article</legend>'+<br />
'<table cellspacing="5">'+<br />
'<tr><td><label for="namedrefs">&nbsp;Named references in text</label></td>'+<br />
'<td><select name="namedrefs" id="namedrefs">';<br />
for (var i=0;i<namedrefs.length;i++) {<br />
form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';<br />
}<br />
form+= '</select>'+<br />
'</td></tr></table>'+<br />
'<input type="button" value="Add citation" onClick="addnamedcite()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function addnamedcite() {<br />
var name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;<br />
var ref = '<ref name="'+name+'" />';<br />
$("#wpTextbox1").focus();<br />
insertTags(ref, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getAllRefs() {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
var text = document.getElementById('wpTextbox1').value;<br />
var regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"<br />
var allrefs = new Array();<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[0].search(/[^\s]{150}/) != -1) {<br />
ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");<br />
}<br />
ref[0] = ref[0].replace(/</g, "&lt;");<br />
ref[0] = ref[0].replace(/>/g, "&gt;");<br />
allrefs[i] = ref[0];<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return allrefs;<br />
}<br />
<br />
function NRcallError(namedrefs, refname) {<br />
for (var i=0; i<namedrefs.length; i++) {<br />
if (namedrefs[i] == refname) {<br />
return true;<br />
}<br />
}<br />
return false;<br />
}<br />
<br />
function errorCheck() {<br />
var allrefs = getAllRefs();<br />
var allrefscontent = new Array();<br />
var samecontentexclude = new Array();<br />
var sx=0;<br />
var templateexclude = new Array();<br />
var tx=0;<br />
var skipcheck = false;<br />
var namedrefcalls = getNamedRefs(true);<br />
for (var i=0; i<allrefs.length; i++) {<br />
allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8"); //"<br />
}<br />
var namedrefs = getNamedRefs(false);<br />
var errorlist = new Array();<br />
var q=0;<br />
var unclosed = document.getElementById('unclosed').checked;<br />
var samecontent = document.getElementById('samecontent').checked;<br />
var templates = document.getElementById('templates').checked;<br />
var repeated = document.getElementById('repeated').checked;<br />
var undef = document.getElementById('undef').checked;<br />
for (var i=0; i<allrefs.length; i++) {<br />
if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Unclosed <tt>&lt;ref&gt;</tt> tag</td></tr>';<br />
q++;<br />
}<br />
if (samecontent) {<br />
for (var d=0; d<samecontentexclude.length; d++) {<br />
if (allrefscontent[i] == samecontentexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var p=0;<br />
while (p<allrefs.length && !skipcheck) {<br />
if (allrefscontent[i] == allrefscontent[p] && i != p) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';<br />
q++;<br />
samecontentexclude[sx] = allrefscontent[i]<br />
sx++;<br />
break;<br />
}<br />
p++;<br />
}<br />
skipcheck=false;<br />
}<br />
if (templates) {<br />
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) {<br />
for (var x=0; x<templateexclude.length; x++) {<br />
if (allrefscontent[i] == templateexclude[x]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Does not use a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a></td></tr>';<br />
q++;<br />
templateexclude[tx] = allrefscontent[i];<br />
tx++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
}<br />
if (repeated) {<br />
var repeatnameexclude = new Array();<br />
var rx=0;<br />
for (var k=0; k<namedrefs.length; k++) {<br />
for (var d=0; d<repeatnameexclude.length; d++) {<br />
if (namedrefs[k] == repeatnameexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var z=0;<br />
while (z<namedrefs.length && !skipcheck) {<br />
if (namedrefs[k] == namedrefs[z] && k != z) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';<br />
q++;<br />
repeatnameexclude[rx] = namedrefs[z];<br />
rx++;<br />
break;<br />
}<br />
z++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (undef) {<br />
var undefexclude = new Array();<br />
var ux=0;<br />
for (var p=0; p<namedrefcalls.length; p++) {<br />
for (var d=0; d<undefexclude.length; d++) {<br />
if (allrefscontent[i] == undefexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
if (!NRcallError(namedrefs, namedrefcalls[p])) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">A <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';<br />
q++;<br />
undefexclude[ux] = namedrefs[p];<br />
ux++;<br />
}<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (q > 0) {<br />
return errorlist;<br />
} else {<br />
return 0;<br />
}<br />
}<br />
<br />
function dispErrors() {<br />
oldFormHide();<br />
var form = '<div id="errorform"><fieldset>'+<br />
'<legend>Error checking</legend>'+<br />
'<b>Check for:</b><br/>'+<br />
'<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+<br />
'<input type="checkbox" id="samecontent" /> References with the same content<br/>'+<br />
'<input type="checkbox" id="templates" /> References not using a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a><br/>'+<br />
'<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+<br />
'<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+<br />
'<input type="button" id="errorchecksubmit" value="Check for selected errors" onclick="doErrorCheck()"/>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function doErrorCheck() {<br />
var errors = errorCheck();<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
if (errors == 0) {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>Error checking</legend>No errors found.</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Error checking</legend>'+<br />
'<table border="1px">';<br />
for (var i=0; i<errors.length; i++) {<br />
form+=errors[i];<br />
}<br />
form+= '</table>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function makeBookCitationCode(callback) {<br />
var cite = '<ref';<br />
var refname = document.getElementById('refname').value;<br />
if (/\S/.test(refname)) {<br />
cite += ' name="' + refname + '"';<br />
}<br />
cite += '>\{\{';<br />
<br />
if (document.getElementById('cite_book').checked || document.getElementById('plain').checked) {<br />
cite += 'cite book';<br />
}<br />
else if (document.getElementById('citation').checked) {<br />
cite += 'citation';<br />
}<br />
else {alert('No template selected.');}<br />
<br />
var authorcite = '';<br />
var prevauthor = 0;<br />
for (var i=3;i>=1;i--) {<br />
//var author = document.getElementById('author' + i).value;<br />
var last = document.getElementById('last' + i).value;<br />
var first = document.getElementById('first' + i).value;<br />
var authorlink = document.getElementById('authorlink' + i).value;<br />
if (i==1 && !prevauthor) { i = ''; }<br />
if (/\S/.test(authorlink)) {<br />
authorcite = '|authorlink' + i + '=' + authorlink + authorcite;<br />
}<br />
if (/\S/.test(last)) {<br />
authorcite = '|last' + i + '=' + last + '|first' + i + '=' + first + authorcite;<br />
prevauthor = 1;<br />
}<br />
/*else if (/\S/.test(author)) {<br />
authorcite = '|author' + i + '=' + author + authorcite;<br />
prevauthor = 1;<br />
}*/<br />
}<br />
cite += authorcite;<br />
<br />
var simplefields = ["coauthors", "editor", "others", "title", "url", "accessdate","edition","series","volume","date","publisher","location","language","isbn","pages","chapter"];<br />
for (var i=0;i<simplefields.length;i++) {<br />
var fieldname = simplefields[i];<br />
var value = document.getElementById(fieldname).value;<br />
if (/\S/.test(value) || fieldname == "title") {<br />
if (fieldname == "pages") {<br />
if (/^\w+$/.test(value)) {<br />
fieldname = "page"; //Use page= instead of pages= if only one page. Makes p. 5 instead of pp. 5.<br />
}<br />
else {<br />
value = value.replace(/-/g, "–"); //Replace hyphens with en dashes [[WP:ENDASH]]<br />
value = value.replace(/,\s*\s?/g, ", "); //One space after each comma<br />
}<br />
}<br />
else if (fieldname == "date" && /^\d\d\d\d$/.test(value)) {<br />
fieldname = "year"; // Use year= instead of date= if only the year is specified<br />
}<br />
cite += '|' + fieldname + '=' + value;<br />
}<br />
}<br />
<br />
<br />
var otherfields = document.getElementById('otherfields').value;<br />
if (/\S/.test(otherfields)) {<br />
cite += '|' + otherfields;<br />
}<br />
<br />
if (document.getElementById('extraparams').checked) {<br />
cite += '|authormask=';<br />
if (!document.getElementById('citation').checked) {<br />
cite += '|trans_title=';<br />
}<br />
cite += '|format=';<br />
cite += '|origyear=';<br />
cite += '|oclc=';<br />
cite += '|doi=';<br />
cite += '|bibcode=';<br />
cite += '|id=';<br />
if (/\S/.test(document.getElementById('chapter').value)) {<br />
if (!document.getElementById('citation').checked) {<br />
cite += '|trans_chapter=';<br />
} <br />
cite += '|chapterurl=';<br />
}<br />
cite += '|quote=';<br />
cite += '|laysummary=';<br />
cite += '|laydate=';<br />
}<br />
<br />
cite += "}}</ref>";<br />
<br />
<br />
if (document.getElementById('plain').checked) {<br />
var match = /^(.*?)(\{\{.*}})(.*?)$/.exec(cite);<br />
if (match) {<br />
var citebeg = match[1];<br />
var citemid = match[2];<br />
var citeend = match[3];<br />
citemid = citemid.replace(/cite book/, "Vancite book");<br />
//alert(citebeg + ':::' + citemid + ':::' + citeend);<br />
//document.getElementById('fullcite').value = 'Updating...';<br />
var url = 'api.php?action=expandtemplates&format=xml&text=' + encodeURIComponent(citemid);<br />
document.getElementById('progress').style.visibility = "visible";<br />
var xmlhttpExpand = new XMLHttpRequest();<br />
xmlhttpExpand.onreadystatechange=function() {<br />
if(xmlhttpExpand.readyState==4) { <br />
if(xmlhttpExpand.status==200) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
var xmlDoc=xmlhttpExpand.responseXML.documentElement;<br />
var expanded = xmlDoc.getElementsByTagName("expandtemplates")[0].textContent;<br />
if (expanded == undefined) {<br />
expanded = xmlDoc.getElementsByTagName("expandtemplates")[0].childNodes[0].nodeValue;<br />
}<br />
expanded = expanded.replace(/<span.*?>/ig, '');<br />
expanded = expanded.replace(/<\/span>/ig, '');<br />
expanded = expanded.replace(/<nowiki\/?>/ig, '');<br />
expanded = expanded.replace(/\&\#32\;/ig, ' ');<br />
expanded = expanded.replace(/\&\#59\;/ig, ';');<br />
expanded = expanded.replace(/\&\#91\;/ig, '[');<br />
expanded = expanded.replace(/\&\#93\;/ig, ']');<br />
<br />
plaincite = citebeg + expanded + citeend;<br />
//alert(plaincite);<br />
callback(plaincite);<br />
}<br />
else<br />
alert('The query returned an error.');<br />
}<br />
}<br />
xmlhttpExpand.open("GET",url,true);<br />
xmlhttpExpand.send(null);<br />
}<br />
else {alert('Error A1');}<br />
}<br />
else {<br />
if (document.getElementById('verbose').checked) {<br />
cite = cite.replace(/\|/g, "\n|");<br />
}<br />
callback(cite);<br />
}<br />
}<br />
<br />
function makeCiteBook() {<br />
makeBookCitationCode(function(cite) { <br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', ''); <br />
if (!refToolDebug) { oldFormHide(); }<br />
});<br />
}<br />
<br />
function formatDate(datein, dateformat) {<br />
if (dateformat == '') {return (datein);}<br />
datein = datein.replace(/^\s*(.*?)\s*$/, "$1"); //Trim whitespace<br />
var year = -1;<br />
var month = -1;<br />
var date = -1;<br />
var match = /^(\d\d\d\d)-(\d\d?)(-(\d\d?))?$/.exec(datein);<br />
if(match) {<br />
//alert(' match[1]=' + match[1] + ' match[2]=#' + match[2] + '# match[3]=' + match[3] + ' match[4]=' + match[4] );<br />
year = parseInt(match[1], 10); //10 forces decimal conversion<br />
month = parseInt(match[2], 10);<br />
if (match[4]) {<br />
date = parseInt(match[4], 10);<br />
}<br />
}<br />
else if (/^\d\d? \w+ \d\d\d\d$/.test(datein) || /^\w+ \d\d?, \d\d\d\d$/.test(datein)) {<br />
var DT = new Date(datein);<br />
year = DT.getUTCFullYear();<br />
month = DT.getUTCMonth()+1;<br />
date = DT.getUTCDate()+1;<br />
}<br />
else if (datein == 'today') {<br />
var DT = new Date();<br />
year = DT.getUTCFullYear();<br />
month = DT.getUTCMonth()+1;<br />
date = DT.getUTCDate();<br />
}<br />
else {return (datein);}<br />
//alert('datein=' + datein + ', y=' + year + ', m=' + month + ', d=' + date);<br />
<br />
var zmonth = '';<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
if (date > -1) {<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString()<br />
}<br />
else { date = ''; }<br />
<br />
var datestr = dateformat;<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[month-1]);<br />
datestr = datestr.replace('<year>', year.toString());<br />
datestr = datestr.replace(/\s+/, ' ').replace(/^\s+/, '').replace(/(\D),/, '$1').replace(/-$/, '');<br />
return (datestr);<br />
}<br />
<br />
<br />
function getDateFormat() {<br />
var dateformat = '';<br />
if (document.getElementById('dmy')){<br />
if (document.getElementById('dmy').checked) {dateformat = '<date> <monthname> <year>'}<br />
else if (document.getElementById('mdy').checked) {dateformat = '<monthname> <date>, <year>'}<br />
else if (document.getElementById('ymd').checked) {dateformat = '<year>-<zmonth>-<zdate>'}<br />
}<br />
else if (citeUserDateFormat) {<br />
dateformat = citeUserDateFormat;<br />
} else {<br />
dateformat = citeGlobalDateFormat;<br />
}<br />
return (dateformat);<br />
}<br />
<br />
function reformatDates() {<br />
var dateformat = getDateFormat();<br />
//alert(':' + dateformat + ':');<br />
document.getElementById('accessdate').value = formatDate(document.getElementById('accessdate').value, dateformat);<br />
document.getElementById('date').value = formatDate(document.getElementById('date').value, dateformat);<br />
//document.getElementById('dateformat_hidden').value = getDateFormatShort();<br />
}<br />
<br />
/*function updateGetButton() {<br />
document.getElementById('urlget').disabled = document.getElementById('url').value == '';<br />
}*/<br />
<br />
function preview(wikitext) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
wikitext += '<references />';<br />
var url = "api.php?action=parse&format=xml&prop=text&text=" + encodeURIComponent(wikitext);<br />
var xmlhttp = new XMLHttpRequest();<br />
xmlhttp.onreadystatechange = function () {<br />
if (xmlhttp.readyState==4) {<br />
if(xmlhttp.status==200) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
var xmlDoc=xmlhttp.responseXML.documentElement;<br />
var previewHTML = xmlDoc.getElementsByTagName("text")[0].textContent;<br />
if (previewHTML == undefined) {<br />
previewHTML = xmlDoc.getElementsByTagName("text")[0].childNodes[0].nodeValue;<br />
}<br />
//alert(previewHTML);<br />
previewHTML = previewHTML.replace(/href="\//gi, 'href="//en.wikipedia.org/');<br />
document.getElementById('previewSpan').innerHTML = '<fieldset><legend>Citation preview</legend>' + previewHTML + '</fieldset>';<br />
}<br />
else<br />
alert('The query returned an error.');<br />
}<br />
};<br />
xmlhttp.open("GET", url, true);<br />
xmlhttp.send(null)<br />
}<br />
<br />
function previewCitationBook() {<br />
makeBookCitationCode(preview);<br />
}<br />
<br />
function previewCitationDefault() {<br />
var wikitext = makeCiteCode();<br />
preview(wikitext);<br />
}<br />
<br />
function pullJs() {<br />
var book_url = document.getElementById('url').value;<br />
if (book_url) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
var book_url_enc = encodeURIComponent(book_url);<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'googlebooksjs.py';<br />
var url = baseurl + '?book_url=' + book_url_enc + '&callback=setFormValues';<br />
/*var script = document.createElement("script"); <br />
script.setAttribute("src",url);<br />
script.setAttribute("type","text/javascript"); <br />
document.body.appendChild(script);*/<br />
JsonRequest(url);<br />
}else{<br />
alert('No URL.');<br />
}<br />
}<br />
<br />
function pullISBN() {<br />
var isbn = document.getElementById('isbn').value;<br />
isbn = isbn.replace(/[^0-9]/g,""); //Digits only<br />
if (isbn) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'getdiberri.py';<br />
var url = baseurl + '?isbn=' + isbn + '&callback=useDiberriData';<br />
/*var script = document.createElement("script");<br />
script.setAttribute("src",url);<br />
script.setAttribute("type","text/javascript");<br />
document.body.appendChild(script);*/<br />
JsonRequest(url);<br />
}else{<br />
alert('No ISBN.');<br />
}<br />
}<br />
<br />
function pullDOI() {<br />
var doi = document.getElementById('doi').value;<br />
if (doi) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'doifetchjs.py';<br />
var url = baseurl + '?doi=' + encodeURIComponent(doi) + '&callback=useDoiData';<br />
JsonRequest(url);<br />
}else{<br />
alert('No DOI.');<br />
}<br />
}<br />
<br />
function pullPMID() {<br />
alert('Not implemented yet...');<br />
/*var doi = document.getElementById('doi').value;<br />
if (doi) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'doifetchjs.py';<br />
var url = baseurl + '?doi=' + encodeURIComponent(doi) + '&callback=useDoiData';<br />
JsonRequest(url);<br />
}else{<br />
alert('No DOI.');<br />
}*/<br />
}<br />
<br />
function pullURL() {<br />
var url = document.getElementById('url').value;<br />
if (url) {<br />
document.getElementById('progress').style.visibility = "visible";<br />
if(!refTagURL) {refTagURL = defaultRefTagURL;}<br />
var baseurl = refTagURL + 'urlfetchjs.py';<br />
var url = baseurl + '?url=' + encodeURIComponent(url) + '&callback=useUrlData';<br />
JsonRequest(url);<br />
}else{<br />
alert('No URl.');<br />
}<br />
}<br />
<br />
function JsonRequest(url) {<br />
//importScriptURI(url) //Bad: does not import the same script more than once<br />
var script = document.createElement("script"); <br />
script.setAttribute("src",url);<br />
script.setAttribute("type","text/javascript"); <br />
//document.body.appendChild(script);<br />
document.getElementsByTagName('head')[0].appendChild(script);<br />
}<br />
<br />
function setFormValues(bookdata) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
//alert(bookdata);<br />
//alert(bookdata.page);<br />
if (bookdata.title.length != 0) { document.getElementById('title').value = bookdata.title; }<br />
if (bookdata.isbn.length != 0) { document.getElementById('isbn').value = bookdata.isbn; }<br />
if (bookdata.publisher.length != 0) { document.getElementById('publisher').value = bookdata.publisher; }<br />
if (bookdata.pages.length != 0) { <br />
document.getElementById('pages').value = bookdata.pages; <br />
document.getElementById('pages').style.backgroundColor = '#FFFF99';<br />
}<br />
if (bookdata.url.length != 0) { document.getElementById('url').value = bookdata.url; }<br />
if (bookdata.date.length != 0) { document.getElementById('date').value = bookdata.date; }<br />
<br />
for (var i=0;i<bookdata.authors.length && i<=2;i++) {<br />
authorn = i+1;<br />
var author = bookdata.authors[i];<br />
var match = /(.+)\s+(.+)/.exec(author);<br />
if (match) {<br />
document.getElementById('first' + authorn).value = match[1];<br />
document.getElementById('last' + authorn).value = match[2];<br />
}<br />
else {<br />
document.getElementById('last' + authorn).value = author;<br />
}<br />
}<br />
document.getElementById('coauthors').value = bookdata.authors.splice(3).join(', ')<br />
setAccessDateToday()<br />
makeRefname()<br />
}<br />
<br />
function useDiberriData(bookdata) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
if (bookdata.title.length != 0) { document.getElementById('title').value = bookdata.title; }<br />
if (bookdata.isbn.length != 0) { document.getElementById('isbn').value = bookdata.isbn; }<br />
if (bookdata.publisher.length != 0) { document.getElementById('publisher').value = bookdata.publisher; }<br />
if (bookdata.location.length != 0) { document.getElementById('location').value = bookdata.location; }<br />
if (bookdata.year.length != 0) { document.getElementById('date').value = bookdata.year; }<br />
if (bookdata.authors.length != 0) {<br />
authors = bookdata.authors.split(';', 4);<br />
for (var i=0;i<authors.length && i<=2;i++) {<br />
authorn = i+1;<br />
nameparts = authors[i].split(',', 2);<br />
document.getElementById('last' + authorn).value = nameparts[0].trim();<br />
if (nameparts.length == 2) {<br />
document.getElementById('first' + authorn).value = nameparts[1].trim();<br />
}<br />
}<br />
if (authors[3]) { document.getElementById('coauthors').value = authors[3].trim(); }<br />
}<br />
makeRefname() <br />
}<br />
<br />
function useDoiData(bookdata) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
if (bookdata.title) { document.getElementById('title').value = bookdata.title; }<br />
//if (bookdata.isbn.length != 0) { document.getElementById('isbn').value = bookdata.isbn; }<br />
//if (bookdata.publisher.length != 0) { document.getElementById('publisher').value = bookdata.publisher; }<br />
//if (bookdata.location.length != 0) { document.getElementById('location').value = bookdata.location; }<br />
if (bookdata.year) { document.getElementById('date').value = bookdata.year; }<br />
if (bookdata.issn) { document.getElementById('issn').value = bookdata.issn; }<br />
if (bookdata.journal) { document.getElementById('journal').value = bookdata.journal; }<br />
if (bookdata.volume) { document.getElementById('volume').value = bookdata.volume; }<br />
if (bookdata.issue) { document.getElementById('issue').value = bookdata.issue; }<br />
if (bookdata.pages) { document.getElementById('pages').value = bookdata.pages; }<br />
<br />
if (bookdata.authors) {<br />
var coauthors = [];<br />
for (var i=0;i<bookdata.authors.length;i++) {<br />
var authorn = i+1;<br />
var author = bookdata.authors[i];<br />
if (authorn == 1) {<br />
if (author.last) { document.getElementById('last').value = author.last.trim(); }<br />
if (author.first) { document.getElementById('first').value = author.first.trim(); }<br />
}<br />
else {<br />
var authorparts = [];<br />
if (author.first) { authorparts.push( author.first.trim() ); }<br />
if (author.last) { authorparts.push( author.last.trim() ); }<br />
coauthors.push(authorparts.join(' '));<br />
}<br />
}<br />
if (coauthors[0]) { document.getElementById('coauthors').value = coauthors.join(', '); }<br />
}<br />
makeRefname();<br />
}<br />
<br />
function useUrlData(data) {<br />
document.getElementById('progress').style.visibility = "hidden";<br />
if (data.title) { document.getElementById('title').value = data.title; }<br />
if (data.work) { document.getElementById('work').value = data.work; }<br />
if (data.page) { document.getElementById('pages').value = data.page; }<br />
if (data.date) {<br />
document.getElementById('date').value = formatDate(data.date, getDateFormat());<br />
}<br />
/*if (data.author) {<br />
var authors = data.author.replace(/ [Aa]nd /, ', ');<br />
var match = /(.+),\s*(.+)/.exec(authors);<br />
var firstauthor = '';<br />
if (match) {<br />
firstauthor = match[1];<br />
var coauthors = match[2];<br />
document.getElementById('coauthors').value = coauthors;<br />
}<br />
else {<br />
firstauthor = data.author;<br />
}<br />
var match = /(.+)\s+(.+)/.exec(firstauthor);<br />
if (match) {<br />
document.getElementById('first').value = match[1];<br />
document.getElementById('last').value = match[2];<br />
}<br />
else {<br />
document.getElementById('last').value = author;<br />
}<br />
}*/<br />
if (data.authors) {<br />
var coauthors = [];<br />
for (var i=0;i<data.authors.length;i++) {<br />
var authorn = i+1;<br />
var author = data.authors[i];<br />
if (authorn == 1) {<br />
var match = /(.+)\s+(.+)/.exec(author);<br />
if (match) {<br />
document.getElementById('first').value = match[1].trim();<br />
document.getElementById('last').value = match[2].trim();<br />
}<br />
else {<br />
document.getElementById('last').value = author.trim();<br />
}<br />
}<br />
else {<br />
coauthors.push(author);<br />
}<br />
}<br />
if (coauthors[0]) { document.getElementById('coauthors').value = coauthors.join(', '); }<br />
}<br />
}<br />
<br />
$( refbuttons );</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&diff=10317
MediaWiki:RefToolbarConfig.js
2017-06-09T08:44:56Z
<p>Nicolas Brouard: From https://en.wikipedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&oldid=695089025</p>
<hr />
<div>/* Sitewide options for the the Cite toolbar button:<br />
* All options should be specified<br />
*<br />
* "date format" sets the date format used for the function to insert the current date<br />
* Current available options:<br />
* date - the day of the month<br />
* zdate - day of the month, zero padded to 2 digits<br />
* monthname - The month name<br />
* month - The numberic month (1-12)<br />
* zmonth - numeric month, zero padded to 2 digits<br />
* year - The full year (4 digits)<br />
*<br />
* "autodate fields" is a list of template fields that should have a button to insert the current date<br />
* <br />
* "months" is a list of localized month names<br />
*<br />
* "modal" - if true, the dialogs will be modal windows, blocking access to the rest of the window.<br />
* See http://en.wikipedia.org/wiki/Modal_window<br />
* All dialogs in the toolbar are modal by default<br />
*<br />
* "autoparse" - if true, previewing a ref will automatically trigger a preview of the parsed wikitext.<br />
* It is not recommended to set this to true as a global setting as it may slow the script down for<br />
* people with slow connections.<br />
*<br />
* "expandtemplates" - if true, templates and parser functions will be expanded when getting page text<br />
* (templates inside of ref tags will not be expanded). This will allow references inside of templates or<br />
* references using {{#tag:ref}} to be listed in the named refs dialog and searched by error checks.<br />
* This may slow loading the named refs and error check dialogs.<br />
*/<br />
<br />
CiteTB.Options = {<br />
"date format" : "<date> <monthname> <year>",<br />
"autodate fields" : ['accessdate'],<br />
"months" : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],<br />
"modal" : true,<br />
"autoparse" : true,<br />
"expandtemplates" : false<br />
};<br />
<br />
// Cite template definitions<br />
new citeTemplate('cite web', 'web',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "website", "autofillprop":"journal"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite news', 'news',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "work", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},<br />
{"field": "agency"},<br />
{"field": "issue"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite book', 'book',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "date", "autofillprop":"year"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location", "autofillprop":"location"},<br />
{"field": "isbn", "autofillid":"isbn", "autofillprop":"isbn"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "edition", "autofillprop":"edition"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "chapter", "autofillprop":"chapter"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite journal', 'journal',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "journal", "autofillprop":"journal"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "volume", "autofillprop":"volume"},<br />
{"field": "issue", "autofillprop":"issue"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "pmid", "autofillid":"pmid"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"},<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "series"},<br />
{"field": "at", "tooltip":"cite-at-tooltip"},<br />
{"field": "trans-title"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "issn", "autofillprop":"issn"},<br />
{"field": "pmc"},<br />
{"field": "oclc"},<br />
{"field": "bibcode"},<br />
{"field": "id"},<br />
{"field": "quote"},<br />
{"field": "postscript", "tooltip":"cite-postscript-tooltip"}<br />
]);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': 'cite-samecontent-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag) {<br />
if ($.inArray(reflist[i].content, refs2) != -1) {<br />
if ($.inArray(reflist[i].content, errors) == -1) {<br />
errors.push(reflist[i].content);<br />
}<br />
} else {<br />
refs2.push(reflist[i].content);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-samecontent-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'repeated', 'desc':'cite-repeated-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
if ($.inArray(reflist[i].refname, refs2) != -1) {<br />
if ($.inArray(reflist[i].refname, errors) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
} else {<br />
refs2.push(reflist[i].refname);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-repeated-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'undefined', 'desc':'cite-undefined-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var longrefs = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
longrefs.push(reflist[i].refname);<br />
}<br />
}<br />
for(var j=0; i<reflist.length; j++) {<br />
if (reflist[i].shorttag && $.inArray(reflist[i].refname, errors) == -1 && $.inArray(reflist[i].refname, longrefs) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-undefined-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
CiteTB.init();</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Pagina_principale&diff=10308
Pagina principale
2013-05-18T18:20:02Z
<p>Nicolas Brouard: </p>
<hr />
<div><!--'''Pagina Principale'''--><br />
[[it-ii:Demopædia:Informazioni]]<br />
{{:it-ii:Demopædia:Informazioni}}<br />
{{SummaryShort}}<br />
[[ar-i:الصفحة الرئيسية]]<br />
[[cs-i:Hlavní strana]]<br />
[[en-i:Main_Page]]<br />
[[es-i:Página principal]]<br />
[[fr-i:Accueil]]<br />
[[id-ii:Halaman Utama]]<br />
[[it-ii:Pagina principale]]<br />
[[ja-ii:メインページ]]<br />
[[ko-ii:대문]]<br />
[[ms-ii:Laman utama]]<br />
[[ne-ii:मुख्य पृष्ठ]]<br />
[[pl-i:Strona główna]]<br />
[[pt-i:Página principal]]<br />
[[ru-i:Заглавная страница]]<br />
[[sh-i:Glavna strana]]<br />
[[th-ii:หน้าหลัก]]<br />
[[vi-ii:Trang Chính]]<br />
[[zh-ii:首页]]</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Pagina_principale&diff=10307
Pagina principale
2013-05-18T18:19:00Z
<p>Nicolas Brouard: </p>
<hr />
<div><!--'''Pagina Principale'''--><br />
[[it-ii:Demopædia:Informazioni]]<br />
{{:it-ii:Demopædia:Informazioni}}<br />
{{SummaryShort}}<br />
[[ar-i:الصفحة الرئيسية]]<br />
[[cs-i:Hlavní strana]]<br />
[[en-i:Main_Page]]<br />
[[es-i:Página principal]]<br />
[[fr-i:Accueil]]<br />
[[id-ii:Halaman Utama]]<br />
[[it-i:Pagina principale]]<br />
[[ja-ii:メインページ]]<br />
[[ko-ii:대문]]<br />
[[ms-ii:Laman utama]]<br />
[[ne-ii:मुख्य पृष्ठ]]<br />
[[pl-i:Strona główna]]<br />
[[pt-i:Página principal]]<br />
[[ru-i:Заглавная страница]]<br />
[[sh-i:Glavna strana]]<br />
[[th-ii:หน้าหลัก]]<br />
[[vi-ii:Trang Chính]]<br />
[[zh-ii:首页]]</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=10327
MediaWiki:Edittools
2012-08-30T15:23:15Z
<p>Nicolas Brouard: </p>
<hr />
<div><div id="editpage-specialchars" style="margin-top: 15px; border: 1px solid #aaaaaa; padding: 2px;" class="edittools-text edittools-version-045"><!-- INCREMENT THIS VERSION NUMBER TO MAKE CHANGES TO [[MediaWiki:Edittools.js]] LIVE --><br />
<!--<br />
This div gets automatically replaced with the actual edit tools by the code in [[MediaWiki:Edittools.js]]. Please make any changes there. Any content is this div is only shown to users with JavaScript turned off (or unsupported).<br />
--><br />
'''Copy and paste:''' – — ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ ← → · § &nbsp; '''Sign your posts on talk pages:''' <nowiki>~~~~</nowiki><br />
----<br />
<small><br />
Special Multilingual Demographic Dictionary :<br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}<br />
<pre><br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}</pre><br />
<charinsert><nowiki>{{</nowiki>TextTerm|+|}} <nowiki>{{</nowiki>RefNumber|+||}} <nowiki>{{</nowiki>Note|+|}} <nowiki>{{</nowiki>NoteTerm|}}</charinsert><br />
<nowiki>{{}}</nowiki> &nbsp; <nowiki>{{{}}}</nowiki> &nbsp; | &nbsp; <nowiki>[]</nowiki> &nbsp; <nowiki>[[]]</nowiki> &nbsp; <nowiki>[[Category:]]</nowiki> &nbsp; <nowiki>#REDIRECT [[]]</nowiki> &nbsp; &amp;nbsp; &nbsp; &lt;s>&lt;/s> &nbsp; &lt;sup>&lt;/sup> &nbsp; &lt;sub>&lt;/sub> &nbsp; &lt;code>&lt;/code> &nbsp; &lt;pre>&lt;/pre> &nbsp; &lt;blockquote>&lt;/blockquote> &nbsp; &lt;ref>&lt;/ref> &nbsp; <nowiki><br />
{{Reflist}}</nowiki> &nbsp; &lt;references/> &nbsp; &lt;includeonly>&lt;/includeonly> &nbsp; &lt;noinclude>&lt;/noinclude> &nbsp; <nowiki>{{DEFAULTSORT:}}</nowiki> &nbsp; &lt;nowiki>&lt;/nowiki> &nbsp; &lt;!-- --> &nbsp; &lt;span class="plainlinks">&lt;/span><br />
</small><br />
----<br />
<small><br />
'''Symbols:''' ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶ &nbsp; # ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞ &nbsp; ‘ ’ “ ” «» &nbsp; ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥ &nbsp; ♠ ♣ ♥ ♦ &nbsp; m² m³ &nbsp; ♭ ♯ ♮ &nbsp; © ® ™<br /><br />
'''Latin:''' A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ &nbsp; B b &nbsp; C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç &nbsp; D d Ď ď Đ đ Ḍ ḍ Ð ð &nbsp; E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ə ə &nbsp; F f &nbsp; G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ &nbsp; H h Ĥ ĥ Ħ ħ Ḥ ḥ &nbsp; I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į &nbsp; J j Ĵ ĵ &nbsp; K k Ķ ķ &nbsp; L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ &nbsp; M m Ṃ ṃ &nbsp; N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ &nbsp; O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ &nbsp; P p &nbsp; Q q &nbsp; R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ &nbsp; S s Ś ś Ŝ ŝ Š š Ş ş Ș ș Ṣ ṣ ß &nbsp; T t Ť ť Ţ ţ Ț ț Ṭ ṭ Þ þ &nbsp; U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ &nbsp; V v &nbsp; W w Ŵ ŵ &nbsp; X x &nbsp; Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ &nbsp; Z z Ź ź Ż ż Ž ž &nbsp; ß Ð ð Þ þ Ə ə &nbsp; <nowiki>{{Unicode|}}</nowiki> <br /><br />
'''Greek:''' Ά ά Έ έ Ή ή Ί ί Ό ό Ύ ύ Ώ ώ &nbsp; Α α Β β Γ γ Δ δ &nbsp; Ε ε Ζ ζ Η η Θ θ &nbsp; Ι ι Κ κ Λ λ Μ μ &nbsp; Ν ν Ξ ξ Ο ο Π π &nbsp; Ρ ρ Σ σ ς Τ τ Υ υ &nbsp; Φ φ Χ χ Ψ ψ Ω ω &nbsp; <nowiki>{{Polytonic|}}</nowiki> <br /><br />
'''Cyrillic:''' А а Б б В в Г г &nbsp; Ґ ґ Ѓ ѓ Д д Ђ ђ &nbsp; Е е Ё ё Є є Ж ж &nbsp; З з Ѕ ѕ И и І і &nbsp; Ї ї Й й Ј ј К к &nbsp; Ќ ќ Л л Љ љ М м &nbsp; Н н Њ њ О о П п &nbsp; Р р С с Т т Ћ ћ &nbsp; У у Ў ў Ф ф Х х &nbsp; Ц ц Ч ч Џ џ Ш ш &nbsp; Щ щ Ъ ъ Ы ы Ь ь &nbsp; Э э Ю ю Я я &nbsp; ́ <br /><br />
'''IPA:''' t̪ d̪ ʈ ɖ ɟ ɡ ɢ ʡ ʔ &nbsp; ɸ ʃ ʒ ɕ ʑ ʂ ʐ ʝ ɣ ʁ ʕ ʜ ʢ ɦ &nbsp; ɱ ɳ ɲ ŋ ɴ &nbsp; ʋ ɹ ɻ ɰ &nbsp; ʙ ʀ ɾ ɽ &nbsp; ɫ ɬ ɮ ɺ ɭ ʎ ʟ &nbsp; ɥ ʍ ɧ &nbsp; ɓ ɗ ʄ ɠ ʛ &nbsp; ʘ ǀ ǃ ǂ ǁ &nbsp; ɨ ʉ ɯ &nbsp; ɪ ʏ ʊ &nbsp; ɘ ɵ ɤ &nbsp; ə ɚ &nbsp; ɛ ɜ ɝ ɞ ʌ ɔ &nbsp; ɐ ɶ ɑ ɒ &nbsp; ʰ ʷ ʲ ˠ ˤ ⁿ ˡ &nbsp; ˈ ˌ ː ˑ ̪ &nbsp; <nowiki>{{IPA|}}</nowiki><br />
</small><br />
<!--<br />
Everything up to here gets automatically replaced with the JavaScript edit tools for users with JavaScript enabled.<br />
--><br />
</div><br />
<br />
<div style="margin-top: 1em;" id="editpage-copywarn2"><br />
<strong style="font-size: 130%;">Please note:</strong><br />
* When you click Save page, your changes will immediately become visible to everyone. If you wish to run a test, please edit the [[Wikipedia:Sandbox|Sandbox]] instead.<br />
*Please post only [[Wikipedia:Wikipedia is an encyclopedia|encyclopedic]] information that can be [[Wikipedia:Verifiability|verified]] by external sources. Please maintain a [[Wikipedia:Neutral point of view|neutral]], unbiased point of view.<br />
* Please [[Wikipedia:Copy-paste|do not copy and paste]] from copyrighted websites – only [[Wikipedia:public domain|public domain]] resources can be copied without permission.<br />
</div></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools.js&diff=10325
MediaWiki:Edittools.js
2012-08-30T15:13:10Z
<p>Nicolas Brouard: </p>
<hr />
<div>// copied from [[mw:User:Alex Smotrov/edittools.js]], modified for use on the English Wikipedia.<br />
// enableForAllFields() feature from [[commons:MediaWiki:Edittools.js]]<br />
// combined and modified by [[User:Ilmari Karonen]]<br />
// after making changes to this page and testing them, update the number after "edittools-version-" in [[MediaWiki:Edittools]] to purge the cache for everyone<br />
<br />
if (typeof (EditTools_set_focus) == 'undefined')<br />
var EditTools_set_focus = true;<br />
<br />
if (typeof (EditTools_set_focus_initially) == 'undefined')<br />
var EditTools_set_focus_initially = EditTools_set_focus;<br />
<br />
var EditTools =<br />
{<br />
charinsert : {<br />
'Insert': ' – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § Sign_your_posts_on_talk_pages: ~~\~~ Cite_your_sources: <ref>+</ref>',<br />
'Wiki markup': 'Insert: – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § ~~\~~ <ref>+</ref> Wiki_markup: {\{+}} {\{\{+}}} | {\{TextTerm|demography|1+}} {\{RefNumber|+13|0|1}} {\{NonRefTerm|+}} {\{Note|+|}} {\{NoteTerm|+}} [+] [\[+]] [\[Category:+]] #REDIRECT.[\[+]] &nbsp; <s>+</s> <sup>+</sup> <sub>+</sub> <code>+</code> <pre>+</pre> <blockquote>+</blockquote> <ref.name="+"/> {\{#tag:ref|+|group="nb"}} {\{Reflist}} <references/> <includeonly>+</includeonly> <noinclude>+</noinclude> {\{DEFAULTSORT:+}} <nowiki>+</nowiki> <!--.+_--> <span.class="plainlinks">+</span>',<br />
'Symbols': '~ | ¡¿†‡↔↑↓•¶ # ½⅓⅔¼¾⅛⅜⅝⅞∞ ‘+’ “+” ‹+› «+» ⟨+⟩ ¤₳฿₵¢₡₢$₫₯€₠₣ƒ₴₭₤ℳ₥₦№₧₰£៛₨₪৳₮₩¥ ♠♣♥♦ m² m³ ♭♯♮ ©®™ ◌ {\{Unicode|+}}', <br />
'Latin': 'A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ B b C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç D d Ď ď Đ đ Ḍ ḍ Ð ð E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ɛ ɛ Ə ə F f G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ H h Ĥ ĥ Ħ ħ Ḥ ḥ I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į J j Ĵ ĵ K k Ķ ķ L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ M m Ṃ ṃ N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ Ŋ ŋ O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ Ɔ ɔ P p Q q R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ S s Ś ś Ŝ ŝ Š š Ş ş Ṣ ṣ ß T t Ť ť Ţ ţ Ṭ ṭ Þ þ U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ V v W w Ŵ ŵ X x Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ Z z Ź ź Ż ż Ž ž ß Ð ð Þ þ Ŋ ŋ Ə ə {\{Unicode|+}}',<br />
'Greek': 'ΆάΈέΉήΊίΌόΎύΏώ ΑαΒβΓγΔδ ΕεΖζΗηΘθ ΙιΚκΛλΜμ ΝνΞξΟοΠπ ΡρΣσςΤτΥυ ΦφΧχΨψΩω ᾼᾳᾴᾺὰᾲᾶᾷἈἀᾈᾀἉἁᾉᾁἌἄᾌᾄἊἂᾊᾂἎἆᾎᾆἍἅᾍᾅἋἃᾋᾃἏἇᾏᾇ ῈὲἘἐἙἑἜἔἚἒἝἕἛἓ ῌῃῄῊὴῂῆῇἨἠᾘᾐἩἡᾙᾑἬἤᾜᾔἪἢᾚᾒἮἦᾞᾖἭἥᾝᾕἫἣᾛᾓἯἧᾟᾗ ῚὶῖἸἰἹἱἼἴἺἲἾἶἽἵἻἳἿἷ ῸὸὈὀὉὁὌὄὊὂὍὅὋὃ ῤῬῥ ῪὺῦὐὙὑὔὒὖὝὕὛὓὟὗ ῼῳῴῺὼῲῶῷὨὠᾨᾠὩὡᾩᾡὬὤᾬᾤὪὢᾪᾢὮὦᾮᾦὭὥᾭᾥὫὣᾫᾣὯὧᾯᾧ {\{Polytonic|+}}',<br />
'Cyrillic': 'АаБбВвГг ҐґЃѓДдЂђ ЕеЁёЄєЖж ЗзЅѕИиІі ЇїЙйЈјКк ЌќЛлЉљМм НнЊњОоПп РрСсТтЋћ УуЎўФфХх ЦцЧчЏџШш ЩщЪъЫыЬь ЭэЮюЯя ӘәӨөҒғҖҗ ҚқҜҝҢңҮү ҰұҲҳҸҹҺһ ҔҕӢӣӮӯҘҙ ҠҡҤҥҪҫӐӑ ӒӓӔӕӖӗӰӱ ӲӳӸӹӀ ҞҟҦҧҨҩҬҭ ҴҵҶҷҼҽҾҿ ӁӂӃӄӇӈӋӌ ӚӛӜӝӞӟӠӡ ӤӥӦӧӪӫӴӵ ́',<br />
'Hebrew': 'אבגדהוזחטיךכלםמןנסעףפץצקרשת ׳ ״ װױײ',<br />
'Arabic': ' Transcription: ʾ ṯ ḥ ḫ ẖ ḏ š ṣ ḍ ṭ ẓ ʿ ġ ẗ ا ﺁ ب ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه ة و ي ى ء أ إ ؤ ئ',<br />
'IPA (English)': 'ˈ ˌ ŋ ɡ tʃ dʒ ʃ ʒ θ ð ʔ iː ɪ uː ʊ ʌ ɜr eɪ ɛ æ oʊ ɒ ɔː ɔɪ ɔr ɑː ɑr aɪ aʊ ə ər ɨ ɵ ʉ {\{IPA-en|+}} {\{IPA|/+/}} ‹+›',<br />
'IPA': 'ʈɖɟɡɢʡʔ ɸβθðʃʒɕʑʂʐçʝɣχʁħʕʜʢɦ ɱɳɲŋɴ ʋɹɻɰ ʙⱱʀɾɽ ɬ ɮ ɺ ɭʎʟ ʍɥɧ ʼ ɓɗʄɠʛ ʘǀǃǂǁ ɨʉɯ ɪʏʊ øɘɵɤ ə ɛœɜɞʌɔ æ ɐ ɶɑɒ ʰʱʷʲˠˤˀ ᵊ k̚ ⁿˡ ˈˌːˑ t̪ d̪ s̺ s̻ θ̼ s̬ n̥ ŋ̊ a̤ a̰ β̞ ˕ r̝ ˔ o˞ ɚ ɝ e̘ e̙ u̟ i̠ ɪ̈ e̽ ɔ̹ ɔ̜ n̩ ə̆ ə̯ ə̃ ȷ̃ ɫ z̴ ə̋ ə́ ə̄ ə̀ ə̏ ə̌ ə̂ ə᷄ ə᷅ ə᷇ ə᷆ ə᷈ ə᷉ t͡ʃ d͡ʒ t͜ɬ ‿ ˥ ˦ ˧ ˨ ˩ ꜛ ꜜ | ‖ ↗ ↘ k͈ s͎ {\{IPA|+}}',<br />
'Math and logic': '− × ÷ ⋅ ° ∗ ∘ ± ∓ ≤ ≥ ≠ ≡ ≅ ≜ ≝ ≐ ≃ ≈ ⊕ ⊗ ⇐ ⇔ ⇒ ∞ ← ↔ → ≪ ≫ ∝ √ ∤ ≀ ◅ ▻ ⋉ ⋊ ⋈ ∴ ∵ ↦ ¬ ∧ ∨ ⊻ ∀ ∃ ∈ ∉ ∋ ⊆ ⊈ ⊊ ⊂ ⊄ ⊇ ⊉ ⊋ ⊃ ⊅ ∪ ∩ ∑ ∏ ∐ ′ ∫ ∬ ∭ ∮ ∇ ∂ ∆ ∅ ℂ ℍ ℕ ℙ ℚ ℝ ℤ ℵ ⌊ ⌋ ⌈ ⌉ ⊤ ⊥ ⊢ ⊣ ⊧ □ ∠ ⟨ ⟩ {\{frac|+|}} &nbsp; &minus; <math>+</math> {\{math|+}}'<br />
},<br />
<br />
charinsertDivider : "\240",<br />
<br />
extraCSS : '\<br />
#editpage-specialchars {\<br />
margin-top: 15px;\<br />
border-width: 1px;\<br />
border-style: solid;\<br />
border-color: #aaaaaa;\<br />
padding: 2px;\<br />
}\<br />
#editpage-specialchars a {\<br />
}\<br />
#editpage-specialchars a:hover {\<br />
}\<br />
',<br />
<br />
appendExtraCSS : function ()<br />
{<br />
appendCSS(EditTools.extraCSS);<br />
},<br />
<br />
<br />
cookieName : 'edittoolscharsubset',<br />
<br />
createEditTools : function (placeholder)<br />
{<br />
var box = document.createElement("div");<br />
box.id = "editpage-specialchars";<br />
box.title = 'Click on the character or tag to insert it into the edit window';<br />
<br />
//append user-defined sets<br />
if (window.charinsertCustom)<br />
for (id in charinsertCustom)<br />
if (EditTools.charinsert[id]) EditTools.charinsert[id] += ' ' + charinsertCustom[id];<br />
else EditTools.charinsert[id] = charinsertCustom[id];<br />
<br />
//create drop-down select<br />
var prevSubset = 0, curSubset = 0;<br />
var sel = document.createElement('select'), id;<br />
for (id in EditTools.charinsert)<br />
sel.options[sel.options.length] = new Option(id, id);<br />
sel.selectedIndex = 0;<br />
sel.style.cssFloat = sel.style.styleFloat = 'left';<br />
sel.style.marginRight = '5px';<br />
sel.title = 'Choose character subset';<br />
sel.onchange = sel.onkeyup = selectSubset;<br />
box.appendChild(sel);<br />
<br />
//create "recall" switch<br />
if (window.editToolsRecall) {<br />
var recall = document.createElement('span');<br />
recall.appendChild(document.createTextNode('↕')); // ↔<br />
recall.onclick = function () {<br />
sel.selectedIndex = prevSubset;<br />
selectSubset();<br />
}<br />
with (recall.style) { cssFloat = styleFloat = 'left'; marginRight = '5px'; cursor = 'pointer'; }<br />
box.appendChild(recall);<br />
}<br />
<br />
// load latest selection from cookies<br />
try {<br />
var cookieRe = new RegExp ("(?:^|;)\\s*" + EditTools.cookieName + "=(\\d+)\\s*(?:;|$)");<br />
var m = cookieRe.exec(document.cookie);<br />
if (m && m.length > 1 && parseInt(m[1]) < sel.options.length)<br />
sel.selectedIndex = parseInt(m[1]);<br />
} catch (err) { /* ignore */ }<br />
<br />
placeholder.parentNode.replaceChild(box, placeholder);<br />
selectSubset();<br />
return;<br />
<br />
function selectSubset ()<br />
{<br />
//remember previous (for "recall" button)<br />
prevSubset = curSubset;<br />
curSubset = sel.selectedIndex;<br />
//save into cookies for persistence<br />
try {<br />
var expires = new Date ();<br />
expires.setTime( expires.getTime() + 30 * 24 * 60 * 60 * 1000 ); // + 30 days<br />
document.cookie = EditTools.cookieName + "=" + curSubset + ";path=/;expires=" + expires.toUTCString();<br />
} catch (err) { /* ignore */ }<br />
//hide other subsets<br />
var pp = box.getElementsByTagName('p') ;<br />
for (var i=0; i<pp.length; i++)<br />
pp[i].style.display = 'none';<br />
//show/create current subset<br />
var id = sel.options[curSubset].value;<br />
var p = document.getElementById(id);<br />
if (!p){<br />
p = document.createElement('p');<br />
p.id = id;<br />
if (id == 'Arabic' || id == 'Hebrew'){ p.style.fontSize = '120%'; p.dir = 'rtl'; }<br />
EditTools.createTokens(p, EditTools.charinsert[id]);<br />
box.appendChild(p);<br />
}<br />
p.style.display = 'inline';<br />
} <br />
},<br />
createTokens : function (paragraph, str)<br />
{<br />
var tokens = str.split(' '), token, i, n;<br />
for (i = 0; i < tokens.length; i++) {<br />
token = tokens[i];<br />
n = token.indexOf('+');<br />
if (token == '' || token == '_')<br />
addText(EditTools.charinsertDivider + ' ');<br />
else if (token == '\n')<br />
paragraph.appendChild(document.createElement('br'));<br />
else if (token == '___')<br />
paragraph.appendChild(document.createElement('hr'));<br />
else if (token.charAt(token.length-1) == ':') // : at the end means just text<br />
addBold(token);<br />
else if (n == 0) // +<tag> -> <tag>+</tag><br />
addLink(token.substring(1), '</' + token.substring(2), token.substring(1));<br />
else if (n > 0) // <tag>+</tag><br />
addLink(token.substring(0,n), token.substring(n+1));<br />
else if (token.length > 2 && token.charCodeAt(0) > 127) //a string of insertable characters<br />
for (var j=0; j < token.length; j++) addLink(token.charAt(j), '');<br />
else<br />
addLink(token, '');<br />
}<br />
return;<br />
<br />
function addLink (tagOpen, tagClose, name)<br />
{<br />
var a = document.createElement('a');<br />
tagOpen = tagOpen.replace(/\./g,' ');<br />
tagClose = tagClose ? tagClose.replace(/_/g,' ') : '';<br />
name = name || tagOpen + tagClose;<br />
name = name.replace(/\\n/g,'');<br />
a.appendChild(document.createTextNode(name));<br />
a.href = "#";<br />
addHandler( a, 'click', new Function( "evt", "insertTags('" + tagOpen + "', '" + tagClose + "', ''); return killEvt( evt );" ) );<br />
paragraph.appendChild(a);<br />
addText(' ');<br />
}<br />
function addBold (text)<br />
{<br />
var b = document.createElement('b');<br />
b.appendChild(document.createTextNode(text.replace(/_/g,' ')));<br />
paragraph.appendChild(b);<br />
addText(' ');<br />
} <br />
function addText (txt)<br />
{<br />
paragraph.appendChild(document.createTextNode(txt));<br />
}<br />
},<br />
<br />
<br />
enableForAllFields : function ()<br />
{<br />
if (typeof (insertTags) != 'function' || window.WikEdInsertTags) return;<br />
// insertTags from the site-wide /skins-1.5/common/edit.js just inserts in the first<br />
// textarea in the document. Evidently, that's not good if we have multiple textareas.<br />
// My first idea was to simply add a hidden textarea as the first one, and redefine<br />
// insertTags such that it copied first the last active textareas contents over to that hidden<br />
// field, set the cursor or selection there, let the standard insertTags do its thing, and<br />
// then copy the hidden field's text, cursor position and selection back to the currently<br />
// active field. Unfortunately, that is just as complex as simply copying the whole code<br />
// from wikibits to here and let it work on the right text field in the first place.<br />
var texts = document.getElementsByTagName ('textarea'); <br />
for (var i = 0; i < texts.length; i++) {<br />
addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
// While we're at it, also enable it for input fields<br />
texts = document.getElementsByTagName ('input');<br />
for (var i = 0; i < texts.length; i++) {<br />
if (texts[i].type == 'text') addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
insertTags = EditTools.insertTags; // Redefine the global insertTags<br />
},<br />
<br />
last_active_textfield : null,<br />
<br />
registerTextField : function (evt)<br />
{<br />
var e = evt || window.event;<br />
var node = e.target || e.srcElement;<br />
if (!node) return;<br />
EditTools.last_active_textfield = node.id;<br />
return true;<br />
},<br />
<br />
getTextArea : function ()<br />
{<br />
var txtarea = null;<br />
if (EditTools.last_active_textfield && EditTools.last_active_textfield != "")<br />
txtarea = document.getElementById (EditTools.last_active_textfield);<br />
if (!txtarea) {<br />
// Fallback option: old behaviour<br />
if (document.editform) {<br />
txtarea = document.editform.wpTextbox1;<br />
} else {<br />
// Some alternate form? Take the first one we can find<br />
txtarea = document.getElementsByTagName ('textarea');<br />
if (txtarea.length > 0) txtarea = txtarea[0]; else txtarea = null;<br />
}<br />
}<br />
return txtarea;<br />
},<br />
<br />
insertTags : function (tagOpen, tagClose, sampleText)<br />
{<br />
var txtarea = EditTools.getTextArea ();<br />
if (!txtarea) return;<br />
<br />
<br />
/* Usability initiative compatibility */<br />
if ( typeof $j != 'undefined' && typeof $j.fn.textSelection != 'undefined' ) {<br />
$j( txtarea ).textSelection(<br />
'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }<br />
);<br />
return;<br />
}<br />
<br />
<br />
var selText, isSample = false;<br />
<br />
function checkSelectedText ()<br />
{<br />
if (!selText) {<br />
selText = sampleText; isSample = true;<br />
} else if (selText.charAt (selText.length - 1) == ' ') { // Exclude ending space char<br />
selText = selText.substring (0, selText.length - 1);<br />
tagClose += ' ';<br />
} <br />
}<br />
<br />
if (document.selection && document.selection.createRange) { // IE/Opera<br />
// Save window scroll position<br />
var winScroll = 0;<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
winScroll = document.documentElement.scrollTop;<br />
else if (document.body)<br />
winScroll = document.body.scrollTop;<br />
// Get current selection <br />
txtarea.focus();<br />
var range = document.selection.createRange();<br />
selText = range.text;<br />
// Insert tags<br />
checkSelectedText ();<br />
range.text = tagOpen + selText + tagClose;<br />
// Mark sample text as selected<br />
if (isSample && range.moveStart) {<br />
if (window.opera) tagClose = tagClose.replace (/\n/g, "");<br />
range.moveStart( 'character', - tagClose.length - selText.length); <br />
range.moveEnd ('character', - tagClose.length); <br />
}<br />
range.select (); <br />
// Restore window scroll position<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
document.documentElement.scrollTop = winScroll;<br />
else if (document.body)<br />
document.body.scrollTop = winScroll;<br />
} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla<br />
// Save textarea scroll position<br />
var textScroll = txtarea.scrollTop;<br />
// Get current selection<br />
txtarea.focus();<br />
var startPos = txtarea.selectionStart;<br />
var endPos = txtarea.selectionEnd;<br />
selText = txtarea.value.substring (startPos, endPos);<br />
// Insert tags<br />
checkSelectedText ();<br />
txtarea.value = txtarea.value.substring (0, startPos)<br />
+ tagOpen + selText + tagClose<br />
+ txtarea.value.substring (endPos);<br />
// Set new selection<br />
if (isSample) {<br />
txtarea.selectionStart = startPos + tagOpen.length;<br />
txtarea.selectionEnd = startPos + tagOpen.length + selText.length;<br />
} else {<br />
txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length;<br />
txtarea.selectionEnd = txtarea.selectionStart;<br />
}<br />
// Restore textarea scroll position<br />
txtarea.scrollTop = textScroll;<br />
}<br />
}, // end insertTags<br />
<br />
setup : function ()<br />
{<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder) return; // has this already been run once?<br />
EditTools.appendExtraCSS ();<br />
EditTools.createEditTools (placeholder);<br />
EditTools.enableForAllFields ();<br />
}<br />
<br />
}; // end EditTools<br />
<br />
// No need to hook this, as the loading of this page is itself hooked.<br />
EditTools.setup();</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Template:RefNumber&diff=10349
Template:RefNumber
2012-04-15T14:47:16Z
<p>Nicolas Brouard: </p>
<hr />
<div><!--'''Template:RefNumber'''-->{{<br />
#if: {{{Page|}}} |<br />
[[{{{Page}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]|<br />
[[{{{1}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]}}</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&diff=10295
MediaWiki:Gadget-refToolbar.js
2012-03-12T15:45:38Z
<p>Nicolas Brouard: Back to fr-ii</p>
<hr />
<div>if (( wgAction == 'edit' || wgAction == 'submit' ) && ( typeof refToolbarInstalled == 'undefined' )) {<br />
if (wgServer == "https://secure.wikimedia.org") {<br />
importScriptURI("https://secure.wikimedia.org/wikipedia/en/w/index.php?title=MediaWiki:RefToolbarBase.js&action=raw&ctype=text/javascript");<br />
} else {<br />
importScriptURI("http://fr-ii.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarBaseTextTerm.js&action=raw&ctype=text/javascript");<br />
}<br />
if( typeof $.wikiEditor != 'undefined' && typeof $.wikiEditor.modules.dialogs != 'undefined' ) {<br />
importScriptURI("http://fr-ii.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&action=raw&ctype=text/javascript");<br />
} else if( typeof $.wikiEditor != 'undefined' ) {<br />
importScriptURI("http://fr-ii.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarNoDialogsTextTerm.js&action=raw&ctype=text/javascript");<br />
} else {<br />
importScriptURI("http://en.wikipedia.org/w/index.php?title=MediaWiki:RefToolbarLegacy.js&action=raw&ctype=text/javascript");<br />
}<br />
refToolbarInstalled = true;<br />
}</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar&diff=10294
MediaWiki:Gadget-refToolbar
2012-03-12T14:59:28Z
<p>Nicolas Brouard: </p>
<hr />
<div>[[:en:Wikipedia:RefToolbar|refTools]], adds a "cite" button to the editing toolbar for quick and easy addition of commonly used citation templates. It also adds a TextTerm icon</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar&diff=10315
MediaWiki:Gadget-refToolbar
2012-03-12T14:58:19Z
<p>Nicolas Brouard: </p>
<hr />
<div>[[:en:Wikipedia:RefToolbar|refTools]], adds a "cite" button to the editing toolbar for quick and easy addition of commonly used citation templates. It also adds a TextTerm icon</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Pagina_principale&diff=10293
Pagina principale
2012-03-12T11:45:45Z
<p>Nicolas Brouard: Unfortunately upersed</p>
<hr />
<div><!--'''Pagina Principale'''--><br />
[[it-ii:Demopædia:Informazioni]]<br />
{{:it-ii:Demopædia:Informazioni}}<br />
{{SummaryShort}}</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations.js&diff=10286
MediaWiki:Gadget-citations.js
2012-03-12T11:44:18Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>/* _____________________________________________________________________________<br />
* | |<br />
* | === WARNING: GLOBAL GADGET FILE === |<br />
* | Changes to this page affect many users. |<br />
* | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |<br />
* |_____________________________________________________________________________|<br />
*<br />
* Imported from version 1.0 as of 17:18, 9 April 2011 (UTC) from [[User:Smith609/citations.js]]<br />
* Adds a "Citation bot" link to the toolbox, and a button beneath edit fields, see [[User:Smith609/citations]]<br />
*/<br />
<br />
// @Version 1.0 - Adds an "Expand citations" link to the toolbox, and a button beneath edit fields.<br />
<br />
function addCBToToolbox() {<br />
if (wgCanonicalNamespace != "Special") {<br />
var pTb = document.getElementById("p-tb");<br />
if( !pTb ) return;<br />
var escPageName = encodeURIComponent(wgPageName);<br />
<br />
addPortletLink("p-tb", "http://toolserver.org/~verisimilus/Bot/citation-bot/doibot.php?edit=toolbar&slow=1&user="+encodeURIComponent(wgUserName)+"&page="+escPageName, 'Expand citations', '', "Expand citations and fix common formatting errors");<br />
}<br />
}<br />
<br />
// Add a citation bot button<br />
function addCitationBot() {<br />
if (document.getElementById('wpDiff')){<br />
var diff = document.getElementById('wpDiff');<br />
var cbButton = document.createElement("input");<br />
cbButton.value="Citations";<br />
cbButton.type="submit";<br />
originalAction=document.getElementById('editform').getAttribute('action');<br />
cbButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
cbButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
diff.setAttribute("onmousedown", originalAction);<br />
diff.setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onkeydown", originalAction);<br />
diff.parentNode.insertBefore(cbButton, diff.nextSibling);<br />
}<br />
<br />
}<br />
addOnloadHook(addCitationBot);<br />
if( skin == "myskin" || skin == "simple" || skin == "monobook" || skin == "modern" || skin == "chick" || skin == "vector") {<br />
addOnloadHook(addCBToToolbox);<br />
}</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations&diff=10288
MediaWiki:Gadget-citations
2012-03-12T11:44:18Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>[[WP:Citation expander|Citation expander]]: Automatically expand and format citations (uses "[[WP:UCB|Citation bot]]").<br />
<!--<br />
* A link in the toolbox will activate [[User:Citation bot]] on the page that you are currently viewing. The bot will expand, format and tidy all references on that page.<br />
<br />
* A button underneath the edit box (next to "Show Changes") will send the contents of the edit box to the bot, which will process them and return the expanded version. This has two possible uses:<br />
** It allows the manual checking of the bot's output before an article is modified<br />
** You can type a partial citation in to an article (e.g. <code><nowiki>{{cite journal|pmid=12345}}</nowiki></code>), then have the bot expand this to a complete citation before you save the page.<br />
<br />
<br />
For more information about the functions performed by [[User:Citation bot|Citation bot]], see [[User:Citation bot|its user page]] or [[WP:UCB|an introductory page]]. For information about the gadget's script, see [[User:Smith609/citation]].<br />
--></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-wikEd.js&diff=10290
MediaWiki:Gadget-wikEd.js
2012-03-12T11:44:18Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor<br />
importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'<br />
+ '&action=raw&ctype=text/javascript');</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=Template:!&diff=10292
Template:!
2012-03-12T11:44:18Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div><!--'''Template:!'''-->|<noinclude><br />
From http://en.wikipedia.org/w/index.php?title=Template:%21&oldid=113778758<br />
</noinclude></div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&diff=10282
MediaWiki:RefToolbarTextTerm.js
2012-03-12T11:44:17Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>// Todo: make autodate an option in the CiteTemplate object, not a preference<br />
<br />
// Global object<br />
if (typeof CiteTB == 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
// only load on edit, unless its a user JS/CSS page<br />
if ((wgAction == 'edit' || wgAction == 'submit') && !((wgNamespaceNumber == 2 || wgNamespaceNumber == 4) &&<br />
(wgPageName.indexOf('.js') != -1 || wgPageName.indexOf('.css') != -1 ))) {<br />
<br />
appendCSS(".cite-form-td {"+<br />
"height: 0 !important;"+<br />
"padding: 0.1em !important;"+<br />
"}"); <br />
<br />
// Default options, these mainly exist so the script won't break if a new option is added<br />
CiteTB.DefaultOptions = {<br />
"date format" : "<year>-<zmonth>-<zdate>",<br />
"autodate fields" : [],<br />
"months" : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],<br />
"modal" : true,<br />
"autoparse" : false,<br />
"expandtemplates": false<br />
};<br />
// Get an option - user settings override global which override defaults<br />
CiteTB.getOption = function(opt) {<br />
if (CiteTB.UserOptions[opt] != undefined) {<br />
return CiteTB.UserOptions[opt];<br />
} else if (CiteTB.Options[opt] != undefined) {<br />
return CiteTB.Options[opt];<br />
}<br />
return CiteTB.DefaultOptions[opt];<br />
}<br />
<br />
CiteTB.init = function() {<br />
/* Main stuff, build the actual toolbar structure<br />
* 1. get the template list, make the dropdown list and set up the template dialog boxes<br />
* 2. actually build the toolbar:<br />
* * A section for cites<br />
* ** dropdown for the templates (previously defined)<br />
* ** button for named refs with a dialog box<br />
* ** button for errorcheck<br />
* 3. add the whole thing to the main toolbar<br />
*/<br />
<br />
if (typeof $j('div[rel=cites]')[0] != 'undefined') { // Mystery IE bug workaround<br />
return;<br />
}<br />
$j('head').trigger('reftoolbarbase');<br />
var $target = $j('#wpTextbox1');<br />
var temlist = {};<br />
var d = new Date();<br />
var start = d.getTime();<br />
for (var t in CiteTB.Templates) {<br />
var tem = CiteTB.Templates[t];<br />
sform = CiteTB.escStr(tem.shortform);<br />
var actionobj = { <br />
type: 'dialog',<br />
module: 'cite-dialog-'+sform<br />
};<br />
var dialogobj = {};<br />
dialogobj['cite-dialog-'+sform] = {<br />
resizeme: false,<br />
titleMsg: 'cite-dialog-'+sform, <br />
id: 'citetoolbar-'+sform,<br />
init: function() {}, <br />
html: tem.getInitial(), <br />
dialog: {<br />
width:675,<br />
open: function() { <br />
$j(this).html(CiteTB.getOpenTemplate().getForm());<br />
$j('.cite-prev-parse').bind( 'click', CiteTB.prevParseClick);<br />
},<br />
beforeclose: function() {<br />
CiteTB.resetForm();<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
$j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
peri: ' '<br />
}<br />
}, $j(this) );<br />
var ref = CiteTB.getRef(false, true);<br />
$j(this).dialog( 'close' );<br />
$j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
pre: ref<br />
}<br />
}, $j(this) );<br />
},<br />
'cite-form-showhide': CiteTB.showHideExtra,<br />
'cite-refpreview': function() { <br />
var ref = CiteTB.getRef(false, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $j("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-preview-label').show();<br />
div.find('.cite-ref-preview').text(ref).show();<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.prevParseClick();<br />
} else {<br />
div.find('.cite-prev-parse').show();<br />
div.find('.cite-prev-parsed-label').hide();<br />
div.find('.cite-preview-parsed').html('');<br />
} <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$j(this).dialog( 'close' );<br />
},<br />
'cite-form-reset': function() {<br />
CiteTB.resetForm();<br />
}<br />
}<br />
} <br />
};<br />
$target.wikiEditor('addDialog', dialogobj);<br />
if (!CiteTB.getOption('modal')) {<br />
//$j('#citetoolbar-'+sform).dialog('option', 'modal', false);<br />
}<br />
temlist[sform] = {label: tem.templatename, action: actionobj }; <br />
}<br />
<br />
var refsection = {<br />
'sections': {<br />
'cites': { <br />
type: 'toolbar', <br />
labelMsg: 'cite-section-label',<br />
groups: { <br />
'template': {<br />
tools: {<br />
'template': {<br />
type: 'select',<br />
labelMsg: 'cite-template-list',<br />
list: temlist<br />
} <br />
}<br />
},<br />
'namedrefs': {<br />
labelMsg: 'cite-named-refs-label',<br />
tools: {<br />
'nrefs': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-namedrefs'<br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/be/Nuvola_clipboard_lined.svg/22px-Nuvola_clipboard_lined.svg.png',<br />
section: 'cites',<br />
group: 'namedrefs',<br />
labelMsg: 'cite-named-refs-button'<br />
}<br />
}<br />
},<br />
'errorcheck': {<br />
labelMsg: 'cite-errorcheck-label',<br />
tools: {<br />
'echeck': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-errorcheck' <br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Nuvola_apps_korganizer-NO.png/22px-Nuvola_apps_korganizer-NO.png',<br />
section: 'cites',<br />
group: 'errorcheck',<br />
labelMsg: 'cite-errorcheck-button'<br />
}<br />
}<br />
}<br />
} <br />
} <br />
} <br />
};<br />
<br />
var defaultdialogs = { <br />
'cite-toolbar-errorcheck': {<br />
titleMsg: 'cite-errorcheck-label',<br />
id: 'citetoolbar-errorcheck',<br />
resizeme: false,<br />
init: function() {},<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
dialog: {<br />
width:550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-errorcheck-submit': function() {<br />
var errorchecks = $j("input[name='cite-err-test']:checked");<br />
var errors = [];<br />
for (var i=0; i<errorchecks.length; i++) {<br />
errors = errors.concat(CiteTB.ErrorChecks[$j(errorchecks[i]).val()].run());<br />
}<br />
CiteTB.displayErrors(errors);<br />
$j(this).dialog( 'close' ); <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$j(this).dialog( 'close' );<br />
}<br />
}<br />
}<br />
},<br />
'cite-toolbar-namedrefs': {<br />
titleMsg: 'cite-named-refs-title',<br />
resizeme: false,<br />
id: 'citetoolbar-namedrefs',<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
init: function() {},<br />
dialog: {<br />
width: 550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var refname = $j("#cite-namedref-select").val();<br />
if (refname == '') {<br />
return;<br />
}<br />
$j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
peri: ' '<br />
}<br />
}, $j(this) );<br />
$j(this).dialog( 'close' );<br />
$j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
pre: CiteTB.getNamedRef(refname, true)<br />
}<br />
}, $j(this) );<br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$j(this).dialog( 'close' );<br />
} <br />
}<br />
} <br />
}<br />
};<br />
<br />
$target.wikiEditor('addDialog', defaultdialogs);<br />
$j('#citetoolbar-namedrefs').unbind('dialogopen');<br />
if (!CiteTB.getOption('modal')) {<br />
//$j('#citetoolbar-namedrefs').dialog('option', 'modal', false);<br />
//$j('#citetoolbar-errorcheck').dialog('option', 'modal', false);<br />
appendCSS(".ui-widget-overlay {"+<br />
"display:none !important;"+<br />
"}"); <br />
}<br />
$target.wikiEditor('addToToolbar', refsection);<br />
} <br />
<br />
// Load local data - messages, cite templates, etc.<br />
$j(document).ready( function() {<br />
switch( wgUserLanguage ) {<br />
case 'de': // German<br />
var RefToolbarMessages = importScript('MediaWiki:RefToolbarMessages-de.js');<br />
break;<br />
default: // English<br />
var RefToolbarMessages = importScript('MediaWiki:RefToolbarMessages-en.js');<br />
}<br />
});<br />
<br />
// Setup the main object<br />
CiteTB.mainRefList = [];<br />
CiteTB.refsLoaded = false;<br />
<br />
// REF FUNCTIONS<br />
// Actually assemble a ref from user input<br />
CiteTB.getRef = function(inneronly, forinsert) {<br />
var template = CiteTB.getOpenTemplate();<br />
var templatename = template.templatename;<br />
var res = '';<br />
var refobj = {'shorttag':false};<br />
if (!inneronly) {<br />
var group = $j('#cite-'+CiteTB.escStr(template.shortform)+'-group').val();<br />
var refname = $j('#cite-'+CiteTB.escStr(template.shortform)+'-name').val();<br />
res += '<ref';<br />
if (refname) {<br />
refname = $j.trim(refname);<br />
res+=' name='+CiteTB.getQuotedString(refname);<br />
refobj.refname = refname;<br />
}<br />
if (group) {<br />
group = $j.trim(group);<br />
res+=' group='+CiteTB.getQuotedString(group);<br />
refobj.refgroup = group;<br />
}<br />
res+='>';<br />
}<br />
var content ='{{'+templatename;<br />
for( var i=0; i<template.basic.length; i++ ) {<br />
var fieldname = template.basic[i].field;<br />
var field = $j('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $j.trim(field.replace("|", "{{!}}"));<br />
}<br />
}<br />
if ($j('#cite-form-status').val() != 'closed') {<br />
for( var i=0; i<template.extra.length; i++ ) {<br />
var fieldname = template.extra[i].field;<br />
var field = $j('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $j.trim(field.replace("|", "{{!}}"));<br />
}<br />
}<br />
}<br />
content+= '}}';<br />
res+=content;<br />
refobj.content = content;<br />
if (!inneronly) {<br />
res+= '</ref>';<br />
}<br />
if (forinsert) {<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
return res;<br />
}<br />
<br />
// Make a reference to a named ref<br />
CiteTB.getNamedRef = function(refname, forinsert) {<br />
var inner = 'name=';<br />
if (forinsert) {<br />
CiteTB.mainRefList.push( {'shorttag':true, 'refname':refname} );<br />
}<br />
return '<ref name='+CiteTB.getQuotedString(refname)+' />'; <br />
}<br />
<br />
// Function to load the ref list<br />
CiteTB.loadRefs = function() {<br />
if (CiteTB.refsLoaded) {<br />
return;<br />
}<br />
CiteTB.getPageText(CiteTB.loadRefsInternal);<br />
}<br />
<br />
// Function that actually loads the list from the page text<br />
CiteTB.loadRefsInternal = function(text) { <br />
// What this does: extract first name/group extract second name/group shorttag inner content<br />
var refsregex = /< *ref(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?:\/ *>|>((?:.|\n)*?)< *\/ *ref *>)/gim<br />
// This should work regardless of the quoting used for names/groups and for linebreaks in the inner content <br />
while (true) {<br />
var ref = refsregex.exec(text);<br />
if (ref == null) {<br />
break;<br />
}<br />
var refobj = {};<br />
if (ref[9]) { // Content + short tag check<br />
//alert('"'+ref[9]+'"');<br />
refobj['content'] = ref[9]; <br />
refobj['shorttag'] = false;<br />
} else {<br />
refobj['shorttag'] = true;<br />
}<br />
if (ref[1] != '') { // First name/group<br />
if (ref[2]) {<br />
refobj['ref'+ref[1]] = ref[2];<br />
} else if (ref[3]) {<br />
refobj['ref'+ref[1]] = ref[3];<br />
} else {<br />
refobj['ref'+ref[1]] = ref[4];<br />
}<br />
}<br />
if (ref[5] != '') { // Second name/group<br />
if (ref[6]) {<br />
refobj['ref'+ref[5]] = ref[6];<br />
} else if (ref[7]) {<br />
refobj['ref'+ref[5]] = ref[7];<br />
} else {<br />
refobj['ref'+ref[5]] = ref[8];<br />
}<br />
}<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
CiteTB.refsLoaded = true;<br />
CiteTB.setupErrorCheck();<br />
CiteTB.setupNamedRefs()<br />
}<br />
<br />
// AJAX FUNCTIONS<br />
// Parse some wikitext and hand it off to a callback function<br />
CiteTB.parse = function(text, callback) {<br />
$j.post( wgServer+wgScriptPath+'/api.php',<br />
{action:'parse', title:wgPageName, text:text, prop:'text', format:'json'},<br />
function(data) {<br />
var html = data['parse']['text']['*'];<br />
callback(html);<br />
},<br />
'json'<br />
); <br />
}<br />
<br />
// Use the API to expand templates on some text<br />
CiteTB.expandtemplates = function(text, callback) {<br />
$j.post( wgServer+wgScriptPath+'/api.php',<br />
{action:'expandtemplates', title:wgPageName, text:text, format:'json'},<br />
function(data) {<br />
var restext = data['expandtemplates']['*'];<br />
callback(restext);<br />
},<br />
'json'<br />
);<br />
}<br />
<br />
// Function to get the page text<br />
CiteTB.getPageText = function(callback) {<br />
var section = $j("input[name='wpSection']").val();<br />
if ( section != '' ) {<br />
var postdata = {action:'query', prop:'revisions', rvprop:'content', pageids:wgArticleId, format:'json'};<br />
if (CiteTB.getOption('expandtemplates')) {<br />
postdata['rvexpandtemplates'] = '1';<br />
}<br />
$j.get( wgServer+wgScriptPath+'/api.php',<br />
postdata,<br />
function(data) {<br />
var pagetext = data['query']['pages'][wgArticleId.toString()]['revisions'][0]['*'];<br />
callback(pagetext);<br />
},<br />
'json'<br />
);<br />
} else {<br />
if (CiteTB.getOption('expandtemplates')) {<br />
CiteTB.expandtemplates($j('#wpTextbox1').wikiEditor('getContents').text(), callback);<br />
} else {<br />
callback($j('#wpTextbox1').wikiEditor('getContents').text());<br />
}<br />
}<br />
}<br />
<br />
// Autofill a template from an ID (ISBN, DOI, PMID)<br />
CiteTB.initAutofill = function() {<br />
var elemid = $j(this).attr('id');<br />
var res = /^cite\-auto\-(.*?)\-(.*)\-(.*)$/.exec(elemid);<br />
var tem = res[1];<br />
var field = res[2];<br />
var autotype = res[3];<br />
var id = $j('#cite-'+tem+'-'+field).val();<br />
if (!id) {<br />
return false;<br />
}<br />
var url = 'http://toolserver.org/~alexz/ref/lookup.php?';<br />
url+=autotype+'='+encodeURIComponent(id);<br />
url+='&template='+encodeURIComponent(tem);<br />
var s = document.createElement('script');<br />
s.setAttribute('src', url);<br />
s.setAttribute('type', 'text/javascript');<br />
document.getElementsByTagName('head')[0].appendChild(s);<br />
return false;<br />
}<br />
<br />
// Callback for autofill<br />
//TODO: Autofill the URL, at least for DOI<br />
CiteTB.autoFill = function(data, template, type) {<br />
var cl = 'cite-'+template+'-';<br />
$j('.'+cl+'title').val(data.title);<br />
if ($j('.'+cl+'last1')) {<br />
for(var i=0; i<data.authors.length; i++) {<br />
if ($j('.'+cl+'last'+(i+1)).length) {<br />
$j('.'+cl+'last'+(i+1)).val(data.authors[i][0]);<br />
$j('.'+cl+'first'+(i+1)).val(data.authors[i][1]);<br />
} else {<br />
var coauthors = [];<br />
for(var j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$j('.'+cl+'coauthors').val(coauthors.join(', '));<br />
break;<br />
}<br />
}<br />
} else if($j('.'+cl+'author1')) {<br />
for(var i=0; i<data.authors.length; i++) {<br />
if ($j('.'+cl+'author'+(i+1)).length) {<br />
$j('.'+cl+'author'+(i+1)).val(data.authors[i].join(', '));<br />
} else {<br />
var coauthors = [];<br />
for(var j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$j('.'+cl+'coauthors').val(coauthors.join(', '));<br />
break;<br />
}<br />
}<br />
} else {<br />
var authors = [];<br />
for(var i=0; j<data.authors.length; j++) {<br />
authors.push(data.authors[j].join(', '));<br />
}<br />
$j('.'+cl+'authors').val(authors.join(', '));<br />
} <br />
if (type == 'pmid' || type == 'doi') {<br />
if (type == 'doi') {<br />
var DT = new Date(data.date);<br />
$j('.'+cl+'date').val(CiteTB.formatDate(DT));<br />
} else {<br />
$j('.'+cl+'date').val(data.date);<br />
}<br />
$j('.'+cl+'journal').val(data.journal);<br />
$j('.'+cl+'volume').val(data.volume);<br />
$j('.'+cl+'issue').val(data.issue);<br />
$j('.'+cl+'pages').val(data.pages);<br />
} else if (type == 'isbn') {<br />
$j('.'+cl+'publisher').val(data.publisher);<br />
$j('.'+cl+'location').val(data.location);<br />
$j('.'+cl+'year').val(data.year);<br />
$j('.'+cl+'edition').val(data.edition);<br />
}<br />
}<br />
<br />
// FORM DIALOG FUNCTIONS<br />
// fill the accessdate param with the current date<br />
CiteTB.fillAccessdate = function() {<br />
var elemid = $j(this).attr('id');<br />
var res = /^cite\-date\-(.*?)\-(.*)$/.exec(elemid);<br />
var id = res[1];<br />
var field = res[2];<br />
var DT = new Date();<br />
datestr = CiteTB.formatDate(DT);<br />
$j('#cite-'+id+'-'+field).val(datestr);<br />
return false;<br />
}<br />
<br />
CiteTB.formatDate = function(DT) {<br />
var datestr = CiteTB.getOption('date format');<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate();<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString()<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', CiteTB.getOption('months')[DT.getUTCMonth()]);<br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return datestr;<br />
}<br />
<br />
// Function called after the ref list is loaded, to actually set the contents of the named ref dialog<br />
// Until the list is loaded, its just a "Loading" placeholder<br />
CiteTB.setupNamedRefs = function() {<br />
var names = []<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname) {<br />
names.push(CiteTB.mainRefList[i]);<br />
}<br />
}<br />
var stuff = $j('<div />')<br />
$j('#citetoolbar-namedrefs').html( stuff );<br />
if (names.length == 0) {<br />
stuff.html(mw.usability.getMsg('cite-no-namedrefs'));<br />
} else {<br />
stuff.html(mw.usability.getMsg('cite-namedrefs-intro'));<br />
var select = $j('<select id="cite-namedref-select">');<br />
select.append($j('<option value="" />').text(mw.usability.getMsg('cite-named-refs-dropdown')));<br />
for(var i=0; i<names.length; i++) {<br />
select.append($j('<option />').text(names[i].refname));<br />
}<br />
stuff.after(select);<br />
select.before('<br />'); <br />
var prevlabel = $j('<div id="cite-nref-preview-label" style="display:none;" />').html(mw.usability.getMsg('cite-raw-preview'));<br />
select.after(prevlabel);<br />
prevlabel.before("<br /><br />");<br />
prevlabel.after('<div id="cite-namedref-preview" style="padding:0.5em; font-size:110%" />');<br />
var parselabel = $j('<span id="cite-parsed-label" style="display:none;" />').html(mw.usability.getMsg('cite-parsed-label'));<br />
$j('#cite-namedref-preview').after(parselabel);<br />
parselabel.after('<div id="cite-namedref-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $j('<a href="#" id="cite-nref-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.html(mw.usability.getMsg('cite-form-parse'));<br />
$j('#cite-namedref-parsed').after(link);<br />
<br />
$j("#cite-namedref-select").bind( 'change', CiteTB.namedRefSelectClick);<br />
$j('#cite-nref-parse').bind( 'click', CiteTB.nrefParseClick);<br />
} <br />
}<br />
<br />
// Function to get the errorcheck form HTML<br />
CiteTB.setupErrorCheck = function() {<br />
var form = $j('<div id="cite-errorcheck-heading" />').html(mw.usability.getMsg('cite-errorcheck-heading'));<br />
var ul = $j("<ul id='cite-errcheck-list' />");<br />
for (var t in CiteTB.ErrorChecks) {<br />
test = CiteTB.ErrorChecks[t];<br />
ul.append(test.getRow());<br />
}<br />
form.append(ul);<br />
$j('#citetoolbar-errorcheck').html(form);<br />
}<br />
<br />
// Callback function for parsed preview<br />
CiteTB.fillNrefPreview = function(parsed) {<br />
$j('#cite-parsed-label').show();<br />
$j('#cite-namedref-parsed').html(parsed);<br />
}<br />
<br />
// Click handler for the named-ref parsed preview<br />
CiteTB.nrefParseClick = function() {<br />
var choice = $j("#cite-namedref-select").val();<br />
if (choice == '') {<br />
$j('#cite-parsed-label').hide();<br />
$j('#cite-namedref-parsed').text('');<br />
return false;<br />
}<br />
$j('#cite-nref-parse').hide();<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
CiteTB.parse(CiteTB.mainRefList[i].content, CiteTB.fillNrefPreview);<br />
return false;<br />
}<br />
} <br />
}<br />
<br />
// Click handler for the named-ref dropdown<br />
CiteTB.lastnamedrefchoice = '';<br />
CiteTB.namedRefSelectClick = function() {<br />
var choice = $j("#cite-namedref-select").val();<br />
if (CiteTB.lastnamedrefchoice == choice) {<br />
return;<br />
}<br />
CiteTB.lastnamedrefchoice = choice;<br />
$j('#cite-parsed-label').hide();<br />
$j('#cite-namedref-parsed').text('');<br />
if (choice == '') {<br />
$j('#cite-nref-preview-label').hide();<br />
$j('#cite-namedref-preview').text('');<br />
$j('#cite-nref-parse').hide();<br />
return;<br />
}<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
$j('#cite-nref-preview-label').show();<br />
$j('#cite-namedref-preview').text(CiteTB.mainRefList[i].content);<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.nrefParseClick();<br />
} else {<br />
$j('#cite-nref-parse').show();<br />
}<br />
}<br />
}<br />
}<br />
<br />
// callback function for parsed preview<br />
CiteTB.fillTemplatePreview = function(text) {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $j("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parsed-label').show();<br />
div.find('.cite-preview-parsed').html(text);<br />
}<br />
<br />
// Click handler for template parsed preview<br />
CiteTB.prevParseClick = function() {<br />
var ref = CiteTB.getRef(true, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $j("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parse').hide();<br />
CiteTB.parse(ref, CiteTB.fillTemplatePreview);<br />
}<br />
<br />
// Show/hide the extra fields in the dialog box<br />
CiteTB.showHideExtra = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $j("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
var setting = div.find(".cite-form-status").val();<br />
if ( setting == 'closed' ) {<br />
div.find(".cite-form-status").val('open');<br />
div.find('.cite-extra-fields').show(1, function() {<br />
// jQuery adds "display:block", which screws things up<br />
div.find('.cite-extra-fields').attr('style', 'width:100%; background-color:transparent;'); <br />
});<br />
} else {<br />
div.find(".cite-form-status").val('closed')<br />
div.find('.cite-extra-fields').hide();<br />
} <br />
}<br />
<br />
// Resets form fields and previews<br />
CiteTB.resetForm = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $j("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-preview-label').hide();<br />
div.find('.cite-ref-preview').text('').hide();<br />
div.find('.cite-prev-parsed-label').hide();<br />
div.find('.cite-preview-parsed').html('');<br />
div.find('.cite-prev-parse').hide();<br />
var id = CiteTB.escStr(template.shortform);<br />
$j('#citetoolbar-'+id+' input[type=text]').val('');<br />
}<br />
<br />
// STRING UTILITY FUNCTIONS<br />
// Returns a string quoted as necessary for name/group attributes<br />
CiteTB.getQuotedString = function(s) {<br />
var sp = /\s/.test(s); // spaces<br />
var sq = /\'/.test(s); // single quotes<br />
var dq = /\"/.test(s); // double quotes<br />
if (!sp && !sq && !dq) { // No quotes necessary<br />
return s;<br />
} else if (!dq) { // Can use double quotes<br />
return '"'+s+'"';<br />
} else if (!sq) { // Can use single quotes<br />
return "'"+s+"'";<br />
} else { // Has double and single quotes<br />
s = s.replace(/\"/g, '\"');<br />
return '"'+s+'"';<br />
}<br />
} <br />
// Fix up strings for output - capitalize first char, replace underscores with spaces<br />
CiteTB.fixStr = function(s) {<br />
s = s.slice(0,1).toUpperCase() + s.slice(1);<br />
s = s.replace('_',' ');<br />
return s;<br />
}<br />
// Escape spaces and quotes for use in HTML classes/ids<br />
CiteTB.escStr = function(s) {<br />
return s.replace(' ', '-').replace("'", "\'").replace('"', '\"');<br />
}<br />
<br />
// MISC FUNCTIONS<br />
// Determine which template form is open, and get the template object for it<br />
CiteTB.getOpenTemplate = function() {<br />
var dialogs = $j(".ui-dialog-content.ui-widget-content:visible");<br />
var templatename = $j(dialogs[0]).find(".cite-template").val();<br />
var template = null;<br />
return CiteTB.Templates[templatename];<br />
}<br />
<br />
// Display the report for the error checks<br />
CiteTB.displayErrors = function(errors) {<br />
$j('#cite-err-report').remove();<br />
var table = $j('<table id="cite-err-report" style="width:100%; border:1px solid #A9A9A9; background-color:#FFEFD5; padding:0.25em; margin-top:0.5em" />');<br />
$j('#editpage-copywarn').before(table);<br />
var tr1 = $j('<tr style="width:100%" />');<br />
var th1 = $j('<th style="width:60%; font-size:110%" />').html(mw.usability.getMsg('cite-err-report-heading'));<br />
var th2 = $j('<th style="text-align:right; width:40%" />');<br />
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/5/55/Gtk-stop.svg/20px-Gtk-stop.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-err-report-close')).attr('title', mw.usability.getMsg('cite-err-report-close'));<br />
var ad = $j('<a id="cite-err-check-close" />').attr('href', '#');<br />
ad.append(im);<br />
th2.append(ad);<br />
tr1.append(th1).append(th2);<br />
table.append(tr1);<br />
$j('#cite-err-check-close').bind('click', function() { $j('#cite-err-report').remove(); });<br />
if (errors.length == 0) {<br />
var tr = $j('<tr style="width:100%;" />');<br />
var td = $j('<td style="text-align:center; margin:1.5px;" />').html(mw.usability.getMsg('cite-err-report-empty'));<br />
tr.append(td);<br />
table.append(tr);<br />
<br />
return;<br />
}<br />
for(var e in errors) {<br />
var err = errors[e];<br />
var tr = $j('<tr style="width:100%;" />');<br />
var td1 = $j('<td style="border: 1px solid black; margin:1.5px; width:60%" />').html(err.err);<br />
var td2 = $j('<td style="border: 1px solid black; margin:1.5px; width:40%" />').html(mw.usability.getMsg(err.msg));<br />
tr.append(td1).append(td2);<br />
table.append(tr);<br />
}<br />
}<br />
<br />
} // End of code loaded only on edit</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Editpage.js&diff=10284
MediaWiki:Editpage.js
2012-03-12T11:44:17Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>//dynamically load Commons-style Edittools<br />
function createEdittoolsLink(){<br />
//get div.mw-editTools<br />
var box = document.getElementById('wpTextbox1')<br />
while (box && box.className!='mw-editTools') box=box.nextSibling<br />
if (!box) return<br />
//create a link<br />
var lnk = document.createElement('a')<br />
lnk.href = 'javascript:loadCommonsTools()'<br />
lnk.title = 'Load Commons-style Edittools' <br />
lnk.id = 'loadCommonsEdittoos'<br />
lnk.appendChild(document.createTextNode('[load edittools]'))<br />
lnk.style.cssText = 'float:right'<br />
box.appendChild(lnk)<br />
}<br />
function loadCommonsTools(){<br />
importScript('MediaWiki:Edittools.js')<br />
var lnk = document.getElementById('loadCommonsEdittoos')<br />
if (lnk) lnk.parentNode.removeChild(lnk)<br />
}<br />
if (doneOnloadHook) createEdittoolsLink()<br />
else addOnloadHook(createEdittoolsLink)</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=10272
MediaWiki:Common.js
2012-03-12T11:44:16Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>/* Test if an element has a certain class **************************************<br />
*<br />
* Description: Uses regular expressions and caching for better performance.<br />
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]<br />
*/<br />
<br />
var hasClass = (function () {<br />
var reCache = {};<br />
return function (element, className) {<br />
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);<br />
};<br />
})();<br />
<br />
<br />
<br />
<br />
/** Collapsible tables *********************************************************<br />
* From http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&oldid=219789618<br />
* Description: Allows tables to be collapsed, showing only the header. See<br />
* [[Wikipedia:NavFrame]].<br />
* Maintainers: [[User:R. Koot]]<br />
*/<br />
<br />
var autoCollapse = 2;<br />
var collapseCaption = "hide";<br />
var expandCaption = "show";<br />
<br />
function collapseTable( tableIndex )<br />
{<br />
var Button = document.getElementById( "collapseButton" + tableIndex );<br />
var Table = document.getElementById( "collapsibleTable" + tableIndex );<br />
<br />
if ( !Table || !Button ) {<br />
return false;<br />
}<br />
<br />
var Rows = Table.rows;<br />
<br />
if ( Button.firstChild.data == collapseCaption ) {<br />
for ( var i = 1; i < Rows.length; i++ ) {<br />
Rows[i].style.display = "none";<br />
}<br />
Button.firstChild.data = expandCaption;<br />
} else {<br />
for ( var i = 1; i < Rows.length; i++ ) {<br />
Rows[i].style.display = Rows[0].style.display;<br />
}<br />
Button.firstChild.data = collapseCaption;<br />
}<br />
}<br />
<br />
function createCollapseButtons()<br />
{<br />
var tableIndex = 0;<br />
var NavigationBoxes = new Object();<br />
var Tables = document.getElementsByTagName( "table" );<br />
<br />
for ( var i = 0; i < Tables.length; i++ ) {<br />
if ( hasClass( Tables[i], "collapsible" ) ) {<br />
<br />
/* only add button and increment count if there is a header row to work with */<br />
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];<br />
if (!HeaderRow) continue;<br />
var Header = HeaderRow.getElementsByTagName( "th" )[0];<br />
if (!Header) continue;<br />
<br />
NavigationBoxes[ tableIndex ] = Tables[i];<br />
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );<br />
<br />
var Button = document.createElement( "span" );<br />
var ButtonLink = document.createElement( "a" );<br />
var ButtonText = document.createTextNode( collapseCaption );<br />
<br />
Button.style.styleFloat = "right";<br />
Button.style.cssFloat = "right";<br />
Button.style.fontWeight = "normal";<br />
Button.style.textAlign = "right";<br />
Button.style.width = "6em";<br />
<br />
ButtonLink.style.color = Header.style.color;<br />
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );<br />
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );<br />
ButtonLink.appendChild( ButtonText );<br />
<br />
Button.appendChild( document.createTextNode( "[" ) );<br />
Button.appendChild( ButtonLink );<br />
Button.appendChild( document.createTextNode( "]" ) );<br />
<br />
Header.insertBefore( Button, Header.childNodes[0] );<br />
tableIndex++;<br />
}<br />
}<br />
<br />
for ( var i = 0; i < tableIndex; i++ ) {<br />
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {<br />
collapseTable( i );<br />
}<br />
}<br />
}<br />
<br />
addOnloadHook( createCollapseButtons );<br />
<br />
<br />
/** Dynamic Navigation Bars (experimental) *************************************<br />
*<br />
* Description: See [[Wikipedia:NavFrame]].<br />
* Maintainers: UNMAINTAINED<br />
*/<br />
<br />
// set up the words in your language<br />
var NavigationBarHide = '[' + collapseCaption + ']';<br />
var NavigationBarShow = '[' + expandCaption + ']';<br />
<br />
// shows and hides content and picture (if available) of navigation bars<br />
// Parameters:<br />
// indexNavigationBar: the index of navigation bar to be toggled<br />
function toggleNavigationBar(indexNavigationBar)<br />
{<br />
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);<br />
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);<br />
<br />
if (!NavFrame || !NavToggle) {<br />
return false;<br />
}<br />
<br />
// if shown now<br />
if (NavToggle.firstChild.data == NavigationBarHide) {<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if ( hasClass( NavChild, 'NavPic' ) ) {<br />
NavChild.style.display = 'none';<br />
}<br />
if ( hasClass( NavChild, 'NavContent') ) {<br />
NavChild.style.display = 'none';<br />
}<br />
}<br />
NavToggle.firstChild.data = NavigationBarShow;<br />
<br />
// if hidden now<br />
} else if (NavToggle.firstChild.data == NavigationBarShow) {<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if (hasClass(NavChild, 'NavPic')) {<br />
NavChild.style.display = 'block';<br />
}<br />
if (hasClass(NavChild, 'NavContent')) {<br />
NavChild.style.display = 'block';<br />
}<br />
}<br />
NavToggle.firstChild.data = NavigationBarHide;<br />
}<br />
}<br />
<br />
// adds show/hide-button to navigation bars<br />
function createNavigationBarToggleButton()<br />
{<br />
var indexNavigationBar = 0;<br />
// iterate over all < div >-elements <br />
var divs = document.getElementsByTagName("div");<br />
for (var i = 0; NavFrame = divs[i]; i++) {<br />
// if found a navigation bar<br />
if (hasClass(NavFrame, "NavFrame")) {<br />
<br />
indexNavigationBar++;<br />
var NavToggle = document.createElement("a");<br />
NavToggle.className = 'NavToggle';<br />
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);<br />
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');<br />
<br />
var NavToggleText = document.createTextNode(NavigationBarHide);<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {<br />
if (NavChild.style.display == 'none') {<br />
NavToggleText = document.createTextNode(NavigationBarShow);<br />
break;<br />
}<br />
}<br />
}<br />
<br />
NavToggle.appendChild(NavToggleText);<br />
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)<br />
for(var j=0; j < NavFrame.childNodes.length; j++) {<br />
if (hasClass(NavFrame.childNodes[j], "NavHead")) {<br />
NavFrame.childNodes[j].appendChild(NavToggle);<br />
}<br />
}<br />
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);<br />
}<br />
}<br />
}<br />
<br />
addOnloadHook( createNavigationBarToggleButton );<br />
<br />
/* Import more specific scripts if necessary */<br />
if (wgAction == 'edit' || wgAction == 'submit' || wgPageName == 'Special:Upload') { //scripts specific to editing pages<br />
importScript('MediaWiki:Common.js/edit.js');<br />
}</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js/edit.js&diff=10274
MediaWiki:Common.js/edit.js
2012-03-12T11:44:16Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>/* Any JavaScript here will be loaded for all users on every page load. */<br />
/** Extra toolbar options ******************************************************<br />
* <br />
* Description: Adds extra buttons to the editing toolbar.<br />
* <br />
* To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/vector.js]].<br />
* <br />
* Maintainers: [[User:MarkS]], [[User:Voice of All]], [[User:R. Koot]]<br />
*/<br />
<br />
if (mwCustomEditButtons) {<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",<br />
"speedTip": "Redirect",<br />
"tagOpen": "#REDIRECT [[",<br />
"tagClose": "]]",<br />
"sampleText": "Target page name"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",<br />
"speedTip": "Strike",<br />
"tagOpen": "<s>",<br />
"tagClose": "</s>",<br />
"sampleText": "Strike-through text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",<br />
"speedTip": "Line break",<br />
"tagOpen": "<br />",<br />
"tagClose": "",<br />
"sampleText": ""<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",<br />
"speedTip": "Superscript",<br />
"tagOpen": "<sup>",<br />
"tagClose": "</sup>",<br />
"sampleText": "Superscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",<br />
"speedTip": "Subscript",<br />
"tagOpen": "<sub>",<br />
"tagClose": "</sub>",<br />
"sampleText": "Subscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",<br />
"speedTip": "Small",<br />
"tagOpen": "<small>",<br />
"tagClose": "</small>",<br />
"sampleText": "Small Text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",<br />
"speedTip": "Insert hidden Comment",<br />
"tagOpen": "<!-- ",<br />
"tagClose": " -->",<br />
"sampleText": "Comment"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",<br />
"speedTip": "Insert a picture gallery",<br />
"tagOpen": "\n<gallery>\n",<br />
"tagClose": "\n</gallery>",<br />
"sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",<br />
"speedTip": "Insert block of quoted text",<br />
"tagOpen": "<blockquote>\n",<br />
"tagClose": "\n</blockquote>",<br />
"sampleText": "Block quote"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",<br />
"speedTip": "Insert a table",<br />
"tagOpen": '{| class="wikitable"\n|',<br />
"tagClose": "\n|}",<br />
"sampleText": "-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",<br />
"speedTip": "Insert a reference",<br />
"tagOpen": "<ref>",<br />
"tagClose": "</ref>",<br />
"sampleText": "Insert footnote text here"<br />
});<br />
}<br />
<br />
<br />
/** Fix edit summary prompt for undo ******************************************<br />
* Fixes the fact that the undo function combined with the "no edit summary prompter"<br />
* causes problems if leaving the edit summary unchanged.<br />
* Added by [[User:Deskana]], code by [[User:Tra]].<br />
* See also [[bugzilla:8912]].<br />
*/<br />
$(function () {<br />
if (document.location.search.indexOf("undo=") != -1 && document.getElementsByName('wpAutoSummary')[0]) {<br />
document.getElementsByName('wpAutoSummary')[0].value='1';<br />
}<br />
});<br />
<br />
<br />
/** Edittools javascript loader ************************************************<br />
*<br />
* Description: Pulls in [[MediaWiki:Edittools.js]]. Includes a cache-bypassing<br />
* version number in the URL in order to allow any changes to the edittools to<br />
* be rapidly deployed to users.<br />
*<br />
* Note that, by default, this function does nothing unless the element with<br />
* the ID "editpage-specialchars" (which contains the old edittools code in<br />
* [[MediaWiki:Edittools]], and will be retained as a placeholder in the new<br />
* implementation) has a class named "edittools-version-NNN", where NNN is a<br />
* number. If the class name has "test" before the number, the code will only<br />
* run for users who have set "window.testJsEdittools = true" in their user JS.<br />
* The "test" should be retained in the class name until the new edittools<br />
* implementation is ready and fully tested, and until at least 30 days have<br />
* passed since this loader stub was added (which will be in 27 June 2008).<br />
*<br />
* For compatibility with Alex Smotrov's original implementation, on which this<br />
* code is loosely based (see [[mw:User talk:Alex Smotrov/edittools.js]]), this<br />
* loader can also be disabled by setting "window.noDefaultEdittools = true".<br />
*<br />
* Maintainers: [[User:Ilmari Karonen]]<br />
*/<br />
<br />
//Prevent the static edittools from flashing before the compact edittools below is loaded.<br />
mw.util.addCSS('div.edittools-text { display:none; }');<br />
<br />
$(function () {<br />
// needs to be deferred until the DOM has fully loaded<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder || window.noDefaultEdittools) {<br />
//Show the static edittools again for users with "window.noDefaultEdittools=true".<br />
mw.util.addCSS('div.edittools-text { display:block; }');<br />
return;<br />
}<br />
var match = /(?:^| )edittools-version-(\d+)(?: |$)/.exec(placeholder.className);<br />
console.log("Common.js/edit.js match =" + match);<br />
// set window.testJsEdittools = true to enable testing before full deployment<br />
if (!match && window.testJsEdittools)<br />
match = /(?:^| )edittools-version-(test\d+)(?: |$)/.exec(placeholder.className);<br />
<br />
if (!match) return;<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=' + match[1];<br />
importScriptURI(url);<br />
});<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript';<br />
importScriptURI(url);</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools.js&diff=10276
MediaWiki:Edittools.js
2012-03-12T11:44:16Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div>// copied from [[mw:User:Alex Smotrov/edittools.js]], modified for use on the English Wikipedia.<br />
// enableForAllFields() feature from [[commons:MediaWiki:Edittools.js]]<br />
// combined and modified by [[User:Ilmari Karonen]]<br />
// after making changes to this page and testing them, update the number after "edittools-version-" in [[MediaWiki:Edittools]] to purge the cache for everyone<br />
<br />
if (typeof (EditTools_set_focus) == 'undefined')<br />
var EditTools_set_focus = true;<br />
<br />
if (typeof (EditTools_set_focus_initially) == 'undefined')<br />
var EditTools_set_focus_initially = EditTools_set_focus;<br />
<br />
var EditTools =<br />
{<br />
charinsert : {<br />
'Insert': ' – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § Sign_your_posts_on_talk_pages: ~~\~~ Cite_your_sources: <ref>+</ref>',<br />
'Wiki markup': 'Insert: – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § ~~\~~ <ref>+</ref> Wiki_markup: {\{+}} {\{\{+}}} | [+] [\[+]] [\[Category:+]] #REDIRECT.[\[+]] &nbsp; <s>+</s> <sup>+</sup> <sub>+</sub> <code>+</code> <pre>+</pre> <blockquote>+</blockquote> <ref.name="+"/> {\{#tag:ref|+|group="nb"}} {\{Reflist}} <references/> <includeonly>+</includeonly> <noinclude>+</noinclude> {\{DEFAULTSORT:+}} <nowiki>+</nowiki> <!--.+_--> <span.class="plainlinks">+</span>',<br />
'Symbols': '~ | ¡¿†‡↔↑↓•¶ # ½⅓⅔¼¾⅛⅜⅝⅞∞ ‘+’ “+” ‹+› «+» ⟨+⟩ ¤₳฿₵¢₡₢$₫₯€₠₣ƒ₴₭₤ℳ₥₦№₧₰£៛₨₪৳₮₩¥ ♠♣♥♦ m² m³ ♭♯♮ ©®™ ◌ {\{Unicode|+}}', <br />
'Latin': 'A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ B b C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç D d Ď ď Đ đ Ḍ ḍ Ð ð E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ɛ ɛ Ə ə F f G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ H h Ĥ ĥ Ħ ħ Ḥ ḥ I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į J j Ĵ ĵ K k Ķ ķ L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ M m Ṃ ṃ N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ Ŋ ŋ O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ Ɔ ɔ P p Q q R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ S s Ś ś Ŝ ŝ Š š Ş ş Ṣ ṣ ß T t Ť ť Ţ ţ Ṭ ṭ Þ þ U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ V v W w Ŵ ŵ X x Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ Z z Ź ź Ż ż Ž ž ß Ð ð Þ þ Ŋ ŋ Ə ə {\{Unicode|+}}',<br />
'Greek': 'ΆάΈέΉήΊίΌόΎύΏώ ΑαΒβΓγΔδ ΕεΖζΗηΘθ ΙιΚκΛλΜμ ΝνΞξΟοΠπ ΡρΣσςΤτΥυ ΦφΧχΨψΩω ᾼᾳᾴᾺὰᾲᾶᾷἈἀᾈᾀἉἁᾉᾁἌἄᾌᾄἊἂᾊᾂἎἆᾎᾆἍἅᾍᾅἋἃᾋᾃἏἇᾏᾇ ῈὲἘἐἙἑἜἔἚἒἝἕἛἓ ῌῃῄῊὴῂῆῇἨἠᾘᾐἩἡᾙᾑἬἤᾜᾔἪἢᾚᾒἮἦᾞᾖἭἥᾝᾕἫἣᾛᾓἯἧᾟᾗ ῚὶῖἸἰἹἱἼἴἺἲἾἶἽἵἻἳἿἷ ῸὸὈὀὉὁὌὄὊὂὍὅὋὃ ῤῬῥ ῪὺῦὐὙὑὔὒὖὝὕὛὓὟὗ ῼῳῴῺὼῲῶῷὨὠᾨᾠὩὡᾩᾡὬὤᾬᾤὪὢᾪᾢὮὦᾮᾦὭὥᾭᾥὫὣᾫᾣὯὧᾯᾧ {\{Polytonic|+}}',<br />
'Cyrillic': 'АаБбВвГг ҐґЃѓДдЂђ ЕеЁёЄєЖж ЗзЅѕИиІі ЇїЙйЈјКк ЌќЛлЉљМм НнЊњОоПп РрСсТтЋћ УуЎўФфХх ЦцЧчЏџШш ЩщЪъЫыЬь ЭэЮюЯя ӘәӨөҒғҖҗ ҚқҜҝҢңҮү ҰұҲҳҸҹҺһ ҔҕӢӣӮӯҘҙ ҠҡҤҥҪҫӐӑ ӒӓӔӕӖӗӰӱ ӲӳӸӹӀ ҞҟҦҧҨҩҬҭ ҴҵҶҷҼҽҾҿ ӁӂӃӄӇӈӋӌ ӚӛӜӝӞӟӠӡ ӤӥӦӧӪӫӴӵ ́',<br />
'Hebrew': 'אבגדהוזחטיךכלםמןנסעףפץצקרשת ׳ ״ װױײ',<br />
'Arabic': ' Transcription: ʾ ṯ ḥ ḫ ẖ ḏ š ṣ ḍ ṭ ẓ ʿ ġ ẗ ا ﺁ ب ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه ة و ي ى ء أ إ ؤ ئ',<br />
'IPA (English)': 'ˈ ˌ ŋ ɡ tʃ dʒ ʃ ʒ θ ð ʔ iː ɪ uː ʊ ʌ ɜr eɪ ɛ æ oʊ ɒ ɔː ɔɪ ɔr ɑː ɑr aɪ aʊ ə ər ɨ ɵ ʉ {\{IPA-en|+}} {\{IPA|/+/}} ‹+›',<br />
'IPA': 'ʈɖɟɡɢʡʔ ɸβθðʃʒɕʑʂʐçʝɣχʁħʕʜʢɦ ɱɳɲŋɴ ʋɹɻɰ ʙⱱʀɾɽ ɬ ɮ ɺ ɭʎʟ ʍɥɧ ʼ ɓɗʄɠʛ ʘǀǃǂǁ ɨʉɯ ɪʏʊ øɘɵɤ ə ɛœɜɞʌɔ æ ɐ ɶɑɒ ʰʱʷʲˠˤˀ ᵊ k̚ ⁿˡ ˈˌːˑ t̪ d̪ s̺ s̻ θ̼ s̬ n̥ ŋ̊ a̤ a̰ β̞ ˕ r̝ ˔ o˞ ɚ ɝ e̘ e̙ u̟ i̠ ɪ̈ e̽ ɔ̹ ɔ̜ n̩ ə̆ ə̯ ə̃ ȷ̃ ɫ z̴ ə̋ ə́ ə̄ ə̀ ə̏ ə̌ ə̂ ə᷄ ə᷅ ə᷇ ə᷆ ə᷈ ə᷉ t͡ʃ d͡ʒ t͜ɬ ‿ ˥ ˦ ˧ ˨ ˩ ꜛ ꜜ | ‖ ↗ ↘ k͈ s͎ {\{IPA|+}}',<br />
'Math and logic': '− × ÷ ⋅ ° ∗ ∘ ± ∓ ≤ ≥ ≠ ≡ ≅ ≜ ≝ ≐ ≃ ≈ ⊕ ⊗ ⇐ ⇔ ⇒ ∞ ← ↔ → ≪ ≫ ∝ √ ∤ ≀ ◅ ▻ ⋉ ⋊ ⋈ ∴ ∵ ↦ ¬ ∧ ∨ ⊻ ∀ ∃ ∈ ∉ ∋ ⊆ ⊈ ⊊ ⊂ ⊄ ⊇ ⊉ ⊋ ⊃ ⊅ ∪ ∩ ∑ ∏ ∐ ′ ∫ ∬ ∭ ∮ ∇ ∂ ∆ ∅ ℂ ℍ ℕ ℙ ℚ ℝ ℤ ℵ ⌊ ⌋ ⌈ ⌉ ⊤ ⊥ ⊢ ⊣ ⊧ □ ∠ ⟨ ⟩ {\{frac|+|}} &nbsp; &minus; <math>+</math> {\{math|+}}'<br />
},<br />
<br />
charinsertDivider : "\240",<br />
<br />
extraCSS : '\<br />
#editpage-specialchars {\<br />
margin-top: 15px;\<br />
border-width: 1px;\<br />
border-style: solid;\<br />
border-color: #aaaaaa;\<br />
padding: 2px;\<br />
}\<br />
#editpage-specialchars a {\<br />
}\<br />
#editpage-specialchars a:hover {\<br />
}\<br />
',<br />
<br />
appendExtraCSS : function ()<br />
{<br />
appendCSS(EditTools.extraCSS);<br />
},<br />
<br />
<br />
cookieName : 'edittoolscharsubset',<br />
<br />
createEditTools : function (placeholder)<br />
{<br />
var box = document.createElement("div");<br />
box.id = "editpage-specialchars";<br />
box.title = 'Click on the character or tag to insert it into the edit window';<br />
<br />
//append user-defined sets<br />
if (window.charinsertCustom)<br />
for (id in charinsertCustom)<br />
if (EditTools.charinsert[id]) EditTools.charinsert[id] += ' ' + charinsertCustom[id];<br />
else EditTools.charinsert[id] = charinsertCustom[id];<br />
<br />
//create drop-down select<br />
var prevSubset = 0, curSubset = 0;<br />
var sel = document.createElement('select'), id;<br />
for (id in EditTools.charinsert)<br />
sel.options[sel.options.length] = new Option(id, id);<br />
sel.selectedIndex = 0;<br />
sel.style.cssFloat = sel.style.styleFloat = 'left';<br />
sel.style.marginRight = '5px';<br />
sel.title = 'Choose character subset';<br />
sel.onchange = sel.onkeyup = selectSubset;<br />
box.appendChild(sel);<br />
<br />
//create "recall" switch<br />
if (window.editToolsRecall) {<br />
var recall = document.createElement('span');<br />
recall.appendChild(document.createTextNode('↕')); // ↔<br />
recall.onclick = function () {<br />
sel.selectedIndex = prevSubset;<br />
selectSubset();<br />
}<br />
with (recall.style) { cssFloat = styleFloat = 'left'; marginRight = '5px'; cursor = 'pointer'; }<br />
box.appendChild(recall);<br />
}<br />
<br />
// load latest selection from cookies<br />
try {<br />
var cookieRe = new RegExp ("(?:^|;)\\s*" + EditTools.cookieName + "=(\\d+)\\s*(?:;|$)");<br />
var m = cookieRe.exec(document.cookie);<br />
if (m && m.length > 1 && parseInt(m[1]) < sel.options.length)<br />
sel.selectedIndex = parseInt(m[1]);<br />
} catch (err) { /* ignore */ }<br />
<br />
placeholder.parentNode.replaceChild(box, placeholder);<br />
selectSubset();<br />
return;<br />
<br />
function selectSubset ()<br />
{<br />
//remember previous (for "recall" button)<br />
prevSubset = curSubset;<br />
curSubset = sel.selectedIndex;<br />
//save into cookies for persistence<br />
try {<br />
var expires = new Date ();<br />
expires.setTime( expires.getTime() + 30 * 24 * 60 * 60 * 1000 ); // + 30 days<br />
document.cookie = EditTools.cookieName + "=" + curSubset + ";path=/;expires=" + expires.toUTCString();<br />
} catch (err) { /* ignore */ }<br />
//hide other subsets<br />
var pp = box.getElementsByTagName('p') ;<br />
for (var i=0; i<pp.length; i++)<br />
pp[i].style.display = 'none';<br />
//show/create current subset<br />
var id = sel.options[curSubset].value;<br />
var p = document.getElementById(id);<br />
if (!p){<br />
p = document.createElement('p');<br />
p.id = id;<br />
if (id == 'Arabic' || id == 'Hebrew'){ p.style.fontSize = '120%'; p.dir = 'rtl'; }<br />
EditTools.createTokens(p, EditTools.charinsert[id]);<br />
box.appendChild(p);<br />
}<br />
p.style.display = 'inline';<br />
} <br />
},<br />
createTokens : function (paragraph, str)<br />
{<br />
var tokens = str.split(' '), token, i, n;<br />
for (i = 0; i < tokens.length; i++) {<br />
token = tokens[i];<br />
n = token.indexOf('+');<br />
if (token == '' || token == '_')<br />
addText(EditTools.charinsertDivider + ' ');<br />
else if (token == '\n')<br />
paragraph.appendChild(document.createElement('br'));<br />
else if (token == '___')<br />
paragraph.appendChild(document.createElement('hr'));<br />
else if (token.charAt(token.length-1) == ':') // : at the end means just text<br />
addBold(token);<br />
else if (n == 0) // +<tag> -> <tag>+</tag><br />
addLink(token.substring(1), '</' + token.substring(2), token.substring(1));<br />
else if (n > 0) // <tag>+</tag><br />
addLink(token.substring(0,n), token.substring(n+1));<br />
else if (token.length > 2 && token.charCodeAt(0) > 127) //a string of insertable characters<br />
for (var j=0; j < token.length; j++) addLink(token.charAt(j), '');<br />
else<br />
addLink(token, '');<br />
}<br />
return;<br />
<br />
function addLink (tagOpen, tagClose, name)<br />
{<br />
var a = document.createElement('a');<br />
tagOpen = tagOpen.replace(/\./g,' ');<br />
tagClose = tagClose ? tagClose.replace(/_/g,' ') : '';<br />
name = name || tagOpen + tagClose;<br />
name = name.replace(/\\n/g,'');<br />
a.appendChild(document.createTextNode(name));<br />
a.href = "#";<br />
addHandler( a, 'click', new Function( "evt", "insertTags('" + tagOpen + "', '" + tagClose + "', ''); return killEvt( evt );" ) );<br />
paragraph.appendChild(a);<br />
addText(' ');<br />
}<br />
function addBold (text)<br />
{<br />
var b = document.createElement('b');<br />
b.appendChild(document.createTextNode(text.replace(/_/g,' ')));<br />
paragraph.appendChild(b);<br />
addText(' ');<br />
} <br />
function addText (txt)<br />
{<br />
paragraph.appendChild(document.createTextNode(txt));<br />
}<br />
},<br />
<br />
<br />
enableForAllFields : function ()<br />
{<br />
if (typeof (insertTags) != 'function' || window.WikEdInsertTags) return;<br />
// insertTags from the site-wide /skins-1.5/common/edit.js just inserts in the first<br />
// textarea in the document. Evidently, that's not good if we have multiple textareas.<br />
// My first idea was to simply add a hidden textarea as the first one, and redefine<br />
// insertTags such that it copied first the last active textareas contents over to that hidden<br />
// field, set the cursor or selection there, let the standard insertTags do its thing, and<br />
// then copy the hidden field's text, cursor position and selection back to the currently<br />
// active field. Unfortunately, that is just as complex as simply copying the whole code<br />
// from wikibits to here and let it work on the right text field in the first place.<br />
var texts = document.getElementsByTagName ('textarea'); <br />
for (var i = 0; i < texts.length; i++) {<br />
addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
// While we're at it, also enable it for input fields<br />
texts = document.getElementsByTagName ('input');<br />
for (var i = 0; i < texts.length; i++) {<br />
if (texts[i].type == 'text') addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
insertTags = EditTools.insertTags; // Redefine the global insertTags<br />
},<br />
<br />
last_active_textfield : null,<br />
<br />
registerTextField : function (evt)<br />
{<br />
var e = evt || window.event;<br />
var node = e.target || e.srcElement;<br />
if (!node) return;<br />
EditTools.last_active_textfield = node.id;<br />
return true;<br />
},<br />
<br />
getTextArea : function ()<br />
{<br />
var txtarea = null;<br />
if (EditTools.last_active_textfield && EditTools.last_active_textfield != "")<br />
txtarea = document.getElementById (EditTools.last_active_textfield);<br />
if (!txtarea) {<br />
// Fallback option: old behaviour<br />
if (document.editform) {<br />
txtarea = document.editform.wpTextbox1;<br />
} else {<br />
// Some alternate form? Take the first one we can find<br />
txtarea = document.getElementsByTagName ('textarea');<br />
if (txtarea.length > 0) txtarea = txtarea[0]; else txtarea = null;<br />
}<br />
}<br />
return txtarea;<br />
},<br />
<br />
insertTags : function (tagOpen, tagClose, sampleText)<br />
{<br />
var txtarea = EditTools.getTextArea ();<br />
if (!txtarea) return;<br />
<br />
<br />
/* Usability initiative compatibility */<br />
if ( typeof $j != 'undefined' && typeof $j.fn.textSelection != 'undefined' ) {<br />
$j( txtarea ).textSelection(<br />
'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }<br />
);<br />
return;<br />
}<br />
<br />
<br />
var selText, isSample = false;<br />
<br />
function checkSelectedText ()<br />
{<br />
if (!selText) {<br />
selText = sampleText; isSample = true;<br />
} else if (selText.charAt (selText.length - 1) == ' ') { // Exclude ending space char<br />
selText = selText.substring (0, selText.length - 1);<br />
tagClose += ' ';<br />
} <br />
}<br />
<br />
if (document.selection && document.selection.createRange) { // IE/Opera<br />
// Save window scroll position<br />
var winScroll = 0;<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
winScroll = document.documentElement.scrollTop;<br />
else if (document.body)<br />
winScroll = document.body.scrollTop;<br />
// Get current selection <br />
txtarea.focus();<br />
var range = document.selection.createRange();<br />
selText = range.text;<br />
// Insert tags<br />
checkSelectedText ();<br />
range.text = tagOpen + selText + tagClose;<br />
// Mark sample text as selected<br />
if (isSample && range.moveStart) {<br />
if (window.opera) tagClose = tagClose.replace (/\n/g, "");<br />
range.moveStart( 'character', - tagClose.length - selText.length); <br />
range.moveEnd ('character', - tagClose.length); <br />
}<br />
range.select (); <br />
// Restore window scroll position<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
document.documentElement.scrollTop = winScroll;<br />
else if (document.body)<br />
document.body.scrollTop = winScroll;<br />
} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla<br />
// Save textarea scroll position<br />
var textScroll = txtarea.scrollTop;<br />
// Get current selection<br />
txtarea.focus();<br />
var startPos = txtarea.selectionStart;<br />
var endPos = txtarea.selectionEnd;<br />
selText = txtarea.value.substring (startPos, endPos);<br />
// Insert tags<br />
checkSelectedText ();<br />
txtarea.value = txtarea.value.substring (0, startPos)<br />
+ tagOpen + selText + tagClose<br />
+ txtarea.value.substring (endPos);<br />
// Set new selection<br />
if (isSample) {<br />
txtarea.selectionStart = startPos + tagOpen.length;<br />
txtarea.selectionEnd = startPos + tagOpen.length + selText.length;<br />
} else {<br />
txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length;<br />
txtarea.selectionEnd = txtarea.selectionStart;<br />
}<br />
// Restore textarea scroll position<br />
txtarea.scrollTop = textScroll;<br />
}<br />
}, // end insertTags<br />
<br />
setup : function ()<br />
{<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder) return; // has this already been run once?<br />
EditTools.appendExtraCSS ();<br />
EditTools.createEditTools (placeholder);<br />
EditTools.enableForAllFields ();<br />
}<br />
<br />
}; // end EditTools<br />
<br />
// No need to hook this, as the loading of this page is itself hooked.<br />
EditTools.setup();</div>
Nicolas Brouard
http://it-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=10278
MediaWiki:Edittools
2012-03-12T11:44:16Z
<p>Nicolas Brouard: una revisione importata: Reftoolbar for TextTerm</p>
<hr />
<div><div id="editpage-specialchars" style="margin-top: 15px; border: 1px solid #aaaaaa; padding: 2px;" class="edittools-text edittools-version-045"><!-- INCREMENT THIS VERSION NUMBER TO MAKE CHANGES TO [[MediaWiki:Edittools.js]] LIVE --><br />
<!--<br />
This div gets automatically replaced with the actual edit tools by the code in [[MediaWiki:Edittools.js]]. Please make any changes there. Any content is this div is only shown to users with JavaScript turned off (or unsupported).<br />
--><br />
'''Copy and paste:''' – — ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ ← → · § &nbsp; '''Sign your posts on talk pages:''' <nowiki>~~~~</nowiki><br />
----<br />
<small><br />
<nowiki>{{}}</nowiki> &nbsp; <nowiki>{{{}}}</nowiki> &nbsp; | &nbsp; <nowiki>[]</nowiki> &nbsp; <nowiki>[[]]</nowiki> &nbsp; <nowiki>[[Category:]]</nowiki> &nbsp; <nowiki>#REDIRECT [[]]</nowiki> &nbsp; &amp;nbsp; &nbsp; &lt;s>&lt;/s> &nbsp; &lt;sup>&lt;/sup> &nbsp; &lt;sub>&lt;/sub> &nbsp; &lt;code>&lt;/code> &nbsp; &lt;pre>&lt;/pre> &nbsp; &lt;blockquote>&lt;/blockquote> &nbsp; &lt;ref>&lt;/ref> &nbsp; <nowiki><br />
{{Reflist}}</nowiki> &nbsp; &lt;references/> &nbsp; &lt;includeonly>&lt;/includeonly> &nbsp; &lt;noinclude>&lt;/noinclude> &nbsp; <nowiki>{{DEFAULTSORT:}}</nowiki> &nbsp; &lt;nowiki>&lt;/nowiki> &nbsp; &lt;!-- --> &nbsp; &lt;span class="plainlinks">&lt;/span><br />
</small><br />
----<br />
<small><br />
'''Symbols:''' ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶ &nbsp; # ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞ &nbsp; ‘ ’ “ ” «» &nbsp; ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥ &nbsp; ♠ ♣ ♥ ♦ &nbsp; m² m³ &nbsp; ♭ ♯ ♮ &nbsp; © ® ™<br /><br />
'''Latin:''' A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ &nbsp; B b &nbsp; C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç &nbsp; D d Ď ď Đ đ Ḍ ḍ Ð ð &nbsp; E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ə ə &nbsp; F f &nbsp; G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ &nbsp; H h Ĥ ĥ Ħ ħ Ḥ ḥ &nbsp; I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į &nbsp; J j Ĵ ĵ &nbsp; K k Ķ ķ &nbsp; L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ &nbsp; M m Ṃ ṃ &nbsp; N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ &nbsp; O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ &nbsp; P p &nbsp; Q q &nbsp; R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ &nbsp; S s Ś ś Ŝ ŝ Š š Ş ş Ș ș Ṣ ṣ ß &nbsp; T t Ť ť Ţ ţ Ț ț Ṭ ṭ Þ þ &nbsp; U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ &nbsp; V v &nbsp; W w Ŵ ŵ &nbsp; X x &nbsp; Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ &nbsp; Z z Ź ź Ż ż Ž ž &nbsp; ß Ð ð Þ þ Ə ə &nbsp; <nowiki>{{Unicode|}}</nowiki> <br /><br />
'''Greek:''' Ά ά Έ έ Ή ή Ί ί Ό ό Ύ ύ Ώ ώ &nbsp; Α α Β β Γ γ Δ δ &nbsp; Ε ε Ζ ζ Η η Θ θ &nbsp; Ι ι Κ κ Λ λ Μ μ &nbsp; Ν ν Ξ ξ Ο ο Π π &nbsp; Ρ ρ Σ σ ς Τ τ Υ υ &nbsp; Φ φ Χ χ Ψ ψ Ω ω &nbsp; <nowiki>{{Polytonic|}}</nowiki> <br /><br />
'''Cyrillic:''' А а Б б В в Г г &nbsp; Ґ ґ Ѓ ѓ Д д Ђ ђ &nbsp; Е е Ё ё Є є Ж ж &nbsp; З з Ѕ ѕ И и І і &nbsp; Ї ї Й й Ј ј К к &nbsp; Ќ ќ Л л Љ љ М м &nbsp; Н н Њ њ О о П п &nbsp; Р р С с Т т Ћ ћ &nbsp; У у Ў ў Ф ф Х х &nbsp; Ц ц Ч ч Џ џ Ш ш &nbsp; Щ щ Ъ ъ Ы ы Ь ь &nbsp; Э э Ю ю Я я &nbsp; ́ <br /><br />
'''IPA:''' t̪ d̪ ʈ ɖ ɟ ɡ ɢ ʡ ʔ &nbsp; ɸ ʃ ʒ ɕ ʑ ʂ ʐ ʝ ɣ ʁ ʕ ʜ ʢ ɦ &nbsp; ɱ ɳ ɲ ŋ ɴ &nbsp; ʋ ɹ ɻ ɰ &nbsp; ʙ ʀ ɾ ɽ &nbsp; ɫ ɬ ɮ ɺ ɭ ʎ ʟ &nbsp; ɥ ʍ ɧ &nbsp; ɓ ɗ ʄ ɠ ʛ &nbsp; ʘ ǀ ǃ ǂ ǁ &nbsp; ɨ ʉ ɯ &nbsp; ɪ ʏ ʊ &nbsp; ɘ ɵ ɤ &nbsp; ə ɚ &nbsp; ɛ ɜ ɝ ɞ ʌ ɔ &nbsp; ɐ ɶ ɑ ɒ &nbsp; ʰ ʷ ʲ ˠ ˤ ⁿ ˡ &nbsp; ˈ ˌ ː ˑ ̪ &nbsp; <nowiki>{{IPA|}}</nowiki><br />
</small><br />
<!--<br />
Everything up to here gets automatically replaced with the JavaScript edit tools for users with JavaScript enabled.<br />
--><br />
</div><br />
<br />
<div style="margin-top: 1em;" id="editpage-copywarn2"><br />
<strong style="font-size: 130%;">Please note:</strong><br />
* When you click Save page, your changes will immediately become visible to everyone. If you wish to run a test, please edit the [[Wikipedia:Sandbox|Sandbox]] instead.<br />
*Please post only [[Wikipedia:Wikipedia is an encyclopedia|encyclopedic]] information that can be [[Wikipedia:Verifiability|verified]] by external sources. Please maintain a [[Wikipedia:Neutral point of view|neutral]], unbiased point of view.<br />
* Please [[Wikipedia:Copy-paste|do not copy and paste]] from copyrighted websites – only [[Wikipedia:public domain|public domain]] resources can be copied without permission.<br />
</div></div>
Nicolas Brouard