// Invisibility Cloak
// version 0.2
// Konrad Voelkel / Gina Trapani
// 2009-11-06
// Released to the public domain.
//
// ==UserScript==
// @name          Invisibility Cloak
// @description   Turns time-wasting web pages invisible for a specified time period.
// @include       http://*.youtube.*/*
// @include       http://*.myspace.*/*
// @include       http://*.twitter.*/*
// @include       http://*.craigslist.org/*
// @include       http://*.orkut.*/*
// @include       http://*.hi5.com/*
// @include       http://*.facebook.com/*
// @include       http://www.xing.com/*
// @include       http://www.linkedin.com/*
// @include       http://www.studivz.net/*
// @include       http://*.cnet.com/*
// @include       http://reader.google.*/*
// @include       http://www.google.*/reader/view/*
// @include       http://*.analytics.google.com/*
// @include       http://www.google.com/analytics/*
// @include       http://www.google.com/adsense/*
// @include       http://www.google.com/webmasters/*
// @include       http://www.amazon.*/gp/yourstore/*
// @include       http://mathoverflow.net/*
// @include       http://*.heise.de/*
// ==/UserScript==
//
// ==RevisionHistory==
// Version 0.1:
// Released: 2006-01-03.
// Initial release by Gina Trapani (public domain)
//
// Version 0.2:
// Released: 2009-11-06.
// Improved version by Konrad Voelkel (public domain)
// ==/RevisionHistory==



(function () {
	// EDIT THE NEXT LINE TO SET THE HOUR FOR WHICH YOUR SITES SHOULD APPEAR
	// HOURS IN 24h-FORMAT TIME, SO 15 = 3PM
	var surf_time_after = 20; // after this time, you can visit the blocked websites
	var surf_time_before = 8; // after this time, the websites specified above are blocked
	var message_begin = "Relaxing on the 'net is okay after";
	var message_end = "but right now, you should continue (or even start) working on something useful!";
	// END EDIT

	var readable_time = '';
	if (surf_time_after > 12 )
	{
		readable_time = surf_time_after - 12;
		readable_time = readable_time + 'PM';
	} else {
		readable_time = surf_time_after + 'AM';
	}

	var tstamp = new Date();

	if (tstamp.getHours() < surf_time_after && tstamp.getHours() > surf_time_before )
	{
		var b = (document.getElementsByTagName("body")[0]);
		b.setAttribute('style', 'display:none!important');
		alert(message_begin+" "+ readable_time + " "+message_end);
	}

})();

