மீடியாவிக்கி:RefToolbarConfig.js
/* Sitewide options for the the Cite toolbar button:
 * All options should be specified
 *
 * &quot;date format&quot; sets the date format used for the function to insert the current date
 * Current available options:
 * date - the day of the month
 * zdate - day of the month, zero padded to 2 digits
 * monthname - The month name
 * month - The numberic month (1-12)
 * zmonth - numeric month, zero padded to 2 digits
 * year - The full year (4 digits)
 *
 * &quot;autodate fields&quot; is a list of template fields that should have a button to insert the current date
 * 
 * &quot;months&quot; is a list of localized month names
 *
 * &quot;modal&quot; - if true, the dialogs will be modal windows, blocking access to the rest of the window.
 * See http://en.wikipedia.org/wiki/Modal_window
 * All dialogs in the toolbar are modal by default
 *
 * &quot;autoparse&quot; - if true, previewing a ref will automatically trigger a preview of the parsed wikitext.
 * It is not recommended to set this to true as a global setting as it may slow the script down for
 * people with slow connections.
 *
 * &quot;expandtemplates&quot; - if true, templates and parser functions will be expanded when getting page text
 * (templates inside of ref tags will not be expanded). This will allow references inside of templates or
 * references using {{#tag:ref}} to be listed in the named refs dialog and searched by error checks.
 * This may slow loading the named refs and error check dialogs.
 */
 
 CiteTB.Options = {
 &quot;date format&quot; : &quot;&lt;date&gt; &lt;monthname&gt; &lt;year&gt;&quot;,
 &quot;autodate fields&quot; : ['accessdate'],
 &quot;months&quot; : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
 &quot;modal&quot; : true,
 &quot;autoparse&quot; : true,
 &quot;expandtemplates&quot; : false
 };
 
 // Cite template definitions
 new citeTemplate('cite web', 'web',
 [ // Basic fields
 {&quot;field&quot;: &quot;last&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;last-incr&quot;, 'increment_group':'author'},
 {&quot;field&quot;: &quot;first&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;first-incr&quot;, 'increment_group':'author', 'increment_button':true}, 
 {&quot;field&quot;: &quot;title&quot;, &quot;autofillprop&quot;:&quot;title&quot;},
 {&quot;field&quot;: &quot;url&quot;, &quot;autofillid&quot;:&quot;url&quot;},
 {&quot;field&quot;: &quot;website&quot;, &quot;autofillprop&quot;:&quot;journal&quot;},
 {&quot;field&quot;: &quot;publisher&quot;, &quot;autofillprop&quot;:&quot;publisher&quot;},
 {&quot;field&quot;: &quot;accessdate&quot;},
 {&quot;field&quot;: &quot;ref&quot;, &quot;tooltip&quot;:&quot;cite-ref-tooltip&quot;}
 ],
 [ // Expanded fields
 {&quot;field&quot;: &quot;author&lt;N&gt;&quot;, 'increment_group':'author_alt', 'increment_button':true},
 {&quot;field&quot;: &quot;authorlink&lt;N&gt;&quot;, &quot;tooltip&quot;:&quot;cite-authorlink-tooltip&quot;, 'increment_group':'authorlink', 'increment_button':true},
 {&quot;field&quot;: &quot;archiveurl&quot;},
 {&quot;field&quot;: &quot;archivedate&quot;},
 {&quot;field&quot;: &quot;location&quot;},
 {&quot;field&quot;: &quot;page&quot;, &quot;tooltip&quot;:&quot;cite-page-tooltip&quot;},
 {&quot;field&quot;: &quot;pages&quot;, &quot;autofillprop&quot;:&quot;pages&quot;, &quot;tooltip&quot;:&quot;cite-pages-tooltip&quot;},
 {&quot;field&quot;: &quot;language&quot;, &quot;autofillprop&quot;:&quot;language&quot;},
 {&quot;field&quot;: &quot;format&quot;},
 {&quot;field&quot;: &quot;doi&quot;, &quot;autofillid&quot;:&quot;doi&quot;, &quot;autofillprop&quot;:&quot;doi&quot;},
 {&quot;field&quot;: &quot;date&quot;, &quot;autofillprop&quot;:&quot;date&quot;},
 {&quot;field&quot;: &quot;quote&quot;}
 ]);
 
 new citeTemplate('cite news', 'news',
 [ // Basic fields
 {&quot;field&quot;: &quot;last&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;last-incr&quot;, 'increment_group':'author'},
 {&quot;field&quot;: &quot;first&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;first-incr&quot;, 'increment_group':'author', 'increment_button':true}, 
 {&quot;field&quot;: &quot;title&quot;, &quot;autofillprop&quot;:&quot;title&quot;},
 {&quot;field&quot;: &quot;url&quot;, &quot;autofillid&quot;:&quot;url&quot;},
 {&quot;field&quot;: &quot;accessdate&quot;},
 {&quot;field&quot;: &quot;work&quot;, &quot;tooltip&quot;:&quot;cite-work-tooltip&quot;, &quot;autofillprop&quot;:&quot;journal&quot;},
 {&quot;field&quot;: &quot;agency&quot;},
 {&quot;field&quot;: &quot;issue&quot;},
 {&quot;field&quot;: &quot;publisher&quot;, &quot;autofillprop&quot;:&quot;publisher&quot;},
 {&quot;field&quot;: &quot;date&quot;, &quot;autofillprop&quot;:&quot;date&quot;},
 {&quot;field&quot;: &quot;ref&quot;, &quot;tooltip&quot;:&quot;cite-ref-tooltip&quot;}
 ],
 [ // Expanded fields
 {&quot;field&quot;: &quot;author&lt;N&gt;&quot;, 'increment_group':'author_alt', 'increment_button':true},
 {&quot;field&quot;: &quot;authorlink&lt;N&gt;&quot;, &quot;tooltip&quot;:&quot;cite-authorlink-tooltip&quot;, 'increment_group':'authorlink', 'increment_button':true},
 {&quot;field&quot;: &quot;archiveurl&quot;},
 {&quot;field&quot;: &quot;archivedate&quot;},
 {&quot;field&quot;: &quot;location&quot;},
 {&quot;field&quot;: &quot;page&quot;, &quot;tooltip&quot;:&quot;cite-page-tooltip&quot;},
 {&quot;field&quot;: &quot;pages&quot;, &quot;autofillprop&quot;:&quot;pages&quot;, &quot;tooltip&quot;:&quot;cite-pages-tooltip&quot;},
 {&quot;field&quot;: &quot;language&quot;, &quot;autofillprop&quot;:&quot;language&quot;},
 {&quot;field&quot;: &quot;format&quot;},
 {&quot;field&quot;: &quot;doi&quot;, &quot;autofillid&quot;:&quot;doi&quot;, &quot;autofillprop&quot;:&quot;doi&quot;},
 {&quot;field&quot;: &quot;quote&quot;}
 ]);
 
 new citeTemplate('cite book', 'book',
 [ // Basic fields
 {&quot;field&quot;: &quot;last&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;last-incr&quot;, 'increment_group':'author'},
 {&quot;field&quot;: &quot;first&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;first-incr&quot;, 'increment_group':'author', 'increment_button':true}, 
 {&quot;field&quot;: &quot;title&quot;, &quot;autofillprop&quot;:&quot;title&quot;},
 {&quot;field&quot;: &quot;date&quot;, &quot;autofillprop&quot;:&quot;year&quot;},
 {&quot;field&quot;: &quot;publisher&quot;, &quot;autofillprop&quot;:&quot;publisher&quot;},
 {&quot;field&quot;: &quot;location&quot;, &quot;autofillprop&quot;:&quot;location&quot;},
 {&quot;field&quot;: &quot;isbn&quot;, &quot;autofillid&quot;:&quot;isbn&quot;, &quot;autofillprop&quot;:&quot;isbn&quot;},
 {&quot;field&quot;: &quot;page&quot;, &quot;tooltip&quot;:&quot;cite-page-tooltip&quot;},
 {&quot;field&quot;: &quot;pages&quot;, &quot;autofillprop&quot;:&quot;pages&quot;, &quot;tooltip&quot;:&quot;cite-pages-tooltip&quot;},
 {&quot;field&quot;: &quot;edition&quot;, &quot;autofillprop&quot;:&quot;edition&quot;},
 {&quot;field&quot;: &quot;url&quot;, &quot;autofillid&quot;:&quot;url&quot;},
 {&quot;field&quot;: &quot;accessdate&quot;},
 {&quot;field&quot;: &quot;ref&quot;, &quot;tooltip&quot;:&quot;cite-ref-tooltip&quot;}
 
 ],
 [ // Expanded fields
 {&quot;field&quot;: &quot;author&lt;N&gt;&quot;, 'increment_group':'author_alt', 'increment_button':true},
 {&quot;field&quot;: &quot;authorlink&lt;N&gt;&quot;, &quot;tooltip&quot;:&quot;cite-authorlink-tooltip&quot;, 'increment_group':'authorlink', 'increment_button':true},
 {&quot;field&quot;: &quot;editor&lt;N&gt;-last&quot;, &quot;increment_group&quot;:&quot;editor&quot;},
 {&quot;field&quot;: &quot;editor&lt;N&gt;-first&quot;, &quot;increment_group&quot;:&quot;editor&quot;, &quot;increment_button&quot;:true},
 {&quot;field&quot;: &quot;editor&lt;N&gt;-link&quot;, 'increment_group':'editorlink', 'increment_button':true},
 {&quot;field&quot;: &quot;archiveurl&quot;},
 {&quot;field&quot;: &quot;archivedate&quot;},
 {&quot;field&quot;: &quot;language&quot;, &quot;autofillprop&quot;:&quot;language&quot;},
 {&quot;field&quot;: &quot;format&quot;},
 {&quot;field&quot;: &quot;chapter&quot;, &quot;autofillprop&quot;:&quot;chapter&quot;},
 {&quot;field&quot;: &quot;quote&quot;}
 ]);
 
 new citeTemplate('cite journal', 'journal',
 [ // Basic fields
 {&quot;field&quot;: &quot;last&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;last-incr&quot;, 'increment_group':'author'},
 {&quot;field&quot;: &quot;first&lt;N&gt;&quot;, &quot;autofillprop&quot;:&quot;first-incr&quot;, 'increment_group':'author', 'increment_button':true}, 
 {&quot;field&quot;: &quot;title&quot;, &quot;autofillprop&quot;:&quot;title&quot;},
 {&quot;field&quot;: &quot;journal&quot;, &quot;autofillprop&quot;:&quot;journal&quot;},
 {&quot;field&quot;: &quot;date&quot;, &quot;autofillprop&quot;:&quot;date&quot;},
 {&quot;field&quot;: &quot;volume&quot;, &quot;autofillprop&quot;:&quot;volume&quot;},
 {&quot;field&quot;: &quot;issue&quot;, &quot;autofillprop&quot;:&quot;issue&quot;},
 {&quot;field&quot;: &quot;page&quot;, &quot;tooltip&quot;:&quot;cite-page-tooltip&quot;},
 {&quot;field&quot;: &quot;pages&quot;, &quot;autofillprop&quot;:&quot;pages&quot;, &quot;tooltip&quot;:&quot;cite-pages-tooltip&quot;},
 {&quot;field&quot;: &quot;doi&quot;, &quot;autofillid&quot;:&quot;doi&quot;, &quot;autofillprop&quot;:&quot;doi&quot;},
 {&quot;field&quot;: &quot;pmid&quot;, &quot;autofillid&quot;:&quot;pmid&quot;},
 {&quot;field&quot;: &quot;url&quot;, &quot;autofillid&quot;:&quot;url&quot;},
 {&quot;field&quot;: &quot;accessdate&quot;},
 {&quot;field&quot;: &quot;ref&quot;, &quot;tooltip&quot;:&quot;cite-ref-tooltip&quot;},
 ],
 [ // Expanded fields
 {&quot;field&quot;: &quot;author&lt;N&gt;&quot;, 'increment_group':'author_alt', 'increment_button':true},
 {&quot;field&quot;: &quot;authorlink&lt;N&gt;&quot;, &quot;tooltip&quot;:&quot;cite-authorlink-tooltip&quot;, 'increment_group':'authorlink', 'increment_button':true},
 {&quot;field&quot;: &quot;editor&lt;N&gt;-last&quot;, &quot;increment_group&quot;:&quot;editor&quot;},
 {&quot;field&quot;: &quot;editor&lt;N&gt;-first&quot;, &quot;increment_group&quot;:&quot;editor&quot;, &quot;increment_button&quot;:true},
 {&quot;field&quot;: &quot;editor&lt;N&gt;-link&quot;, 'increment_group':'editorlink', 'increment_button':true},
 {&quot;field&quot;: &quot;series&quot;},
 {&quot;field&quot;: &quot;at&quot;, &quot;tooltip&quot;:&quot;cite-at-tooltip&quot;},
 {&quot;field&quot;: &quot;trans-title&quot;},
 {&quot;field&quot;: &quot;publisher&quot;, &quot;autofillprop&quot;:&quot;publisher&quot;},
 {&quot;field&quot;: &quot;location&quot;},
 {&quot;field&quot;: &quot;language&quot;, &quot;autofillprop&quot;:&quot;language&quot;},
 {&quot;field&quot;: &quot;format&quot;},
 {&quot;field&quot;: &quot;issn&quot;, &quot;autofillprop&quot;:&quot;issn&quot;},
 {&quot;field&quot;: &quot;pmc&quot;},
 {&quot;field&quot;: &quot;oclc&quot;},
 {&quot;field&quot;: &quot;bibcode&quot;},
 {&quot;field&quot;: &quot;id&quot;},
 {&quot;field&quot;: &quot;quote&quot;},
 {&quot;field&quot;: &quot;postscript&quot;, &quot;tooltip&quot;:&quot;cite-postscript-tooltip&quot;}
 ]);
 
 new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': 'cite-samecontent-desc',
 'func': function(reflist) {
   var errors = [];
   var refs2 = [];
   for(var i=0; i&lt;reflist.length; i++) {
     if (!reflist[i].shorttag) {
       if ($.inArray(reflist[i].content, refs2) != -1) {
         if ($.inArray(reflist[i].content, errors) == -1) {
           errors.push(reflist[i].content);
         }
       } else {
         refs2.push(reflist[i].content);
       }
     }
   }
   ret = [];
   for(var j=0; j&lt;errors.length; j++) {
     ret.push({'msg':'cite-samecontent-error', 'err':errors[j]});
   }
   return ret;
 }}
 );
 
 new citeErrorCheck({'type':'reflist', 'testname':'repeated', 'desc':'cite-repeated-desc',
 'func': function(reflist) {
   var errors = [];
   var refs2 = [];
   for(var i=0; i&lt;reflist.length; i++) {
     if (!reflist[i].shorttag &amp;&amp; reflist[i].refname) {
       if ($.inArray(reflist[i].refname, refs2) != -1) {
         if ($.inArray(reflist[i].refname, errors) == -1) {
           errors.push(reflist[i].refname);
         }
       } else {
         refs2.push(reflist[i].refname);
       }
     }
   }
   ret = [];
   for(var j=0; j&lt;errors.length; j++) {
     ret.push({'msg':'cite-repeated-error', 'err':errors[j]});
   }
   return ret;
 }}
 );
 
 new citeErrorCheck({'type':'reflist', 'testname':'undefined', 'desc':'cite-undefined-desc',
 'func': function(reflist) {
   var errors = [];
   var longrefs = [];
   for(var i=0; i&lt;reflist.length; i++) {
     if (!reflist[i].shorttag &amp;&amp; reflist[i].refname) {
       longrefs.push(reflist[i].refname);
     }
   }
   for(var j=0; i&lt;reflist.length; j++) {
     if (reflist[i].shorttag &amp;&amp; $.inArray(reflist[i].refname, errors) == -1 &amp;&amp; $.inArray(reflist[i].refname, longrefs) == -1) {
       errors.push(reflist[i].refname);
     }
   }
   ret = [];
   for(var j=0; j&lt;errors.length; j++) {
     ret.push({'msg':'cite-undefined-error', 'err':errors[j]});
   }
   return ret;
 }}
 );