User:Persisch/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.
// Script from [[User:Lupin/recent2.jsUser:Lupin/recent2.js]]
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js' 
+ '&action=raw&ctype=text/javascript');
 
//Interiot's javascript edit counter
if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js' 
+ '&action=raw&ctype=text/javascript'); }
 
 
// install [[User:Cacycle/diff]] text diff code
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js'
+ '&action=raw&ctype=text/javascript');
 
// install [[User:Pilaf/Live_Preview]] page preview tool
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js'
+ '&action=raw&ctype=text/javascript');
 
// install [[User:Mboverload/RegExTypoFix|RegExTypoFix]] common typo fixer
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Cacycle/RegExTypoFix.js'
+ '&action=raw&ctype=text/javascript');
 
 
/* Syntax highlighter */
 
if(document.title.indexOf(".js") == -1)     //   Ignore pages that end in .js
$(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();
$(dp.SyntaxHighlighter.HighlightAll);
//
 
 
}
 
//</nowiki></pre>[[Category:Wikipedians who use VoA script]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
// Selected TWINKLE scripts
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklewarn.js');
importScript('User:AzaToth/twinklearv.js');
importScript('User:AzaToth/twinklespeedy.js');
 
//Other scripts
importScript('User:Ais523/votesymbols.js'); //[[User:Ais523/votesymbols.js]]
importScript('User:Ais523/topcontrib.js'); //[[User:Ais523/topcontrib.js]]
importScript('User:Ais523/contribcalendar.js'); //[[User:Ais523/contribcalendar.js]]
importScript('User:Ais523/highlightmyname2.js'); //[[User:Ais523/highlightmyname2.js]]
importScript('User:Ais523/catwatch.js'); //[[User:Ais523/catwatch.js]]
importScript('User:Ais523/sandbox.js'); //[[User:Ais523/sandbox.js]]
importScript('User:Ais523/watchlistnotifier.js'); //[[User:Ais523/watchlistnotifier.js]]
importScript('User:Ais523/adminrights.js'); //[[User:Ais523/adminrights.js]]
importScript('User:Ais523/stubtagtab2.js'); //[[User:Ais523/stubtagtab2.js]]
importScript('User:Ais523/editsection0tab.js'); //[[User:Ais523/editsection0tab.js]]
var bm_useparsebutton=1;
importScript('User:Ais523/bracketmatch.js'); //[[User:Ais523/bracketmatch.js]]
 
// Rollback summary script
importScript('User:Gracenotes/rollback.js');
 
// Qui script
importScript('User:TheDJ/qui.js');
 
// A useful saving edits script
importScript('User:Wayiran/opennewwindowinstead.js');
 
// Shortcut links
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Jsimlo/shortcuts.js' 
            + '&action=raw&ctype=text/javascript');
function shortcutsInit ()
{
 shortcutsStartSection ('Shortcuts');
 shortcutsAddLink ('To Do List', 'User:Wayiran/todolist');
 shortcutsStartSection ('Useful Links');
 shortcutsAddLink ('Iran-related watchlist', 'Special:RecentChangesLinked/Wikipedia:WikiProject Iran/Main Iran-related articles/Watchlist');
 shortcutsAddLink ('Our history watchlist', 'Special:RecentChangesLinked/Wikipedia:WikiProject_Iran/History_of_Iran/Watchlist');
}
 
// AfD Helper mod
importScript('User:Foxy Loxy/afdhelpermod.js');
 
// Vote symbols
importScript('User:Ais523/votesymbols.js');
 
// Add reference toolbar
importScript('User:Mr.Z-man/refToolbar.js');
 
// Only last changes script
importScript('Wikipedia:WikiProject User scripts/Scripts/Watchlist since');
 
 
//New part:
TwinkleConfig = {
	batchdeleteChunks			:	50,
	batchDeleteMinCutOff			:	5,
	batchMax				:	5000,
	batchProtectChunks			:	50,
	batchProtectMinCutOff			:	5,
	batchundeleteChunks			:	50,
	batchUndeleteMinCutOff			:	5,
  	blankTalkpageOnIndefBlock		:	false,
  	defaultWarningGroup			:	1,
	deleteTalkPageOnDelete			:	false,
	deletionSummaryAd			:	' using [[WP:TW|TW]]',
	deliChunks				:	500,
	deliMax					:	5000,
  	markAIVReportAsMinor			:	true,
  	markSockReportAsMinor			:	true,
  	markUAAReportAsMinor			:	true,
	markRevertedPagesAsMinor		:	[ 'vand' ],
	markSpeedyPagesAsMinor			:	false,
	markSpeedyPagesAsPatrolled		:	true,
	notifyUserOnDeli			:	true,
	notifyUserOnSpeedyDeletionNomination	:	[ 'g1', 'g2', 'g3', 'g4', 'g10', 'g11', 'g12', 'a1', 'a2', 'a3', 'a5', 'a7', 'a9', 'i1', 'i2', 'i3', 'i4', 'i5', 'i6', 'i7', 'i8', 'i9', 'i10', 'i11', 'u3', 't1', 't2', 't3', 'p2' ],
	offerReasonOnNormalRevert		:	true,
	openTalkPage				:	[ 'agf', 'norm', 'vand' ],
	openTalkPageOnAutoRevert		:	false,
	openUserTalkPageOnSpeedyDelete		:	[ 'g1', 'g2', 'g3', 'g4', 'g5', 'g10', 'g11', 'g12', 'a1', 'a3', 'a7', 'a9', 'i3', 'i4', 'i5', 'i6', 'i7', 'i9', 'i11', 'u3', 't1', 't2' ],
	orphanBacklinksOnSpeedyDelete		:	{exclude:['g6'], orphan:true},
	proddeleteChunks			:	50,
	protectionSummaryAd			:	' using [[WP:TW|TW]]',
	revertMaxRevisions			:	50,
	showSharedIPNotice			:	true,
	summaryAd				:	' using [[WP:TW|TW]]',
	userTalkPageMode			:	'window',
	watchProdPages				:	false,
	watchRevertedPages			:	[],
	watchSpeedyPages			:	[],
  	watchWarnings				:	false
};
 
 
importScript('User:Ioeth/friendly.js');
 
 
if( typeof( FriendlyConfig ) == 'undefined' ) FriendlyConfig = {}; // DO NOT REMOVE THIS LINE - ALL FRIENDLY SETTINGS AFTER THIS
FriendlyConfig.clockStyle			=	"dynamic";
FriendlyConfig.enableClock			=	false;
FriendlyConfig.groupByDefault			=	true;
FriendlyConfig.idsToRename			=	[
		{ id: 'ca-nstab-main', name: 'Main', mainPageOnly: true },
		{ id: 'ca-nstab-help', name: 'Help' },
		{ id: 'ca-nstab-special', name: 'Special' },
		{ id: 'ca-nstab-project', name: 'Project' },
		{ id: 'ca-nstab-user', name: 'User' },
		{ id: 'ca-edit', name: 'Edit' },
		{ id: 'ca-viewsource', name: 'Source' },
		{ id: 'ca-talk', name: 'Talk' },
		{ id: 'ca-undelete', name: 'Undelete' },
		{ id: 'ca-addsection', name: '+' }
	];
FriendlyConfig.insertHeadings			=	true;
FriendlyConfig.insertSignature			=	true;
FriendlyConfig.insertUsername			=	true;
FriendlyConfig.markSharedIPAsMinor		=	true;
FriendlyConfig.markTaggedPagesAsMinor		=	true;
FriendlyConfig.markTaggedPagesAsPatrolled	=	true;
FriendlyConfig.markTalkbackAsMinor		=	true;
FriendlyConfig.markWelcomesAsMinor		=	true;
FriendlyConfig.maskTemplateInSummary		=	true;
FriendlyConfig.quickWelcomeMode		=	"semiauto";
FriendlyConfig.quickWelcomeTemplate		=	"Welcome";
FriendlyConfig.summaryAd			=	" using [[WP:FRIENDLY|Friendly]]";
FriendlyConfig.talkbackHeading			=	"== Talkback ==";
FriendlyConfig.topWelcomes			=	false;
FriendlyConfig.watchTaggedPages		=	false;
FriendlyConfig.watchWelcomes			=	false;
FriendlyConfig.welcomeHeading			=	"== Welcome ==";