MediaWiki:RefToolbarConfig.js

Nota: Despois de publicar, quizais teñas que arrodear a caché do navegador para ver os cambios.

  • Firefox/Safari: Preme Maiúsculas á vez que en Recargar, ou preme en Ctrl-F5 ou Ctrl-R (⌘-R nos Mac).
  • Google Chrome: Preme en Ctrl-Maiús-R (⌘-Maiús-R nos Mac).
  • Internet Explorer / Edge: Preme Ctrl mentres clicas en Refrescar, ou preme Ctrl-F5
  • Opera: Preme Ctrl-F5.
/* 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" : ['dataacceso'],
"months" : ['xaneiro', 'febreiro', 'marzo', 'abril', 'maio', 'xuño', 'xullo', 'agosto', 'setembro', 'outubro', 'novembro', 'decembro'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};

// Definicións dos modelos de citas
new citeTemplate('cita web', 'cite web',
[ // Campos básicos
{"field": "apelidos", "autofillprop":"apelidos1"},
{"field": "nome", "autofillprop":"nome1"}, 
{"field": "título", "autofillprop":"título"},
{"field": "url"},
{"field": "obra", "tooltip": "cite-obra-tooltip", "autofillprop":"revista"},
{"field": "editor"},
{"field": "dataacceso"}
],
[ // Campos expandidos
{"field": "autor"},
{"field": "ligazónautor", "tooltip":"cite-ligazónautor-tooltip"},
{"field": "coautores", "autofillprop":"coautores"},
{"field": "urlarquivo"},
{"field": "dataarquivo"},
{"field": "localización"},
{"field": "páxina"},
{"field": "páxinas", "autofillprop":"páxinas"},
{"field": "lingua"},
{"field": "formato"},
{"field": "doi", "autofillid":"doi"},
{"field": "data", "autofillprop":"data"},
{"field": "mes"},
{"field": "ano"},
{"field": "cita"}
]);

new citeTemplate('cita novas', 'cite news',
[ // Campos básicos
{"field": "apelidos"},
{"field": "nome"}, 
{"field": "título"},
{"field": "url"},
{"field": "dataacceso"},
{"field": "obra"},
{"field": "data"}
],
[ // Campos expandidos
{"field": "autor"},
{"field": "autor2"},
{"field": "autor3"},
{"field": "autor4"},
{"field": "autor5"},
{"field": "ligazónautor", "tooltip":"cite-ligazónautor-tooltip"},
{"field": "axencia"},
{"field": "urlarquivo"},
{"field": "dataarquivo"},
{"field": "localización"},
{"field": "páxina"},
{"field": "páxinas"},
{"field": "lingua"},
{"field": "formato"},
{"field": "doi"},
{"field": "mes"},
{"field": "ano"},
{"field": "cita"}
]);

new citeTemplate('cita libro', 'cite book',
[ // Campos básicos
{"field": "apelidos", "autofillprop":"apelidos1"},
{"field": "nome", "autofillprop":"nome1"}, 
{"field": "título", "autofillprop":"título"},
{"field": "ano", "autofillprop":"ano"},
{"field": "editor", "autofillprop":"editor"},
{"field": "localización", "autofillprop":"localización"},
{"field": "isbn", "autofillid":"isbn"},
{"field": "páxinas"},
{"field": "url"}
],
[ // Campos expandidos
{"field": "autor"},
{"field": "edición", "autofillprop":"edición"},
{"field": "ligazónautor", "tooltip":"cite-ligazónautor-tooltip"},
{"field": "coautores", "autofillprop":"coautores"},
{"field": "editor"},
{"field": "dataacceso"},
{"field": "urlarquivo"},
{"field": "dataarquivo"},
{"field": "páxina"},
{"field": "lingua"},
{"field": "formato"},
{"field": "capítulo"},
{"field": "data"},
{"field": "mes"},
{"field": "cita"}
]);

new citeTemplate('cita publicación periódica', 'cite journal',
[ // Campos básicos
{"field": "apelidos", "autofillprop":"apelidos1"},
{"field": "nome", "autofillprop":"nome1"},
{"field": "coautores", "autofillprop":"coautores"},
{"field": "título", "autofillprop":"título"},
{"field": "revista", "autofillprop":"revista"},
{"field": "data", "autofillprop":"data"},
{"field": "ano"},
{"field": "mes"},
{"field": "volume", "autofillprop":"volume"},
{"field": "serie"},
{"field": "número", "autofillprop":"número"},
{"field": "páxinas", "autofillprop":"páxinas"},
{"field": "doi", "autofillid":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "url"},
{"field": "dataacceso"}
],
[ // Campos expandidos
{"field": "autor"},
{"field": "ligazónautor"},
{"field": "editor1-nome"},
{"field": "editor1-apelidos"},
{"field": "editor1-ligazón"},
{"field": "páxina"},
{"field": "en", "tooltip":"cite-en-tooltip"},
{"field": "trad_título"},
{"field": "editor"},
{"field": "localización"},
{"field": "lingua"},
{"field": "formato"},
{"field": "issn"},
{"field": "pmc"},
{"field": "oclc"},
{"field": "bibcode"},
{"field": "id"},
{"field": "cita"},
{"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();