Järjestelmäviesti:RefToolbarConfig.js

Huomautus: Selaimen välimuisti pitää tyhjentää asetusten tallentamisen jälkeen, jotta muutokset tulisivat voimaan.

  • Firefox ja Safari: Napsauta Shift-näppäin pohjassa Päivitä, tai paina Ctrl-F5 tai Ctrl-R (⌘-R Macilla)
  • Google Chrome: Paina Ctrl-Shift-R (⌘-Shift-R Macilla)
  • Internet Explorer ja Edge: Napsauta Ctrl-näppäin pohjassa Päivitä tai paina Ctrl-F5
  • Opera: Paina 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>.<month>.<year>',
  "autodate fields" : ["viitattu","ajankohta"],
  // Alla olevia käytetään vain viitteiden AutoFill-ominaisuudessa (julkaisun kuukausi)
  "months" : ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
  "modal" : true,
  "autoparse" : false,
  "expandtemplates" : false
};
// Cite template definitions
// Cite template definitions
new citeTemplate("Verkkoviite", "Verkkoviite",
[ // Basic fields
  {"field": "osoite", "label": "URL", "autofillid":"url"},
  {"field": "nimeke", "label": "Otsikko", "autofillprop":"title"},
  {"field": "julkaisu", "label" : "Julkaisu", "autofillprop":"journal"},
  {"field": "julkaisija", "label" : "Julkaisija", "autofillprop":"publisher" },
  {"field": "ajankohta", "label" : "Ajankohta", "autofillprop":"date" },
  {"field": "tekijä", "label": "Tekijä", "autofillprop":"authors"},
  {"field": "kieli"},
  {"field": "viitattu"}
],
[ // Expanded fields
  {"field": "tiedostomuoto"},
  {"field": "julkaisija"},
  //{"field": "Julkaisupaikka"},
  {"field": "selite"}
]);
new citeTemplate("Kirjaviite", "Kirjaviite",
[ // Basic fields
  {"field": "nimeke", "label": "Teoksen nimi", "autofillprop":"title"},
  {"field": "tekijä", "tooltip": "Teoksen kirjoittaja(t) muodossa sukunimi, etunimi. Jos teoksella on kaksi tai kolme kirjoittajaa, erotetaan ne toisistaan &-merkillä. Jos kirjoittajia on neljä tai enemmän, merkitään ensimmäinen tai tärkein sekä \"et al.\"" , "autofillprop":"authors"},
  {"field": "julkaisija",  "autofillprop":"publisher"},
  {"field": "vuosi", "tooltip": "Teoksen julkaisuvuosi. Tarvittaessa myös tarkemmin, esimerkiksi kuukauden tai päivän tarkkuudella", "autofillprop":"year"},
  {"field": "isbn", "label":"ISBN", "tooltip": "Teoksen ISBN-numero", "autofillid":"isbn"},
  {"field": "sivu", "label": "Sivut"},
  {"field": "kieli", "tooltip": "Teoksen tai sen viitatun osan kieli, jos muu kuin suomi. Anna kieli muodossa {{koodi}}, jossa koodi on kielen kaksimerkkinen ISO 639-1 -kielikoodi. Esim. {{en}}"},
  {"field": "suomentaja"},
  {"field": "viitattu"},
  {"field": "www", "label":"URL", "tooltip": "Teoksen verkkoversion osoite"}
],
[ // Expanded fields
  {"field": "luku"},
  {"field": "julkaisupaikka"},
  {"field": "tunniste", "tooltip": "Teoksen tunniste (ISBN-numerolle on oma parametrinsa)"},
  {"field": "tiedostomuoto", "tooltip": "Verkkoversion tiedostomuoto, jos muu kuin HTML"},
  {"field": "www-teksti", "label": "WWW-teksti", "tooltip": "Teksti verkkoversion linkkiin (oletuksena \"Teoksen verkkoversio\")"},
  {"field": "selite", "tooltip": "Mahdollinen tarkentava selite, esimerkiksi alkuteoksen nimi, tieto painoksesta tai tieto sarjasta, jossa julkaisu on ilmestynyt"}
]);

new citeTemplate('Lehtiviite', 'Lehtiviite',
[ // Basic fields
  {"field": "Otsikko", "autofillprop":"title"},
  {"field": "Julkaisu", "autofillprop":"journal"},
  {"field": "Tekijä", "tooltip": "Artikkelin kirjoittaja(t) muodossa sukunimi, etunimi. Jos artikkelilla on kaksi tai kolme kirjoittajaa, erotetaan ne toisistaan &-merkillä. Jos kirjoittajia on neljä tai enemmän, merkitään ensimmäinen tai tärkein sekä \"et al.\"", "autofillprop":"authors"},
  {"field": "Ajankohta", "label": "Julkaistu", "tooltip": "Artikkelin julkaisuajankohta (päivämäärä tai vuosi)", "autofillprop":"date"},
  {"field": "Kieli", "tooltip": "Artikkelin kieli, jos muu kuin suomi. Anna kieli muodossa {{koodi}}, jossa koodi on kielen kaksimerkkinen ISO 639-1 -kielikoodi. Esim. {{en}}"},
  {"field": "www", "label": "URL", "tooltip": "Artikkelin verkkoversion osoite"},
  {"field": "Viitattu"},
  {"field": "Doi", "label":"DOI", "autofillid":"doi"},
  {"field": "Pmid", "label":"PubMed ID", "autofillid":"pmid"}
],
[ // Expanded fields
  {"field": "Sivut"},
  {"field": "Vuosikerta", "tooltip": 'Lehden vuosikerran ("volumen") järjestysnumero (lähinnä tieteellisissä julkaisuissa). Tähän ei merkitä kalenterivuotta.', "autofillprop":"volume"},
  {"field": "Numero", "autofillprop":"issue"},
  {"field": "Julkaisija", "autofillprop":"publisher"},
  {"field": "Julkaisupaikka", "autofillprop":"location"},
  {"field": "Issn", "label":"ISSN"},
  {"field": "Tunniste", "tooltip": "Lehden muu tunniste"},
  {"field": "Tiedostomuoto", "tooltip": "Verkkoversion tiedostomuoto, jos muu kuin HTML"},
  {"field": "Selite", "tooltip": "Mahdollinen tarkentava tieto"}
]);

/*
new citeTemplate('cite web', 'web',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "url", "autofillid":"url"},
{"field": "website", "autofillprop":"journal"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "accessdate"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "archiveurl"},
{"field": "archivedate"},
{"field": "location"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "date", "autofillprop":"date"},
{"field": "quote"}
]);

new citeTemplate('cite news', 'news',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "url", "autofillid":"url"},
{"field": "accessdate"},
{"field": "work", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},
{"field": "agency"},
{"field": "issue"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "date", "autofillprop":"date"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "archiveurl"},
{"field": "archivedate"},
{"field": "location"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "quote"}
]);

new citeTemplate('cite book', 'book',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "date", "autofillprop":"year"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "location", "autofillprop":"location"},
{"field": "isbn", "autofillid":"isbn", "autofillprop":"isbn"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "edition", "autofillprop":"edition"},
{"field": "url", "autofillid":"url"},
{"field": "accessdate"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}

],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "editor<N>-last", "increment_group":"editor"},
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},
{"field": "archiveurl"},
{"field": "archivedate"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "chapter", "autofillprop":"chapter"},
{"field": "quote"}
]);

new citeTemplate('cite journal', 'journal',
[ // Basic fields
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "title", "autofillprop":"title"},
{"field": "journal", "autofillprop":"journal"},
{"field": "date", "autofillprop":"date"},
{"field": "volume", "autofillprop":"volume"},
{"field": "issue", "autofillprop":"issue"},
{"field": "page", "tooltip":"cite-page-tooltip"},
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "url", "autofillid":"url"},
{"field": "accessdate"},
{"field": "ref", "tooltip":"cite-ref-tooltip"},
],
[ // Expanded fields
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "editor<N>-last", "increment_group":"editor"},
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},
{"field": "series"},
{"field": "at", "tooltip":"cite-at-tooltip"},
{"field": "trans-title"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "location"},
{"field": "language", "autofillprop":"language"},
{"field": "format"},
{"field": "issn", "autofillprop":"issn"},
{"field": "pmc"},
{"field": "oclc"},
{"field": "bibcode"},
{"field": "id"},
{"field": "quote"},
{"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();