MediaWiki:RefToolbarConfig.js

Википедия — ирекле энциклопедия мәғлүмәте

Иҫкәрмә: Күрәһең, битте һаҡлағандан һуң үҙгәртеүҙәрегеҙ күренһен өсөн, браузерығыҙҙың кэшын таҙартырға кәрәк.

  • Firefox / Safari: Shift төймәһенә баҫып, ебәрмәйенсә, панелдәге Яңыртырға төймәһенә баҫығыҙ, йәки Ctrl+F5 йә Ctrl+R (Mac-та ⌘-R) төймәләренә баҫығыҙ
  • Google Chrome: Ctrl+Shift+R төймәләренә баҫығыҙ (Mac-та ⌘-Shift+R)
  • Internet Explorer: Ctrl төймәһенә баҫып, ебәрмәйенсә, Яңыртырға төймәһенә йәки Ctrl+F5 төймәләренә баҫығыҙ
  • Opera: Ctrl+F5 төймәләренә баҫығыҙ.
/* From https://en.wikipedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&oldid=630221931
* 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" : "<year>-<zmonth>-<zdate>",
"autodate fields" : ['accessdate'],
"months" : ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'],
"modal" : false,
"autoparse" : false,
"expandtemplates" : false
};

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

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

new citeTemplate('книга', 'книга',
[ // Basic fields
{"field": "автор", "autofillprop":"автор"}, 
{"field": "часть", "autofillprop":"часть"},
{"field": "заглавие", "autofillprop":"заглавие"}, 
{"field": "оригинал", "autofillprop":"оригинал"}, 
{"field": "ссылка", "autofillprop":"ссылка"}, 
{"field": "ответственный", "autofillprop":"ответственный"}, 
{"field": "издание", "autofillprop":"издание"}, 
{"field": "место", "autofillprop":"место"}, 
{"field": "издательство", "autofillprop":"издательство"}, 
{"field": "год", "autofillprop":"год"}, 
{"field": "том", "autofillprop":"том"}, 
{"field": "серия", "autofillprop":"серия"}, 
{"field": "страницы", "autofillprop":"страницы"}, 
{"field": "страниц", "autofillprop":"страниц"}, 
{"field": "pages", "autofillprop":"pages"}, 
{"field": "allpages", "autofillprop":"allpages"}, 
{"field": "isbn", "autofillprop":"isbn"}, 
{"field": "тираж", "autofillprop":"тираж"}, 
{"field": "url"},
{"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"},
{"field": "format"},
{"field": "chapter"},
{"field": "quote"}
]);

new citeTemplate('публикация|книга', 'публикация книга',
[ // Basic fields
{"field": "автор"},
{"field": "заглавие"}, 
{"field": "часть"},
{"field": "ссылка"},
{"field": "ответственный"},
{"field": "место"},
{"field": "издательство"},
{"field": "год"},
{"field": "isbn"},
{"field": "ref", "tooltip":"cite-ref-tooltip"},
],
[ // Expanded fields
{"field": "подзаголовок"},
{"field": "язык"},
{"field": "издание"},
{"field": "выпуск"},
{"field": "книга"},
{"field": "раздел"},
{"field": "серия"},
{"field": "инфо"},
{"field": "том"},
{"field": "томов"},
{"field": "страницы"},
{"field": "страниц"},
{"field": "pages"},
{"field": "allpages"},
{"field": "столбцы"},
{"field": "столбцов"},
{"field": "volume"},
{"field": "соавторы"},
{"field": "тираж"},
{"field": "примечание"},
]);

new citeTemplate('публикация|статья', 'публикация статья',
[ // Basic fields
{"field": "автор"},
{"field": "заглавие"}, 
{"field": "часть"}, 
{"field": "часть ссылка"},
{"field": "издание"},
{"field": "год"},
{"field": "месяц"},
{"field": "день"},
{"field": "номер"},
{"field": "том"},
{"field": "issn"},
{"field": "ref", "tooltip":"cite-ref-tooltip"},
],
[ // Expanded fields
{"field": "подзаголовок"},
{"field": "ссылка"},
{"field": "оригинал"},
{"field": "вид"},
{"field": "соавторы"},
{"field": "ответственный"},
{"field": "издание ответственный"},
{"field": "тип"},
{"field": "выпуск"},
{"field": "issue"},
{"field": "volume"},
{"field": "страницы"},
{"field": "pages", "label" : "Pages"},
{"field": "язык"},
{"field": "doi"},
{"field": "примечание"},
]);

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();