Wikipedista:Blahma/RefToolbarConfig.js

Poznámka: Po uložení musíte vyprázdnit mezipaměť vašeho prohlížeče, jinak změny neuvidíte.

/* 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" : "<year>-<zmonth>-<zdate>",
"autodate fields" : ['datum_přístupu'],
"months" : ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};
 
// Cite template definitions
new citeTemplate('Citace elektronické monografie', 'web',
[ // Basic fields
{"field": "příjmení"},
{"field": "jméno"},
{"field": "titul"},
{"field": "vydavatel", "tooltip":"cite-web-tooltip"},
{"field": "datum_vydání"},
{"field": "datum_aktualizace"},
{"field": "datum_přístupu"},
{"field": "místo"},
{"field": "url"},
{"field": "jazyk"}
],
[ // Expanded fields
{"field": "příjmení2"},
{"field": "jméno2"},
{"field": "příjmení3"},
{"field": "jméno3"},
{"field": "autor", "tooltip":"cite-autor-tooltip"},
{"field": "autor2", "tooltip":"cite-autor-tooltip"},
{"field": "autor3", "tooltip":"cite-autor-tooltip"},
{"field": "odkaz_na_autora", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora2", "tooltip":"cite-odkazzaautora-tooltip"},
{"field": "odkaz_na_autora3", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "spoluautoři", "tooltip":"cite-spoluautoři-tooltip"},
{"field": "korporace"},
{"field": "druh_nosiče"},
{"field": "editoři"},
{"field": "redaktoři"},
{"field": "překladatelé"},
{"field": "ilustrátoři"},
{"field": "další"},
{"field": "vydání"},
{"field": "edice"},
{"field": "subedice"},
{"field": "kapitola"},
{"field": "strany"},
{"field": "isbn"},
{"field": "id"},
{"field": "doi"},
{"field": "poznámka"}
]);
 
new citeTemplate('Citace monografie', 'kniha',
[ // Basic fields
{"field": "příjmení", "autofillprop":"last1"},
{"field": "jméno", "autofillprop":"first1"}, 
{"field": "titul", "autofillprop":"title"},
{"field": "url"},
{"field": "vydavatel", "autofillprop":"publisher"},
{"field": "místo", "autofillprop":"location"},
{"field": "rok", "autofillprop":"year"},
{"field": "počet_stran", "autofillprop":"pages"},
{"field": "kapitola"},
{"field": "strany"},
{"field": "isbn", "autofillid":"isbn"},
{"field": "jazyk"}
],
[ // Expanded fields
{"field": "příjmení2"},
{"field": "jméno2"},
{"field": "příjmení3"},
{"field": "jméno3"},
{"field": "autor", "tooltip":"cite-autor-tooltip"},
{"field": "autor2", "tooltip":"cite-autor-tooltip"},
{"field": "autor3", "tooltip":"cite-autor-tooltip"},
{"field": "odkaz_na_autora", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora2", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora3", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "spoluautoři", "tooltip":"cite-spoluautoři-tooltip"},
{"field": "korporace"},
{"field": "editoři"},
{"field": "redaktoři"},
{"field": "překladatelé"},
{"field": "ilustrátoři"},
{"field": "vydání", "autofillprop":"edition"},
{"field": "typ_vydání"},
{"field": "rok_tisku"},
{"field": "rok_copyrightu"},
{"field": "edice"},
{"field": "subedice"},
{"field": "svazek"},
{"field": "isbn2"},
{"field": "id"},
{"field": "doi"},
{"field": "poznámka"}
]);
 
new citeTemplate('Citace elektronického periodika', 'ezin',
[ // Basic fields
{"field": "příjmení", "autofillprop":"last1"},
{"field": "jméno", "autofillprop":"first1"}, 
{"field": "titul", "autofillprop":"title"},
{"field": "periodikum", "autofillprop":"journal"},
{"field": "odkaz_na_periodikum", "autofillprop":"journallink"},
{"field": "vydavatel", "autofillprop":"publisher"},
{"field": "datum_vydání", "autofillprop":"date"},
{"field": "datum_aktualizace", "autofillprop":"publicationdate"},
{"field": "datum_přístupu"},
{"field": "ročník", "autofillprop":"volume"},
{"field": "číslo", "autofillprop":"issue"},
{"field": "strany", "autofillprop":"pages"},
{"field": "lokace"},
{"field": "url", "autofillid":"url"},
{"field": "issn", "autofillprop":"issn"},
{"field": "jazyk", "autofillprop":"language"},
{"field": "doi"}
],
[ // Expanded fields
{"field": "příjmení2"},
{"field": "jméno2"},
{"field": "příjmení3"},
{"field": "jméno3"},
{"field": "autor", "tooltip":"cite-autor-tooltip"},
{"field": "autor2", "tooltip":"cite-autor-tooltip"},
{"field": "autor3", "tooltip":"cite-autor-tooltip"},
{"field": "odkaz_na_autora", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora2", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora3", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "spoluautoři", "tooltip":"cite-spoluautoři-tooltip"},
{"field": "překladatelé"},
{"field": "ilustrátoři"},
{"field": "fotografové"},
{"field": "kapitola"},
{"field": "číslování"},
{"field": "poznámky"},
{"field": "pmid"},
{"field": "id"},
{"field": "bibcode"},
{"field": "arxiv"}
]);
 
new citeTemplate('Citace periodika', 'periodikum',
[ // Basic fields
{"field": "příjmení", "autofillprop":"last1"},
{"field": "jméno", "autofillprop":"first1"}, 
{"field": "titul", "autofillprop":"title"},
{"field": "periodikum", "autofillprop":"journal"},
{"field": "ročník", "autofillprop":"volume"},
{"field": "číslo", "autofillprop":"issue"},
{"field": "datum", "autofillprop":"date"},
{"field": "strany", "autofillprop":"pages"},
{"field": "url"},
{"field": "issn"},
{"field": "datum_přístupu"},
{"field": "jazyk"},
{"field": "doi", "autofillid":"doi"}
],
[ // Expanded fields
{"field": "příjmení2"},
{"field": "jméno2"},
{"field": "příjmení3"},
{"field": "jméno3"},
{"field": "autor", "tooltip":"cite-autor-tooltip"},
{"field": "autor2", "tooltip":"cite-autor-tooltip"},
{"field": "autor3", "tooltip":"cite-autor-tooltip"},
{"field": "odkaz_na_autora", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora2", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora3", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "spoluautoři", "autofillprop":"coauthors"},
{"field": "překladatelé"},
{"field": "ilustrátoři"},
{"field": "fotografové"},
{"field": "poznámky"},
{"field": "formát"},
{"field": "pmid"},
{"field": "id"}
]);
 
new citeTemplate('Citace sborníku', 'sbornik',
[ // Basic fields
{"field": "příjmení"},
{"field": "jméno"}, 
{"field": "titul"},
{"field": "příjmení_sestavitele"},
{"field": "jméno_sestavitele"},
{"field": "sborník"},
{"field": "vydavatel"},
{"field": "místo"},
{"field": "rok_vydání"},
{"field": "isbn"},
{"field": "url"},
{"field": "kapitola"},
{"field": "strany"},
{"field": "jazyk"}
],
[ // Expanded fields
{"field": "příjmení2"},
{"field": "jméno2"},
{"field": "příjmení3"},
{"field": "jméno3"},
{"field": "autor", "tooltip":"cite-autor-tooltip"},
{"field": "autor2", "tooltip":"cite-autor-tooltip"},
{"field": "autor3", "tooltip":"cite-autor-tooltip"},
{"field": "odkaz_na_autora", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora2", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "odkaz_na_autora3", "tooltip":"cite-odkaznaautora-tooltip"},
{"field": "spoluautoři", "tooltip":"cite-spoluautoři-tooltip"},
{"field": "korporace"},
{"field": "příjmení_sestavitele2"},
{"field": "jméno_sestavitele2"},
{"field": "příjmení_sestavitele3"},
{"field": "jméno_sestavitele3"},
{"field": "spolusestavitelé"},
{"field": "sestavující_korporace"},
{"field": "datum_vydání"},
{"field": "rok_tisku"},
{"field": "rok_copyrightu"},
{"field": "isbn2"},
{"field": "issn"},
{"field": "doi"},
{"field": "id"},
{"field": "poznámka"},
{"field": "svazek"},
{"field": "url_kapitoly"}
]);
 
new citeTemplate('Citace kvalifikační práce', 'diplomka',
[ // Basic fields
{"field": "příjmení"},
{"field": "jméno"}, 
{"field": "instituce"},
{"field": "titul"},
{"field": "url"},
{"field": "typ_práce"},
{"field": "vedoucí"},
{"field": "místo"},
{"field": "počet_stran"},
{"field": "strany"},
{"field": "rok"},
{"field": "citace"},
{"field": "poznámka"}
],
[ // Expanded fields
]); 
 
new citeTemplate('Citace právního předpisu', 'predpis',
[ // Basic fields
{"field": "typ"},
{"field": "číslo"}, 
{"field": "název"},
{"field": "paragraf"},
{"field": "příloha"},
{"field": "vydání"},
{"field": "url"},
{"field": "datum_přístupu"}
],
[ // Expanded fields
{"field": "poznámka"}
]);
 
new citeTemplate('Citace Sbírky zákonů', 'zakon',
[ // Basic fields
{"field": "typ"},
{"field": "číslo"}, 
{"field": "rok"},
{"field": "titul"},
{"field": "paragraf"},
{"field": "odkaz_na_titul"}
],
[ // Expanded fields
{"field": "datum_přístupu"},
{"field": "url"},
{"field": "instituce"},
{"field": "zkrácený_titul"},
{"field": "datum_schválení"},
{"field": "zkratka"},
{"field": "kapitola"},
{"field": "typ_kapitoly"},
{"field": "kapitola2"},
{"field": "typ_kapitoly2"},
{"field": "url_kapitoly"},
{"field": "článek"},
{"field": "lokace"},
{"field": "poznámka"},
{"field": "jazyk"},
{"field": "mvčr"},
{"field": "mvčr_zákon"},
{"field": "mvčr_částka"},
{"field": "aktualizace"},
{"field": "datum_aktualizace"}
]);  
 
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();