Jump to content

User:Panser Born/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// **POP-UPS** [[User:Lupin/popups.js]] 

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

// **EMPTY TALK PAGE TAB BECOMES ADD NEW SECTION**
function talkpageplus()
{
    var talkpagelink = document.getElementById('ca-talk');
    if (talkpagelink.className == 'new')
    {
        talkpagelink.firstChild.href += '&section=new';
    }
}

addOnloadHook(talkpageplus);

// **WIKI-ED** install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://wiki.riteme.site/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// **STOP DIFF STRETCHING** inline style sheet to keep this whole thing self-contained:
document.write('<style type="text/css">' +
    ' .xdiff { width: 100%; background: white; }' +
    ' .xdiff-row { width: 100%; margin: 0 0 3px 0; overflow: hidden; }' +
    ' .xdiff-col { width: 49%; margin: 0; float: left; clear: none; position: relative; }' +
    ' .xdiff-sign, .xdiff-outer, .xdiff-inner { display: block; margin: 0; }' +
    ' .xdiff-sign { position: absolute; top: 0; left: 0; width: 2em; text-align: center; }' +
    ' .xdiff-outer { padding: 0 0 0 2em; }' +
    ' .xdiff-inner { overflow: auto; overflow-y: visible; width: 100%; }' +
    ' .xdiff-inner.diff-addedline { font-size: 85%; background: #cfc; }' +
    ' .xdiff-inner.diff-deletedline { font-size: 85%; background: #ffa; }' +
    ' .xdiff-inner.diff-context { font-size: 85%; background: #eee; }' +
    (!document.recalc ? '' :  // IE kluge:
        ' * html .xdiff-inner { padding-bottom: expression(this.scrollWidth > this.offsetWidth ? "16px" : 0); }' +
        ' * html .xdiff-sign { top: expression((this.parentNode.clientHeight - this.offsetHeight)/2 + "px"); }') +
    '<'+'/style>');

if (false) addOnloadHook(function () { // OBSOLETE!!!
    var diffSigns = new Array();
    var fixDiffWidth = function () {
        var tables = document.getElementsByTagName('table');

        for (var i = 0; i < tables.length; i++) {
            if (tables[i].className != 'diff') continue;
            var rows = tables[i].getElementsByTagName('tr');

            var diffDiv = document.createElement('div');
            diffDiv.className = 'xdiff';

            for (var j = 0; j < rows.length; j++) {
                var rowDiv = document.createElement('div');
                rowDiv.className = 'xdiff-row';

                var colDiv = null;
                var cols = rows[j].getElementsByTagName('td');
                for (var k = 0; k < cols.length; k++) { 
                    if (!colDiv) {
                        colDiv = document.createElement('div');
                        colDiv.className = 'xdiff-col';
                        rowDiv.appendChild(colDiv);
                    }
                    if (cols[k].getAttribute('colspan') == 2 || cols[k].className.substring(0,5) == 'diff-') {                
                        // use spans instead of divs so that an eventual non-js solution will look nice in lynx!
                        var outerSpan = document.createElement('span');
                        var innerSpan = document.createElement('span');
                        outerSpan.className = 'xdiff-outer';
                        innerSpan.className = 'xdiff-inner ' + cols[k].className;
                        innerSpan.style.textAlign = cols[k].getAttribute('align');
                        for (var node = cols[k].firstChild; node; node = node.nextSibling)
                            innerSpan.appendChild(node.cloneNode(true));
                        innerSpan.appendChild(document.createTextNode(String.fromCharCode(0xa0))); // add nbsp
                        outerSpan.appendChild(innerSpan);
                        colDiv.appendChild(outerSpan);
                        colDiv = null;  // start new column
                    }
                    else if (cols[k].firstChild && (cols[k].firstChild.nextSibling ||
                             cols[k].firstChild.nodeType != 3 || cols[k].firstChild.nodeValue.match(/\S/))) {
                        // use spans instead of divs so that an eventual non-js solution will look nice in lynx!
                        var signSpan = document.createElement('span');
                        signSpan.className = 'xdiff-sign';
                        if (!signSpan.style.setExpression)
                            diffSigns[diffSigns.length] = signSpan;
                        for (var node = cols[k].firstChild; node; node = node.nextSibling)
                            signSpan.appendChild(node.cloneNode(true));
                        colDiv.appendChild(signSpan);
                    }
                }
                diffDiv.appendChild(rowDiv);
            }
            tables[i].parentNode.replaceChild(diffDiv, tables[i]);
        }
    };
    // finally, a kluge to vertically center the +/- signs
    var centerDiffSigns = function () {
        for (var i = 0; i < diffSigns.length; i++) {
            var parentHeight;
            if (!( parentHeight = diffSigns[i].parentNode )) continue; 
            if (!( parentHeight = parentHeight.clientHeight )) continue; 
            diffSigns[i].style.top = ((parentHeight - diffSigns[i].offsetHeight)/2) + "px";
        }
    };
    fixDiffWidth();
    if (diffSigns.length) {
        hookEvent('resize', centerDiffSigns);
        setTimeout(centerDiffSigns, 250); 
    }
});

//

// **ADD VOTE SYMBOLS** [[User:Ais523/votesymbols.js]]
// Code for adding icons to !votes in AfDs, RfAs, etc.. Doesn't affect the page, just
// shows the icons when this code is installed.
// Please see [[:Image:Votesymbols.js-enhanced_SfD.png]] for copyright info on the images that are added.

function lowerNoPunct(s)
{
  return s.toLowerCase().split('.').join('').split(',').join('').split(':').join('').split(';').join('').split('+').join('');
}

addOnloadHook(function() {
  if(wgNamespaceNumber==0) return; //avoid article space, generally speaking
  var vs=
  "http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/15px-Symbol_support_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Symbol_keep_vote.svg/15px-Symbol_keep_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Symbol_oppose_vote.svg/15px-Symbol_oppose_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_delete_vote.svg/15px-Symbol_delete_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Symbol_neutral_vote.svg/15px-Symbol_neutral_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/b0/Symbol_merge_vote.svg/15px-Symbol_merge_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Symbol_move_vote.svg/15px-Symbol_move_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Symbol_redirect_vote.svg/15px-Symbol_redirect_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Symbol_opinion_vote.svg/15px-Symbol_opinion_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/9/9e/Symbol_comment_vote_2.svg/15px-Symbol_comment_vote_2.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Symbol_unsupport_vote.svg/15px-Symbol_unsupport_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Symbol_question.svg/15px-Symbol_question.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Symbol_divide_vote.svg/15px-Symbol_divide_vote.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/5/54/Symbol_wait.svg/15px-Symbol_wait.svg.png#"+
  "http://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Face-grin.svg/15px-Face-grin.svg.png";
  var vt=vs.split("#");
  var la=new Array();
  la['support']=0; la['endorse']=0;
  la['keep']=1;
  la['oppose']=2; la['overturn']=2; la['object']=2;
  la['delete']=3;
  la['neutral']=4;
  la['merge']=5; la['upmerge']=5;
  la['move']=6; la['rename']=6; la['userfy']=6; la['transwiki']=6;
  la['redirect']=7;
  la['opinion']=8; la['relist']=8; la['subst']=8; la['salt']=8; la['change']=8;
  // Note that icon 8 on the list is often used for debate-specific !votes
  la['comment']=9; la['update']=9; la['note']=9;
  la['delist']=10;
  la['question']=11;
  la['split']=12;
  la['wait']=13;
  la['bjaodn']=14;
 
  var btc=document.body.getElementsByTagName("B");
  i=btc.length;
  while(i--)
  {
    var j,k;
    j=btc[i].innerHTML.split("<").join(" ").split(">").join(" ").split("/").join(" ").split(" ");
    k=0;
    var x="";
    while(k<j.length)
    {
      if(lowerNoPunct(j[k])=="don't"||lowerNoPunct(j[k])=='not'
       ||lowerNoPunct(j[k])=='no'||lowerNoPunct(j[k])=='without') break;
      var l=la[lowerNoPunct(j[k])];
      if(l!=undefined)
      {
        x+="<IMG SRC='"+vt[l]+"' /> "
      }
      k++;
    }
    if(x!="") btc[i].innerHTML=x+btc[i].innerHTML;
  }
});
//[[Category:Wikipedia scripts]]

/////////////////////////////////////////////////////////////////////////
 // Translates the 'in other languages' list in the sidebar to English. //
 //               Note: does not translate all languages                //
 //                                                                     //
 //                                By Tra                               //
 //                       (bug fix by Voice_of_All)                     //
 /////////////////////////////////////////////////////////////////////////


function languagereplace () {
if (document.getElementById('p-lang')) {
var LangNodes=document.getElementById('p-lang').getElementsByTagName('ul')[0].getElementsByTagName('li');
for( var x = 0; x < LangNodes.length; x++ ) {

LangNodes[x].getElementsByTagName('a')[0].innerHTML = localtoEnglish(LangNodes[x].getElementsByTagName('a')[0].innerHTML);
}
}
}

addOnloadHook (languagereplace)

function localtoEnglish(localname) {

switch (localname) {

case 'Deutsch': return 'German'; break;
case 'Français': return 'French'; break;
case 'Polski': return 'Polish'; break;
case '日本語': return 'Japanese'; break;
case 'Nederlands': return 'Dutch'; break;
case 'Italiano': return 'Italian'; break;
case 'Português': return 'Portuguese'; break;
case 'Svenska': return 'Swedish'; break;
case 'Español': return 'Spanish'; break;
case 'Русский': return 'Russian'; break;
case '中文': return 'Chinese'; break;
case 'Suomi': return 'Finnish'; break;
case 'Norsk (bokmål)': return 'Norwegian'; break;
case 'Esperanto': return 'Esperanto'; break;
case 'Slovenčina': return 'Slovak'; break;
case 'Dansk': return 'Danish'; break;
case 'Česky': return 'Czech'; break;
case 'עברית': return 'Hebrew'; break;
case 'Català': return 'Catalan'; break;
case 'Magyar': return 'Hungarian'; break;
case 'Bahasa Indonesia': return 'Indonesian'; break;
case 'Română': return 'Romanian'; break;
case 'Українська': return 'Ukrainian'; break;
case 'Српски / Srpski': return 'Serbian'; break;
case 'Türkçe': return 'Turkish'; break;
case 'Slovenščina': return 'Slovenian'; break;
case 'Lietuvių': return 'Lithuanian'; break;
case 'Български': return 'Bulgarian'; break;
case '한국어': return 'Korean'; break;
case 'Eesti': return 'Estonian'; break;
case 'Hrvatski': return 'Croatian'; break;
case 'తెలుగు': return 'Telugu'; break;
case 'العربية': return 'Arabic'; break;
case 'Galego': return 'Galician'; break;
case 'Norsk (nynorsk)': return 'Nynorsk'; break;
case 'ไทย': return 'Thai'; break;
case 'فارسی': return 'Persian'; break;
case 'Ελληνικά': return 'Greek'; break;
case 'Bahasa Melayu': return 'Malay'; break;
case 'Euskara': return 'Basque'; break;
case 'Ido': return 'Ido'; break;
case 'Nnapulitano': return 'Neapolitan'; break;
case 'বাংলা': return 'Bengali'; break;
case 'Íslenska': return 'Icelandic'; break;
case 'ქართული': return 'Georgian'; break;
case 'Simple English': return 'Simple English'; break;
case 'Tiếng Việt': return 'Vietnamese'; break;
case 'Bosanski': return 'Bosnian'; break;
case 'Lëtzebuergesch': return 'Luxembourgish'; break;
case 'Brezhoneg': return 'Breton'; break;
case 'Shqip': return 'Albanian'; break;
case 'Македонски': return 'Macedonian'; break;
case 'Walon': return 'Walloon'; break;
case 'Srpskohrvatski / Српскохрватски': return 'Serbo-Croatian'; break;
case 'Latina': return 'Latin'; break;
case 'Krèyol ayisyen': return 'Haitian'; break;
case 'Sicilianu': return 'Sicilian'; break;
case 'Kurdî / كوردي': return 'Kurdish'; break;
case 'Сибирской': return 'Siberian/Nort Russian'; break;
case 'Latviešu': return 'Latvian'; break;
case 'मराठी': return 'Marathi'; break;
case 'Asturianu': return 'Asturian'; break;
case 'Afrikaans': return 'Afrikaans'; break;
case 'Basa Sunda': return 'Sundanese'; break;
case 'Occitan': return 'Occitan'; break;
case 'Ripoarisch': return 'Ripuarian'; break;
case 'Беларуская': return 'Belarusian'; break;
case 'Cymraeg': return 'Welsh'; break;
case 'Tagalog': return 'Tagalog'; break;
case 'O\'zbek': return 'Uzbek'; break;
case 'தமிழ்': return 'Tamil'; break;
case 'Corsu': return 'Corsican'; break;
case 'Aragonés': return 'Aragonese'; break;
case 'Чăвашла': return 'Chuvash'; break;
case 'ಕನ್ನಡ': return 'Kannada'; break;
case 'Gàidhlig': return 'Scottish Gaelic'; break;
case 'Gaeilge': return 'Irish Gaelic'; break;
case 'Tatarça': return 'Tatar'; break;
case 'Azərbaycan': return 'Azeri'; break;
case 'Vèneto': return 'Venetian'; break;
case 'हिन्दी': return 'Hindi'; break;
case 'Basa Jawa': return 'Javanese'; break;
case 'Тоҷикӣ': return 'Tajik'; break;
case 'Frysk': return 'West Frisian'; break;
case 'اردو': return 'Urdu'; break;
case 'Interlingua': return 'Interlingua'; break;
case 'Plattdüütsch': return 'Low Saxon'; break;
case 'Lumbaart': return 'Lombard'; break;
case 'Alemannisch': return 'Alemannic'; break;
case 'Հայերեն': return 'Armenian'; break;
case 'Limburgs': return 'Limburgian'; break;
case 'ייִדיש': return 'Yiddish'; break;
case 'Kiswahili': return 'Swahili'; break;
case 'Bân-lâm-gú': return 'Min Nan'; break;
case 'Ilokano': return 'Ilokano'; break;
case 'Føroyskt': return 'Faroese'; break;
case 'Piemontèis': return 'Piedmontese'; break;
case 'Nouormand': return 'Norman'; break;
case 'Arpitan': return 'Franco-Provençal/Arpitan'; break;
case 'Winaray': return 'Waray-Waray'; break;
case 'Scots': return 'Scots'; break;
case 'Kapampangan': return 'Kapampangan'; break;
case 'Иронау': return 'Ossetian'; break;
case 'Furlan': return 'Friulian'; break;
case 'Cebuano': return 'Cebuano'; break;
case '粵語': return 'Cantonese'; break;
case 'Nedersaksisch': return 'Dutch Low Saxon'; break;
case 'മലയാളം': return 'Malayalam'; break;
case 'Kernewek': return 'Cornish'; break;
case 'Deitsch': return 'Pennsylvania German'; break;
case 'नेपाल भाषा': return 'Newar / Nepal Bhasa'; break;
case 'Oyghurque': return 'Uyghur'; break;
case 'Líguru': return 'Ligurian'; break;
case 'Novial': return 'Novial'; break;
case 'Basa Banyumasan': return 'Banyumasan'; break;
case 'Sámegiella': return 'Northern Sami'; break;
case 'Ladino': return 'Ladino'; break;
case 'Kaszëbsczi': return 'Kashubian'; break;
case 'Malti': return 'Maltese'; break;
case 'Volapük': return 'Volapük'; break;
case 'አማርኛ': return 'Amharic'; break;
case 'Anglo Saxon': return 'Anglo-Saxon'; break;
case 'پښتو': return 'Pashto'; break;
case 'West-Vlaoms': return 'West Flemish'; break;
case 'संस्कृत': return 'Sanskrit'; break;
case 'Žemaitėška': return 'Samogitian'; break;
case 'Võro': return 'Voro'; break;
case 'Māori': return 'Maori'; break;
case 'Zazaki': return 'Zazaki'; break;
case 'Runa Simi': return 'Quechua'; break;
case 'Молдовеняскэ': return 'Moldovan'; break;
case 'Reo Mā`ohi': return 'Tahitian'; break;
case 'Монгол': return 'Mongolian'; break;
case 'Lojban': return 'Lojban'; break;
case 'कश्मीरी - (كشميري)': return 'Kashmiri'; break;
case 'Nahuatl': return 'Nahuatl'; break;
case 'Türkmen': return 'Turkmen'; break;
case 'Tok Pisin': return 'Tok Pisin'; break;
case 'Interlingue': return 'Interlingue'; break;
case 'Кыргызча': return 'Kirghiz'; break;
case 'नेपाली': return 'Nepali'; break;
case 'Rumantsch': return 'Romansh'; break;
case 'ܕܥܒܪܸܝܛ': return 'Assyrian Neo-Aramaic'; break;
case 'Toki Pona': return 'Tokipona'; break;
case 'Lingala': return 'Lingala'; break;
case 'Ekakairũ Naoero': return 'Nauruan'; break;
case 'faka-Tonga': return 'Tongan'; break;
case 'Қазақша': return 'Kazakh'; break;
case 'Armâneashti': return 'Aromanian'; break;
case 'Удмурт': return 'Udmurt'; break;
case 'Wollof': return 'Wolof'; break;
case 'ગુજરાતી': return 'Gujarati'; break;
case 'Malagasy': return 'Malagasy'; break;
case 'བོད་ཡིག': return 'Tibetan'; break;
case 'Tetun': return 'Tetum'; break;
case 'ދިވެހިބަސް': return 'Divehi'; break;
case '古文 / 文言文': return 'Classical Chinese'; break;
case 'Romani': return 'Romani'; break;
case 'Sardu': return 'Sardinian'; break;
case 'Авар': return 'Avar'; break;
case 'Gaelg': return 'Manx'; break;
case 'Kongo': return 'Kongo'; break;
case '吴语': return 'Wu'; break;
case 'Pangasinan': return 'Pangasinan'; break;
case 'Башҡорт': return 'Bashkir'; break;
case 'ᏣᎳᎩ': return 'Cherokee'; break;
case 'සිංහල': return 'Sinhalese'; break;
case 'Bamanankan': return 'Bambara'; break;
case 'سنڌي': return 'Sindhi'; break;
case '𐌲𐌿𐍄𐌹𐍃𐌺': return 'Gothic'; break;
case 'Emilià': return 'Emilian-Romagnol'; break;
case 'Hornjoserbsce': return 'Upper Sorbian'; break;
case 'ភាសាខ្មែរ': return 'Khmer'; break;
case 'Gagana Samoa': return 'Samoan'; break;
case 'isiZulu': return 'Zulu'; break;
case 'Boarisch': return 'Bavarian'; break;
case 'ᐃᓄᒃᑎᑐᑦ': return 'Inuktitut'; break;
case 'Myanmasa': return 'Burmese'; break;
case 'Diné bizaad': return 'Navajo'; break;
case 'словѣньскъ': return 'Old Church Slavonic'; break;
case 'Yorùbá': return 'Yoruba'; break;
case 'Kalaallisut': return 'Greenlandic'; break;
case 'Аҧсуа': return 'Abkhazian'; break;
case 'Hawai`i': return 'Hawaiian'; break;
case 'ລາວ': return 'Lao'; break;
case 'ਪੰਜਾਬੀ': return 'Punjabi'; break;
case 'Soomaaliga': return 'Somali'; break;
case 'Mìng-dĕ̤ng-ngṳ̄': return 'Min Dong'; break;
case 'seSotho': return 'Sesotho'; break;
case 'ইমার ঠার/বিষ্ণুপ্রিয়া মণিপুরী': return 'Bishnupriya Manipuri'; break;
case 'Papiamentu': return 'Papiamentu'; break;
case 'Avañe\'ẽ': return 'Guarani'; break;
case 'Aymar': return 'Aymara'; break;
case 'Kinyarwanda': return 'Kinyarwanda'; break;
case 'گیلکی': return 'Gilaki'; break;
case 'Zeêuws': return 'Zealandic'; break;
case 'isiXhosa': return 'Xhosan'; break;
case 'Na Vosa Vakaviti': return 'Fijian'; break;
case 'Bislama': return 'Bislama'; break;
case 'Коми': return 'Komi'; break;
case 'Tarandíne': return 'Tarantino'; break;
case 'Хальмг': return 'Kalmyk'; break;
case 'पािऴ': return 'Pali'; break;
case 'Setswana': return 'Tswana'; break;
case '(Cuengh)': return 'Zhuang'; break;
case 'Kanuri': return 'Kanuri'; break;
case 'Нохчийн': return 'Chechen'; break;
case 'Zamboangueño': return 'Zamboanga Chavacano'; break;
case 'هَوُسَ': return 'Hausa'; break;
case 'chiTumbuka': return 'Tumbuka'; break;
case 'Fulfulde': return 'Peul'; break;
case 'Twi': return 'Twi'; break;
case 'Igbo': return 'Igbo'; break;
case 'Nēhiyaw / ᓀᐦᐃᔭᐤ': return 'Cree'; break;
case 'ꆇꉙ': return 'Sichuan Yi'; break;
case 'Iñupiak': return 'Inupiak'; break;
case 'Kirundi': return 'Kirundi'; break;
case 'Luganda': return 'Luganda'; break;
case 'Afar': return 'Afar'; break;
case 'Sängö': return 'Sango'; break;
case 'Oromoo': return 'Oromo'; break;
case 'Chi-Chewa': return 'Chichewa'; break;
case 'chiShona': return 'Shona'; break;
case 'Hiri Motu': return 'Hiri Motu'; break;
case 'Akana': return 'Akan'; break;
case 'Norfuk / Pitkern': return 'Norfolk'; break;
case 'ᨅᨔ ᨕᨘᨁᨗ': return 'Buginese'; break;
case 'অসমীয়া': return 'Assamese'; break;
case 'Xitsonga': return 'Tsonga'; break;
case 'Eʋegbe': return 'Ewe'; break;
case 'Gĩkũyũ': return 'Kikuyu'; break;
case 'Kuanyama': return 'Kuanyama'; break;
case 'Tsetsêhestâhese': return 'Cheyenne'; break;
case 'Otsiherero': return 'Herero'; break;
case 'Ebon': return 'Marshallese'; break;
case 'भोजपुरी': return 'Bihari'; break;
case 'ትግርኛ': return 'Tigrinya'; break;
case 'Oshiwambo': return 'Ndonga'; break;
case 'Tshivenda': return 'Venda'; break;
case 'ଓଡ଼ିଆ': return 'Oriya'; break;
case 'SiSwati': return 'Swati'; break;
case 'Chamoru': return 'Chamorro'; break;
case 'Choctaw': return 'Choctaw'; break;
case 'Muscogee': return 'Muscogee'; break;
case 'Буряад': return 'Buryat (Russia)'; break;
case 'ཇོང་ཁ': return 'Dzongkha'; break;
case 'مَزِروني': return 'Mazandarani'; break;
case 'Лакку': return 'Lak'; break;

default: return localname;
}

}

importScript('User:Dycedarg/easyprod.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');

//<pre><nowiki>
 function aivlist(type) {
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  var ip = prompt("Enter IP address", "");
  var reason = prompt("Enter reason for listing", "");
  t.value += "*{{" + type + "|" + ip +"}} " + reason + "--~" + "~" + "~" + "~";
  f.wpSummary.value = "Listing " + ip;
  f.submit();
 }

addOnloadHook(
 function addaivlink() { 
  if (document.title.indexOf("Editing Wikipedia:Administrator intervention against vandalism") != -1)
  {
    mw.util.addPortletLink("p-cactions", "javascript:aivlist('vandal')", "vandal", "ca-vandal", "Report a vandal", "");
    mw.util.addPortletLink("p-cactions", "javascript:aivlist('ipvandal')", "ipvandal", "ca-ipvandal", "Report an ipvandal", "");
  } }
);
//</nowiki></pre>

// <nowiki>If you are editing a page, click the wikify button on your tab bar to add "{{Wikify|{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}" to the top, set "Marked for wikification" as the edit summary, mark it as a minor edit, and submit.</nowiki>

function doQwikify() {
  document.editform.wpTextbox1.value = '{' + '{' + 'Wikify|' + '{' + '{' + 'subst:CURRENTMONTHNAME}} ' + '{' + '{' + 'subst:CURRENTYEAR}}}}\n\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value = 'Marked for wikification';
  document.editform.wpMinoredit.checked = true;
  document.editform.submit();
}

addOnloadHook(function() {
  if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk") {
     // wouldn't it make more sense to just check for wgCanonicalNamespace != "", or am I missing something?
     return;
  }
  if (document.editform) {
     mw.util.addPortletLink("p-cactions", "javascript:doQwikify()", "wikify", "ca-wikify", "Mark for wikification", "");
  }
});

// by [[User:Raylu|raylu]]
//

// addPurge
addOnloadHook(function () {
    var hist; var url;
    if (!(hist = document.getElementById('ca-history') )) return;
    if (!(url = hist.getElementsByTagName('a')[0] )) return;
    if (!(url = url.href )) return;
    mw.util.addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),
                   'purge', 'ca-purge', 'Purge server cache for this page', '0');
});

//

// [[User:Henrik/sandbox/google-search]] (please include this line)
 function install_search()
 {
 document.getElementById('searchBody').innerHTML='<div>'+
 '<FORM method=get action="http://www.google.com/search">'+
 '<input type=hidden name="ie" value="UTF-8" /><input type=hidden name="oe" value="UTF-8" />'+
 '<INPUT id="searchInput" name="q" type="text" accesskey="f" value="" />'+
 '<input type="hidden" name="domains" value="wiki.riteme.site" />'+
 '<input type=radio name=sitesearch value="">Web'+
 '<input type=radio name=sitesearch value="wiki.riteme.site" checked />WP'+
 '<INPUT type="submit" name="btnG" VALUE="Google Search"  /></FORM></div>';
 }
 addOnloadHook(install_search);

/* Allows you to watch/unwatch a page without leaving it. */

function getXmlHttpObject() {
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        xmlHttp = false;
      }
    }
  }
  return xmlHttp;
}

function changeTab() {
   if (watchAction == 'watch') {
      watchLink.innerHTML = 'unwatch';
      watchAction = 'unwatch';
   } else if (watchAction == 'unwatch') {
      watchLink.innerHTML = 'watch';
      watchAction = 'watch';
   }
}

function setWatch(action) {
   xmlHttp = getXmlHttpObject();
   if (xmlHttp == false) return;
   xmlHttp.onreadystatechange = changeTab();
   xmlHttp.open('GET', 'http://wiki.riteme.site/w/index.php?title=' + pageName + '&action=' + action, true);
   xmlHttp.send(null);
}

function setWatchTab() {
   if (document.getElementById('ca-watch') || document.getElementById('ca-unwatch')) {
      if (document.getElementById('ca-watch')) {
         watchLink = document.getElementById('ca-watch').getElementsByTagName('a')[0];
         watchAction = 'watch';
      } else if (document.getElementById('ca-unwatch')) {
         watchLink = document.getElementById('ca-unwatch').getElementsByTagName('a')[0];
         watchAction = 'unwatch';
      }
      watchUrl = watchLink.href
      pageName = watchUrl.substring(watchUrl.indexOf('title=')+6,watchUrl.indexOf('&action'));
      watchLink.href = 'javascript:setWatch(watchAction);';
   }
}
addOnloadHook(setWatchTab);