Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

/* Sitewide options for the the Cite toolbar button:
* All options should be specified
*
* "date format" 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)
*
* "autodate fields" is a list of template fields that should have a button to insert the current date
* 
* "months" is a list of localized month names
*
* "modal" - 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
*
* "autoparse" - 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.
*
* "expandtemplates" - 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 = {
"date format" : "<date> <monthname> <year>",
"autodate fields" : ['access-date'],
"months" : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
"modal" : true,
"autoparse" : true,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('cite web', 'web',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "url", "autofillid":"url"},
{"field": "website", "autofillprop":"journal"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "access-date"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "author<N>-link", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "archive-url"},
{"field": "archive-date"},
{"field": "location"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "date", "autofillprop":"date"},
{"field": "quote"},
{"field": "url-status", "tooltip":"cite-urlstatus-tooltip"}
]);

new citeTemplate('cite news', 'news',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "url", "autofillid":"url"},
{"field": "access-date"},
{"field": "work", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},
{"field": "agency", "tooltip":"cite-agency-tooltip"},
{"field": "issue"},
{"field": "publisher", "tooltip":"cite-publisher-tooltip", "autofillprop":"publisher"},
{"field": "date", "autofillprop":"date"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "author<N>-link", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "archive-url"},
{"field": "archive-date"},
{"field": "location"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "quote"}
]);

new citeTemplate('cite book', 'book',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "date", "autofillprop":"date"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "location", "autofillprop":"location"},
{"field": "isbn", "autofillid":"isbn", "autofillprop":"isbn"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "edition", "autofillprop":"edition"},
{"field": "url", "autofillid":"url"},
{"field": "access-date"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}

],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "author<N>-link", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "editor<N>-last", "increment_group":"editor"},
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},
{"field": "archive-url"},
{"field": "archive-date"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "chapter", "autofillprop":"chapter"},
{"field": "quote"}
]);

new citeTemplate('cite journal', 'journal',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "journal", "autofillprop":"journal"},
{"field": "date", "autofillprop":"date"},
{"field": "volume", "autofillprop":"volume"},
{"field": "issue", "autofillprop":"issue"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "url", "autofillid":"url"},
{"field": "access-date"},
{"field": "ref", "tooltip":"cite-ref-tooltip"},
],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "author<N>-link", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "editor<N>-last", "increment_group":"editor"},
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},
{"field": "series"},
{"field": "at", "tooltip":"cite-at-tooltip"},
{"field": "trans-title"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "location"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "issn", "autofillprop":"issn"},
{"field": "pmc"},
{"field": "oclc"},
{"field": "bibcode"},
{"field": "id"},
{"field": "quote"},
{"field": "postscript", "tooltip":"cite-postscript-tooltip"}
]);

new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': 'cite-samecontent-desc',
'func': function(reflist) {
  var errors = [];
  var refs2 = [];
  for(var i=0; i<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<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<reflist.length; i++) {
    if (!reflist[i].shorttag && 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<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<reflist.length; i++) {
    if (!reflist[i].shorttag && reflist[i].refname) {
      longrefs.push(reflist[i].refname);
    }
  }
  for(var j=0; i<reflist.length; j++) {
    if (reflist[i].shorttag && $.inArray(reflist[i].refname, errors) == -1 && $.inArray(reflist[i].refname, longrefs) == -1) {
      errors.push(reflist[i].refname);
    }
  }
  ret = [];
  for(var j=0; j<errors.length; j++) {
    ret.push({'msg':'cite-undefined-error', 'err':errors[j]});
  }
  return ret;
}}
);

CiteTB.init();

// All user-facing messages
// TODO: Document usage
if(typeof mw.usability !== 'undefined') {
mw.usability.addMessages( { 
'cite-section-label' : 'Cite',
'cite-template-list' : 'Templates',
'cite-named-refs-label' : 'Named references',
'cite-named-refs-title' : 'Insert a named reference',
'cite-named-refs-button' : 'Named references',
'cite-named-refs-dropdown' : 'Named references', // Used on the top of the named refs list dropdown
'cite-errorcheck-label' : 'Error check',
'cite-errorcheck-button' : 'Check for errors',
'cite-dialog-web' : 'Web citation (RefToolbar)',
'cite-dialog-news' : 'News citation (RefToolbar)',
'cite-dialog-book' : 'Book citation (RefToolbar)',
'cite-dialog-journal' : 'Journal citation (RefToolbar)',
'cite-form-submit' : 'Insert',
'cite-form-showhide' : 'Show/hide extra fields',
'cite-no-namedrefs' : 'Cannot find any named references on the page',
'cite-namedrefs-intro' : "Select a name from the list to see the ref content. Click 'Insert' to insert a reference to it in the text.",
'cite-raw-preview' : 'Wikitext:',
'cite-parsed-label' : 'Parsed wikitext:',
'cite-form-parse' : 'Show parsed preview',
'cite-refpreview' : 'Preview',
'cite-name-label' : 'Ref name',
'cite-group-label' : 'Ref group',
'cite-errorcheck-submit' : 'Check',
'cite-errorcheck-heading' : 'Check for the following errors:',
'cite-error-unclosed' : 'Unclosed <span style="font-family:monospace">&lt;ref&gt;</span> tags',
'cite-error-samecontent' : 'References with the same content',
'cite-error-templates' : 'References not using a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a>',
'cite-error-repeated' : 'Multiple references with the same name',
'cite-error-undef' : 'Usage of undefined named references',
'cite-error-samecontent-msg' : 'Multiple refs contain the same content: $1',
'cite-error-repeated-msg' : 'Multiple refs are given the name: \'$1\'',
'cite-error-templates-msg' : 'Does not use a template: $1',
'cite-form-reset' : 'Reset form',
'cite-loading' : 'Loading data', // Shown while pagetext is being downloaded from the API
'cite-insert-date' : 'Insert current date', // Alt/title text for 'insert date' icon
'cite-err-report-heading' : 'Citation error report', // Heading for error report table
'cite-err-report-close' : 'Close', // Alt/title text for 'close' icon on error report
'cite-err-report-empty' : 'No errors found', // Message displayed in the error report list if there are no errors
'cite-autofill-alt' : 'Autofill', // Alt text for autofill button image
'cite-agency-tooltip' : 'News agency (wire service) that provided the content published elsewhere',
'cite-work-tooltip' : 'Name of journal, magazine, newspaper, periodical or website',
'cite-authorlink-tooltip' : 'If the author has a Wikipedia article, the name of the article',
'cite-at-tooltip' : 'Position within the resource (when page is inappropriate)',
'cite-ref-tooltip' : 'ID for anchor (for creating a linkable reference)',
'cite-postscript-tooltip' : 'If specified, overrides the default behavior of terminating the citation with a period',
'cite-page-tooltip' : 'Page in the source that supports the content.',
'cite-pages-tooltip' : 'Pages in the source that supports the content; separate page ranges with an en dash (–); separate non-sequential pages with a comma (,); do not use to indicate the total number of pages in the source.',
'cite-publisher-tooltip' : 'Parent company that published the work being cited',
'cite-website-tooltip' : 'Name of the website in full, not the URL',
'cite-samecontent-desc' : 'References with the same content',
'cite-samecontent-error' : 'Multiple references contain the same content',
'cite-repeated-desc' : 'Multiple references with the same name',
'cite-repeated-error' : 'Multiple references are using the same name',
'cite-undefined-desc' : 'Usage of undefined named references',
'cite-undefined-error' : 'A named reference is used but not defined',
'cite-urlstatus-tooltip' : 'Mark the live/dead/usurped status of the original URL, defining its relevance versus the (required) archive URL',
'cite-first-label' : 'First name',
'cite-last-label' : 'Last name',
'cite-title-label' : 'Title',
'cite-work-label' : 'Work',
'cite-newspaper-label' : 'Newspaper',
'cite-journal-label' : 'Journal',
'cite-publisher-label' : 'Publisher',
'cite-access-date-label' : 'Access date',
'cite-author-label' : 'Author',
'cite-author-link-label' : "Author's article",
'cite-archive-url-label' : 'Archive URL',
'cite-archive-date-label' : 'Archive date',
'cite-location-label' : 'Location',
'cite-page-label' : 'Page',
'cite-pages-label' : 'Pages',
'cite-at-label' : 'At',
'cite-chapter-label' : 'Chapter',
'cite-volume-label' : 'Volume',
'cite-series-label' : 'Series',
'cite-issue-label' : 'Issue',
'cite-language-label' : 'Language',
'cite-format-label' : 'Format',
'cite-date-label' : 'Date',
'cite-month-label' : 'Month',
'cite-year-label' : 'Year',
'cite-quote-label' : 'Quote',
'cite-author2-label' : '2nd author',
'cite-author3-label' : '3rd author',
'cite-author4-label' : '4th author',
'cite-author5-label' : '5th author',
'cite-agency-label' : 'Agency',
'cite-editor-label' : 'Editor',
'cite-editor1-first-label' : "Editor's first",
'cite-editor1-last-label' : "Editor's last",
'cite-editor1-link-label' : "Editor's article",
'cite-editor-first-label' : "Editor's first",
'cite-editor-last-label' : "Editor's last",
'cite-editor-link-label' : "Editor's article",
'cite-edition-label' : 'Edition',
'cite-trans-title-label' : 'Translated title',
'cite-ref-label' : 'Ref',
'cite-postscript-label' : 'Postscript',
'cite-url-label' : 'URL',
'cite-url-status-label' : 'URL status',
'cite-doi-label' : 'DOI',
'cite-isbn-label' : 'ISBN',
'cite-pmid-label' : 'PMID',
'cite-issn-label' : 'ISSN',
'cite-pmc-label' : 'PMC',
'cite-oclc-label' : 'OCLC',
'cite-bibcode-label' : 'Bibcode',
'cite-id-label' : 'ID',
'cite-website-label' : 'Website name',
'cite-increment-alt' : 'Add another', // Alt text for field increment button, not specific to a particular field
});

// Load configuration for site
var RefToolbarLocal = mw.loader.load('/w/index.php?title=MediaWiki:RefToolbarConfig.js&action=raw&ctype=text/javascript');
}

// All user-facing messages
// TODO: Document usage
mw.usability.addMessages( { 
'cite-section-label' : 'Quellangabe',
'cite-template-list' : 'Vorlagen',
'cite-named-refs-label' : 'Benannte Referenz', //TODO
'cite-named-refs-title' : 'Benannte Referenz einfügen', //TODO
'cite-named-refs-button' : 'Benannte Referenzen',
'cite-named-refs-dropdown' : 'Benannte Referenzen', // Used on the top of the named refs list dropdown
'cite-errorcheck-label' : 'Fehlerprüfung',
'cite-errorcheck-button' : 'Auf Fehler prüfen',
'cite-dialog-web' : 'Web-Quelle',
'cite-dialog-news' : 'News-Quelle',
'cite-dialog-book' : 'Buchquelle',
'cite-dialog-journal' : 'Fachjournal',
'cite-form-submit' : 'Einfügen',
'cite-form-showhide' : 'Zusätzliche Felder anzeigen/verbergen',
'cite-no-namedrefs' : 'Keine Quellangaben auf dieser Seite gefunden',
'cite-namedrefs-intro' : "Name auswählen, um die Quellangabe zu sehen. \"Einfügen\" anklicken, um sie in den Text einzufügen.", //TODO: could use imparative form / formal version
'cite-raw-preview' : 'Wikitext:',
'cite-parsed-label' : 'Geparster Wikitext:',
'cite-form-parse' : 'Vorschau für Wikitext',
'cite-refpreview' : 'Vorschau',
'cite-name-label' : 'Referenz-Name', //TODO
'cite-group-label' : 'Referenzgruppe', //TODO
'cite-errorcheck-submit' : 'Prüfen',
'cite-errorcheck-heading' : 'Behebe die folgenden Fehler:', //TODO: needs formal!
'cite-error-unclosed' : 'Schlißendes <span style="font-family:monospace">&lt;/ref&gt;</span>-Tag fehlt.',
'cite-error-samecontent' : 'Mehrere Quellangaben mit gleichem Inhalt',
'cite-error-templates' : 'Quellangabe verwendet keine <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">Vorlage</a>',
'cite-error-repeated' : 'Mehrere Referenzen mit dem selben Namen',
'cite-error-undef' : 'Verwendung eines unbekannten Referenz-Namens',
'cite-error-samecontent-msg' : 'Mehrere Quellangaben haben den selben Inhalt: $1',
'cite-error-repeated-msg' : 'Mehrere Quellangaben haben den selben Namen: \'$1\'',
'cite-error-templates-msg' : 'Verwendet keine Vorlage: $1',
'cite-form-reset' : 'Formular zurücksetzen',
'cite-loading' : 'Daten werden geladen', // Shown while pagetext is being downloaded from the API
'cite-insert-date' : 'Aktuelles Datum einfügen', // Alt/title text for 'insert date' icon
'cite-err-report-heading' : 'Fehlerbericht für Quellangaben', // Heading for error report table
'cite-err-report-close' : 'Schließen', // Alt/title text for 'close' icon on error report
'cite-err-report-empty' : 'Keine Fehler gefunden', // Message displayed in the error report list if there are no errors
'cite-autofill-alt' : 'Automatisch ausfüllen', // Alt text for autofill button image
'cite-work-tooltip' : 'Teil welches größeren Werkes',
'cite-authorlink-tooltip' : 'Name der Wiki-Seite über den Autor, falls vorhanden',
'cite-at-tooltip' : 'Position innerhalb der Quelle, falls keine Seite angegeben werden kann',
'cite-ref-tooltip' : 'Anker-ID (Zum erstellen einer verknüpften Referenz)',
'cite-postscript-tooltip' : 'Keinen Punkt an die Quellangabe anfügen',
'cite-samecontent-desc' : 'Prüfe auf Quellangaben mit dem selben Inhalt',
'cite-samecontent-error' : 'Mehrere Quellangaben haben den selben Inhalt',
'cite-repeated-desc' : 'Mehrere Quellangaben haben den selben Namen', //TODO: compare below
'cite-repeated-error' : 'Mehrere Quellangaben haben den selben Namen', //TODO: compare above??
'cite-undefined-desc' : 'Verwendung unbekannter benannter Referenzen', //TODO: desc vs. error!
'cite-undefined-error' : 'Verwendung unbekannter benannter Referenzen', //TODO: desc vs. error!
'cite-first-label' : 'Vorname',
'cite-last-label' : 'Nachname',
'cite-title-label' : 'Titel',
'cite-work-label' : 'Werk',
'cite-newspaper-label' : 'Zeitschrift',
'cite-journal-label' : 'Fachjournal',
'cite-publisher-label' : 'Verlag',
'cite-accessdate-label' : 'Zugriffsdatum',
'cite-author-label' : 'Autor',
'cite-authorlink-label' : "Wikiseite über den Autor",
'cite-coauthors-label' : 'Coautoren',
'cite-archiveurl-label' : 'Archiv-URL',
'cite-archivedate-label' : 'Archivdatum',
'cite-location-label' : 'Ort',
'cite-page-label' : 'Seite',
'cite-pages-label' : 'Seiten',
'cite-at-label' : 'An',
'cite-chapter-label' : 'Kapitel',
'cite-volume-label' : 'Band',
'cite-series-label' : 'Serie',
'cite-issue-label' : 'Ausgabe',
'cite-language-label' : 'Sprache',
'cite-format-label' : 'Format',
'cite-date-label' : 'Datum',
'cite-month-label' : 'Monat',
'cite-year-label' : 'Jahr',
'cite-quote-label' : 'Zitat',
'cite-author2-label' : 'Zweiter Autor',
'cite-author3-label' : 'Dritter Autor',
'cite-author4-label' : 'Vierter Autor',
'cite-author5-label' : 'Fünfter Autor',
'cite-agency-label' : 'Einrichtung',
'cite-editor-label' : 'Herausgeber',
'cite-editor1-first-label' : "Vorname der Hg.",
'cite-editor1-last-label' : "Nachname des Hg.",
'cite-editor1-link-label' : "Wikiseite über den Hg.",
'cite-edition-label' : 'Herausgeber',
'cite-trans_title-label' : 'Übersetzer Titel',
'cite-ref-label' : 'Ref', //TODO: kontext??
'cite-postscript-label' : 'Postscript',
'cite-url-label' : 'URL',
'cite-doi-label' : 'DOI',
'cite-isbn-label' : 'ISBN',
'cite-pmid-label' : 'PMID',
'cite-issn-label' : 'ISSN',
'cite-pmc-label' : 'PMC',
'cite-oclc-label' : 'OCLC',
'cite-bibcode-label' : 'Bibcode',
'cite-id-label' : 'ID'
});

// Load configuration for site
var RefToolbarLocal = mw.loader.load('/w/index.php?title=MediaWiki:RefToolbarConfig.js&action=raw&ctype=text/javascript');