میڈیاویکی:RefToolbarConfig.js

آزاد دائرۃ المعارف، ویکیپیڈیا سے

تفصیل کے لیے کھولیں کے بٹن پر کلک کریں یاددہانی: محفوظ کرنے کے بعد تازہ ترین تبدیلیوں کو دیکھنے کے لیے آپ کو اپنے براؤزر کا کیش صاف کرنا ہوگا۔

  • فائرفاکس/ سفاری: جب Reload پر کلک کریں تو Shift دبا کر رکھیں، یا Ctrl-F5 یا Ctrl-R دبائیں (Mac پر R- )
  • گوگل کروم: Ctrl-Shift-R دبائیں (Mac پر Shift-R-⌘)
  • انٹرنیٹ ایکسپلورر: جب Refresh پر کلک کریں تو Ctrl یا Ctrl-F5 دبائیں
  • اوپیرا: Tools → Preferences میں جائیں اور کیش صاف کریں

/* 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> <monthname> <year>",
"autodate fields" : ['تاریخ_نظرثانی'],
"months" : ['جنوری', 'فروری', 'مارچ', 'اپریل', 'مئی', 'جون', 'جولائی', 'اگست', 'ستمبر', 'اکتوبر', 'نومبر', 'دسمبر'],
"modal" : true,
"autoparse" : false,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('حوالہ ویب', 'ویب',
[ // Basic fields
{"field": "نام_خانوادگی<N>", "autofillprop":"last-incr", 'increment_group':'مصنف'},
{"field": "نام<N>", "autofillprop":"first-incr", 'increment_group':'مصنف', 'increment_button':true}, 
{"field": "عنوان", "autofillprop":"title"},
{"field": "ربط"},
{"field": "ویب_سائٹ", "autofillprop":"journal"},
{"field": "ناشر"},
{"field": "تاریخ_نظرثانی"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "مصنف<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "مصنف_کا_ربط<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'پیوند نویسنده', 'increment_button':true},
{"field": "وثق_کا_ربط"},
{"field": "تاریخ_وثق_سازی"},
{"field": "مقام"},
{"field": "صفحہ", "tooltip":"cite-page-tooltip"},
{"field": "صفحات", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "زبان"},
{"field": "سانچہ"},
{"field": "ڈی_او_آئی", "autofillid":"doi"},
{"field": "تاریخ", "autofillprop":"date"},
{"field": "اقتباس"}
]);

new citeTemplate('حوالہ خبر', 'خبر',
[ // Basic fields
{"field": "نام_خانوادگی<N>", "autofillprop":"last-incr", 'increment_group':'author'},
{"field": "نام<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "عنوان", "autofillprop":"title"},
{"field": "ربط"},
{"field": "تاریخ_نظرثانی"},
{"field": "تصنیف", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},
{"field": "خبرگزاری"},
{"field": "شماره"},
{"field": "ناشر"},
{"field": "تاریخ", "autofillprop":"date"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}
],
[ // Expanded fields
{"field": "مصنف<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "پیوند_نویسنده<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "نشانی_بایگانی"},
{"field": "تاریخ_بایگانی"},
{"field": "مکان"},
{"field": "صفحہ", "tooltip":"cite-page-tooltip"},
{"field": "صفحات", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "زبان"},
{"field": "فرمت"},
{"field": "doi", "autofillid":"doi"},
{"field": "گفتاورد"}
]);

new citeTemplate('حوالہ کتاب', 'کتاب',
[ // Basic fields
{"field": "نام_خانوادگی<N>", "autofillprop":"last-incr", 'increment_group':'نویسنده'},
{"field": "نام<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, 
{"field": "عنوان", "autofillprop":"title"},
{"field": "تاریخ", "autofillprop":"year"},
{"field": "ناشر", "autofillprop":"publisher"},
{"field": "مقام", "autofillprop":"location"},
{"field": "آئی_ایس_بی_این", "autofillid":"isbn"},
{"field": "صفحہ", "tooltip":"cite-page-tooltip"},
{"field": "صفحات", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "نسخہ", "autofillprop":"edition"},
{"field": "ربط"},
{"field": "تاریخ_بازبینی"},
{"field": "ref", "tooltip":"cite-ref-tooltip"}

],
[ // Expanded fields
{"field": "نویسنده<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "پیوند_نویسنده<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},
{"field": "نام خانوادگی_ویراستار<N>", "increment_group":"ویراستار"},
{"field": "نام_ویراستار<N>", "increment_group":"ویراستار", "increment_button":true},
{"field": "پیوند ویراستار<N>", 'increment_group':'پیوند ویراستار', 'increment_button':true},
{"field": "نشانی_بایگانی"},
{"field": "تاریخ_بایگانی"},
{"field": "زبان"},
{"field": "فرمت"},
{"field": "فصل"},
{"field": "گفتاورد"}
]);

new citeTemplate('حوالہ جریدہ', 'جریدہ',
[ // Basic fields
{"field": "نام_خانوادگی<N>", "autofillprop":"last-incr", 'increment_group':'نویسنده'},
{"field": "نام<N>", "autofillprop":"first-incr", 'increment_group':'نویسنده', 'increment_button':true}, 
{"field": "عنوان", "autofillprop":"title"},
{"field": "ژورنال", "autofillprop":"journal"},
{"field": "تاریخ", "autofillprop":"date"},
{"field": "جلد", "autofillprop":"volume"}, // این فیلد در الگو:یادکرد ژورنال وجود ندارد!
{"field": "شماره", "autofillprop":"issue"},
{"field": "صفحه", "tooltip":"cite-page-tooltip"},
{"field": "صفحات", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "doi", "autofillid":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "ربط"},
{"field": "تاریخ_بازبینی"},
{"field": "ref", "tooltip":"cite-ref-tooltip"},
],
[ // Expanded fields
{"field": "نویسنده<N>", 'increment_group':'author_alt', 'increment_button':true},
{"field": "پیوند_نویسنده<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'پیوند نویسنده', 'increment_button':true},
{"field": "نام خانوادگی_ویراستار<N>", "increment_group":"ویراستار"},
{"field": "نام_ویراستار<N>", "increment_group":"ویراستار", "increment_button":true},
{"field": "پیوند_ویراستار<N>", 'increment_group':'پیوند ویراستار', 'increment_button':true},
{"field": "سری"},
{"field": "در", "tooltip":"cite-at-tooltip"},
{"field": "ترجمہ_عنوان"},
{"field": "ناشر"},
{"field": "مقام"},
{"field": "زبان"},
{"field": "فرمت"},
{"field": "شاپا"},
{"field": "pmc"},
{"field": "oclc"},
{"field": "bibcode"},
{"field": "id"},
{"field": "گفتاورد"},
{"field": "پس_نوشت", "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();