ok, here's my take on it:
Code:
/* Name: Dim */
@-moz-document url-prefix(http://www.wrongplanet.net/)
{
html
{ background: rgb(0,0,0) !important;
}
body
{ background: rgb(224,224,224);
opacity: 0.75 !important;
}
}
Remove the @-moz-document line and the outer brackets to apply to all sites.
If you have Greasemonkey, you can also try this:
Code:
// ==UserScript==
// @name Dim
// @description dim display
// @include *
// ==/UserScript==
const dim_x = 30;
const dim_y = 20;
const veil_opacity = "0.33";
const veil_color = "rgb(0,0,0)";
const veil_refresh_delay = 200;
const veil_id_str = "user_dim_veil";
var last_hidden_veil = null;
var last_x = 0;
var last_y = 0;
var veil_array;
var veil_refresh_id = null;
var bool_Legacy = false;
if( typeof(window.innerWidth) != "number" )
{ bool_Legacy = true; }
function getWindowsSizeX()
{ if( bool_Legacy )
{ return document.documentElement.clientWidth; }
return window.innerWidth;
}
function getWindowsSizeY()
{ if( bool_Legacy )
{ return document.documentElement.clientHeight; }
return window.innerHeight
}
function eventHandlerHideVeil(event)
{ if( last_hidden_veil != null ) { last_hidden_veil.style.visibility = "visible"; }
last_hidden_veil = event.currentTarget;
last_hidden_veil.style.visibility = "hidden";
return true;
}
function eventHandlerResize(event)
{ if( veil_refresh_id == null )
{ veil_refresh_id = setTimeout( function() { resize_veil(); }, veil_refresh_delay ); }
return true;
}
function resize_veil()
{ const atom_x = Math.ceil( getWindowsSizeX() / dim_x );
const atom_y = Math.ceil( getWindowsSizeY() / dim_y );
if( (atom_x != last_x) || (atom_y != last_y) )
{ last_x = atom_x;
last_y = atom_y;
const x_size = atom_x + "px";
const y_size = atom_y + "px";
var x_now;
var y_now = 0;
for( var y=0; y<dim_y; y++ )
{ x_now = 0;
y_now_str = y_now + "px";
for( var x=0; x<dim_x; x++ )
{ with( veil_array[y][x].style )
{ top = y_now_str;
left = x_now + "px";
height = y_size;
width = x_size;
}
x_now += atom_x;
}
y_now += atom_y;
}
}
veil_refresh_id = null;
return;
}
function create_veil()
{ veil_array = new Array(dim_y);
for( var y=0; y<dim_y; y++ )
{ veil_array[y] = new Array(dim_x);
for( var x=0; x<dim_x; x++ )
{ var div_veil = document.createElement("div");
with( div_veil.style )
{ position = "fixed";
zIndex = "2147483647";
background = veil_color;
opacity = veil_opacity;
}
div_veil.addEventListener( "mouseover", function(event) { eventHandlerHideVeil(event); }, true );
veil_array[y][x] = div_veil;
}
}
resize_veil();
veil_array[0][0].id = veil_id_str;
}
if( window == top )
{ create_veil();
window.addEventListener( "load",
function(event)
{ if( !document.body ) { return; }
if( !document.getElementById( veil_id_str ) )
{ for( var y=0; y<dim_y; y++ )
for( var x=0; x<dim_x; x++ )
{ document.body.appendChild( veil_array[y][x] ); }
window.addEventListener( 'resize', function(event) { eventHandlerResize(event); }, true );
}
},
false
);
}
It looks better but I can't find a way for events to pass through, so the area under the mouse cursor isn't dimmed.