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. 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/common.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
/* 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]]

/* TEST SCRIPTS ARE AT TOP OF THE PAGE */

//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//
/**
** /* wgUserGroup sort by rank *//*
** BY: [[User:Technical 13]]
** 17 September 2021
 */
  const rankedGroups = [ 'developer', 'steward', 'bureaucrat', 'sysop', 'superuser', 'ddowikivip', 'autoconfirmed', 'user', '*', 'bot', 'widgeteditor' ];
  const usersGroups = mw.config.get( 'wgUserGroups' );
  var sortedGroups = [];
  usersGroups.forEach( ( group ) => { sortedGroups[ rankedGroups.indexOf( group ) ] = group; } );
  mw.config.set( 'wgUserGroups', sortedGroups.filter( ( g ) => { if ( g ) { return g; } } ) );

/* Make [rollback] and "blocklink" disappear */ //Personally, I only want this working on my contributions page.
let pageName = mw.config.get( 'wgPageName' ), canonicalSpecialPageName = mw.config.get( 'wgCanonicalSpecialPageName' );
if (/* pageName == 'Special:Watchlist' || pageName ==  'Special:RecentChanges' || */canonicalSpecialPageName == 'Contributions' ) {
	$( 'span.mw-rollback-link' ).remove();
	$( 'span.mw-usertoollinks' ).each( function () {
		$( this ).children( 'a:last' ).replaceWith( '-' );
		$( this ).html( $( this ).html().replace( ' | -', '' ) );
	} );
}

/* Edit Counter */
/* [[User:Technical 13/Scripts/Edit counter]] */
var editPage = 'Edit count';
var tableStyle = 'width: 268px;';
mw.loader.load( '/index.php?title=User:Technical_13/Scripts/Edit_counter.js&action=raw&ctype=text/javascript' );

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

/* Temporary name change mechanic until Extension:User Merge and Delete properly updates the edit count */
$('h1[id^="title"]').each(function() {
	this.innerHTML = this.innerHTML.replace("User:Technical 13", "User:ShoeMaker");
});
$('a[href^="/page/User:Technical_13"]').each(function() {
	this.innerHTML = this.innerHTML.replace("Technical 13", "ShoeMaker");
});

/* Shrink all things on my "Contributions" page that no-one has edited since me. */
//$('.mw-uctop').closest('li').css({"font-size":"6px", "text-decoration":"italic"});

/* Refresh my WatchList page when viewing every minute */
if (wgPageName == "Special:Watchlist" || wgPageName == "Special:RecentChanges") {
	setTimeout(function(){location = ''},600000);
/*
	mw.loader.load( '/index.php?title=User:Joenuts/Watchlist.js&action=raw&ctype=text/javascript' );
*/
	var timeNow = new Date();
	var minNow = timeNow.getMinutes();
	var minNow = minNow - 3;
	var timeCheck = new Date();
	timeCheck.setMinutes(minNow);
	var postTime = $('td.mw-enhanced-rc').html();
	var nbsp = (postTime.match(/ /g)||[]).length;
	for (i=0;i<nbsp;i++) {postTime = postTime.replace('&nbsp;', '');}
	postTime = postTime.replace('<span class="mw-enhancedchanges-arrow-space"></span>', '');
	postTime = postTime.replace('<abbr class="newpage" title="This edit created a new page">N</abbr>', '');
	postTime = postTime.replace('<abbr class="minoredit" title="This is a minor edit">m</abbr>', '');
	postTime = postTime.replace('<abbr class="botedit" title="This edit was performed by a bot">b</abbr>', '');
	postTime = postTime.replace('<abbr class="unpatrolled" title="This edit has not yet been patrolled">!</abbr>', '');
	postTime = postTime.split(':', '2');
	var postHour = postTime[0];
	var postMin = postTime[1];
	var timePost = new Date();
	timePost.setHours(postHour);
	timePost.setMinutes(postMin);
	var timePost = timePost.getTime();
	timeCheck = timeCheck.getTime();
	timeNow = timeNow.toLocaleTimeString();
	var headTitlePrefix = "";// Initialize variable
	var patrolsRequired = $('abbr.unpatrolled').length - $('table.mw-collapsed').has('abbr.unpatrolled').length;
	var headTitle = timeNow + " - " + document.title;
	if (timePost >= timeCheck) {
		var enhRC = $('td.mw-enhanced-rc').html();
		$('td[class^="mw-enhanced-rc"]').each(function() {this.innerHTML = this.innerHTML.replace(enhRC, '<span style="font-weight: bold; font-size: 12pt;">' + enhRC + '</span>');});
/* Using this styles ALL times	   $('td[class^="mw-enhanced-rc"]').css({"font-weight":"bold", "font-size":"12pt"});*/
		headTitlePrefix = "N";
	}
	if (patrolsRequired !== 0){
		if (patrolsRequired > 1) {
			headTitlePrefix = patrolsRequired + "!" + headTitlePrefix;
		} else {
			headTitlePrefix = "!" + headTitlePrefix;
		}
	}
	if (headTitlePrefix){ headTitle = headTitlePrefix + " - " + headTitle; }
	document.title = headTitle;
}