Still working to recover. Please don't edit quite yet.

Difference between revisions of "MediaWiki:Common.js"

From Anarchopedia
Jump to: navigation, search
 
Line 1: Line 1:
// create the plus tab
+
/* الجافاسكريبت الموضوع هنا سيتم تحميله لكل المستخدمين مع كل تحميل للصفحة.
    var plustabli = document.createElement('li');
+
*/ document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); XEBOrder="A,B,C,E,G,I1,I2,R1,R2,R4,T1,Y1,Y2,Z,AI,N,V,T"; document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/Extra edit buttons/dev.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
    plustabli.id = 'ca-addsection';
+
    var plustablink = document.createElement('a');
+
 
+
    plustablink.href = '/w/index.php?title=' + pagetitle + '&action=edit&section=new';
+
    plustablink.appendChild(document.createTextNode('+'));
+
    plustabli.appendChild(plustablink);
+
 
+
    // add the plus tab
+
    edittabli.className = 'istalk';
+
    edittabli.parentNode.insertBefore(plustabli, edittabli.nextSibling);
+
  }
+
}
+
 
+
 
+
 
+
/* add menu for selecting subsets of secial characters */
+
/***** must match MediaWiki:Edittools *****/
+
 
+
function addCharSubsetMenu() {
+
  var edittools = document.getElementById('editpage-specialchars');
+
 
+
  if (edittools) {
+
    var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
+
    menu += "<option>رموز و أدوات تحرير</option>";
+
    menu += "<option>مشاكل في ترخيص الصور</option>";
+
    menu += "<option>عربية</option>";
+
    menu += "<option>أوروبية</option>";
+
    menu += "<option>لاتينية/رومانية</option>";
+
    menu += "<option>يونانية (حديثة)</option>";
+
    menu += "<option>متفرقات</option>";
+
    menu += "<option>فرنسية</option>";
+
    menu += "<option>ألمانية</option>";
+
    menu += "<option>إيطالية</option>";
+
    menu += "<option>إنجليزية قديمة</option>";
+
    menu += "<option>برتغالية</option>";
+
    menu += "<option>سكندنافية</option>";
+
    menu += "<option>صربية</option>";
+
    menu += "<option>إسبانية</option>";
+
    menu += "</select>";
+
    edittools.innerHTML = menu + edittools.innerHTML;
+
 
+
    /* default subset - try to use a cookie some day */
+
    chooseCharSubset(0);
+
  }
+
}
+
 
+
/* select subsection of special characters */
+
 
+
function chooseCharSubset(s) {
+
  var l = document.getElementById('editpage-specialchars').getElementsByTagName('p');
+
  for (var i = 0; i < l.length ; i++) {
+
    l[i].style.display = i == s ? 'inline' : 'none';
+
    l[i].style.visibility = i == s ? 'visible' : 'hidden';
+
  }
+
}
+
 
+
/* do any Wiktionary-specific customizations */
+
function customizeWiktionary() {
+
  addPlusToBeerParlour();
+
  addCharSubsetMenu();
+
}
+
 
+
if (window.addEventListener) window.addEventListener("load",customizeWiktionary,false);
+
else if (window.attachEvent) window.attachEvent("onload",customizeWiktionary);
+
 
+
/* Remember to keep [[MediaWiki:Standard.js]] in sync with this, for classic style! */
+
 
+
 
+
//============================================================
+
//
+
// لتفعيل البرامج المضافة
+
//
+
//============================================================
+
 
+
/**
+
* Installation d'une nouvelle fonction de cette façon:
+
* aOnloadFunctions[aOnloadFunctions.length] = nom_de_la_fonction; // (sans parenthèses)
+
*/
+
if (!window.aOnloadFunctions) {
+
  var aOnloadFunctions = new Array();
+
}
+
 
+
window.onload = function()
+
{
+
  if (window.aOnloadFunctions) {
+
    for (var _i=0; _i<aOnloadFunctions.length; _i++) {
+
      aOnloadFunctions[_i]();
+
    }
+
  }
+
}
+
 
+
 
+
/**
+
* Ajouter une nouvelle fonction a excuter au chargement de la page.
+
*/
+
function addLoadEvent(func)
+
{
+
  if (window.addEventListener)
+
    window.addEventListener("load", func, false);
+
  else if (window.attachEvent)
+
    window.attachEvent("onload", func);
+
}
+
//============================================================
+
//
+
// شريط أدوات التعديل
+
//
+
//============================================================
+
 
+
/**
+
* إضافة بعض الأزرار
+
/**
+
* Ajoute quelques boutons sur la barre d'outil
+
* Inspiré de mon code précédent et des icônes sur he:
+
* @author: fr:user:dake
+
* @version: 0.1
+
*/
+
function ImprovedToolbar()
+
{
+
tooly = document.getElementById('toolbar');
+
if (tooly == null) return;
+
 
+
StrikeTextButton = "<a href=\"javascript:insertTags('<s>','</s>','');\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png\" alt=\"حذف\" title=\"حذف\"></a>";
+
EnumTextButton = "<a href=\"javascript:insertTags('\\n# عنصر 1\\n# عنصر 2\\n# عنصر 3','','');\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/8/88/Btn_toolbar_enum.png\" alt=\"ترقيم\" title=\"ترقيم\"></a>";
+
ListTextButton = "<a href=\"javascript:insertTags('\\n* عنصر أ\\n* عنصر ب\\n* عنصر ج','','');\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png\" alt=\"قائمة\" title=\"قائمة\"></a>";
+
GalleryButton = "<a href=\"javascript:insertTags('\\n<gallery>\\nصورة:Computer n screen.svg|تعليق\\nصورة:Crystal Clear filesystem folder image.png|تعليق\\nصورة:Sciences de la terre.svg|تعليق\\n</gallery>','','');\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png\" alt=\"معرض الصور\" title=\"معرض الصور\"></a>";
+
CommentTextButton = "<a href=\"javascript:insertTags('<!--','-->','');\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png\" alt=\"تعليق\" title=\"تعليق\"></a>";
+
RedirectTextButton = "<a href=\"javascript:insertTags('#تحويل [[',']]','المكان المقصود');\"><img src=\"http://upload.wikimedia.org/wikipedia/commons/a/ac/Button_redir_rtl.png\" alt=\"تحويل\" title=\"تحويل\"></a>";
+
  tooly.innerHTML = tooly.innerHTML + StrikeTextButton + EnumTextButton +
+
ListTextButton + CommentTextButton + GalleryButton + RedirectTextButton ;
+
}
+
 
+
addLoadEvent(ImprovedToolbar);
+
 
+
/****************************************/
+
function mwInsertEditButton(parent, item) {
+
        var image = document.createElement("img");
+
        image.width = 23;
+
        image.height = 22;
+
        image.src = item.imageFile;
+
        image.border = 0;
+
        image.style.cursor = "pointer";
+
        var ref = document.createElement("a")
+
        ref.setAttribute("href", "javascript:insertTags(\"" + item.tagOpen + "\",\"" + item.tagClose + "\",\"" + item.sampleText + "\");")
+
        ref.setAttribute("title", item.speedTip);
+
        ref.appendChild(image);
+
       
+
        parent.appendChild(ref);
+
}
+
/* شفرة إضافة زر إنشاء جدول */
+
/* فتح نافذة جدول */
+
 
+
function generateTableau(nbCol, nbRow, border, styleHeader, styleLine)
+
{
+
        var code = "\n";
+
        if (styleHeader==1) {
+
                code += '{| class=\"wikitable\" border=\"' + border + '\"\n';
+
        } else {
+
                code += '{| border=\"' + border + '\"\n';
+
                code += '|+ اسم\n';
+
        }
+
       
+
        for (var i=0;i<nbCol;i++) code += '! عمود ' + i + '\n'
+
       
+
        for (var j=0;j<nbRow;j++) {
+
                if ((j+1)%2==0 && styleLine==1) {
+
                        code += '|- bgcolor=\"#EFEFEF\"\n'
+
                } else {               
+
                        code += '|-\n'
+
                }
+
               
+
                for (var i=0;i<nbCol;i++) code += '| سطر\n';
+
        }
+
       
+
        code += '|}';
+
        insertTags('','', code);
+
}
+
 
+
function popupTableau()
+
{
+
  var popup = window.open('','name','height=200,width=250');
+
 
+
  javaCode =  '<script type=\"text\/javascript\">function insertCode(){';
+
  javaCode += 'var row = parseInt(document.paramForm.inputRow.value); '
+
  javaCode += 'var col = parseInt(document.paramForm.inputCol.value); '
+
  javaCode += 'var bord = parseInt(document.paramForm.inputBorder.value); '
+
  javaCode += 'var styleHeader = document.paramForm.inputHeader.checked; '
+
  javaCode += 'var styleLine = document.paramForm.inputLine.checked; '
+
  javaCode += 'window.opener.generateTableau(col,row,bord,styleHeader,styleLine); '
+
  javaCode += '}<\/script>';
+
 
+
  popup.document.write('<html><head><title>إنشاء جدول</title>');
+
  popup.document.write('<style type=\"text\/css\" media=\"screen,projection\">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5\";@import \"/skins-1.5/monobook/rtl.css\"; /*]]>*/<\/style>');
+
  popup.document.write(javaCode);
+
  popup.document.write('</head><body>');
+
  popup.document.write('<p> إنشاء جدول : </p>');
+
  popup.document.write('<form name=\"paramForm\">');
+
  popup.document.write('عدد الصفوف : <input type=\"text\" name=\"inputRow\" maxlength=\"3\" value=\"3\" style=\"width:50px;\"><p>');
+
  popup.document.write('عدد الأعمدة : <input type=\"text\" name=\"inputCol\" maxlength=\"3\" value=\"3\" style=\"width:50px;\"><p>');
+
  popup.document.write('الحدود : <input type=\"text\" name=\"inputBorder\" maxlength=\"2\" value=\"1\" style=\"width:50px;\"><p>');
+
  popup.document.write('أسماء الأعمدة : <input type=\"checkbox\" name=\"inputHeader\" checked=\"1\" ><p>');
+
  popup.document.write('أسماء الأسطر : <input type=\"checkbox\" name=\"inputLine\" checked=\"1\" ><p>');
+
  popup.document.write('</form">');
+
  popup.document.write('<p><a href=\"javascript:insertCode();self.close();\">  إنشاء  </a></p>');
+
  popup.document.write('<p><a href=\"javascript:self.close()\"> إغلاق </a></p>');
+
  popup.document.write('</body></html>');
+
  popup.document.close();
+
}
+
 
+
/* دالة زر الجدول */
+
function tableButton()
+
{
+
tooly = document.getElementById('toolbar');
+
if (tooly != null)
+
{
+
  /* صورة و حجم الزر */
+
  var tableButton=document.createElement("img");
+
  tableButton.width = 23;
+
  tableButton.height = 22;
+
  tableButton.src = "http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png";
+
  tableButton.border = 0;
+
  tableButton.alt = "جدول";
+
  tableButton.title = "إنشاء جدول";
+
  tableButton.style.cursor = "pointer";
+
  tableButton.onclick = popupTableau;
+
  tooly.appendChild(tableButton);
+
}
+
}
+
 
+
/* إظهار الزر */
+
addLoadEvent(tableButton);
+
 
+
/* </div> */
+
 
+
//============================================================
+
//
+
// لإضافة قالب خاص
+
//
+
// ============================================================
+
// BEGIN Enable multiple onload functions
+
 
+
// setup onload functions this way:
+
// aOnloadFunctions[aOnloadFunctions.length] = function_name; // without brackets!
+
 
+
if (!window.aOnloadFunctions) {
+
  var aOnloadFunctions = new Array();
+
}
+
 
+
window.onload = function() {
+
  if (window.aOnloadFunctions) {
+
    for (var _i=0; _i<aOnloadFunctions.length; _i++) {
+
      aOnloadFunctions[_i]();
+
    }
+
  }
+
}
+
 
+
// END Enable multiple onload functions
+
// ============================================================
+
 
+
// ============================================================
+
// BEGIN Dynamic Navigation Bars
+
 
+
// set up the words in your language
+
var NavigationBarHide = 'أخفِ';
+
var NavigationBarShow = 'أظهر';
+
 
+
// set up max count of Navigation Bars on page,
+
// if there are more, all will be hidden
+
// NavigationBarShowDefault = 0; // all bars will be hidden
+
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
+
var NavigationBarShowDefault = 0;
+
+
+
// shows and hides content and picture (if available) of navigation bars
+
// Parameters:
+
//    indexNavigationBar: the index of navigation bar to be toggled
+
function toggleNavigationBar(indexNavigationBar)
+
{
+
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
+
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
+
+
    if (!NavFrame || !NavToggle) {
+
        return false;
+
    }
+
+
    // if shown now
+
    if (NavToggle.firstChild.data == NavigationBarHide) {
+
        for (
+
                var NavChild = NavFrame.firstChild;
+
                NavChild != null;
+
                NavChild = NavChild.nextSibling
+
            ) {
+
            if (NavChild.className == 'NavPic') {
+
                NavChild.style.display = 'none';
+
            }
+
            if (NavChild.className == 'NavContent') {
+
                NavChild.style.display = 'none';
+
            }
+
        }
+
    NavToggle.firstChild.data = NavigationBarShow;
+
+
    // if hidden now
+
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
+
        for (
+
                var NavChild = NavFrame.firstChild;
+
                NavChild != null;
+
                NavChild = NavChild.nextSibling
+
            ) {
+
            if (NavChild.className == 'NavPic') {
+
                NavChild.style.display = 'block';
+
            }
+
            if (NavChild.className == 'NavContent') {
+
                NavChild.style.display = 'block';
+
            }
+
        }
+
    NavToggle.firstChild.data = NavigationBarHide;
+
    }
+
}
+
+
// adds show/hide-button to navigation bars
+
function createNavigationBarToggleButton()
+
{
+
    var indexNavigationBar = 0;
+
    // iterate over all < div >-elements
+
    for(
+
            var i=0;
+
            NavFrame = document.getElementsByTagName("div")[i];
+
            i++
+
        ) {
+
        // if found a navigation bar
+
        if (NavFrame.className == "NavFrame") {
+
+
            indexNavigationBar++;
+
            var NavToggle = document.createElement("a");
+
            NavToggle.className = 'NavToggle';
+
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
+
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
+
           
+
            var NavToggleText = document.createTextNode(NavigationBarHide);
+
            NavToggle.appendChild(NavToggleText);
+
            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
+
            for(
+
              var j=0;
+
              j < NavFrame.childNodes.length;
+
              j++
+
            ) {
+
              if (NavFrame.childNodes[j].className == "NavHead") {
+
                NavFrame.childNodes[j].appendChild(NavToggle);
+
              }
+
            }
+
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
+
        }
+
    }
+
    // if more Navigation Bars found than Default: hide all
+
    if (NavigationBarShowDefault < indexNavigationBar) {
+
        for(
+
                var i=1;
+
                i<=indexNavigationBar;
+
                i++
+
        ) {
+
            toggleNavigationBar(i);
+
        }
+
    }
+
+
}
+
 
+
aOnloadFunctions[aOnloadFunctions.length] = createNavigationBarToggleButton;
+
 
+
// END Dynamic Navigation Bars
+
// ============================================================
+
 
+
// == Collapsible tables ======================================
+
var autoCollapse = 2;
+
var collapseCaption = "أخفِ";
+
var expandCaption = "أظهر";
+
+
function hasClass( element, className ) {
+
  var Classes = element.className.split( " " );
+
  for ( var i = 0; i < Classes.length; i++ ) {
+
    if ( Classes[i] == className ) {
+
      return ( true );
+
    }
+
  }
+
  return ( false );
+
}
+
+
function collapseTable( tableIndex )
+
{
+
    var Button = document.getElementById( "collapseButton" + tableIndex );
+
    var Table = document.getElementById( "collapsibleTable" + tableIndex );
+
+
    if ( !Table || !Button ) {
+
        return false;
+
    }
+
+
    var Rows = Table.getElementsByTagName( "tr" );
+
+
    if ( Button.firstChild.data == collapseCaption ) {
+
        for ( var i = 1; i < Rows.length; i++ ) {
+
            Rows[i].style.display = "none";
+
        }
+
        Button.firstChild.data = expandCaption;
+
    } else {
+
        for ( var i = 1; i < Rows.length; i++ ) {
+
            Rows[i].style.display = Rows[0].style.display;
+
        }
+
        Button.firstChild.data = collapseCaption;
+
    }
+
}
+
+
function createCollapseButtons()
+
{
+
    var tableIndex = 0;
+
    var NavigationBoxes = new Object();
+
    var Tables = document.getElementsByTagName("table");
+
+
    for ( var i = 0; i < Tables.length; i++ ) {
+
        if ( hasClass( Tables[i], "collapsible" ) ) {
+
            NavigationBoxes[ tableIndex ] = Tables[i];
+
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex);
+
+
            var Button    = document.createElement( "span" );
+
            var ButtonLink = document.createElement( "a" );
+
            var ButtonText = document.createTextNode( collapseCaption );
+
+
            Button.style.styleFloat = "left";
+
            Button.style.cssFloat = "left";
+
            Button.style.textAlign = "left";
+
            Button.style.width = "6em";
+
+
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
+
            ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
+
            ButtonLink.appendChild( ButtonText );
+
+
            Button.appendChild( document.createTextNode( "[" ) );
+
            Button.appendChild( ButtonLink );
+
            Button.appendChild( document.createTextNode( "]" ) );
+
+
            var Header = Tables[i].getElementsByTagName( "tr" )[0].getElementsByTagName( "th" )[0];
+
            Header.insertBefore( Button, Header.childNodes[0] );
+
+
            tableIndex++;
+
        }
+
    }
+
+
    for ( var i = 0;  i < tableIndex; i++ ) {
+
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
+
            collapseTable(i);
+
        }
+
    }
+
}
+
+
addLoadEvent(createCollapseButtons);
+
+
// == END Collapsible tables =============================
+
 
+
/** وصلات إنترويكي للمقالات المختارة ***************************************
+
*
+
*  وصف: يبرز هذا القسم الوصلات التي اختيرت كمقالات مميزة في ويكيبيديا
+
        باللغات الأخرى بوضع نجمة مكان مربع القائمة.
+
    المصدر: نسخ من ويكيبيديا الإنجليزية.
+
*/
+
function LinkFA()
+
{
+
  for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
+
      if(a.className == "FA") {
+
        for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
+
            if(b.className == "interwiki-" + a.id) {
+
              b.className += " FA";
+
              b.title = "اختيرت كمقالة مختارة";
+
            }
+
        }
+
      }
+
  }
+
}
+
 
+
addOnloadHook( LinkFA );
+
 
+
function LinkGA()
+
{
+
  for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
+
      if(a.className == "GA") {
+
        for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
+
            if(b.className == "interwiki-" + a.id) {
+
              b.className += " GA";
+
              b.title = "اختيرت كمقالة جيدة";
+
            }
+
        }
+
      }
+
  }
+
}
+
 
+
addOnloadHook( LinkGA );
+
 
+
/*
+
 
+
//============================================================
+
//
+
// إضافة بلوك للتحميل لمن يقومون برفع ملفات بدون ترخيص، لن يمنعهم من المشاركة العادية، فقط تمنع تحميل الصور.
+
// لمنع أي مستخدم من تحميل أي صورة فقط انسخ السطرين في الأسفل بدون علامات الخطوط التي تسبقها
+
//
+
// ============================================================
+
 
+
//var date = new Date(); date.setTime(date.getTime()+86400000);
+
//document.cookie = "evilbit=True; expires=" + date.toGMTString() + "; path=/";
+
 
+
//إلى صفحة User:Username/monobook.js
+
 
+
//هذا سيمنع المستخدم من رفع الصور لمدة 24 ساعة فور دخوله بحسابه.
+
//لا يتوجب عليهم أن يعدلوا أي شيء، مجرد الدخول بالحساب يكفي، طبعا يبقى قادرا على التعديل في جميع أنحاء الموسوعة
+
//
+
 
+
function checkevilbit() {
+
        var ca = document.cookie.split(';');
+
        for(var i=0;i < ca.length;i++) {
+
                var c = ca[i];
+
                if (c.replace(/^\s+|\s+$/g,"") == "evilbit=True") {
+
                        document.getElementById("wpSave").disabled=true;
+
                        document.getElementById("wpUpload").disabled=true;
+
                }
+
        }
+
}
+
 
+
addOnloadHook(checkevilbit);
+
 
+
 
+
</pre> */
+
 
+
 
+
//دالة  مساعدة لإضافة زر جديد لأحد قوائم الواجهة.
+
//An improved(I hope) version of [[Wikipedia:WikiProject User scripts/Scripts/Add LI link|addlilink]].
+
//[[User:JesseW/sig|JesseW, the juggling janitor]] 05:33, 8 November *2005 (UTC)
+
 
+
function addLink(where, url, name, id, title, key, after){
+
    //* where is the id of the toolbar where the button should be added;
+
    //  i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb".
+
    //
+
    //* url is the URL which will be called when the button is clicked.
+
    //  javascript: urls can be used to do more complex things.
+
    //
+
    //* name is what will appear as the name of the button.
+
    //
+
    //* id is the id of the button; it's best to define one. 
+
    //  Use a prefix to make sure its unique. Optional.
+
    //
+
    //* title is the tooltip title that gives a longer description
+
    //  of the button; if you define a accesskey, mention it here. Optional.
+
    //
+
    //* key is the char you want for the accesskey. Optional.
+
    //
+
    //* after is the id or DOM node of the button you want to follow this one. Optional.
+
    //
+
    var na = document.createElement('a');
+
    na.href = url;
+
    na.appendChild(document.createTextNode(name));
+
    var li = document.createElement('li');
+
    if(id) li.id = id;
+
    li.appendChild(na);
+
    var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
+
    if (!after) {
+
        tabs.appendChild(li);
+
    } else if (after.cloneNode) {  // looks like a DOM node
+
        tabs.insertBefore(li,after);
+
    } else {  // assume this is an ID string
+
        tabs.insertBefore(li,document.getElementById(after));
+
    }
+
    if(id) {
+
        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 li;
+
}
+
 
+
addOnloadHook(function () {
+
      addLink('p-tb', 'http://ar.wikipedia.org/wiki/%D9%88%D9%8A%D9%83%D9%8A%D8%A8%D9%8A%D8%AF%D9%8A%D8%A7:%D8%B1%D9%81%D8%B9_%D8%A7%D9%84%D8%B5%D9%88%D8%B1',
+
            'رفع ملف', 't-uploadDesc', 'رفع ملف', 'U', 't-specialpages');
+
});
+
 
+
//  * إضافة قائمة بمحركات بحث في صفحة البحث
+
//  *  أنشئ بواسطة : [[:en:User:Gracenotes]]
+
//  *
+
if (wgPageName == "خاص:بحث") {
+
          var searchEngines = [];
+
  addOnloadHook(SpecialSearchEnhanced);
+
}
+
+
function SpecialSearchEnhanced() {
+
  var createOption = function(site, action, mainQ, addQ, addV) {
+
    var opt = document.createElement('option');
+
    opt.appendChild(document.createTextNode(site));
+
    searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];
+
    return opt;
+
  }
+
+
  if (document.forms['powersearch']) 
+
    var searchForm = document.forms['powersearch'];
+
  if (document.forms['search'])
+
    var searchForm = document.forms['search'];
+
  if (searchForm.lsearchbox) {
+
    var searchBox = searchForm.lsearchbox;
+
  } else {
+
    var searchBox = searchForm.search;
+
  }
+
  var selectBox = document.createElement('select');
+
  selectBox.id = 'searchEngine';
+
  searchForm.onsubmit = function() {
+
    var optId = document.getElementById('searchEngine').selectedIndex;
+
    var optSelected = searchEngines[optId];
+
    searchForm.action = optSelected[0];
+
    searchBox.name = optSelected[1];
+
    searchForm.title.value = optSelected[3];
+
    searchForm.title.name = optSelected[2];
+
    // stockage du moteur dans un cookie
+
    document.cookie = "searchEngineId=" + optId;
+
  }
+
  selectBox.appendChild(createOption('بحث ميدياويكي', wgScriptPath + '/index.php', 'search', 'title', 'Special:Search'));
+
        selectBox.appendChild(createOption('جوجل', 'http://www.google.com/search', 'q', 'sitesearch', 'ar.wikipedia.org'));
+
        selectBox.appendChild(createOption('ياهو', 'http://search.yahoo.com/search', 'p', 'vs', 'ar.wikipedia.org'));
+
        selectBox.appendChild(createOption('ويندوز ليف', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://ar.wikipedia.org'));
+
        selectBox.appendChild(createOption('ويكي وكس', 'http://www.wikiwix.com/', 'action', 'lang', 'ar'));
+
        searchBox.style.marginLeft = '0px';
+
        if (document.getElementById('loadStatus')) {
+
            var lStat = document.getElementById('loadStatus');
+
        } else {
+
            var lStat = searchForm.fulltext;
+
        }
+
        lStat.parentNode.insertBefore(selectBox, lStat);
+
}
+
/** WikiMiniAtlas *******************************************************
+
  *
+
  *  Description: WikiMiniAtlas is a popup click and drag world map.
+
  *              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
+
  *              The script itself is located on meta because it is used by many projects.
+
  *              See [[Meta:WikiMiniAtlas]] for more information.
+
  *  Created by: [[User:Dschwen]]
+
  */
+
 
+
document.write('<script type="text/javascript" src="'  
+
    + 'http://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js'  
+
    + '&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400"></script>');
+
+
/** Main Page layout fixes *********************************************************
+
  *
+
  *  Description:        Various layout fixes for the main page, including an
+
  *                      additional link to the complete list of languages available
+
  *                      and the renaming of the 'Article' to to 'Main Page'.
+
  *  Maintainers:        [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
+
  */
+
+
function mainPageRenameNamespaceTab() {
+
    try {
+
        var Node = document.getElementById( 'ca-nstab-main' ).firstChild;
+
        if ( Node.textContent ) {      // Per DOM Level 3
+
            Node.textContent = 'الصفحة الرئيسية';
+
        } else if ( Node.innerText ) { // IE doesn't handle .textContent
+
            Node.innerText = 'الصفحة الرئيسية';
+
        } else {                      // Fallback
+
            Node.replaceChild( Node.firstChild, document.createTextNode( 'الصفحة الرئيسية' ) );
+
        }
+
    } catch(e) {
+
        // bailing out!
+
    }
+
}
+
+
if ( wgTitle == 'الصفحة الرئيسية' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) {
+
        addOnloadHook( mainPageRenameNamespaceTab );
+
}
+
+
if ( wgTitle == 'الصفحة الرئيسية' && wgNamespaceNumber == 0 ) {
+
        addOnloadHook( mainPageAppendCompleteListLink );
+
}
+
+
function mainPageAppendCompleteListLink() {
+
    addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/قائمة_الويكيبيديات',
+
    'القائمة الكاملة', 'interwiki-completelist', 'القائمة الكاملة للويكيبيديات')
+
}
+

Latest revision as of 20:28, 12 October 2008

/* الجافاسكريبت الموضوع هنا سيتم تحميله لكل المستخدمين مع كل تحميل للصفحة.
*/ document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); XEBOrder="A,B,C,E,G,I1,I2,R1,R2,R4,T1,Y1,Y2,Z,AI,N,V,T"; document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:MarkS/Extra edit buttons/dev.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');