مدیاویکی:Gadget-Need.js

از ویکی‌پدیا، دانشنامهٔ آزاد
(تغییرمسیر از مدیاویکی:Gadget-Niaz.js)

نکته: برای دیدن تغییرات، ممکن است نیاز باشد که حافظهٔ نهانی مرورگر خود را پس از انتشار پاک‌سازی کنید. گوگل کروم، فایرفاکس، مایکروسافت اج و سافاری: کلید Shift را نگه دارید و روی دکمهٔ Reload در نوار ابزار مرورگر کلیک کنید. برای آگاهی از جزئیات و نحوهٔ پاک‌سازی حافظهٔ نهانی سایر مرورگرها، صفحهٔ ویکی‌پدیا:میانگیر مرورگرتان را خالی کنید را ببینید.

/*
<<<<<<<<<< derived from [[n:en:MediaWiki:Gadget-UserMessages.js]] and [[n:MediaWiki:Gadget-UserMessages.js]] for fa.wikipeida.org >>>>>>>>>>
adapted by [[user:Reza1615]] 
*/
// <source lang="javascript">
 
//moved here from commons
function getParamValue(paramName, url) { if (typeof url == "undefined") { url = document.location.href; } var cmdRe = RegExp("[&?]" + paramName + "=([^&]*)"); var m = cmdRe.exec(url); if (m) { try { return decodeURIComponent(m[1]); } catch (someError) { } } return null; }
//end moved here from commons
// Configuration
 
// Should the edits be saved automatically?
if(window.template3_autosave == false){}else{ template3_autosave = true; }
 
// template3 Name
var utemplate32 = new Array(17)
utemplate32[0]  =  'جعبه اطلاعات-نیاز'
utemplate32[1]  =  'میان‌ویکی-نیاز'
utemplate32[2]  =  'رده-نیاز'
utemplate32[3]  =  'مختصات-نیاز'
utemplate32[4]  =  'عنوان مترادف-نیاز'
utemplate32[5]  =  'ترجمه-نیاز'
utemplate32[6]  =  'اصلاح ترجمه'
utemplate32[7]  =  'بازنویسی'
utemplate32[8]  =  'فارسی‌سازی نشانه'
utemplate32[9]  =  'عکس-نیاز'
utemplate32[10]  =  'تصویر نرم‌افزار-نیاز'
utemplate32[11]  =  'نقشه-نیاز'
utemplate32[12]  =  'پرچم-نیاز'
utemplate32[13]  =  'جدول-نیاز'
utemplate32[14]  =  'نمودار-نیاز'
utemplate32[15]  =  'آمار-نیاز'
utemplate32[16]  =  'سیستم متریک-نیاز'
utemplate32[17]  =  'به روز-نیاز'
utemplate32[18]  =  'کد شابک کتاب-نیاز'
 
 
 
// Text to be shown in Toolbox
var uText3= new Array(17)
uText3[0]  =  'جعبه > جعبه اطلاعات-نیاز'
uText3[1]  =  'نیاز > میان‌ویکی-نیاز'
uText3[2]  =  'نیاز > رده-نیاز'
uText3[3]  =  'نیاز > مختصات-نیاز'
uText3[4]  =  'ترجمه > عنوان مترادف-نیاز'
uText3[5]  =  'ترجمه > ترجمه-نیاز'
uText3[6]  =  'ترجمه > اصلاح ترجمه'
uText3[7]  =  'ترجمه > بازنویسی'
uText3[8]  =  'ترجمه > فارسی‌سازی نشانه'
uText3[9]  =  'عکس > عکس-نیاز'
uText3[10]  =  'عکس > تصویر نرم‌افزار-نیاز'
uText3[11]  =  'عکس > نقشه-نیاز'
uText3[12]  =  'الگو > پرچم-نیاز'
uText3[13]  =  'نیاز > جدول-نیاز'
uText3[14]  =  'نیاز > نمودار-نیاز'
uText3[15]  =  'نیاز > آمار-نیاز'
uText3[16]  =  'نیاز > سیستم متریک-نیاز'
uText3[17]  =  'نیاز > به روز-نیاز'
uText3[18]  =  'نیاز > کد شابک کتاب-نیاز'
 
 
// Mouseover help text for Toolbox
var uHelp3 = new Array(17)
uHelp3[0]  =  'جعبه > جعبه اطلاعات-نیاز'
uHelp3[1]  =  'نیاز > میان‌ویکی-نیاز'
uHelp3[2]  =  'نیاز > رده-نیاز'
uHelp3[3]  =  'نیاز > مختصات-نیاز'
uHelp3[4]  =  'ترجمه > عنوان مترادف-نیاز'
uHelp3[5]  =  'ترجمه > ترجمه-نیاز'
uHelp3[6]  =  'ترجمه > اصلاح ترجمه'
uHelp3[7]  =  'ترجمه > بازنویسی'
uHelp3[8]  =  'ترجمه > فارسی‌سازی نشانه'
uHelp3[9]  =  'عکس > عکس-نیاز'
uHelp3[10]  =  'عکس > تصویر نرم‌افزار-نیاز'
uHelp3[11]  =  'عکس > نقشه-نیاز'
uHelp3[12]  =  'الگو > پرچم-نیاز'
uHelp3[13]  =  'نیاز > جدول-نیاز'
uHelp3[14]  =  'نیاز > نمودار-نیاز'
uHelp3[15]  =  'نیاز > آمار-نیاز'
uHelp3[16]  =  'نیاز > سیستم متریک-نیاز'
uHelp3[17]  =  'نیاز > به روز-نیاز'
uHelp3[18]  =  'نیاز > کد شابک کتاب-نیاز'
 
 
template3_pagename = "نام مقاله را بنویسید:";
template3_what = "با چی؟";
 
// Site info
scriptPath = "/w/index.php";
prettyPath = "/wiki/";
wikiHostname = "fa.wikipedia.org";
 
// From [[en:Wikipedia:WikiProject User scripts/Scripts/addLink]]
function addLink(where, url1, name3, id, title, key, after, url2, name4)
{
    var na2 = document.createElement('a');
    na2.href = url1;
    na2.appendChild(document.createTextNode(name3));
    var li2 = document.createElement('li');
    if(id) li2.id = id;
    li2.appendChild(na2);
 
    if (url2) { //Another link, brother of the previous.
       var na2 = document.createElement('a');
       na2.href = url2;
       na2.appendChild(document.createTextNode(name4 ? name4 : name3));
       li2.appendChild(document.createTextNode(" · ")); //separate them a bit
       li2.appendChild(na2);
    }
 
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
    if(after) {
        tabs.insertBefore(li2,document.getElementById(after));
    } else {
        tabs.appendChild(li2);
    }
    //akeytt is deprected and does nothing. who cares about access keys anyhow.
    /*if(id && ta) { //ta does not exist in vector? 
        if(key && title) { ta[id] = [key, title]; }
        else if(key) { ta[id] = [key, '']; }
        else if(title) { ta[id] = ['', title];}
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();*/
    return li2;
}
 
// Add the template3
function template3_mark(page_fakeaction, message_lang) {
  //if (!message_lang) return; //User pressed cancel
 
  //Now we assume message template3s to be properly autotranslated
  if (message_lang) langparam='&template3_lang=' + message_lang;
  else langparam='';
 
  var pagename2 = encodeURIComponent(mw.config.get('wgPageName'));
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  document.location = editlk + '&fakeaction=' + page_fakeaction + langparam + '&template3_type=1';
}
 
// Add template3 to user talk page
function template3_addtemplate(template3) {
  if (getParamValue('template3_lang')) {
          template3 = template3 + '/' + getParamValue('template3_lang');
  }
 
  var txt = '{{' + template3 + '}}';
  document.editform.wpTextbox1.value =  txt + '\n'+document.editform.wpTextbox1.value;
  //  the edit summary for when you mark the image. You can change it if you want.
  document.editform.wpSummary.value = 'برچسب «' + template3 + '» به مقاله با استفاده از [[ویکی‌پدیا:ابزار برچسب‌گذار|ابزار برچسب‌گذار]]';
  if (template3_autosave) document.editform.wpSave.click();
}
 
// Add the template3
function template3_mark2(page_fakeaction, media_name, can_handle_empty_parameter, add_namespace) {
  if (media_name == null) return; // User pressed cancel
  if (media_name == '' && can_handle_empty_parameter != 1) return; // User did not supply parameter and template3 cannot handle that
  // Parameter handling for special cases
  if (add_namespace && media_name.length > 0) media_name = 'File:' + media_name;
 
  var pagename2 = encodeURIComponent(mw.config.get('wgPageName'));
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  document.location = editlk + '&fakeaction=' + page_fakeaction + '&media_name=' + encodeURIComponent (media_name) + '&template3_type=2';
}
 
// Add template3 to user talk page
function template3_addtemplate2(template3) {
  if (getParamValue('media_name')) {
          template3 = template3 + '|' + getParamValue('media_name');
  }
 
  var txt = '{{' + template3 + '}}';
  document.editform.wpTextbox1.value =  txt + '\n'+document.editform.wpTextbox1.value;
  //  the edit summary for when you mark the image. You can change it if you want.
  document.editform.wpSummary.value = 'برچسب «' + template3 + '» به مقاله با استفاده از [[ویکی‌پدیا:ابزار برچسب‌های نیاز|ابزار برچسب‌های نیاز]]';
  if (template3_autosave) document.editform.wpSave.click();
}
 
 
// Do the thing with the stuff here.
function template3_onload2() {
  if (mw.config.get('wgNamespaceNumber') == 0) { //NS_USERTALK
    // new section
    try {
    if (skin === 'vector') {
        if (window.useFancyVectorDropdown || window.useFancyVectorDropdown === undefined) {
            try {
                makeVectorFancySection3();
                useFancyVectorDropdown = 'done'; //this is for debug. can remove
            }
            catch (e) {
                document.getElementById('panel3').innerHTML += '<div id="p-Niaz" class="portal"><h5 lang="fa" xml:lang="fa">Niaz</h5><div class="body"><ul> </ul> </div> </div>';
            }
        }
        else {
            document.getElementById('panel3').innerHTML += '<div id="p-Niaz" class="portal"><h5 lang="fa" xml:lang="fa">Niaz</h5><div class="body">\n <ul> </ul> </div> </div>';
       }
    }
    if (skin === 'monobook') {
        document.getElementById('column-one').innerHTML += '<div id="p-Niaz" class="portlet3"> <h5 lang="fa" xml:lang="fa">Niaz</h5> <div class="pBody">	<ul></ul></div>	</div>';
    }
    } catch (e) {} //ignore errors and just use tb if they happen.
    var portlet3 = (document.getElementById('p-Niaz') ? 'p-Niaz' : 'p-navigation');
  //"p-cactions", "p-personal", "p-navigation", or "p-tb"
    addLink(portlet3, 'javascript:template3_mark(\'0\')', uText3[0], 'mark-warn', uHelp3[0], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'1\')', uText3[1], 'mark-warn', uHelp3[1], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'2\')', uText3[2], 'mark-warn', uHelp3[2], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'3\')', uText3[3], 'mark-warn', uHelp3[3], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'4\')', uText3[4], 'mark-warn', uHelp3[4], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'5\')', uText3[5], 'mark-warn', uHelp3[5], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'6\')', uText3[6], 'mark-warn', uHelp3[6], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'7\')', uText3[7], 'mark-warn', uHelp3[7], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'8\')', uText3[8], 'mark-warn', uHelp3[8], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'9\')', uText3[9], 'mark-warn', uHelp3[9], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'10\')', uText3[10], 'mark-warn', uHelp3[10], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'11\')', uText3[11], 'mark-warn', uHelp3[11], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'12\')', uText3[12], 'mark-warn', uHelp3[12], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'13\')', uText3[13], 'mark-warn', uHelp3[13], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'14\')', uText3[14], 'mark-warn', uHelp3[14], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'15\')', uText3[15], 'mark-warn', uHelp3[15], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'16\')', uText3[16], 'mark-warn', uHelp3[16], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'17\')', uText3[17], 'mark-warn', uHelp3[17], null, null);
    addLink(portlet3, 'javascript:template3_mark(\'18\')', uText3[18], 'mark-warn', uHelp3[18], null, null);
  }
// Important thing and stuff above.
 
  var fakeaction2 = getParamValue('fakeaction');
  var template3_type = getParamValue('template3_type');	// Fetch what template3 to add
 
  var action_idx2 = -1;
  try {
    action_idx2 = parseInt (fakeaction2, 10);
  } catch (some_error) {
    action_idx2 = -1;    
  }
  var add_idx2 = -1;
  try {
    add_idx2 = parseInt (template3_type, 10);
  } catch (some_error) {
    add_idx2 = -1;    
  }
  if (add_idx2 >= 1 && add_idx2 <= 2 && action_idx2 >= 0 && action_idx2 < utemplate32.length) {
    //may i take this moment to mention, this script is very very confusing - bawolff
    if (mw.config.get('wgNamespaceNumber') !== 0) { 
      alert("The user notify script has been disabled in this namespace for security reasons. If you see this message, please tell [[n:en:User:Bawolff]] what linked you clicked on to get here.");
      throw new Error("خطای امنیتی: فضای نامی اشتباه برای ابزار اطلاع رسانی.");
    }
    if (add_idx2 == 1)
      template3_addtemplate (utemplate32[action_idx2]);
    else
      template3_addtemplate2 (utemplate32[action_idx2]);
  }
}
 
$(document).ready(template3_onload2);
 
function makeVectorFancySection3()  {
//wrap this in a try. this might be somewhat delicate at the moment.
var pNiaz = document.createElement('div');
pNiaz.id = 'p-Niaz'
pNiaz.className = 'vectorMenu'
pNiaz.innerHTML = ' <h5><span>Niaz</span><a href="#" style="background-image:none;"/></h5> <div class="menu"> <ul lang="fa" xml:lang="fa"> </ul> </div>';
var rightNav3 = document.getElementById('right-navigation');
var pViews3 = document.getElementById('p-views');
rightNav3.insertBefore(pNiaz, pViews3 .nextSibling)
 
}
// </source>