// ***************************************************************************************
// ŞABLON YARDIMCISI
// ***************************************************************************************
// [[Vikipedi:Araçlar/Şablon yardımcısı]] - [[VP:ŞY]] Taslak şablonu ekleme modülü
// ***************************************************************************************
// ***************************************************************************************
// BİLGİLER
// ***************************************************************************************
// Yazar / Author : [[:en:User:ais523]]
// Geliştirme / Enhancements : [[:en:User:Alai]] ve [[:en:User:jj137]]
// Onarımlar / Fixes : [[:en:User:Zro]] ve [[:en:User:Amalthea]]
// Kaynak / Source : [[:en:User:Zro/stubtagtab3.js]]
// Bilgi / Info : [[Vikipedi:Araçlar/Taslak yardımcısı]]
// Türkçeleştirme / Localization : [[Kullanıcı:Vito Genovese]]
// ***************************************************************************************
// BETİK KODU
// ***************************************************************************************
$(function(){
if(wgNamespaceNumber==0&&wgAction=="view")
{
if(document.getElementById("ca-edit"))
mw.util.addPortletLink('p-cactions', 'javascript:stubtagtab()', 'taslak', 'ca-stubtag',
'Sayfaya taslak etiketi ekle', '');
}
if(location.href.indexOf("&autoaddstubtag=")!=-1&&document.getElementById('wpTextbox1')!=null)
{
var x=decodeURIComponent(location.href.split("&autoaddstubtag=")[1]);
if(x.indexOf("-taslak")==-1) x+="-taslak";
document.getElementById('wpTextbox1').value+="\n{"+"{"+x+"}}"; //add to the end of the article
document.getElementById('wpSummary').value=
"[[VP:ŞY|Şablon yardımcısı]] kullanılarak {"+"{"+x+"}} etiketi konuyor";
document.getElementById('editform').submit();
}
});
function stubtagtab()
{
var h;
// Vikipedi:VikiProje taslak sınıflandırma altsayfaları
var a=['futbolcu','Biyografi','Coğrafya','Diğer',
'Din, mitoloji ve inanç','Eğitim','Eğlence','Hukuk ve politika',
'Kurum','Kültür','Savaş','Spor','Tarih','Ticaret'];
var i=0;
h="<div style='color:#000000; background-color:#fff8f8;'>• ";
while(i<a.length)
{
h+="<a href='javascript:stubtagmenu(\""+a[i]+"\");'>"+a[i]+"</a> • ";
i++;
}
h+="</div><div id='stubtagmenudiv' style='color:#000000; background-color:#fffff8;'></div>";
document.getElementById("contentSub").innerHTML=h;
}
function stubtagmenurender(a)
{
if(a.readyState != 4){
document.getElementById('stubtagmenudiv').innerHTML= "<i>Yükleniyor, lütfen bekleyin...</i>";
return;
}
if(a.responseText.indexOf('<text xml:space="preserve">') ==-1 ){
document.getElementById('stubtagmenudiv').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("<").join("<").split(">").join(">");
s=s.split(""").join('"').split("&").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:stubtagwith(\'');
s=s.split('<a href=').join('<a style="color:#000000;" notanhref=');
s=s.split('<a temphref=').join('<a href=');
document.getElementById('stubtagmenudiv').innerHTML=s;
}
function stubtagmenu(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:VikiProje_taslak_sınıflandırma/'+
x+'}}')+'&format=xml');
a.onreadystatechange = function(){stubtagmenurender(a)};
a.send('');
}
function stubtagwith(x)
{
if(x==null||x=="") return;
location.href=mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+
"&action=edit&autoaddstubtag="+encodeURIComponent(x);
}
// </source>