MediaWiki:RefToolbarLocal.js

Wikipedia, Entziklopedia askea

Oharra: Gorde ondoren zure nabigatzailearen katxea ekidin beharko duzu aldaketak ikusteko. Mozilla / Firefox / Safari: Shift tekla sakatu birkargatzeko momentuan, edo Ctrl-Shift-R sakatu (Cmd-Shift-R Apple Mac baten); IE: Ctrl tekla sakatu birkargatzeko momentuan, edo Ctrl-F5 sakatu; Konqueror:: Birkargatzeko klik egin, edo F5 sakatu, besterik ez; Opera erabiltzaileek Tresnak-Hobespenak atalera jo eta katxea garbitzeko aukera hautatu.

/* 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 //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>-<month>-<date>",
"autodate fields" : ['sartze-data'],
"months" : ['urtarrila', 'otsaila', 'martxoa', 'apirila', 'maiatza', 'ekaina', 'uztaila', 'abuztua', 'iraila', 'urria', 'azaroa', 'abendua'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('Web erref', 'Web',
[ // Basic fields
{"field": "abizena", "label":"Abizena"},
{"field": "izena", "label":"Izena"}, 
{"field": "izenburua"},
{"field": "url", "label":"URL"},
{"field": "lana", "tooltip": "Lan luze baten zati bada"},
{"field": "argitaletxea"},
{"field": "sartze-data"}
],
[ // Expanded fields
{"field": "egilea"},
{"field": "egile-lotura", "label":"Egilearen artikulua", "tooltip":"Egileak artikulua badu, artikuluaren izena"},
{"field": "egilekideak"},
{"field": "artxibo-url"},
{"field": "artxibo-data"},
{"field": "lekua"},
{"field": "orrialdea"},
{"field": "orrialdeak"},
{"field": "hizkuntza"},
{"field": "formatua"},
{"field": "doi", "label":"DOI"},
{"field": "data"},
{"field": "hila"},
{"field": "urtea"},
{"field": "aipua"}
]);

new citeTemplate('Albiste erref', 'Albisteak',
[ // Basic fields
{"field": "abizena", "label":"Abizena"},
{"field": "izena", "label":"Izena"}, 
{"field": "izenburua"},
{"field": "url", "label":"URL"},
{"field": "sartze-data"},
{"field": "argitaletxea"},
{"field": "data"}
],
[ // Expanded fields
{"field": "egilea"},
{"field": "egilea2", 'label': "2. egilea"},
{"field": "egilea2", 'label': "3. egilea"},
{"field": "egilea4", 'label': "4. egilea"},
{"field": "egilea5", 'label': "5. egilea"},
{"field": "egile-lotura", "label":"Egilearen artikulua", "tooltip":"Egileak artikulua badu, artikuluaren izena"},
{"field": "argitaletxea"},
{"field": "artxibo-url"},
{"field": "artxibo-data"},
{"field": "lekua"},
{"field": "orrialdea"},
{"field": "orrialdeak"},
{"field": "hizkuntza"},
{"field": "formatua"},
{"field": "doi", "label":"DOI"},
{"field": "hilabetea"},
{"field": "urtea"},
{"field": "aipua"}
]);

new citeTemplate('Liburu erref', 'Liburua',
[ // Basic fields
{"field": "abizena", "label":"Abizena"},
{"field": "izena", "label":"Izena"}, 
{"field": "izenburua"},
{"field": "urtea"},
{"field": "argitaletxea"},
{"field": "isbn", "label":"ISBN"},
{"field": "orrialdeak"},
{"field": "url", "label":"URL"}
],
[ // Expanded fields
{"field": "egilea"},
{"field": "egile-lotura", "label":"Egilearen artikulua", "tooltip":"Egileak artikulua badu, artikuluaren izena"},
{"field": "egilekideak"},
{"field": "editorea"},
{"field": "sartze-data"},
{"field": "artxibo-url"},
{"field": "artxibo-data"},
{"field": "lekua"},
{"field": "orrialdea"},
{"field": "hizkuntza"},
{"field": "formatua"},
{"field": "edizioa"},
{"field": "data"},
{"field": "hilabetea"},
{"field": "aipua"}
]);

new citeTemplate('Aldizkako erref', 'Aldizkakoa',
[ // Basic fields
{"field": "abizena", "label":"Abizena"},
{"field": "izena", "label":"Izena"},
{"field": "egilekideak"},
{"field": "izenburua"},
{"field": "argitaletxea"},
{"field": "data"},
{"field": "urtea"},
{"field": "hilabetea"},
{"field": "liburukia"},
{"field": "bilduma"},
{"field": "gaia"},
{"field": "orrialdeak"},
{"field": "doi", "label":"DOI"},
{"field": "pmid", "label":"PMID"},
{"field": "url", "label":"URL"},
{"field": "sartze-data"}
],
[ // Expanded fields
{"field": "egilea"},
{"field": "egile-lotura", "label":"Egilearen artikulua"},
{"field": "izena1", "label":"Egilearen izena"},
{"field": "abizena1", "label":"Egilearen abizena"},
{"field": "lotura1", "label":"Egilearen artikulua"},
{"field": "orrialdea"},
{"field": "non"},
{"field": "itzulpen-izenburua", "label":"Itzulitako izenburua"},
{"field": "argitaletxea"},
{"field": "lekua"},
{"field": "hizkuntza"},
{"field": "formatua"},
{"field": "issn", "label":"ISSN"},
{"field": "pmc", "label":"PMC"},
{"field": "oclc", "label":"OCLC"},
{"field": "bibcode"},
{"field": "id", "label":"ID"},
{"field": "laysummary", "label":"Lay summary"},
{"field": "laysource", "label":"Lay source"},
{"field": "laydate", "label":"Lay date"},
{"field": "aipua"},
{"field": "erref"},
{"field": "postscript"}
]);


new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': "Eduki berdineko erreferentziak bilatu",
'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':'Hainbat erreferentziek eduki berdina dute', 'err':errors[j]});
  }
  return ret;
}}
);

new citeErrorCheck({'type':'reflist', 'testname':'repeated', 'desc':'Hainbat erreferentziek izen berdina dute',
'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':'Hainbat erreferentziek izen berdina erabiltzen dute', 'err':errors[j]});
  }
  return ret;
}}
);

new citeErrorCheck({'type':'reflist', 'testname':'undefined', 'desc':'Izenik gabeko erreferentzien erabilera',
'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':'Izendun erreferentzia bat erabili da baina ez da definitu', 'err':errors[j]});
  }
  return ret;
}}
);

// All user-facing messages
// TODO: Document usage
$(document).ready( function() {
mw.usability.addMessages( { "cite-section-label" : "Erreferentziatu",
"cite-template-list" : "Txantiloia",
"cite-named-refs-label" : "Izendun erref.",
"cite-named-refs-title" : "Izendun erreferentzia sartu",
"cite-named-refs-button" : "Izendun erreferentziak",
"cite-named-refs-dropdown" : "Izendun erref.", // Used on the top of the named refs list dropsown
"cite-errorcheck-label" : "Errore bilaketa",
"cite-errorcheck-button" : "Erroreak bilatu",
"cite-dialog-base" : "erreferentzia",
"cite-form-submit" : "Txertatu",
"cite-form-showhide" : "Erakutsi/ezkutatu eremu gehigarriak",
"cite-no-namedrefs" : "Ez da izendun erreferentziarik aurkitu orrialdean",
"cite-namedrefs-intro" : "Erreferentziaren edukia ikusteko zerrendatik izen bat aukeratu. Sakatu \"Insert\" erreferentzia txertatzeko testuan.",
"cite-raw-preview" : "Wikitestua:",
"cite-parsed-label" : "Wikitestu analizatua:",
"cite-form-parse" : "Erakutsi aurrikuspen analizatua",
"cite-refpreview" : "Aurrikuspena",
"cite-name-label" : "Erref izena",
"cite-group-label" : "Erref izena",
"cite-errorcheck-submit" : "Bilatu",
"cite-errorcheck-heading" : "Ondorengo erroreak bilatu:",
"cite-error-unclosed" : "<span style='font-family:monospace'>&lt;ref&gt;</span> etiketak itxi gabe",
"cite-error-samecontent" : "Eduki berdineko erreferentziak",
"cite-error-templates" : "<a href='//eu.wikipedia.org/wiki/Laguntza:Erreferentziak'>Erreferentzia txantiloia</a> erabiltzen ez duten erreferentziak",
"cite-error-repeated" : "Hainbat erreferentzia izen berdinarekin",
"cite-error-undef" : "Izenik gabeko erreferentzien erabilera",
"cite-error-samecontent-msg" : "Hainbat erref eduki berdinarekin: $1",
"cite-error-repeated-msg" : "Hainbat erref izen honekin: \"$1\"",
"cite-error-templates-msg" : "Ez du txantiloirik erabiltzen: $1",
"cite-form-reset" : "Eremuak hustu",
"cite-loading" : "Kargatzen", // Shown while pagetext is being downloaded from the API
"cite-insert-date" : "Data txertatu", // Alt/title text for "insert date" icon
"cite-err-report-heading" : "Erreferentzia errore txostena", // Heading for error report table
"cite-err-report-close" : "Itxi", // Alt/title text for "close" icon on error report
"cite-err-report-empty" : "Ez da errorerik aurkitu" // Message displayed in the error report list if there are no errors
});

CiteTB.init();
});

$(window).on( 'load', function() {
  CiteTB.init();
});