Diferencia entre revisiones de «MediaWiki:RefToolbarConfig.js»
De Bioeticawiki
Línea 30: | Línea 30: | ||
CiteTB.Options = { | CiteTB.Options = { | ||
"date format" : "<date> <monthname> <year>", | "date format" : "<date> de <monthname> de <year>", | ||
"autodate fields" : [' | "autodate fields" : ['fechaacceso'], | ||
"months" : [' | "months" : ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'], | ||
"modal" : true, | "modal" : true, | ||
"autoparse" : | "autoparse" : false, | ||
"expandtemplates" : false | "expandtemplates" : false | ||
}; | }; | ||
// Cite template definitions | // Cite template definitions | ||
new citeTemplate(' | new citeTemplate('cita web', 'web', | ||
[ // Basic fields | [ // Basic fields | ||
{"field": " | {"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'}, | ||
{"field": " | {"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, | ||
{"field": " | {"field": "título", "autofillprop":"title"}, | ||
{"field": "url", " | {"field": "url"}, | ||
{"field": "obra", "autofillprop":"journal"}, | |||
{"field": " | {"field": "editorial"}, | ||
{"field": " | {"field": "idioma", "tooltip":"cite-idioma-tooltip"}, | ||
{"field": "fecha", "autofillprop":"date"}, | |||
{"field": "fechaacceso"} | |||
], | ], | ||
[ // Expanded fields | [ // Expanded fields | ||
{"field": " | {"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true}, | ||
{"field": " | {"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true}, | ||
{"field": " | {"field": "urlarchivo"}, | ||
{"field": " | {"field": "fechaarchivo"}, | ||
{"field": " | {"field": "ubicación"}, | ||
{"field": " | {"field": "página", "tooltip":"cite-page-tooltip"}, | ||
{"field": " | {"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"}, | ||
{"field": " | {"field": "formato", "tooltip":"cite-formato-tooltip"}, | ||
{"field": " | {"field": "doi", "autofillid":"doi"}, | ||
{"field": "cita", "tooltip":"cite-cita-tooltip"}, | |||
{"field": " | {"field": "ref", "tooltip":"cite-ref-tooltip"} | ||
]); | ]); | ||
new citeTemplate(' | new citeTemplate('cita noticia', 'news', | ||
[ // Basic fields | [ // Basic fields | ||
{"field": " | {"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'}, | ||
{"field": " | {"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, | ||
{"field": " | {"field": "título", "autofillprop":"title"}, | ||
{"field | {"field": "url"}, | ||
{"field": " | {"field": "fechaacceso"}, | ||
{"field": " | {"field": "obra", "tooltip":"cite-work-tooltip", "autofillprop":"journal"}, | ||
{"field": " | {"field": "agencia"}, | ||
{"field": "issue"}, | //{"field": "issue"}, // no disponible en Wikipedia en español --abián, 21 dic 2014 | ||
{"field": " | {"field": "editorial"}, | ||
{"field": " | {"field": "fecha", "autofillprop":"date"}, | ||
{"field": "ref", "tooltip":"cite-ref-tooltip"} | {"field": "ref", "tooltip":"cite-ref-tooltip"} | ||
], | ], | ||
[ // Expanded fields | [ // Expanded fields | ||
{"field": " | {"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true}, | ||
{"field": " | {"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true}, | ||
{"field": "archiveurl"}, | //{"field": "archiveurl"}, // no disponible en Wikipedia en español --abián, 21 dic 2014 | ||
{"field": "archivedate"}, | //{"field": "archivedate"}, // no disponible en Wikipedia en español --abián, 21 dic 2014 | ||
{"field": " | {"field": "ubicación"}, | ||
{"field": " | {"field": "página", "tooltip":"cite-page-tooltip"}, | ||
{"field": " | {"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"}, | ||
{"field": " | {"field": "idioma", "tooltip":"cite-idioma-tooltip"}, | ||
{"field": " | {"field": "formato", "tooltip":"cite-formato-tooltip"}, | ||
{"field": "doi", "autofillid":"doi", " | {"field": "doi", "autofillid":"doi"}, | ||
{"field": "cita", "tooltip":"cite-cita-tooltip"} | |||
]); | ]); | ||
new citeTemplate(' | new citeTemplate('cita libro', 'book', | ||
[ // Basic fields | [ // Basic fields | ||
{"field": " | {"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'}, | ||
{"field": " | {"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, | ||
{"field": " | {"field": "título", "autofillprop":"title"}, | ||
{"field": " | {"field": "fecha", "autofillprop":"year"}, | ||
{"field": " | {"field": "editorial", "autofillprop":"publisher"}, | ||
{"field": " | {"field": "ubicación", "autofillprop":"location"}, | ||
{"field": "isbn", "autofillid | {"field": "isbn", "autofillid":"isbn"}, | ||
{"field": " | {"field": "página", "tooltip":"cite-page-tooltip"}, | ||
{"field": " | {"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"}, | ||
{"field": " | {"field": "edición", "autofillprop":"edition"}, | ||
{"field | {"field": "url"}, | ||
{"field": " | {"field": "fechaacceso"}, | ||
{"field": "ref", "tooltip":"cite-ref-tooltip"} | {"field": "ref", "tooltip":"cite-ref-tooltip"} | ||
], | ], | ||
[ // Expanded fields | [ // Expanded fields | ||
{"field": " | {"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true}, | ||
{"field": " | {"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true}, | ||
{"field": "editor<N> | {"field": "apellido-editor<N>", "increment_group":"editor"}, | ||
{"field": "editor<N> | {"field": "nombre-editor<N>", "increment_group":"editor", "increment_button":true}, | ||
{"field": "editor<N> | {"field": "enlace-editor<N>", 'increment_group':'editorlink', 'increment_button':true}, | ||
{"field": "archiveurl"}, | //{"field": "archiveurl"}, // no disponible en Wikipedia en español --abián, 21 dic 2014 | ||
{"field": "archivedate"}, | //{"field": "archivedate"}, // no disponible en Wikipedia en español --abián, 21 dic 2014 | ||
{"field": " | {"field": "idioma", "tooltip":"cite-idioma-tooltip"}, | ||
{"field": " | {"field": "formato", "tooltip":"cite-formato-tooltip"}, | ||
{"field": " | {"field": "capítulo"}, | ||
{"field": "cita", "tooltip":"cite-cita-tooltip"} | |||
]); | ]); | ||
new citeTemplate(' | new citeTemplate('cita publicación', 'journal', | ||
[ // Basic fields | [ // Basic fields | ||
{"field": " | {"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'}, | ||
{"field": " | {"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, | ||
{"field": " | {"field": "título", "autofillprop":"title"}, | ||
{"field": " | {"field": "publicación", "autofillprop":"journal"}, | ||
{"field": " | {"field": "fecha", "autofillprop":"date"}, | ||
{"field": " | {"field": "volumen", "autofillprop":"volume"}, | ||
{"field": " | {"field": "número", "autofillprop":"issue"}, | ||
{"field": " | {"field": "página", "tooltip":"cite-page-tooltip"}, | ||
{"field": " | {"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"}, | ||
{"field": "doi", "autofillid | {"field": "doi", "autofillid":"doi"}, | ||
{"field": "pmid", "autofillid":"pmid"}, | {"field": "pmid", "autofillid":"pmid"}, | ||
{"field | {"field": "url"}, | ||
{"field": " | {"field": "fechaacceso"}, | ||
{"field": "ref", "tooltip":"cite-ref-tooltip"}, | {"field": "ref", "tooltip":"cite-ref-tooltip"}, | ||
], | ], | ||
[ // Expanded fields | [ // Expanded fields | ||
{"field": " | {"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true}, | ||
{"field": " | {"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true}, | ||
{"field": "editor<N> | {"field": "apellidos-editor<N>", "increment_group":"editor"}, | ||
{"field": "editor<N> | {"field": "nombre-editor<N>", "increment_group":"editor", "increment_button":true}, | ||
{"field": "editor<N> | {"field": "enlace-editor<N>", 'increment_group':'editorlink', 'increment_button':true}, | ||
{"field": " | {"field": "serie"}, | ||
{"field": " | {"field": "en", "tooltip":"cite-at-tooltip"}, | ||
{"field": " | {"field": "títulotrad"}, | ||
{"field": " | {"field": "editorial"}, | ||
{"field": " | {"field": "ubicación"}, | ||
{"field": " | {"field": "idioma", "tooltip":"cite-idioma-tooltip"}, | ||
{"field": " | {"field": "formato", "tooltip":"cite-formato-tooltip"}, | ||
{"field": "issn"}, | |||
{"field": "pmc"}, | {"field": "pmc"}, | ||
{"field": "oclc"}, | {"field": "oclc"}, | ||
{"field": "bibcode"}, | {"field": "bibcode"}, | ||
{"field": "id"}, | {"field": "id"}, | ||
{"field": " | {"field": "cita", "tooltip":"cite-cita-tooltip"}, | ||
{"field": "postscript", "tooltip":"cite-postscript-tooltip"} | {"field": "postscript", "tooltip":"cite-postscript-tooltip"} | ||
]); | ]); | ||
Línea 224: | Línea 224: | ||
} | } | ||
ret = []; | ret = []; | ||
for(var | for(var k=0; k<errors.length; k++) { | ||
ret.push({'msg':'cite-undefined-error', 'err':errors[ | ret.push({'msg':'cite-undefined-error', 'err':errors[k]}); | ||
} | } | ||
return ret; | return ret; |
Revisión actual del 12:16 26 oct 2018
/* 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> de <monthname> de <year>",
"autodate fields" : ['fechaacceso'],
"months" : ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};
// Cite template definitions
new citeTemplate('cita web', 'web',
[ // Basic fields
{"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true},
{"field": "título", "autofillprop":"title"},
{"field": "url"},
{"field": "obra", "autofillprop":"journal"},
{"field": "editorial"},
{"field": "idioma", "tooltip":"cite-idioma-tooltip"},
{"field": "fecha", "autofillprop":"date"},
{"field": "fechaacceso"}
],
[ // Expanded fields
{"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "urlarchivo"},
{"field": "fechaarchivo"},
{"field": "ubicación"},
{"field": "página", "tooltip":"cite-page-tooltip"},
{"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "formato", "tooltip":"cite-formato-tooltip"},
{"field": "doi", "autofillid":"doi"},
{"field": "cita", "tooltip":"cite-cita-tooltip"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
]);
new citeTemplate('cita noticia', 'news',
[ // Basic fields
{"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true},
{"field": "título", "autofillprop":"title"},
{"field": "url"},
{"field": "fechaacceso"},
{"field": "obra", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},
{"field": "agencia"},
//{"field": "issue"}, // no disponible en Wikipedia en español --abián, 21 dic 2014
{"field": "editorial"},
{"field": "fecha", "autofillprop":"date"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
//{"field": "archiveurl"}, // no disponible en Wikipedia en español --abián, 21 dic 2014
//{"field": "archivedate"}, // no disponible en Wikipedia en español --abián, 21 dic 2014
{"field": "ubicación"},
{"field": "página", "tooltip":"cite-page-tooltip"},
{"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "idioma", "tooltip":"cite-idioma-tooltip"},
{"field": "formato", "tooltip":"cite-formato-tooltip"},
{"field": "doi", "autofillid":"doi"},
{"field": "cita", "tooltip":"cite-cita-tooltip"}
]);
new citeTemplate('cita libro', 'book',
[ // Basic fields
{"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true},
{"field": "título", "autofillprop":"title"},
{"field": "fecha", "autofillprop":"year"},
{"field": "editorial", "autofillprop":"publisher"},
{"field": "ubicación", "autofillprop":"location"},
{"field": "isbn", "autofillid":"isbn"},
{"field": "página", "tooltip":"cite-page-tooltip"},
{"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "edición", "autofillprop":"edition"},
{"field": "url"},
{"field": "fechaacceso"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "apellido-editor<N>", "increment_group":"editor"},
{"field": "nombre-editor<N>", "increment_group":"editor", "increment_button":true},
{"field": "enlace-editor<N>", 'increment_group':'editorlink', 'increment_button':true},
//{"field": "archiveurl"}, // no disponible en Wikipedia en español --abián, 21 dic 2014
//{"field": "archivedate"}, // no disponible en Wikipedia en español --abián, 21 dic 2014
{"field": "idioma", "tooltip":"cite-idioma-tooltip"},
{"field": "formato", "tooltip":"cite-formato-tooltip"},
{"field": "capítulo"},
{"field": "cita", "tooltip":"cite-cita-tooltip"}
]);
new citeTemplate('cita publicación', 'journal',
[ // Basic fields
{"field": "apellidos<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "nombre<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true},
{"field": "título", "autofillprop":"title"},
{"field": "publicación", "autofillprop":"journal"},
{"field": "fecha", "autofillprop":"date"},
{"field": "volumen", "autofillprop":"volume"},
{"field": "número", "autofillprop":"issue"},
{"field": "página", "tooltip":"cite-page-tooltip"},
{"field": "páginas", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "doi", "autofillid":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "url"},
{"field": "fechaacceso"},
{"field": "ref", "tooltip":"cite-ref-tooltip"},
],
[ // Expanded fields
{"field": "autor<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "enlaceautor<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "apellidos-editor<N>", "increment_group":"editor"},
{"field": "nombre-editor<N>", "increment_group":"editor", "increment_button":true},
{"field": "enlace-editor<N>", 'increment_group':'editorlink', 'increment_button':true},
{"field": "serie"},
{"field": "en", "tooltip":"cite-at-tooltip"},
{"field": "títulotrad"},
{"field": "editorial"},
{"field": "ubicación"},
{"field": "idioma", "tooltip":"cite-idioma-tooltip"},
{"field": "formato", "tooltip":"cite-formato-tooltip"},
{"field": "issn"},
{"field": "pmc"},
{"field": "oclc"},
{"field": "bibcode"},
{"field": "id"},
{"field": "cita", "tooltip":"cite-cita-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 k=0; k<errors.length; k++) {
ret.push({'msg':'cite-undefined-error', 'err':errors[k]});
}
return ret;
}}
);
CiteTB.init();