Skip to content

Instantly share code, notes, and snippets.

@undergroundmonorail
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save undergroundmonorail/8afd27c91930a92b3db5 to your computer and use it in GitHub Desktop.
Save undergroundmonorail/8afd27c91930a92b3db5 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name TagPro Cursor Hider
// @namespace http://www.reddit.com/u/undergroundmonorail
// @description Hides the cursor after a specified amount of time with no movement
// @include http://tagpro-*.koalabeast.com:*
// @include http://tangent.jukejuice.com:*
// @include http://maptest.newcompte.fr:*
// @include http://justletme.be:*
// @license WTFPL; http://www.wtfpl.net/txt/copying/
// @author monorail
// @version 0.2
// ==/UserScript==
// The number of milliseconds your mouse has to be idle before it is hidden
// Default: 500
var WAIT_TIME = 500;
// The number of milliseconds between each time the script checks if you are idle
// (This can probably stay at the default honestly)
// Default: 100
var CHECK_FREQ = 100;
(function() {
var lastmove;
window.onmousemove = handleMouseMove;
function handleMouseMove(event) {
lastmove = +new Date();
document.body.style.cursor = 'auto';
}
setInterval(function() {
if (+new Date() - lastmove >= WAIT_TIME) {
document.body.style.cursor = 'none';
}
}, CHECK_FREQ);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment