Jump to content

MediaWiki:RefToolbarLegacy.js: Difference between revisions

no edit summary
(Created page with "//<nowiki> var numforms = 0; var wikEdAutoUpdateUrl; var citeUserDateFormat; var refTagURL; var defaultRefTagURL = ''; var refToolDebug; String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); }; function easyCiteMain() { document.getElementById('citeselect').style.display = ''; document.getElementById('citemore').style.display = 'none'; } function refbuttons() { if (mw.toolbar) { mw.toolbar.addButton( { imageFile: "//upload.wikimedia.or...")
 
No edit summary
 
Line 273: Line 273:
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<span style="float:right"><a href="//en.bharatpedia.org.in/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '<span style="float:right"><a href="//en.bharatpedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '</fieldset><span id="previewSpan"></span></div>';
     '</fieldset><span id="previewSpan"></span></div>';
   document.getElementById('refToolFormArea').innerHTML = form;
   document.getElementById('refToolFormArea').innerHTML = form;
Line 298: Line 298:
<td><input type="text" tabindex=1 style="width:100%" id="author-link'+i+'"> \
<td><input type="text" tabindex=1 style="width:100%" id="author-link'+i+'"> \
<!--<a id="authorLinkAnchor'+i+'"><img id="authorLinkButton'+i+'" src="static/progress.gif" border="0" style="visibility: hidden" /></a> \
<!--<a id="authorLinkAnchor'+i+'"><img id="authorLinkButton'+i+'" src="static/progress.gif" border="0" style="visibility: hidden" /></a> \
<a href="//en.bharatpedia.org.in/wiki/%s" target="_blank"><img id="authorTryLink'+i+'" src="static/external.png" border="0" style="visibility: hidden" /></a> --> \
<a href="//en.bharatpedia.org/wiki/%s" target="_blank"><img id="authorTryLink'+i+'" src="static/external.png" border="0" style="visibility: hidden" /></a> --> \
</td> \
</td> \
</tr>';
</tr>';
Line 351: Line 351:
</table> \
</table> \
\
\
<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.bharatpedia.org.in/wiki/Template:Cite_book" target="_blank">[doc]</a></sup> \
<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.bharatpedia.org/wiki/Template:Cite_book" target="_blank">[doc]</a></sup> \
<input type="radio" tabindex=1 name="template" id="citation" value="citation"><label for="citation">\{\{citation}}</label> <sup><a href="//en.bharatpedia.org.in/wiki/Template:Citation" target="_blank">[doc]</a></sup> \
<input type="radio" tabindex=1 name="template" id="citation" value="citation"><label for="citation">\{\{citation}}</label> <sup><a href="//en.bharatpedia.org/wiki/Template:Citation" target="_blank">[doc]</a></sup> \
<input type="radio" tabindex=1 name="template" id="plain" value="plain"><label for="plain">plain wikicode (experimental)</label> \
<input type="radio" tabindex=1 name="template" id="plain" value="plain"><label for="plain">plain wikicode (experimental)</label> \
<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label> \
<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label> \
Line 417: Line 417:
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<span style="float:right"><a href="//en.bharatpedia.org.in/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '<span style="float:right"><a href="//en.bharatpedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '</fieldset><span id="previewSpan"></span></div>';
     '</fieldset><span id="previewSpan"></span></div>';
   document.getElementById('refToolFormArea').innerHTML = form;
   document.getElementById('refToolFormArea').innerHTML = form;
Line 467: Line 467:
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<span style="float:right"><a href="//en.bharatpedia.org.in/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '<span style="float:right"><a href="//en.bharatpedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '</fieldset><span id="previewSpan"></span></div>';
     '</fieldset><span id="previewSpan"></span></div>';
   document.getElementById('refToolFormArea').innerHTML = form;
   document.getElementById('refToolFormArea').innerHTML = form;
Line 499: Line 499:
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<span style="float:right"><a href="//en.bharatpedia.org.in/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '<span style="float:right"><a href="//en.bharatpedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '</fieldset><span id="previewSpan"></span></div>';
     '</fieldset><span id="previewSpan"></span></div>';
   document.getElementById('refToolFormArea').innerHTML = form;
   document.getElementById('refToolFormArea').innerHTML = form;
Line 545: Line 545:
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
<img id="progress" src="//upload.wikimedia.org/wikipedia/commons/5/59/RefToolbar_spinning_throbber.gif" style="visibility: hidden" />'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<input type="checkbox" tabindex=1 name="verbose" id="verbose" value="verbose"><label for="verbose">Vertical form</label>'+
     '<span style="float:right"><a href="//en.bharatpedia.org.in/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '<span style="float:right"><a href="//en.bharatpedia.org/wiki/Template:'+template.replace(/ /g, '_')+'" target="_blank">[Template documentation]</a></span>'+
     '</fieldset><span id="previewSpan"></span></div>';
     '</fieldset><span id="previewSpan"></span></div>';
   document.getElementById('refToolFormArea').innerHTML = form;
   document.getElementById('refToolFormArea').innerHTML = form;
Line 563: Line 563:
<input id="type-reflist" name="type" type="radio" tabindex=1 checked="checked"><label for="type-reflist">\{\{Reflist}}</label><br /> \
<input id="type-reflist" name="type" type="radio" tabindex=1 checked="checked"><label for="type-reflist">\{\{Reflist}}</label><br /> \
<input id="type-reflist2" name="type" type="radio" tabindex=1><label for="type-reflist2">\{\{Reflist|2}}</label><br /> \
<input id="type-reflist2" name="type" type="radio" tabindex=1><label for="type-reflist2">\{\{Reflist|2}}</label><br /> \
<input type="checkbox" tabindex=1 id="ldr"><label for="ldr">List-defined references</label> (<a href="//en.bharatpedia.org.in/wiki/Bharatpedia:Footnotes#List-defined_references" target="_blank">Info 1</a>, <a href="//en.bharatpedia.org.in/wiki/Help:Footnotes#List-defined_references" target="_blank">Info 2</a>)<br />\
<input type="checkbox" tabindex=1 id="ldr"><label for="ldr">List-defined references</label> (<a href="//en.bharatpedia.org/wiki/Bharatpedia:Footnotes#List-defined_references" target="_blank">Info 1</a>, <a href="//en.bharatpedia.org/wiki/Help:Footnotes#List-defined_references" target="_blank">Info 2</a>)<br />\
     <input type="button" value="Add references section" onClick="addRefSection()">'+
     <input type="button" value="Add references section" onClick="addRefSection()">'+
  '</fieldset></div>';
  '</fieldset></div>';
Line 796: Line 796:
         if (allrefscontent[i] == allrefscontent[p] && i != p) {
         if (allrefscontent[i] == allrefscontent[p] && i != p) {
           errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';
           errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';
           errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.bharatpedia.org.in/wiki/Bharatpedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';
           errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.bharatpedia.org/wiki/Bharatpedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';
           q++;
           q++;
           samecontentexclude[sx] = allrefscontent[i]
           samecontentexclude[sx] = allrefscontent[i]
Line 815: Line 815:
         if (!skipcheck) {
         if (!skipcheck) {
           errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
           errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';
           errorlist[q] += '<td width="25%">Does not use a <a href="//en.bharatpedia.org.in/wiki/Bharatpedia:Citation_templates">citation template</a></td></tr>';
           errorlist[q] += '<td width="25%">Does not use a <a href="//en.bharatpedia.org/wiki/Bharatpedia:Citation_templates">citation template</a></td></tr>';
           q++;
           q++;
           templateexclude[tx] = allrefscontent[i];
           templateexclude[tx] = allrefscontent[i];
Line 837: Line 837:
         if (namedrefs[k] == namedrefs[z] && k != z) {
         if (namedrefs[k] == namedrefs[z] && k != z) {
           errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';
           errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';
           errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.bharatpedia.org.in/wiki/Bharatpedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';
           errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.bharatpedia.org/wiki/Bharatpedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';
           q++;
           q++;
           repeatnameexclude[rx] = namedrefs[z];
           repeatnameexclude[rx] = namedrefs[z];
Line 860: Line 860:
         if (!NRcallError(namedrefs, namedrefcalls[p])) {
         if (!NRcallError(namedrefs, namedrefcalls[p])) {
           errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';
           errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';
           errorlist[q] += '<td width="25%">A <a href="//en.bharatpedia.org.in/wiki/Bharatpedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';
           errorlist[q] += '<td width="25%">A <a href="//en.bharatpedia.org/wiki/Bharatpedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';
           q++;
           q++;
           undefexclude[ux] = namedrefs[p];
           undefexclude[ux] = namedrefs[p];
Line 883: Line 883:
     '<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+
     '<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+
     '<input type="checkbox" id="samecontent" /> References with the same content<br/>'+
     '<input type="checkbox" id="samecontent" /> References with the same content<br/>'+
     '<input type="checkbox" id="templates" /> References not using a <a href="//en.bharatpedia.org.in/wiki/Bharatpedia:Citation_templates">citation template</a><br/>'+
     '<input type="checkbox" id="templates" /> References not using a <a href="//en.bharatpedia.org/wiki/Bharatpedia:Citation_templates">citation template</a><br/>'+
     '<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+
     '<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+
     '<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+
     '<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+
Line 1,170: Line 1,170:
}
}
//alert(previewHTML);
//alert(previewHTML);
previewHTML = previewHTML.replace(/href="\//gi, 'href="//en.bharatpedia.org.in/');
previewHTML = previewHTML.replace(/href="\//gi, 'href="//en.bharatpedia.org/');
document.getElementById('previewSpan').innerHTML = '<fieldset><legend>Citation preview</legend>' + previewHTML + '</fieldset>';
document.getElementById('previewSpan').innerHTML = '<fieldset><legend>Citation preview</legend>' + previewHTML + '</fieldset>';
}
}
Line 1,267: Line 1,267:


function JsonRequest(url) {
function JsonRequest(url) {
//importScriptURI(url)  //Bad: does not import the same script more than once
//mw.loader.load(url)  //Bad: does not import the same script more than once
var script = document.createElement("script");         
var script = document.createElement("script");         
script.setAttribute("src",url);
script.setAttribute("src",url);