ਮੀਡੀਆਵਿਕੀ:Gadget-ContrastReducer.js

ਵਿਕੀਸਰੋਤ ਤੋਂ

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// Script to shade the background and edit boxes to lower contrast and 
// avoid eyestrain
//
// Complain to User:Inductiveload

/* global jQuery, mw */

jQuery( document ).ready( function() {
	
	var currentAction = mw.config.get('wgAction');
	
	if (currentAction == "edit" || currentAction == "submit"){
	
		var colourEditInterfaceBackground = function( pageBG, editboxBG, fontColour, linkColour, newLinkColour, extLinkColour){ 
		
			style = $('<style type="text/css" />').appendTo('head');
			
			style.append(
				'#content		{background-color:'+ pageBG +' !important;}\
				#content		{color:'+ fontColour +' !important;}\
				a				{color:'+ linkColour +' !important;}\
				.new			{color:'+ newLinkColour +' !important;}\
				.extiw			{color:'+ extLinkColour +' !important;}\
				textarea, input	{background-color:'+editboxBG +' !important;}');
		};
		
		colourEditInterfaceBackground('#DDD', '#DDD', '#222', '#22F', '#BA0000', '#33F');
	}
});

//alternative colours
//colourEditInterfaceBackground('#228', '#228', '#FDD', '#DFD', '#BFB');