انتقل إلى المحتوى

مستخدم:Izoozo/common.js

من ويكيبيديا، الموسوعة الحرة

ملاحظة: بعد الحفظ، قد يلزمك إفراغ الكاش لرؤية التغييرات.

$(function(){
  if(wgNamespaceNumber==0&&wgAction=="view")
  {
    if(document.getElementById("ca-edit"))
      mw.util.addPortletLink('p-cactions', 'javascript:stubtagtab()', 'إضافة قالب', 'ca-stubtag',
                                   'إضافة قالب إلى هذه الصفحة', '');
  }
  if(location.href.indexOf("&autoaddstubtag=")!=-1&&document.getElementById('wpTextbox1')!=null)
  {
    var x=decodeURIComponent(location.href.split("&autoaddstubtag=")[1]);
    if(x=="") x=""; else x=""+x;
    document.getElementById('wpTextbox1').value+="\n{"+"{"+x+"}}"; //add to the end of the article
    document.getElementById('wpSummary').value=
      "وسم {"+"{"+x+"}}";
 document.getElementById('wpPreview').click();
  }
});
 
function stubtagtab()
{
  var x=prompt("أكتب أسم القالب "+
               "- ");
  if(x==null) return;
  location.href=mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+                                  
                "&action=edit&autoclick=wpSave&autoaddstubtag="+encodeURIComponent(x);
}