-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backlog
- Loading branch information
Showing
4 changed files
with
38 additions
and
26 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# No Distractions Full Screen | ||
# v2.3 2/9/2020 | ||
# v2.3.2 2/10/2020 | ||
# Copyright (c) 2020 Quip13 ([email protected]) | ||
# | ||
# MIT License | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
//No Distractions Full Screen v2.3 | ||
//No Distractions Full Screen v2.3.2 | ||
//var cursorIdleTimer = 5000; //Defined in python | ||
|
||
var cursorHidden = false; | ||
|
||
function hide_mouse() { | ||
pycmd("cursor_hide"); | ||
console.log("cursor_hide"); | ||
//$('*').css({cursor: 'none'}); | ||
cursorHidden = true; | ||
} | ||
|
||
function show_mouse() { | ||
pycmd("cursor_show"); | ||
console.log("cursor_show"); | ||
//$('*').css({cursor: 'default'}); | ||
cursorHidden = false; | ||
} | ||
|
||
$(function hide_cursor() { | ||
if (cursorIdleTimer >= 0){ | ||
var cursorHidden = false; | ||
var timer = setTimeout(function () { | ||
//$('*').css({cursor: 'none'}); | ||
pycmd("cursor_hide"); | ||
console.log("cursor_hide"); | ||
cursorHidden = true; | ||
}, cursorIdleTimer); | ||
$(document).mousemove(function () { | ||
clearTimeout(timer); | ||
timer = setTimeout(function () { | ||
//$('*').css({cursor: 'none'}); | ||
pycmd("cursor_hide"); | ||
console.log("cursor_hide"); | ||
cursorHidden = true; | ||
}, cursorIdleTimer); | ||
if (cursorIdleTimer >= 0) { | ||
var currentTime = Date.now(); | ||
var lastTime = currentTime; | ||
var timer = setTimeout(function(){hide_mouse();}, cursorIdleTimer); | ||
|
||
pycmd("cursor_show"); | ||
console.log("cursor_show"); | ||
cursorHidden = false; | ||
return | ||
}); | ||
} | ||
}); | ||
$(document).mousemove(function() { | ||
currentTime = Date.now(); | ||
if (cursorHidden){ | ||
show_mouse(); | ||
} else if (currentTime - lastTime > 500) { | ||
show_mouse(); | ||
clearTimeout(timer); | ||
timer = setTimeout(function(){hide_mouse();}, cursorIdleTimer); | ||
lastTime = currentTime; | ||
} | ||
//console.log("skip"); | ||
}); | ||
} | ||
}); |