МедијаВики:RefToolbarLocal.js

Од Википедија — слободната енциклопедија

Напомена: По објавувањето може да треба да го исчистите меѓускладот (кеш) на прелистувачот за да можете ги видите промените.

  • Firefox / Safari: Држете Shift и стиснете на Превчитај (Reload) или притиснете Ctrl-F5 или Ctrl-R (⌘-R на Mac);
  • Google Chrome: Притиснете Ctrl-Shift-R (⌘-R на Mac)
  • Internet Explorer / Edge: Држете Ctrl додека притискате на Refresh или притиснете Ctrl-F5.
  • Opera: Стиснете на 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.
* 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> <monthname> <year>",
"autodate fields" : ['accessdate'],
"months" : ['јануари', 'февруари', 'март', 'април', 'мај', 'јуни', 'јули', 'август', 'септември', 'октомври', 'ноември', 'декември'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('cite web', 'Web',
[ // Basic fields
{"field": "last", "label":"Презиме", "autofillprop":"last1"},
{"field": "first", "label":"Име", "autofillprop":"first1"}, 
{"field": "title", "autofillprop":"title"},
{"field": "url", "label":"URL"},
{"field": "work", "tooltip": "What larger work this is part of", "autofillprop":"journal"},
{"field": "publisher"},
{"field": "accessdate", "label":"Консултирано"}
],
[ // Expanded fields
{"field": "author"},
{"field": "authorlink", "label":"Авторска статија", "совет":"Ако авторот има статија, тогаш називот на статијата"},
{"field": "coauthors", "autofillprop":"coauthors"},
{"field": "archiveurl", "label":"Архивска URL"},
{"field": "archivedate", "label":"Архивски датум"},
{"field": "location"},
{"field": "page"},
{"field": "pages", "autofillprop":"pages"},
{"field": "language"},
{"field": "format"},
{"field": "doi", "label":"DOI", "autofillid":"doi"},
{"field": "date", "autofillprop":"date"},
{"field": "month"},
{"field": "year"},
{"field": "quote"}
]);

new citeTemplate('cite news', 'Вести',
[ // Basic fields
{"field": "last", "label":"Презиме"},
{"field": "first", "label":"Име"}, 
{"field": "title"},
{"field": "url", "label":"URL"},
{"field": "accessdate", "label":"Консултирано"},
{"field": "newspaper"},
{"field": "date"}
],
[ // Expanded fields
{"field": "author"},
{"field": "author2", 'label': "2. автор"},
{"field": "author3", 'label': "3. автор"},
{"field": "author4", 'label': "4. автор"},
{"field": "author5", 'label': "5. автор"},
{"field": "authorlink", "label":"Авторска статија", "совет":"Ако авторот има статија, тогаш називот на статијата"},
{"field": "agency"},
{"field": "archiveurl", "label":"Архивска URL"},
{"field": "archivedate", "label":"Архивски датум"},
{"field": "location"},
{"field": "page"},
{"field": "pages"},
{"field": "language"},
{"field": "format"},
{"field": "doi", "label":"DOI"},
{"field": "month"},
{"field": "year"},
{"field": "quote"}
]);

new citeTemplate('cite book', 'Книга',
[ // Basic fields
{"field": "last", "label":"Презиме", "autofillprop":"last1"},
{"field": "first", "label":"Име", "autofillprop":"first1"}, 
{"field": "title", "autofillprop":"title"},
{"field": "year", "autofillprop":"year"},
{"field": "publisher", "autofillprop":"publisher"},
{"field": "location", "autofillprop":"location"},
{"field": "isbn", "label":"ISBN", "autofillid":"isbn"},
{"field": "pages"},
{"field": "url", "label":"URL"}
],
[ // Expanded fields
{"field": "author"},
{"field": "edition", "autofillprop":"edition"},
{"field": "authorlink", "label":"Авторска статија", "совет":"Ако авторот има статија, називот на статијавата"},
{"field": "coauthors", "autofillprop":"coauthors"},
{"field": "editor"},
{"field": "accessdate", "label":"Консултирано"},
{"field": "archiveurl", "label":"Архивска URL"},
{"field": "archivedate", "label":"Архивски датум"},
{"field": "page"},
{"field": "language"},
{"field": "format"},
{"field": "chapter"},
{"field": "date"},
{"field": "month"},
{"field": "quote"}
]);

new citeTemplate('cite journal', 'Списание',
[ // Basic fields
{"field": "last", "label":"Last name", "autofillprop":"last1"},
{"field": "first", "label":"First name", "autofillprop":"first1"},
{"field": "coauthors", "autofillprop":"coauthors"},
{"field": "title", "autofillprop":"title"},
{"field": "journal", "autofillprop":"journal"},
{"field": "date", "autofillprop":"date"},
{"field": "year"},
{"field": "month"},
{"field": "volume", "autofillprop":"volume"},
{"field": "series"},
{"field": "issue", "autofillprop":"issue"},
{"field": "pages", "autofillprop":"pages"},
{"field": "doi", "label":"DOI", "autofillid":"doi"},
{"field": "pmid", "label":"PMID", "autofillid":"pmid"},
{"field": "url", "label":"URL"},
{"field": "accessdate", "label":"Консултирано"}
],
[ // Expanded fields
{"field": "author"},
{"field": "authorlink", "label":"Авторска статија"},
{"field": "editor1-first", "label":"Име на уредникот"},
{"field": "editor1-last", "label":"Презиме на уредникот"},
{"field": "editor1-link", "label":"Статија на уредникот"},
{"field": "page"},
{"field": "at"},
{"field": "trans_title", "label":"Преведен наслов"},
{"field": "publisher"},
{"field": "location"},
{"field": "language"},
{"field": "format"},
{"field": "issn", "label":"ISSN"},
{"field": "pmc", "label":"PMC"},
{"field": "oclc", "label":"OCLC"},
{"field": "bibcode"},
{"field": "id", "label":"ID"},
{"field": "laysummary", "label":"Нестручен опис"},
{"field": "laysource", "label":"Нестручен извор"},
{"field": "laydate", "label":"Нестручен датум"},
{"field": "quote"},
{"field": "ref"},
{"field": "postscript"}
]);


new citeErrorCheck({'type':'reflist', 'testname':'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':'Има повеќе наводи со иста содржина', 'err':errors[j]});
  }
  return ret;
}}
);

new citeErrorCheck({'type':'reflist', 'testname':'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':'Повеќе наводи носат исто име', 'err':errors[j]});
  }
  return ret;
}}
);

new citeErrorCheck({'type':'reflist', 'testname':'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':'A named reference is used but not defined', 'err':errors[j]});
  }
  return ret;
}}
);

// All user-facing messages
// TODO: Document usage
$(document).ready( function() {
mw.usability.addMessages( { "cite-section-label" : "Наведување",
"cite-template-list" : "Предлошки",
"cite-named-refs-label" : "Именуван наводи",
"cite-named-refs-title" : "Вметни именуван навод",
"cite-named-refs-button" : "Именувани наводи",
"cite-named-refs-dropdown" : "Именувани наводи", // Стои најгоре во расклопникот за именувани наводи
"cite-errorcheck-label" : "Проверка на грешки",
"cite-errorcheck-button" : "Провери грешки",
"cite-dialog-base" : "навод",
"cite-form-submit" : "Вметни",
"cite-form-showhide" : "Прик/скр уште полиња",
"cite-no-namedrefs" : "Не најдов ниеден именуван навод на странивава",
"cite-namedrefs-intro" : "Изберете име од списокот за да ги видите наведените содржини. Стиснете на \„Вметни\“ за да вметнете негов навод во текстот.",
"cite-raw-preview" : "Викитрекст:",
"cite-parsed-label" : "Расчленет викитекст:",
"cite-form-parse" : "Прикажи расчленет преглед",
"cite-refpreview" : "Преглед",
"cite-name-label" : "Име на навд.",
"cite-group-label" : "Наводна група",
"cite-errorcheck-submit" : "Провери",
"cite-errorcheck-heading" : "Провери го следниве грешки:",
"cite-error-unclosed" : "Необострани ознаки <span style='font-family:monospace'>&lt;ref&gt;</span>",
"cite-error-samecontent" : "Наводи со иста содржина",
"cite-error-templates" : "Наводите не користат <a href='//en.wikipedia.org/wiki/Wikipedia:Citation_templates'>предлошка за наведување</a>",
"cite-error-repeated" : "Повеќе наводи со исто име",
"cite-error-undef" : "Употреба на неопределени именувани наводи",
"cite-error-samecontent-msg" : "Повеќе наводи имаат иста содржина: $1",
"cite-error-repeated-msg" : "Повеќе наводи го носат името: \"$1\"",
"cite-error-templates-msg" : "Не ја користи предлошката: $1",
"cite-form-reset" : "Одново образецот",
"cite-loading" : "Вчитувам податоци", // Се прикажува додека извршникот го презема текстот на страницата
"cite-insert-date" : "Вметни тековен датум", // Алт/насловен текст за иконата „вметни датум“
"cite-err-report-heading" : "Изшветај од грешки во наводите", // Заглавие за табелата со грешки
"cite-err-report-close" : "Затвори", // Алт/насловен текст за иконата „затвори“ во извештајот за грешки
"cite-err-report-empty" : "Не најдов ниедна грешка", // Порака што се прикажува во списокот на грешки ако нема ниедна грешка
"cite-autofill-alt" : "Самопополни" // Алтернативен текст на копчето за самопополнување
});

CiteTB.init();
});

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