Year of the Dragon: Through May 28th, claim free Expansion Pack (excluding Vecna Unleashed) or a Greater Elixir of Discovery! Speak to Xatheral in the Hall of Heroes.
Known Issue: Xatheral has been temporarily disabled while we investigate a bug with Year of the Dragon gift delivery.DDO Forums edit

Game mechanicsNewbie guideIn developmentDDO StoreSocial Media


ChallengesClassesCollectablesCraftingEnhancementsEpic DestiniesFavorFeats

GlossaryItemsMapsMonstersPlacesQuestsRacesReincarnationSkillsSpells


Please create an account or log in to build a reputation and unlock more editing privileges, and then visit DDO wiki's IRC Chat/Discord if you need any help!

User:Technical 13/vector.js

From DDO wiki
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes, you can click here or try one of the methods below..

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl+F5 or Ctrl+r ( Command+r on a Mac)
  • Google Chrome: Press Ctrl+ Shift+R ( Command+ Shift+R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl+F5
  • Konqueror: Click Reload or press F5
  • Opera: Clear the cache in Tools ‣ Preferences
/* RC long dates */
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Recentchanges' ){
  var arrDaysOfWeek = [ 'Sunday', 'Monday',  'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ];
  $( 'div.mw-changeslist h4' ).each( function( n, h4date ) {
    var strDate = h4date.innerText;
    var thisDay = ( new Date( strDate ) ).getDay();
    if ( n === 0 ) {
      h4date.id = "today";
    } else {
      h4date.id = arrDaysOfWeek[ thisDay ] + ( Math.floor( n / 7 ) + 1 );
    }
    h4date.innerText = arrDaysOfWeek[ thisDay ] + ', ' + strDate;
  } );
  $( 'fieldset.rcoptions' ).html(
    $( 'fieldset.rcoptions' ).html()
      .replace( ' minor edits | ', ' minor | ' )
      .replace( ' anonymous users | ', ' IPs | ' )
      .replace( ' registered users | ', ' users | ' )
      .replace( ' patrolled edits | ', ' patrolled | ' )
      .replace( ' my edits', ' mine' )
  );
  $( 'body' ).append( '<div id="RCnav" style="position: fixed; left: 5px; bottom: 20px; display: block; width: 150px; z-index: 999; overflow: hidden; border: 1px solid #A7D7F9; background-color: #FFFFFF; text-align: center;"><a href="#today"><small style="font-weight: bold;">&uArr; &nbsp; &uArr; &nbsp; Today &nbsp; &uArr; &nbsp; &uArr;</small></a></div>' );
}

/* UserCSSJS */// To make it easy to navigate to your own custom CSS and JS pages
// [[Special:MyPage/common.css]] [[Special:MyPage/common.js]]
// [[Special:MyPage/vector.css]] [[Special:MyPage/vector.js]]

mw.loader.load( '/index.php?title=MediaWiki:Gadget-DeOrphaner.js&action=raw&ctype=text/javascript' );// [[MW:Gadget-DeOrphaner.js]]

//mw.loader.load( '/index.php?title=MediaWiki:Gadget-spamBlock.js/sandbox.js&action=raw&ctype=text/javascript' );// [[MW:Gadget-spamBlock.js/sandbox.js]]

mw.loader.load( '/index.php?title=MediaWiki:Gadget-editBox.js&action=raw&ctype=text/javascript' );// [[MW:Gadget-editBox.js]]

/* BD */// Testing new code for "Better Diffs"
$( '.diff-otitle' ).append( '<br /><span style="color: #8B0000; font-weight: bold;">-' + $( '.diff-deletedline' ).text().length + '</span>' );
$( '.diff-ntitle' ).append( '<br /><span style="color: #006400; font-weight: bold;">+' + $( '.diff-addedline' ).text().length + '</span>' );
var intDiff = $( '.diff-addedline' ).text().length - $( '.diff-deletedline' ).text().length;
$( '.diff-otitle' ).parents( 'tr' ).after(
	'<tr style="vertical-align: top; text-align: center;"><td colspan="4">Change this edit: <span style="color: #' +
	( intDiff === 0 ? '8A8A8A' : ( intDiff < 0 ? '8B0000' : '006400' ) ) +
	'; font-weight: ' + ( Math.abs( intDiff ) >= 500 ? 'bold' : 'inherit' ) + ';">' + intDiff + '</span></td></tr>'
	);

/* QL */// Testing for [[Template:MyContent]] and [[MediaWiki:Template-MyContent.js]]
//mw.loader.load( '/index.php?title=MediaWiki:Template-MyContent.js&action=raw&ctype=text/javascript' );

/* Logout */// Remind me to log out when at school
//mw.loader.load( '/index.php?title=User:Technical_13/Scripts/logout.js&action=raw&ctype=text/javascript' );// [[User:Technical_13/Scripts/logout]]

/* diff_links */// Test for adding links in diffs
if( $( 'table.diff' ).length != 0 ) {
	if( $( 'table.diff' ).text().match( /([\d\w\s]*?)\.(jpg|png|jpeg|bmp)/gi ) != null ) {
		Array.prototype.unique = function( a ) {
			return function(){ return this.filter( a ) }
		}( function( a, b, c ){ return c.indexOf( a, b+1 ) < 0 } );
		var linkedHTML = '';
		var linkedText = $('table.diff').text().match(/([\d\w\s:]*?)\.(jpg|png|jpeg|bmp)/gi);
console.log('linkedText: %s', linkedText);
		var linkDestination = $('table.diff').text().match(/([\d\w\s]*?)\.(jpg|png|jpeg|bmp)/gi);
console.log('linkDestination: %s', linkDestination);
		linkedText = linkedText.unique();
console.log('unique linkedText: %s', linkedText);
		linkDestination= linkDestination.unique();
console.log('unique linkDestination: %s', linkDestination);
		for(var i=0; i<linkedText.length; i++){
			linkedText[i] = linkedText[i].trim();
console.log('linkedText[%d]: %s', i, linkedText[i]);
			linkedHTML = $('table.diff').html().closest(':contains(linkDestination[i].substr(0, (linkDestination[i].length - 4)))');
console.log('linkedHTML: %s', linkedHTML);
			linkDestination[i] = linkDestination[i].trim();
console.log('linkDestination[%d]: %s', i, linkDestination[i]);
//			$('table.diff').html($('table.diff').html().replace(linkedHTML[i], '<a href="/images/' + linkDestination[i] + '" title="' + linkedText[i] + '">' + linkedHTML[i] + '</a>'));
console.log('.replace: %s ::with: <a href="/images/%s" title="%s">%s</a>', linkedHTML[i], linkDestination[i], linkedText[i], linkedHTML[i]);
		}
	}
}

/* Add a very useful table and information on [[Special:UserRights]]. */
if ( mw.config.get( 'wgUserName' ) === 'Technical 13' && mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Userrights' ) {
	var useVersion = confirm( 'Use the \"LIVE\" version.' );
	if ( useVersion ){
		mw.loader.load( '/index.php?title=MediaWiki:Gadget-SpecialPages.js/UserRights.js&action=raw&ctype=text/javascript' );
	} else {
		mw.loader.load( '/index.php?title=User:Technical_13/SandBox/Gadget-UserRights.js&action=raw&ctype=text/javascript' );
	}
} else {
	mw.loader.load( '/index.php?title=MediaWiki:Gadget-SpecialPages.js/UserRights.js&action=raw&ctype=text/javascript' );
}