利用者:Penn Station/refToolbar.js
表示
お知らせ: 保存した後、ブラウザのキャッシュをクリアしてページを再読み込みする必要があります。
多くの Windows や Linux のブラウザ
- Ctrl を押しながら F5 を押す。
Mac における Safari
Mac における Chrome や Firefox
- ⌘ Cmd と ⇧ Shift を押しながら R を押す。
詳細についてはWikipedia:キャッシュを消すをご覧ください。
//
// [[en:Wikipedia:RefToolbar 2.0/porting]] 01:48, 4 April 2011 UTC
//
if (( mw.config.get('wgAction') == 'edit' || mw.config.get('wgAction') == 'submit' ) && ( typeof refToolbarInstalled == 'undefined' )) {
if (mw.config.get('wgServer') == "https://secure.wikimedia.org") {
mw.loader.load("https://secure.wikimedia.org/wikipedia/en/w/index.php?title=MediaWiki:RefToolbarBase.js&action=raw&ctype=text/javascript");
} else {
mw.loader.load("//en-two.iwiki.icu/w/index.php?title=MediaWiki:RefToolbarBase.js&action=raw&ctype=text/javascript");
}
if( typeof $.wikiEditor != 'undefined' && typeof $.wikiEditor.modules.dialogs != 'undefined' ) {
mw.loader.load("//en-two.iwiki.icu/w/index.php?title=MediaWiki:RefToolbar.js&action=raw&ctype=text/javascript");
} else if( typeof $.wikiEditor != 'undefined' ) {
mw.loader.load("//en-two.iwiki.icu/w/index.php?title=MediaWiki:RefToolbarNoDialogs.js&action=raw&ctype=text/javascript");
} else {
mw.loader.load("//en-two.iwiki.icu/w/index.php?title=MediaWiki:RefToolbarLegacy.js&action=raw&ctype=text/javascript");
}
refToolbarInstalled = true;
}
//
// [[en:MediaWiki:RefToolbarMessages-en.js]] 17:38, 16 March 2011 UTC
//
// All user-facing messages
// TODO: Document usage
mw.usability && 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',
'cite-dialog-news' : 'News citation',
'cite-dialog-book' : 'Book citation',
'cite-dialog-journal' : 'Journal citation',
'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"><ref></span> tags',
'cite-error-samecontent' : 'References with the same content',
'cite-error-templates' : 'References not using a <a href="http://en-two.iwiki.icu/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' : 'Mutiple 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-work-tooltip' : 'What larger work this is part of',
'cite-authorlink-tooltip' : 'If the author has an 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-samecontent-desc' : 'Check for 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-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-accessdate-label' : 'Access date',
'cite-author-label' : 'Author',
'cite-authorlink-label' : "Author's article",
'cite-coauthors-label' : 'Coauthors',
'cite-archiveurl-label' : 'Archive URL',
'cite-archivedate-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-edition-label' : 'Edition',
'cite-trans_title-label' : 'Translated title',
'cite-ref-label' : 'Ref',
'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 = importScript('MediaWiki:RefToolbarConfig.js');
//
// [[en:MediaWiki:RefToolbarConfig.js]] 17:33, 16 March 2011 UTC
//
/* 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-two.iwiki.icu/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.
* Its 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.
*/
if (typeof CiteTB !=='undefined'){
CiteTB.Options = {
"date format" : "<date> <monthname> <year>",
"autodate fields" : ['accessdate'],
"months" : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};
// Cite template definitions
new citeTemplate('cite web', 'web',
[ // Basic fields
{"field": "last", "autofillprop":"last1"},
{"field": "first", "autofillprop":"first1"},
{"field": "title", "autofillprop":"title"},
{"field": "url"},
{"field": "work", "tooltip": "cite-work-tooltip", "autofillprop":"journal"},
{"field": "publisher"},
{"field": "accessdate"}
],
[ // Expanded fields
{"field": "author"},
{"field": "authorlink", "tooltip":"cite-authorlink-tooltip"},
{"field": "coauthors", "autofillprop":"coauthors"},
{"field": "archiveurl"},
{"field": "archivedate"},
{"field": "location"},
{"field": "page"},
{"field": "pages", "autofillprop":"pages"},
{"field": "language"},
{"field": "format"},
{"field": "doi", "autofillid":"doi"},
{"field": "date", "autofillprop":"date"},
{"field": "month"},
{"field": "year"},
{"field": "quote"}
]);
new citeTemplate('cite news', 'news',
[ // Basic fields
{"field": "last"},
{"field": "first"},
{"field": "title"},
{"field": "url"},
{"field": "accessdate"},
{"field": "newspaper"},
{"field": "date"}
],
[ // Expanded fields
{"field": "author"},
{"field": "author2"},
{"field": "author3"},
{"field": "author4"},
{"field": "author5"},
{"field": "authorlink", "tooltip":"cite-authorlink-tooltip"},
{"field": "agency"},
{"field": "archiveurl"},
{"field": "archivedate"},
{"field": "location"},
{"field": "page"},
{"field": "pages"},
{"field": "language"},
{"field": "format"},
{"field": "doi"},
{"field": "month"},
{"field": "year"},
{"field": "quote"}
]);
new citeTemplate('cite book', 'book',
[ // Basic fields
{"field": "last", "autofillprop":"last1"},
{"field": "first", "autofillprop":"first1"},
{"field": "title", "autofillprop":"title"},
{"field": "year", "autofillprop":"year"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "location", "autofillprop":"location"},
{"field": "isbn", "autofillid":"isbn"},
{"field": "pages"},
{"field": "url"}
],
[ // Expanded fields
{"field": "author"},
{"field": "edition", "autofillprop":"edition"},
{"field": "authorlink", "tooltip":"cite-authorlink-tooltip"},
{"field": "coauthors", "autofillprop":"coauthors"},
{"field": "editor"},
{"field": "accessdate"},
{"field": "archiveurl"},
{"field": "archivedate"},
{"field": "page"},
{"field": "language"},
{"field": "format"},
{"field": "chapter"},
{"field": "date"},
{"field": "month"},
{"field": "quote"}
]);
new citeTemplate('cite journal', 'journal',
[ // Basic fields
{"field": "last", "autofillprop":"last1"},
{"field": "first", "autofillprop":"first1"},
{"field": "coauthors", "autofillprop":"coauthors"},
{"field": "title", "autofillprop":"title"},
{"field": "journal", "autofillprop":"journal"},
{"field": "date", "autofillprop":"date"},
{"field": "year"},
{"field": "month"},
{"field": "volume", "autofillprop":"volume"},
{"field": "series"},
{"field": "issue", "autofillprop":"issue"},
{"field": "pages", "autofillprop":"pages"},
{"field": "doi", "autofillid":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "url"},
{"field": "accessdate"}
],
[ // Expanded fields
{"field": "author"},
{"field": "authorlink"},
{"field": "editor1-first"},
{"field": "editor1-last"},
{"field": "editor1-link"},
{"field": "page"},
{"field": "at", "tooltip":"cite-at-tooltip"},
{"field": "trans_title"},
{"field": "publisher"},
{"field": "location"},
{"field": "language"},
{"field": "format"},
{"field": "issn"},
{"field": "pmc"},
{"field": "oclc"},
{"field": "bibcode"},
{"field": "id"},
{"field": "quote"},
{"field": "ref", "tooltip":"cite-ref-tooltip"},
{"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();
}