GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing en.wikipedia.org — Wikipedia:RefToolbar/2.0 - Wikipedia
RefToolbar 2.0 is the current version of RefToolbar, which adds citing capability to the enhanced editing toolbar (the MediaWiki extension WikiEditor). It may appear two different ways depending on a user's preferences. See the troubleshooting section below for details. Reftoolbar 2.0 consists of a series of JavaScript scripts that use the jQuery and jQuery UI JavaScript libraries. It also makes use of the JSON standard. No installation requiredRefToolbar 2.0 is now turned on by default for all users on English Wikipedia. You don't have to do anything to install it. DisablingTo disable the refTools script from loading, add the following line to your common JS page or skin JS page: window.refToolbarInstalled = 'bypass'; UsageFor an introductory tutorial, see Help:Introduction to referencing with Wiki Markup.
TemplatesOn the left side of the Cite panel is a dropdown list of all available templates. Clicking one will open a dialog box with the fields for that template. Buttons on the bottom of the dialog are used to insert the ref into the article, preview the ref, reset the form, and close the dialog without changing the article. Clicking Named refsClicking the "Named refs" button will open a dialog listing all of the named references in the article. Choosing one will show the wikitext of the reference with an option to preview how the reference looks after parsing. Clicking the "Insert" button will insert the named reference ( Error checkingTo use error checking, click the Error check symbol, then select the error checks to run. A panel listing any errors found will be inserted underneath the edit area. Additional error checks can be added, see below for details. ConfigurationUnlike the old version of the script, this version is highly customizable sitewide and on a per-user basis. Note that while the script is designed to be easily configurable, the configuration options do need to be valid JavaScript code - brackets and parentheses must be matched and strings must be wrapped in quotation marks with quotation marks in the string escaped as necessary. Configuration is done using a global Individual usersNo customization is required, the script will use the sitewide defaults "out of the box". All user configuration options override the sitewide options. Sitewide configurationAll global configuration is done in the MediaWiki:RefToolbarConfig.js script file. The script will set a default for all options, but it is recommended that site defaults include a value for all options. For all option sample code shown below, change "UserOptions" to "Options" for site configuration. The initial Automatic date insertionChanging the date format used for automatically added dates (such as accessdate) is done using a simple string replacement system. "Special" words will be replaced with their corresponding date, all other characters will be left as-is. The current date options available are:
Other options may be available on request. Currently only one format will be used. If there is demand for it, the automatic date system may be extended to allow multiple options in a dropdown selection box. The date is always in UTC. The fields that have an automatic date option are stored in the "autodate fields" option. To customize automatic date insertion, options can be set like so: $('head').one('reftoolbarbase', function() { CiteTB.UserOptions['date format'] = "<date> <monthname> <year>"; CiteTB.UserOptions['autodate fields'] = ['accessdate']; }); Modal dialogsTo set whether the dialogs should be modal, use the "modal" option. If set to true, opening one of the dialogs will block access to the rest of the edit page until the dialog is closed. $('head').one('reftoolbarbase', function() { CiteTB.UserOptions['modal'] = true; }); Automatic parsingThe script can be set to automatically provide a parsed preview when previewing a citation template through the "autoparse" option. Its not recommended to set this to true as a global setting as it may slow the script down for people with slow connections. $('head').one('reftoolbarbase', function() { CiteTB.UserOptions['autoparse'] = false; }); Template expansionTo be able to retrieve more references on a page, the script can also expand templates and parser functions on the page (except templates inside of ref tags) so that references from templates or references that use the $('head').one('reftoolbarbase', function() { CiteTB.UserOptions['expandtemplates'] = false; }); Month namesThe month names used for automatic date insertion are also customizable, for translation to other languages, or to use abbreviations. $('head').one('reftoolbarbase', function() { CiteTB.UserOptions['months'] = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; }); Citation templatesCitation templates can be added using an object syntax. To add a new template, simply create a new citeTemplate object. Each template has 4 required parameters.
For sitewide settings, templates should be included in the RefToolbarConfig page. Users can also add their own templates with this system by adding them to their user script page. If the script is installed on the user script page (as opposed to using a gadget), the templates must be below where the script is imported. Object syntax for fieldsEach field is described as an object in a list, using JavaScript Object Notation. The basic options are:
The object system allows other options for additional features, which are described below. Automatic-incrementing fieldsFor fields such as authors and editors where it is frequently necessary to specify more than one, automatic-incrementing fields can be used. For each field, an "increment_group" option is set. This allows fields such as last/first to be incremented together, as long as they're in the same group. One field in each group should also have an "increment_button" option set - this field will have a button ( {"field": "last<N>", 'increment_group':'author'}, {"field": "first<N>", 'increment_group':'author', 'increment_button':true}, {"field": "editor<N>", 'increment_group':'editor', 'increment_button':true}, For authors, auto-incrementing fields can also be used with the autofilling options, see the section below for details. AutofillingThe script can autofill citation details given an identifier for the work. Currently DOI, PMID, ISBN, and URL are supported. To add autofill support to a template, set the "autofillid" param on a field that will be used for the ID code, for example
For multiple authors, the autofill system accepts several possible options. In order that the script checks for:
If using the There are also several options for dates and the behavior of the script will depend on how complete a date is returned by the database. Not all DOI/PMIDs will return a full date. For DOI/PMID
For DOI/PMID, Sample code$('head').one('reftoolbarbase', function() { new citeTemplate('cite example', 'Example', [ // Basic fields {"field": "last", "label":"Last name", "autofillprop":"last1"}, {"field": "first", "label":"First name", "autofillprop":"first1"}, {"field": "title", "autofillprop":"title"}, {"field": "url", "label":"URL"}, {"field": "work", "tooltip": "If this is part of a larger work"}, {"field": "isbn", "label":"ISBN", "autofillid":"isbn"}, {"field": "publisher", "autofillprop":"publisher"}, {"field": "accessdate"} ], [ // Expanded fields {"field": "author"}, {"field": "authorlink", "label":"Author's article", "tooltip":"If the author has an article, the name of the article"}, {"field": "coauthors", "autofillprop":"coauthors"}, {"field": "page"}, {"field": "pages"}, {"field": "language"}, {"field": "format"}, {"field": "date"}, ]); }); Error checking functionsError checking functions can be added in a way similar to citation templates. The citeErrorCheck object requires one parameter, an object. This object should contain certain the information as described below. Currently all attributes are required. In the future, optional attributes may be added to support other features.
There are currently 3 types of error checks. The differences between them are described below:
An error object is a JavaScript object that should contain 2 attributes. The 'msg' attribute should be an error message describing the problem and the 'err' attribute should be a portion of the wikitext showing the error, such as the content of the reference with the problem. Some example code for a simple function that checks whether each reference uses a template could be: $('head').one('reftoolbarbase', function() { new citeErrorCheck({'type':'refcheck', 'testname':'notemplate', 'desc': "Check for references not using a template", 'func': function(ref) { if (!ref.shorttag && ref.content.search('{{') == -1) { return {'msg': "Does not use a <a href='http://en.wikipedia.org/wiki/Wikipedia:Citation_templates'>citation template</a>", 'err': ref.content }; } }} ); }); TroubleshootingThe refToolbar comes in three versions, depending on the settings at Preferences → Editing → Editor:
Porting to another wikiThis script is designed to be easily portable to other wikis that use a similar (template-based) reference system. You should not need to copy the main script itself. You can, but it means that you will have to check for changes and manually update to receive bug fixes and new features. You do need to copy the following files to your wiki (this requires sysop access on the wiki the script is being ported to). Then you can customize the options, templates, error functions, and translate the messages as necessary.
Note: If you translate the "field" names in the "MediaWiki:RefToolbarConfig.js" page, you also need to change the corresponding message keys at "MediaWiki:RefToolbarMessages-<language code>.js", to avoid "null" descriptions in the popups. Note that the script has not yet been tested using RTL (right to left) languages. Install as an opt-in gadgetEnsure that the Gadgets extension has been installed in the LocalSettings.php file. Then follow these steps to install RefToolbar as a gadget:
Install as an opt-out scriptTo enable this tool for everyone, follow the same steps as above but add the "default" option to the gadget's definition: * refToolbar[ResourceLoader|default|dependencies=user.options,mediawiki.util]|refToolbar.js Information for developersThis section covers information relevant to developers that might not be covered above. Descriptions of the The
Reference objects:
The script uses the jQuery library, which is well documented at http://docs.jquery.com. It also uses some modules from WikiEditor extension, which is documented at mw:Extension:WikiEditor/Toolbar customization. The live code for RefToolbar can be found at the following pages:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |