মিডিয়াউইকি:RefToolbarConfig.js

উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে

লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।

  • ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
  • ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
  • অপেরা: 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> <monthname> <year>",
"autodate fields" : ['সংগ্রহের-তারিখ'],
"months" : ['জানুয়ারি', 'ফেব্রুয়ারি', 'মার্চ', 'এপ্রিল', 'মে', 'জুন', 'জুলাই', 'আগস্ট', 'সেপ্টেম্বর', 'অক্টোবর', 'নভেম্বর', 'ডিসেম্বর'],
"modal" : true,
"autoparse" : true,
"expandtemplates" : false
};

// Cite template definitions
new citeTemplate('ওয়েব উদ্ধৃতি', 'web',
[ // 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": "ইউআরএল", "autofillid":"url"},
{"field": "ওয়েবসাইট", "autofillprop":"journal"},
{"field": "প্রকাশক", "autofillprop":"publisher"},
{"field": "সংগ্রহের-তারিখ"},
{"field": "সূত্র", "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": "ভাষা", "autofillprop":"language"},
{"field": "বিন্যাস"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "তারিখ", "autofillprop":"date"},
{"field": "উক্তি"},
{"field": "ইউআরএল-অবস্থা", "tooltip":"cite-urlstatus-tooltip"}
]);

new citeTemplate('সংবাদ উদ্ধৃতি', 'news',
[ // 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": "ইউআরএল", "autofillid":"url"},
{"field": "সংগ্রহের-তারিখ"},
{"field": "কর্ম", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},
{"field": "এজেন্সি"},
{"field": "সংখ্যা নং"},
{"field": "প্রকাশক", "autofillprop":"publisher"},
{"field": "তারিখ", "autofillprop":"date"},
{"field": "সূত্র", "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": "ভাষা", "autofillprop":"language"},
{"field": "বিন্যাস"},
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},
{"field": "উক্তি"}
]);

new citeTemplate('বই উদ্ধৃতি', 'book',
[ // 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": "তারিখ", "autofillprop":"date"},
{"field": "প্রকাশক", "autofillprop":"publisher"},
{"field": "অবস্থান", "autofillprop":"location"},
{"field": "আইএসবিএন", "autofillid":"isbn", "autofillprop":"isbn"},
{"field": "পাতা", "tooltip":"cite-page-tooltip"},
{"field": "পাতাসমূহ", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},
{"field": "সংস্করণ", "autofillprop":"edition"},
{"field": "ইউআরএল", "autofillid":"url"},
{"field": "সংগ্রহের-তারিখ"},
{"field": "সূত্র", "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":"editor"},
{"field": "সম্পাদক<N>-প্রথমাংশ", "increment_group":"editor", "increment_button":true},
{"field": "সম্পাদক<N>-সংযোগ", 'increment_group':'editorlink', 'increment_button':true},
{"field": "আর্কাইভের-ইউআরএল"},
{"field": "আর্কাইভের-তারিখ"},
{"field": "ভাষা", "autofillprop":"language"},
{"field": "বিন্যাস"},
{"field": "অধ্যায়", "autofillprop":"chapter"},
{"field": "উক্তি"}
]);

new citeTemplate('সাময়িকী উদ্ধৃতি', 'journal',
[ // 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": "সাময়িকী", "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", "autofillprop":"doi"},
{"field": "pmid", "autofillid":"pmid"},
{"field": "ইউআরএল", "autofillid":"url"},
{"field": "সংগ্রহের-তারিখ"},
{"field": "সূত্র", "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":"editor"},
{"field": "সম্পাদক<N>-প্রথমাংশ", "increment_group":"editor", "increment_button":true},
{"field": "সম্পাদক<N>-সংযোগ", 'increment_group':'editorlink', 'increment_button':true},
{"field": "ধারাবাহিক"},
{"field": "at", "tooltip":"cite-at-tooltip"},
{"field": "অনূদিত-শিরোনাম"},
{"field": "প্রকাশক", "autofillprop":"publisher"},
{"field": "অবস্থান"},
{"field": "ভাষা", "autofillprop":"language"},
{"field": "বিন্যাস"},
{"field": "issn", "autofillprop":"issn"},
{"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();