User:Pyrospirit/monobook.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
/*#### This area contains scripts only for Firefox ####*/
var detect = navigator.userAgent.toLowerCase();
var IE;
var place = detect.indexOf('msie') + 1;
if (place) IE=true;
if (!IE) {

//Twinkle reversion script
importScript('User:AzaToth/twinkle.js');

TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'tab',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       " ([[WP:TW|TW]])",
        deletionSummaryAd               :       " ([[WP:TW|TW]])",
        protectionSummaryAd             :       " ([[WP:TW|TW]])",
        watchSpeedyPages                :       [ ],
        watchProdPages                  :       true,
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ ],
        markRevertedPagesAsMinor        :       [ 'norm', 'vand' ],
        deleteTalkPageOnDelete          :       false,
        markWarningsAsMinor             :       false,
        markAIVReportAsMinor            :       true,
        markSpeedyPagesAsMinor          :       false,
        markProdPagesAsMinor            :       false,
        confirmUsernameToAIV            :       true
};

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

// This will add an [edit] link at the top of all pages except preview pages and the main page
// by User:Pile0nades

// Add an [edit] link to pages
addOnloadHook(function () {
  // if this is preview page or generated page, stop
  if(
    document.getElementById("wikiPreview") ||
    document.getElementById("histlegend‎") ||
    document.getElementById("difference‎") ||
    document.getElementById("watchdetails") ||
    document.getElementById("ca-viewsource") ||
    window.location.href.indexOf("/wiki/Special:") != -1
  ) {
    if(window.location.href.indexOf("&action=edit&section=0") != -1) {
      document.getElementById("wpSummary").value = "/* Intro */ ";
    }
    return;
  };

  // get the page title
  var pageTitle = wgPageName;

  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="Edit section: '+pageTitle+'">edit intro</a>]</div>';

  // insert divContainer into the DOM below the h1
  if(window.location.href.indexOf("&action=edit") == -1) {
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
  }

});

}
/*#### End Firefox only scripts ####*/

// [[User:Lupin/popups.js]]      
importScript('User:Lupin/popups.js');

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

 function shortcutsInit ()
 {

  shortcutsAddLink ( 'Monobook.js', 'User:Pyrospirit/monobook.js' );
  shortcutsAddLink ( 'Monobook.css', 'User:Pyrospirit/monobook.css' );
  shortcutsAddLink ( 'Scripts', 'Wikipedia:WikiProject User scripts/Scripts' );
  shortcutsAddLink ( 'wikEd', 'User:Cacycle/wikEd' );
  shortcutsAddLink ( 'Twinkle', 'Wikipedia:WikiProject User scripts/Scripts/Twinkle' );
  shortcutsAddLink ( 'VandalProof', 'User:AmiDaniel/VP/Welcome' );
  shortcutsAddLink ( 'New pages', 'Special:Newpages' );
  shortcutsAddLink ( 'RuneScape', 'RuneScape' );
  shortcutsAddLink ( 'RuneScape locations', 'RuneScape locations' );
  shortcutsAddLink ( 'RS task force', 'Wikipedia:WikiProject Massively multiplayer online games/RuneScape' );
  shortcutsAddLink ( 'User warnings', 'Wikipedia:Template messages/User talk namespace' );
  shortcutsAddLink ( 'AIV', 'Wikipedia:Administrator intervention against vandalism' );

 }

importScript('Wikipedia:WikiProject User scripts/Scripts/Add purge to tabs');

importScript('Wikipedia:WikiProject User scripts/Scripts/Unwatch');

// Script from [[User:Tra/userwatchlist.js]]
importScript('User:Tra/userwatchlist.js'); //[[User:Tra/userwatchlist.js]]

importScript('Wikipedia:WikiProject User scripts/Scripts/Logs link');

importScript('Wikipedia:WikiProject User scripts/Scripts/Compare link');

importScript('Wikipedia:WikiProject User scripts/Scripts/Formatter');

 // [[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="en.wikipedia.org" />'+
 '<input type=radio name=sitesearch value="">Web'+
 '<input type=radio name=sitesearch value="en.wikipedia.org" checked />Wiki'+
 '<INPUT type="submit" name="btnG" VALUE="Google Search"  /></FORM></div>';
 }
 addOnloadHook(install_search);

importScript('User:Alex_Smotrov/qpreview.js');

/*#### Start Firefox only scripts ####*/
var detect = navigator.userAgent.toLowerCase();
var IE;
var place = detect.indexOf('msie') + 1;
if (place) IE=true;
if (!IE) {

/* Syntax highlighter */

if(document.title.indexOf(".js") == -1)     //   Ignore pages that end in .js
addOnloadHook(function () {
/* CSS syntax highlighting */
multicommentRE = new RegExp('(/\\*[\\s\\S]*?\\*/)', 'g');
ruleRE = new RegExp('([^\\{]+)\\{([^\\}]+)\\}', 'g');
idselectorRE = new RegExp('(#[a-zA-Z0-9\-\_]+)\\b', 'g');
classselectorRE = new RegExp('(\\.[a-zA-Z0-9\-\_]+)\\b', 'g');
pairRE = new RegExp('([a-zA-Z-]+):([^;]+);', 'g');
css = document.getElementsByTagName('pre');
for (i = 0; i < css.length; i++) {
c = css[i];
content = c.innerHTML;
content=content.replace(multicommentRE, '<span class="comment">$1</span>');
content = content.replace(ruleRE, function(text, selector, body) {
selector = selector.replace(idselectorRE, '<span class="idselector">$1</span>');
selector = selector.replace(classselectorRE, '<span class="classselector">$1</span>');
body = body.replace(pairRE, '<span class="property">$1</span>:<span class="value">$2</span>;');
return selector + '{' + body + '}';
});
c.innerHTML = content;
}
});

else { /* JS syntax highlighting */

//

/** 
* Code Syntax Highlighter.
* Version 1.3.0
* Copyright (C) 2004 Alex Gorbatchev.
* http://www.dreamprojections.com/syntaxhighlighter/
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

var dp={sh:{Brushes:{},Version:'1.3.0'}};dp.SyntaxHighlighter=dp.sh;dp.sh.Match=function(value,index,css){this.value=value;this.index=index,this.length=value.length,this.css=css};dp.sh.Highlighter=function(){this.addGutter=true,this.collapse=false,this.tabsToSpaces=true};dp.sh.Highlighter.SortCallback=function(m1,m2){if(m1.index<m2.index)return -1;else if(m1.index>m2.index)return 1;else{if(m1.length<m2.length)return -1;else if(m1.length>m2.length)return 1};return 0};dp.sh.Highlighter.prototype.GetMatches=function(regex,css){var index=0;var match=null;while((match=regex.exec(this.code))!=null){this.matches[this.matches.length]=new dp.sh.Match(match[0],match.index,css)}};dp.sh.Highlighter.prototype.AddBit=
function(str,css){
var span=document.createElement('span');
str=str.replace(/&/g,'\&');
str=str.replace(/\&/g,'&');
str=str.replace(/\"/g,'"');
str=str.replace(/ |\t/g,' ').replace(/\n/gm,' <br />');
if(css!=null){var regex=new RegExp('<br />','gi');if(regex.test(str)){var lines=str.split(' <br />');str='';for(var i=0;i<lines.length;i++){span=document.createElement('SPAN');span.className=css;span.innerHTML=lines[i];this.div.appendChild(span);if(i+1<lines.length)this.div.appendChild(document.createElement('BR'))}}else{span.className=css,span.innerHTML=str;this.div.appendChild(span)}}else{span.innerHTML=str;this.div.appendChild(span)}};dp.sh.Highlighter.prototype.IsInside=function(match){if(match==null||match.length==0)return;for(var i=0;i<this.matches.length;i++){var c=this.matches[i];if(c==null)continue;if((match.index>c.index)&&(match.index<=c.index+c.length))return true}return false};dp.sh.Highlighter.prototype.ProcessRegexList=function(){for(var i=0;i<this.regexList.length;i++)this.GetMatches(this.regexList[i].regex,this.regexList[i].css)};dp.sh.Highlighter.prototype.ProcessSmartTabs=function(code){var lines=code.split('\n');var result='';var tabSize=4;var tab='\t';function InsertSpaces(line,pos,count){var left=line.substr(0,pos);var right=line.substr(pos+1,line.length);var spaces='';for(var i=0;i<count;i++)spaces+=' ';return left+spaces+right};function ProcessLine(line,tabSize){if(line.indexOf(tab)==-1)return line;var pos=0;while((pos=line.indexOf(tab))!=-1){var spaces=tabSize-pos % tabSize;line=InsertSpaces(line,pos,spaces)}return line};for(var i=0;i<lines.length;i++)result+=ProcessLine(lines[i],tabSize)+'\n';return result};dp.sh.Highlighter.prototype.SwitchToTable=function(){var html=this.div.innerHTML.replace(/<(br)\/?>/gi,'\n');var lines=html.split('\n');var row=null;var cell=null;var tBody=null;var html='';var pipe=' | ';tBody=document.createElement('TBODY');this.table.appendChild(tBody);if(this.addGutter==true){row=tBody.insertRow(-1);cell=row.insertCell(-1)}for(var i=0,lineIndex=this.firstLine;i<lines.length-1;i++,lineIndex++){row=tBody.insertRow(-1);if(this.addGutter==true){cell=row.insertCell(-1);cell.className='gutter';cell.innerHTML=lineIndex};cell=row.insertCell(-1);cell.className='line'+(i % 2+1);cell.innerHTML=lines[i]};this.div.innerHTML=''};dp.sh.Highlighter.prototype.Highlight=function(code){function Trim(str){return str.replace(/^\s*(.*?)[\s\n]*$/g,'$1')};function Chop(str){return str.replace(/\n*$/,'').replace(/^\n*/,'')};function Unindent(str){var lines=str.split('\n');var indents=new Array();var regex=new RegExp('^\\s*','g');var min=1000;for(var i=0;i<lines.length&&min>0;i++){if(Trim(lines[i]).length==0)continue;var matches=regex.exec(lines[i]);if(matches!=null&&matches.length>0)min=Math.min(matches[0].length,min)};if(min>0)for(var i=0;i<lines.length;i++)lines[i]=lines[i].substr(min);return lines.join('\n')};function Copy(string,pos1,pos2){return string.substr(pos1,pos2-pos1)};var pos=0;this.originalCode=code;this.code=Chop(Unindent(code));this.div=document.createElement('DIV');this.table=document.createElement('TABLE');this.matches=new Array();if(this.CssClass!=null)this.table.className=this.CssClass;if(this.tabsToSpaces==true)this.code=this.ProcessSmartTabs(this.code);this.table.border=0;this.table.cellSpacing=0;this.table.cellPadding=0;this.ProcessRegexList();if(this.matches.length==0){this.AddBit(this.code,null);this.SwitchToTable();return};this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);for(var i=0;i<this.matches.length;i++)if(this.IsInside(this.matches[i]))this.matches[i]=null;for(var i=0;i<this.matches.length;i++){var match=this.matches[i];if(match==null||match.length==0)continue;this.AddBit(Copy(this.code,pos,match.index),null);this.AddBit(match.value,match.css);pos=match.index+match.length};this.AddBit(this.code.substr(pos),null);this.SwitchToTable()};dp.sh.Highlighter.prototype.GetKeyw=function(str){return '\\b'+str.replace(/ /g,'\\b|\\b')+'\\b'};dp.sh.HighlightAll=function(event,showGutter,firstLine){var elements=document.getElementsByTagName('PRE');var highlighter=null;var registered=new Object();if(elements==null)return;for(var i=0;i<elements.length;i++){var element=elements[i];highlighter=new dp.sh.Brushes['JScript']();highlighter.addGutter=(showGutter==null)?true:showGutter;highlighter.firstLine=(firstLine==null)?0:firstLine;highlighter.Highlight(element['innerHTML']);element.innerHTML="";element.className='dp-highlighter';element.appendChild(highlighter.table)}};

dp.sh.Brushes.JScript = function(){
var keywords =  'abstract boolean break byte case catch char class const continue debugger ' +
'default delete do double else enum export extends false final finally float ' +
'for function goto if implements import in instanceof int interface long native ' +
'new null package private protected public return short static super switch ' +
'synchronized this throw throws transient true try typeof var void volatile while with';
this.regexList = [
{regex: new RegExp('//.*$', 'gm'),            css: 'comment' },    // one line comments
{regex: new RegExp('/\\*[\\s\\S]*?\\*/', 'g'),css: 'comment' },    // multiline comments
{regex: new RegExp('"(?:[^"\n]|[\"])*?".*?','g'),css: 'string' },     // double quoted strings
{regex: new RegExp("'(?:[^'\n]|[\'])*?'.*?",'g'),css: 'string' },     // single quoted strings
{regex: new RegExp('^\\s*#.*', 'gm'),         css: 'preprocessor'},// preprocessor tags like #region and #endregion
{regex: new RegExp(this.GetKeyw(keywords),'gm'),css: 'keyword'}    // keywords
];
this.CssClass = 'dp-c';
}
dp.sh.Brushes.JScript.prototype = new dp.sh.Highlighter();
addOnloadHook(dp.SyntaxHighlighter.HighlightAll);
//

}

/* This is Voice of All's helper JavaScript. */
 //<nowiki> Helper tools
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Voice_of_All/Addtabs/monobook.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//</nowiki>
/* End VoA helper script */

/* Now some selected VoA scripts */

//<nowiki> Admin-like RC Patrol tools

importScript('User:Voice of All/UTCclock.js');
importScript('User:Voice_of_All/History/monobook.js');

//<pre><nowiki>
// [[User:Lupin/popupsdev.js]] - please include this line 
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
popupStructure='shortmenus';
popupSubpopups=false;
// [[User:Lupin/recent2.js]] - please include this line
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//</nowiki></pre>

//</nowiki>[[Category:Wikipedians who use RC script ]]

/* End selected VoA scripts */

//These are [[User:GeorgeMoney]]'s helper scripts, copied to my userspace for convenience.
//The scripts are: Cookies, AddLinks, and Include.
importScript('User:Pyrospirit/gmhelper.js');

// [[User:Dschwen/wikiminiatlas2.js]] - please include this line 


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

}


/*#### End Firefox only scripts ####*/