صارف:سیف اللہ/monobook.js

وکیپیڈیا سے

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror:: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.

function addlilink(tabs, url, name, id, title, key){
    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);
    tabs.appendChild(li);
    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;
}

// STATUS CHANGER
addOnloadHook(function (){
  var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;
  var subpage = "/Status";
  var scheme = "/StatusTemplate";
  var linkprefix = "http://ur.wikipedia.org/w/index.php?title=User:";
  var contribs = document.getElementById( 'pt-mycontris' );
  //Add the links
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=in", "حاضر", "pt-status-in", "I'm in!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=busy", "مصروف", "pt-status-busy", "I'm busy!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=out", "غیرحاضر", "pt-status-out", "I'm out!", "");
  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = "{{User:"+user+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "میں اب "+status +" ہوں";
  document.getElementById('wpMinoredit').checked = 'checked';
  //Submit it!
  document.getElementById('editform').submit();
});
// 

// [[User:Lupin/popups.js]] - please include this line 

document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');



/* Configuration for "star" logo at the top of Featured Articles */

function StarFA() {
   if (document.getElementById("FA")) {
      // Monobook.css will take over styling from here
      document.body.className += " FA";
      // Iterate over all <h1> elements - this loop is optional
      for (var i = 0; a = document.getElementsByTagName("h1")[i]; i++) {
         // Apply a tooltip to the article title, which includes the little star
         if (a.className == "firstHeading") {
            a.title = "This article has gained featured status";
         }
      }
   }
}

addLoadEvent(StarFA);


<!--Trying to load load data into combo box -->

/* add menu for selecting subsets of secial characters */
/***** must match MediaWiki:Edittools *****/


// Amélioration de la page de recherche
// Auteur : Dake
// Sous licence GFDL.

function SpecialSearchEnhanced() 
{
  if (wgPageName == "Special:Search") {
    var mainNode = document.getElementsByTagName("form");
    if (!mainNode) return;
    
    var searchValue = document.getElementById("lsearchbox").value
    var firstForm = mainNode[0];

    var node = document.createElement('center');
    
    var googleSearch = '<hr /><p /><FORM method=GET action="http://www.google.fr/search">';
    googleSearch +=  '<TABLE bgcolor="#FFFFFF"><tr><td>';
    googleSearch += '<A HREF="http://www.google.fr">';
    googleSearch += '<IMG SRC="http://www.google.com/logos/Logo_25wht.gif" border="0" '
    googleSearch += 'ALT="Google" align="absmiddle"></A> '
    googleSearch += '<INPUT TYPE=text name=q size=31 maxlength=255 value="' + searchValue + '">'
    googleSearch += '<INPUT TYPE=hidden name=hl value=fr>'
    googleSearch += '<INPUT TYPE=hidden name=as_sitesearch value=fr.wikipedia.org>'
    googleSearch += '<INPUT type=submit name=btnG VALUE="Rechercher sur fr.wikipedia.org">'
    googleSearch += '</td></tr></TABLE>'
    googleSearch += '</FORM>'
    
    var yahooSearch = '<FORM method=GET action="http://fr.search.yahoo.com/search">';
    yahooSearch +=  '<TABLE bgcolor="#FFFFFF"><tr><td>';
    yahooSearch += '<A HREF="http://fr.yahoo.com">';
    yahooSearch += '<IMG SRC="http://us.yimg.com/i/yahootogo/y88red2.gif" alt="Yahoo!" border="0" '
    yahooSearch += 'align="absmiddle"></A> '
    yahooSearch += '<INPUT TYPE=text name=p size=31 maxlength=255 value="' + searchValue + '">'
    yahooSearch += '<INPUT TYPE=hidden name=vs value=fr.wikipedia.org>'
    yahooSearch += '<INPUT type=submit name=btnG VALUE="Rechercher sur fr.wikipedia.org">'
    yahooSearch += '</td></tr></TABLE>'
    yahooSearch += '</FORM>'

    node.innerHTML = node.innerHTML + '<div id="enhancedSearch">' + googleSearch + yahooSearch + '</div>';
        
    firstForm.parentNode.insertBefore(node, firstForm.nextSibling);
    
  }
}
     
addOnloadHook(SpecialSearchEnhanced);