ব্যবহারকারী:Pratyya Ghosh/StatusChanger.js

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

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

  • ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
  • ইন্টারনেট এক্সপ্লোরার / এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন
  • অপেরা: Ctrl-F5 টিপুন।
//////////STATUS CHANGER
// compatible with {{Statustop}} for display
 
$(function (){
  //Check if the config is defined
  if (typeof(statusChangerConfig) == 'undefined') {
    statusChangerConfig = {}
  }
 
  if (typeof(statusChangerConfig.statusList) == 'undefined') {
      statusChangerConfig.statusList = [ 'অনলাইনে', 'ব্যস্ত','কাছাকাছি', 'অফলাইনে', 'ঘুমাচ্ছেন' ];
  }
 
  if (typeof(statusChangerConfig.statusPage) == 'undefined') {
      statusChangerConfig.statusPage = 'User:' + wgUserName + '/অবস্থা';
  }
 
  //Add the links
  for (var i=0; i<statusChangerConfig.statusList.length; i++) {
    var stat = statusChangerConfig.statusList[i];
    var message = (stat === "sleep") ?  link = "asleep" : link = decodeURIComponent(stat);
    mw.util.addPortletLink(
      "p-personal", //target tab - personal links
      mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + statusChangerConfig.statusPage + "&action=edit&newstatus=" + decodeURIComponent(stat), //link URL
      decodeURIComponent(stat), //link text
      "pt-status-" + decodeURIComponent(stat), //id of new button
      "I'm " + message + "!", //hover text
      "", //???
      document.getElementById("pt-logout")); //add before logout button
  }
 
  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  var status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = decodeURIComponent(status);
  if (status == "sleep")
  { status = "sleeping"; }
  document.getElementById('wpSummary').value = wgUserName + " এখন " + decodeURIComponent(status) +"।" + "([[ ব্যবহারকারী:Pratyya Ghosh/StatusChanger.js|StatusChanger.js]] ব্যবহার করে)";
  document.getElementById('wpMinoredit').checked = true;
  //Submit it!
  document.getElementById('editform').submit();
});
 
//[[বিষয়শ্রেণী:উইকিপিডিয়া স্ক্রিপ্ট|statusChanger]]