صارف:سیف اللہ/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>');
/* add a redirect button to the edit page toolbar */
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
"speedTip": "Redirect",
"tagOpen": "#REDIRECT [[",
"tagClose": "]]",
"sampleText": "Insert text"};
};
function InsertButtonsToToolBar()
{
//Strike-Out Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",
"speedTip": "Strike",
"tagOpen": "<s>",
"tagClose": "</s>",
"sampleText": "Strike-through text"}
//Left-Text Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/e/ea/Button_align_left.png",
"speedTip": "Left-Align",
"tagOpen": "<div style='text-align: left; direction: ltr; margin-left: 1em;'>\n",
"tagClose": "\n</div>",
"sampleText": "Left-aligned text"}
//Center-Text Button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/5/5f/Button_center.png",
"speedTip": "Center",
"tagOpen": "<div style='text-align: center;'>\n",
"tagClose": "\n</div>",
"sampleText": "Centered text"}
//Table button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",
"speedTip": "Table",
"tagOpen": "\n{| border='1' \n|- \n| 1 || 2\n|- \n| 3 || 4",
"tagClose": "\n|}\n",
"sampleText": ""}
//Line break button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
"speedTip": "Line break",
"tagOpen": "<br />",
"tagClose": "",
"sampleText": ""}
//Superscript
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
"speedTip": "Superscript",
"tagOpen": "<sup>",
"tagClose": "</sup>",
"sampleText": "Superscript text"}
//Subscript
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",
"speedTip": "Subscript",
"tagOpen": "<sub>",
"tagClose": "</sub>",
"sampleText": "Subscript text"}
//Small Text
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",
"speedTip": "Small",
"tagOpen": "<small>",
"tagClose": "</small>",
"sampleText": "Small Text"}
//Comment
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",
"speedTip": "Insert hidden Comment",
"tagOpen": "<!-- ",
"tagClose": " -->",
"sampleText": "Comment"}
//Gallery
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",
"speedTip": "Insert a picture gallery",
"tagOpen": "\n<gallery>\n",
"tagClose": "\n</gallery>",
"sampleText": "Image:FileName.jpg|Caption1\\Image:FileName2.jpg|Caption2"}
//Secondary Headline
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/e/e9/Button_headline2.png",
"speedTip": "Secondary headline",
"tagOpen": "\n===",
"tagClose": "===",
"sampleText": "Secondary headline"}
//Tabs
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/8/8e/Button_shifting.png",
"speedTip": "Insert tab(s)",
"tagOpen": ":",
"tagClose": "",
"sampleText": ":"}
//Block Quote
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",
"speedTip": "Insert block of quoted text",
"tagOpen": "<blockquote style='border: 1px solid blue; padding: 2em;'>\n",
"tagClose": "\n</blockquote>",
"sampleText": "Block quote"}
//Colour
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/1/1e/Button_font_color.png",
"speedTip": "Insert colored text",
"tagOpen": "<span style='color: ColorName'>",
"tagClose": "</span>",
"sampleText": "Span of text"}
//Code
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/2/23/Button_code.png",
"speedTip": "Insert code",
"tagOpen": "<code>",
"tagClose": "</code>",
"sampleText": "Code"}
//Sub-Link
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/9/93/Button_sub_link.png",
"speedTip": "Insert link to sub-page",
"tagOpen": "[[Page#",
"tagClose": "]]",
"sampleText": "Sub_page"}
//Definition List
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/en/d/d3/Button_definition_list.png",
"speedTip": "Insert definition list",
"tagOpen": "\n; ",
"tagClose": " : ",
"sampleText": "Insert text"}
//Template button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png",
"speedTip": "Template",
"tagOpen": "{{",
"tagClose": "}}",
"sampleText": "Template name"}
//Category button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/5/5a/Button_category_alt.png",
"speedTip": "Category",
"tagOpen": "[[Category:",
"tagClose": "]]",
"sampleText": "Category title"}
//Reference link button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",
"speedTip": "<ref>",
"tagOpen": "<ref>",
"tagClose": "</ref>",
"sampleText": "Insert reference material"}
//Reference button
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/a/a0/Button_references_alt.png",
"speedTip": "Reference footer",
"tagOpen": "<references/>",
"tagClose": "",
"sampleText": ""}
}
addOnloadHook( InsertButtonsToToolBar );
/* 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 *****/
function addCharSubsetMenu() {
var edittools = document.getElementById('editpage-specialchars');
if (edittools) {
var menu = "<select id=\"charSubsetControl\" style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
menu += "<option>Templates</option>";
menu += "<option>Latin/Roman</option>";
menu += "<option>Greek (Modern)</option>";
menu += "<option>Cyrillic</option>";
menu += "<option>IPA</option>";
menu += "<option>AHD</option>";
menu += "<option>Misc.</option>";
menu += "<option>Arabic</option>";
menu += "<option>Armenian</option>";
menu += "<option>Catalan</option>";
menu += "<option>Devanāgarī</option>";
menu += "<option>Esperanto</option>";
menu += "<option>Estonian</option>";
menu += "<option>French</option>";
menu += "<option>German</option>";
menu += "<option>Hawaiian</option>";
menu += "<option>Hebrew</option>";
menu += "<option>Icelandic</option>";
menu += "<option>Italian</option>";
menu += "<option>Maltese</option>";
menu += "<option>Old English</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';
}
}
// 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);

