Kullanıcı:Vito Genovese/Şablon yardımcısı/BOT.js

Vikipedi, özgür ansiklopedi
Not: Sayfayı kaydettikten sonra değişiklikleri görebilmek için tarayıcınızın önbelleğinizi temizlemeniz gerekir. Google Chrome, Firefox, Microsoft Edge ve Safari: ⇧ Shift tuşuna basılı tutun ve Yeniden Yükle araç çubuğu düğmesine tıklayın. Ayrıntılar ve diğer tarayıcılara yönelik yönergeler için Vikipedi:Önbelleğinizi atlayın sayfasını inceleyin.
// ***************************************************************************************
// ŞABLON YARDIMCISI
// ***************************************************************************************
// [[Vikipedi:Araçlar/Şablon yardımcısı]] - [[VP:ŞY]] - BOT oylaması kapatma modülü
// ***************************************************************************************
 
// ***************************************************************************************
// BİLGİLER
// ***************************************************************************************
// [[VP:TY]] betiğinin modifiye edilmiş sürümüdür / Modified version of [[VP:TY]]
// For credits please see [[Kullanıcı:Vito Genovese/Taslak yardımcısı.js]]
// ***************************************************************************************
// BETİK KODU
// ***************************************************************************************

function şybot() {
	if( userIsInGroup( 'bureaucrat' ) && document.title.indexOf("Vikipedi:Botlar/Başvurular/") != -1 ) {
                şyAddPortletLink( "javascript:bottagtab()", "Kapat", "ca-bottagtab", "BOT oylamasını kapat", "");
	}
  if(wgNamespaceNumber==4&&location.href.indexOf("&autoaddbottag=")!=-1&&document.getElementById('wpTextbox1')!=null)
  {
    var x=decodeURIComponent(location.href.split("&autoaddbottag=")[1]);
    document.editform.wpTextbox1.value = "{"+"{"+x+"}}--~~"+"~~\n\n" + document.editform.wpTextbox1.value + "\n\n{{BOT Son}}"
    document.getElementById('wpSummary').value=
      "[[VP:ŞY|Şablon yardımcısı]] kullanılarak oylama kapatılıyor. Karar: "+x;
    document.getElementById('wpPreview').click();
  }
}
window.ŞabyarInit= (window.ŞabyarInit|| []).concat(şybot); //schedule initializer 
 
function bottagtab()
{
  var h;
  // Vikipedi:VikiProje taslak sınıflandırma altsayfaları
  var a=['BOT'];
  var i=0;
  h="<div style='color:#000000; background-color:#fff8f8;'>&bull; ";
  while(i<a.length)
  {
    h+="<a href='javascript:bottagmenu(\""+a[i]+"\");'>"+a[i]+"</a> &bull; ";
    i++;
  }
  h+="</div><div id='bottagmenudiv' style='color:#000000; background-color:#fffff8;'></div>";
  document.getElementById("contentSub").innerHTML=h;
}
 
function bottagmenurender(a)
{

if(a.readyState != 4){
document.getElementById('bottagmenudiv').innerHTML= "<i>Yükleniyor, lütfen bekleyin...</i>";
return;
}

if(a.responseText.indexOf('<text xml:space="preserve">') ==-1 ){
document.getElementById('bottagmenudiv').innerHTML= "<i>Galiba yanlış giden bir şeyler var. Kategoride sorun olabilir mi?</i>";
return;
}

  var s=a.responseText.split('<text xml:space="preserve">')[1].split("</text>")[0];
  s=s.split("&lt;").join("<").split("&gt;").join(">");
  s=s.split("&quot;").join('"').split("&amp;").join('&');
  s=s.split('<a href="/wiki/%C5%9Eablon:');
  var i=s.length;
  while(--i) s[i]=s[i].split('" title').join('\');" title');
  s=s.join('<a temphref="javascript:bottagwith(\'');
  s=s.split('<a href=').join('<a style="color:#000000;" notanhref=');
  s=s.split('<a temphref=').join('<a href=');
  document.getElementById('bottagmenudiv').innerHTML=s;
}
 
function bottagmenu(x)
{
  //Fetch the relevant subpage of the WikiProject
  var a = sajax_init_object();
  a.open('GET',mw.config.get('wgServer')+mw.config.get('wgScriptPath')+'/api.php?action=parse&prop=text&text='+
    encodeURIComponent('__NOTOC____NOEDITSECTION__{{Vikipedi:Araçlar/Şablon_yardımcısı/'+
                       x+'}}')+'&format=xml');
  a.onreadystatechange = function(){bottagmenurender(a)};
  a.send('');
}
 
function bottagwith(x)
{
  if(x==null||x=="") return;
  location.href=mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+                                  
                "&action=edit&autoaddbottag="+encodeURIComponent(x);
}
 
// </source>