Skip to content

Instantly share code, notes, and snippets.

@tetsuharuohzeki
Created March 2, 2010 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tetsuharuohzeki/319600 to your computer and use it in GitHub Desktop.
Save tetsuharuohzeki/319600 to your computer and use it in GitHub Desktop.
0時を過ぎると「もう寝ろよ」と優しくabout:blankに書き出してくれるUserScript
// ==UserScript==
// @name Do Sleep
// @namespace http://gist.github.com/saneyuki
// @include about:blank
// @developper saneyuki
// ==/UserScript==
(function(){
var sleep = 0;
var wakeup = 5;
var now = (new Date()).getHours();
if (sleep <= now && now < wakeup) {
var neroyo = document.createTextNode("もう寝ろよ");
var wrapNeroyo = document.createElement("div");
wrapNeroyo.appendChild(neroyo);
// Text style
wrapNeroyo.style.fontWeight = "bold";
wrapNeroyo.style.fontSize = "5em";
// box style
wrapNeroyo.style.height = "1em";
wrapNeroyo.style.width = "5em";
wrapNeroyo.style.position = "absolute";
wrapNeroyo.style.top = "50%";
wrapNeroyo.style.left = "50%";
wrapNeroyo.style.marginTop = "-0.5em";
wrapNeroyo.style.marginLeft = "-2.5em";
document.getElementsByTagName("body")[0].appendChild(wrapNeroyo);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment