Saltar para o conteúdo

MediaWiki:RefToolbarConfig.js: diferenças entre revisões

Origem: Wikipédia, a enciclopédia livre.
Conteúdo apagado Conteúdo adicionado
 
m Reposição de um parâmetro removido acidentalmente durante a tradução (https://pt.wikipedia.org/wiki/MediaWiki:RefToolbarConfig.js?diff=31886686&oldid=33991881). Causa um erro: MediaWiki Discussão:Gadget-refToolbar.js#Uncaught TypeError
(Há 3 revisões intermédias de 2 utilizadores que não estão a ser apresentadas)
Linha 39: Linha 39:


// Cite template definitions
// Cite template definitions
new citeTemplate('citar web',
new citeTemplate('citar web', 'web',
[ // Basic fields
[ // Basic fields
{"field": "ultimo", "autofillprop":"last1"},
{"field": "ultimo", "autofillprop":"last1"},

Revisão das 17h00min de 6 de fevereiro de 2013

/* 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.
* 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.
*/

CiteTB.Options = {
"date format" : "<date> de <monthname> de <year>",
"autodate fields" : ['accessodata'],
"months" : ['Janerio', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Decembro'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('citar web', 'web',
[ // Basic fields
{"field": "ultimo", "autofillprop":"last1"},
{"field": "primeiro", "autofillprop":"first1"},
{"field": "título", "autofillprop":"title"},
{"field": "url"},
{"field": "obra", "tooltip": "cite-work-tooltip", "autofillprop":"journal"},
{"field": "puclicado"},
{"field": "accessodata"}
],
[ // Expanded fields
{"field": "autor"},
{"field": "autorlink", "tooltip":"cite-authorlink-tooltip"},
{"field": "coautores", "autofillprop":"coauthors"},
{"field": "arcquivourl"},
{"field": "arcquivodata"},
{"field": "location"},
{"field": "page"},
{"field": "paginas", "autofillprop":"pages"},
{"field": "língua"},
{"field": "formato"},
{"field": "doi", "autofillid":"doi"},
{"field": "data", "autofillprop":"date"},
{"field": "mes"},
{"field": "ano"},
{"field": "citação"}
]);

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('citar livro', 'livro',
[ // Basic fields
{"field": "sobrenome", "autofillprop":"last1"},
{"field": "nome", "autofillprop":"first1"},
{"field": "título", "autofillprop":"title"},
{"field": "ano", "autofillprop":"year"},
{"field": "editora", "autofillprop":"publisher"},
{"field": "local", "autofillprop":"location"},
{"field": "isbn", "autofillid":"isbn"},
{"field": "páginas"},
{"field": "url"}
],
[ // Expanded fields
{"field": "autor"},
{"field": "edição", "autofillprop":"edition"},
{"field": "autorlink", "tooltip":"cite-authorlink-tooltip"},
{"field": "coautores", "autofillprop":"coauthors"},
{"field": "editor"},
{"field": "accessodate"},
{"field": "arquivourl"},
{"field": "arquivodata"},
{"field": "página"},
{"field": "idioma"},
{"field": "format"},
{"field": "chapter"},
{"field": "data"},
{"field": "mês"},
{"field": "citação"}
]);

new citeTemplate('citar periódico', 'periódico',
[ // Basic fields
{"field": "ultimo", "autofillprop":"last1"},
{"field": "primeiro", "autofillprop":"first1"},
{"field": "coautores", "autofillprop":"coauthors"},
{"field": "titulo", "autofillprop":"title"},
{"field": "jornal", "autofillprop":"journal"},
{"field": "data", "autofillprop":"date"},
{"field": "ano"},
{"field": "mês"},
{"field": "volume", "autofillprop":"volume"},
{"field": "series"},
{"field": "numero", "autofillprop":"issue"},
{"field": "paginas", "autofillprop":"pages"},
{"field": "doi", "autofillid":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "url"},
{"field": "accessadoem"}
],
[ // Expanded fields
{"field": "autor"},
{"field": "autorlink"},
{"field": "editor1-first"},
{"field": "editor1-last"},
{"field": "editor1-link"},
{"field": "pagina"},
{"field": "at", "tooltip":"cite-at-tooltip"},
{"field": "trans_title"},
{"field": "editora"},
{"field": "local"},
{"field": "idioma"},
{"field": "formato"},
{"field": "issn"},
{"field": "pmc"},
{"field": "oclc"},
{"field": "bibcode"},
{"field": "id"},
{"field": "aspas"},
{"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 ($j.inArray(reflist[i].content, refs2) != -1) {
        if ($j.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 ($j.inArray(reflist[i].refname, refs2) != -1) {
        if ($j.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 && $j.inArray(reflist[i].refname, errors) == -1 && $j.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();