Jump to content

User:Ckatz/vector.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.
function addLink(where, url, name, id, title, key, after) {
   // addLink() accepts either an id or a DOM node, mw.util.addPortletLink() only takes a node
   if (after && !after.cloneNode)
       after = document.getElementById(after);

   return mw.util.addPortletLink(where, url, name, id, title, key, after);
}

// [[User:Henrik/sandbox/google-search]] (please include this line)
function install_search()
{
document.getElementById('searchBody').innerHTML='<div>'+
'<FORM method=get action="http://www.google.ca/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 />WP'+
'<INPUT type="submit" name="btnG" VALUE="Google Search"  /></FORM></div>';
}
$(install_search);

// [[User:TheDJ/apipopups.js]]   
// importScript('User:TheDJ/apipopups.js');

popupAdminLinks=true;
popupAdjustDates=true;
popupTimeOffset=true;
popupStructure='menus';


// Script from [[User:Lupin/recent2.js]]
mw.loader.load(
             'https://en.wikipedia.org/w/index.php?title=User:Lupin/recent2.js'
             + '&action=raw&ctype=text/javascript&dontcountme=s');

//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'); }


//Add "unwatch" functionality to the watchlist ([[user:js/watchlist]], replaces [[User:Ilmari Karonen/unwatch.js]] and [[Wikipedia:WikiProject_User_scripts/Scripts/Unwatch]]
importScript('user:js/watchlist.js')

// Script from [[User:Lupin/editcount.js]]
importScript('User:Lupin/editcount.js'); //[[User:Lupin/editcount.js]]
popupEditCounterTool='custom';
popupEditCounterUrl='http://en.wikipedia.org/wiki/User:$1?ectarget=$1';

//Adding Twinkle (Wikipedia:WikiProject User scripts/Scripts/Twinkle)
//importScript('User:AzaToth/twinkle.js');

if( typeof( TwinkleConfig ) == 'undefined' ) TwinkleConfig = {}; // DO NOT REMOVE THIS LINE - ALL TWINKLE SETTINGS AFTER THIS
TwinkleConfig.batchdeleteChunks			=	50;
TwinkleConfig.batchDeleteMinCutOff			=	5;
TwinkleConfig.batchMax					=	5000;
TwinkleConfig.batchProtectChunks			=	50;
TwinkleConfig.batchProtectMinCutOff			=	5;
TwinkleConfig.batchundeleteChunks			=	50;
TwinkleConfig.batchUndeleteMinCutOff			=	5;
TwinkleConfig.blankTalkpageOnIndefBlock		=	false;
TwinkleConfig.defaultWarningGroup			=	1;
TwinkleConfig.deleteTalkPageOnDelete			=	false;
TwinkleConfig.deletionSummaryAd			=	"";
TwinkleConfig.deliChunks				=	500;
TwinkleConfig.deliMax					=	5000;
TwinkleConfig.markAIVReportAsMinor			=	true;
TwinkleConfig.markSockReportAsMinor			=	true;
TwinkleConfig.markUAAReportAsMinor			=	true;
TwinkleConfig.markRevertedPagesAsMinor			=	[ 'vand' ];
TwinkleConfig.markSpeedyPagesAsMinor			=	false;
TwinkleConfig.markSpeedyPagesAsPatrolled		=	true;
TwinkleConfig.notifyUserOnDeli				=	true;
TwinkleConfig.notifyUserOnSpeedyDeletionNomination	=	[ 'g1',	'g2', 'g3', 'g4', 'g10', 'g11',	'g12', 'a1', 'a2', 'a3', 'a5', 'a7', 'a9', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f9', 'f10', 'f11', 'u3', 't2', 't3', 'p2'	];
TwinkleConfig.offerReasonOnNormalRevert		=	true;
TwinkleConfig.openTalkPage				=	[ 'agf', 'norm', 'vand'	];
TwinkleConfig.openTalkPageOnAutoRevert			=	false;
TwinkleConfig.openUserTalkPageOnSpeedyDelete		=	[ 'g1',	'g2', 'g3', 'g4', 'g5',	'g10', 'g11', 'g12', 'a1', 'a3', 'a7', 'a9', 'f3', 'f4', 'f5', 'f6', 'f7', 'f9', 'f11', 'u3', 't2' ];
TwinkleConfig.orphanBacklinksOnSpeedyDelete		=	{exclude:['g6'], orphan:true};
TwinkleConfig.proddeleteChunks				=	50;
TwinkleConfig.protectionSummaryAd			=	"";
TwinkleConfig.revertMaxRevisions			=	50;
TwinkleConfig.showRollbackLinks			=	[ 'diff', 'others' ];
TwinkleConfig.showSharedIPNotice			=	false;
TwinkleConfig.summaryAd				=	"";
TwinkleConfig.userTalkPageMode				=	'tab';
TwinkleConfig.watchProdPages				=	true;
TwinkleConfig.watchRevertedPages			=	[ 'agf', 'norm', 'vand', 'torev' ];
TwinkleConfig.watchSpeedyPages				=	[ 'g3',	'g5', 'g10', 'g11', 'g12', 't1'	];
TwinkleConfig.watchWarnings				=	true;
TwinkleConfig.welcomeUserOnSpeedyDeletionNotification	=	TwinkleConfig.notifyUserOnSpeedyDeletionNomination;


// [[User:Jsimlo/shortcuts.js]]
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Jsimlo/shortcuts.js' 
             + '&action=raw&ctype=text/javascript');
 
function shortcutsInit ()
{
 
  shortcutsAddLink ('UWatchlist', 'User:Tra/User_watchlist');


  shortcutsAddLink ('Navigation shortcuts', 'Wikipedia:Tools/Navigation shortcuts');
  shortcutsAddLink ('Useful tools', 'User:Ckatz/Tools');
  shortcutsAddLink ('Admin changes', 'Special:RecentChangesLinked/User:Ckatz/admin');
  shortcutsAddLink ('ADMIN: AIV', 'Wikipedia:Administrator intervention against vandalism');
  shortcutsAddLink ('ADMIN: ANI', 'WP:ANI');
  shortcutsAddLink ('ADMIN: Block list', 'Special:IPBlockList');
  shortcutsAddLink ('SEARCH: Ext. links', 'Special:Linksearch');
  shortcutsAddLink ('DIR: user pages', 'Special:PrefixIndex/User:Ckatz/');
  shortcutsAddLink ('DIR: talk pages', 'Special:PrefixIndex/User talk:Ckatz/');



 
}

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


//importScript('User:AndyZ/peerreviewer.js'); //[[User:AndyZ/peerreviewer.js]]

/*** BEGIN WIKIBREAK ENFORCER ***/
$(function() {
 
	/*** Start editing here ***/
 
	// When you want to end your break?
	// no leading zeroes. (example: 7 - correct, 07 - incorrect)
 
	var date = { year: 2008, month: 2, day: 6};
	var time = { hours: 20, minutes: 22, seconds: 0 };
 
	/*** Stop editing here ***/
 
	var currentDate = new Date();
	var enforcedBreakEnd = new Date(
		date.year,date.month-1,date.day,time.hours,time.minutes,time.seconds);
	if (currentDate <= enforcedBreakEnd) {
		alert("Enforced wikibreak until "+enforcedBreakEnd.toLocaleString()
			+ "\n(now is "+currentDate.toLocaleString()+")\n\nBye!");
		location = "http://"+location.host+"/w/index.php?title="
			+ "Special:Userlogout&returnto=Main_Page";
	}
});
/*** END WIKIBREAK ENFORCER ***/


if( !document.all ) {
/* Watchlist notifier ([[User:Ais523/watchlistnotifier.js]]); displays a message every time a watched page changes. */
//<pre><nowiki>
 
var wmwpajax;
// From [[WP:US]] mainpage (wpajax renamed to wmwpajax)
wmwpajax={
        download:function(bundle) {
                // mandatory: bundle.url
                // optional:  bundle.onSuccess (xmlhttprequest, bundle)
                // optional:  bundle.onFailure (xmlhttprequest, bundle)
                // optional:  bundle.otherStuff OK too, passed to onSuccess and onFailure
 
                var x = window.XMLHttpRequest ? new XMLHttpRequest()
                : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP")
                : false;
 
                if (x) {
                        x.onreadystatechange=function() {
                                x.readyState==4 && wmwpajax.downloadComplete(x,bundle);
                        };
                        x.open("GET",bundle.url,true);
                        x.send(null); 
                }
                return x;
        },
 
        downloadComplete:function(x,bundle) {
                x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true )
                || ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText+': '+bundle.url));
        }
};
 
// Example:
// function dlComplete(xmlreq, data) {
//      alert(data.message + xmlreq.responseText);
// }
//  wmwpajax.download({url:'http://en.wikipedia.org/w/index.php?title=Thresher&action=raw', 
//                   onSuccess: dlComplete, message: "Here's what we got:\n\n" });
 
// End of [[WP:US]] quote
 
function wmWatchEditFound(xmlreq, data) {
  var watchrev, watchsum, watchrevold, watchpage, junk;
  if(xmlreq.responseText.indexOf('revid=')==-1)
  {
    document.getElementById('contentSub').innerHTML+=
      "<div class='watchlistnotify'>(<i>watchlistnotifier can't determine whether a "+
      "watched page has changed<i>)</div>";
    return;
  }
  watchrev=xmlreq.responseText.split('revid="')[1].split('"')[0];
  try
  {
    watchrevold=document.cookie.split('ais523wmwatchrev=')[1].split('.')[0];
  }
  catch(junk) {watchrevold=0;}
  if(mw.config.get('wgPageName') == "Special:Watchlist")
  {
    document.cookie="ais523wmwatchrev="+watchrev+".; path=/";
    var aas=document.getElementById('bodyContent').getElementsByTagName('a');
    var i=aas.length;
    while(i--)
    {
      if(aas[i].href.indexOf('diff=')!=-1&&watchrevold)
        if(+(aas[i].href.split('diff=')[1].split('&')[0])>watchrevold)
          aas[i].parentNode.style.fontWeight='bold';
    }
  }
  else
  {
    watchsum=xmlreq.responseText.split('comment="')[1].split('"')[0];
    watchpage=xmlreq.responseText.split('title="')[1].split('"')[0];
    watchsum=watchsum.split('<').join('&lt;').split('>').join('&gt;');
    watchpage=watchpage.split('<').join('&lt;').split('>').join('&gt;');
    if(watchrev!=watchrevold)
      document.getElementById('contentSub').innerHTML+=
        "<div class='watchlistnotify'>\""+watchpage+'" changed: "'+watchsum+
        '". (<a href="/wiki/Special:Watchlist">watchlist</a>)</div>';
  }
}
 
$(function() {
  /* Find the top item in the watchlist, and its edit summary. We only need one item, so
     set the limit to 1 to ease the load on the server. */
    wmwpajax.download({url:'http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wllimit=1&'+
      'wldir=older&format=xml&wlprop=comment|ids|title', onSuccess: wmWatchEditFound});
});
// </nowiki></pre>
// [[Category:Wikipedia scripts]]
}

//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		=	"auto";
FriendlyConfig.quickWelcomeTemplate		=	"Welcome";
FriendlyConfig.summaryAd			=	" using [[WP:FRIENDLY|Friendly]]";
FriendlyConfig.talkbackHeading			=	"== Talkback ==";
FriendlyConfig.topWelcomes			=	false;
FriendlyConfig.watchTaggedPages		=	true;
FriendlyConfig.watchWelcomes			=	true;
FriendlyConfig.welcomeHeading			=	"== Welcome ==";

//<nowiki>
FriendlyConfig.customTagList	=	[
		{
			label: '{{sprotected}}: Semi-protected template (small version)',
			value: 'sprotected|small=yes' },
		{
			label: '{{sprotected}}: Semi-protected template (large version)',
			value: 'sprotected' }
	];
//</nowiki>



//Variables for wikEd
var wikEdRegExTypoFix = true;


//Gracenotes - script to add custom summaries for rollbacks

importScript('User:Gracenotes/rollback.js');

//Cameltrader - add "Advisor" script

importScript('User:Cameltrader/Advisor.js');


//AWeenieMan - Fair Use Rationale scripts (Firefox only)

importScript('User:AWeenieMan/furme.js');
importScript('User:AWeenieMan/furmescroller.js');

//[[User:js/diff.js]] - improved "diff" rendering
importScript('user:js/diffs.js');

//[[User:Alex Smotrov/histcomb.js]] - improved history page rendering
importScript('User:Alex Smotrov/histcomb.js');

//[[User:Animum/easyblock.js]] - Aids for block functions
importScript("User:Animum/easyblock.js"); //[[User:Animum/easyblock.js]]

//[[User:Gary King/localize comments.js]] - reformat talk page dates to local time
LocalComments = {
        dateDifference: true,
	dateFormat : 'dmy',
	timeFirst : false,
	twentyFourHours: true
};

//[[User:Haza-w/cactions.js]] - more useful tabbed actions ([[User:Haza-w/Caction tool]])
//importScript('User:Haza-w/cactions.js'); //[[User:Haza-w/cactions.js]]


// [[User:Markhurd/hidetopcontrib.js]]
// By a suggestion by [[User:Discospinster]]
// 090325 MEH Fixed where it is not hiding all (top)s, starting with redirects
//            and continuing after any regex mismatch.
 
// This script hides lines according to who has the top contribution for a page.
 
//<pre><nowiki>
importScript('User:Markhurd/hidetopcontrib.js');

//Watchlist time-sort function
importScript('User:Largoplazo/watchpoint.js');

//Add sidebar links to Google Translate
importScript('User:TachyonJack/gTranslate.js');

//Wikipedia:AutoEd (article issues scanner)
importScript('Wikipedia:AutoEd/complete.js');

//PersonalLogs (add a link for personal logs to the task bar)
importScript('User:Drilnoth/personallogs.js'); //See [[User:Drilnoth/personallogs.js/doc]] for details