previous behavior as default behavior until improved

master
Fabien Benetou 14 years ago
parent 205ca9cd6b
commit 9dbcfa0588
  1. 22
      greasemonkey/virtualblinders.user.js

@ -15,6 +15,9 @@
# make timers (default to 0 sec, value defined via the script or a GM_Value) to be more flexible # make timers (default to 0 sec, value defined via the script or a GM_Value) to be more flexible
## reset timer either manually or per day (i.e.) reset if last set date <5AM ## reset timer either manually or per day (i.e.) reset if last set date <5AM
## set 2 thresholds, the first as a warning, the second as an action ## set 2 thresholds, the first as a warning, the second as an action
# allow to check the timer while the page is loaded
## else one could just arrive before the threshold and pass it unknowingly
### e.g. not with Wikipedia but with YouTube
Note that it does work even when Flash has focus. Note that it does work even when Flash has focus.
@ -23,6 +26,7 @@ Note that it does work even when Flash has focus.
var t; var t;
var MODE="video"; var MODE="video";
var time_spent = GM_getValue(MODE,0); var time_spent = GM_getValue(MODE,0);
var cognitiveEnvironmentURL = "http://fabien.benetou.fr/CognitiveEnvironments/";
GM_xmlhttpRequest({ GM_xmlhttpRequest({
method: "GET", method: "GET",
@ -34,19 +38,18 @@ GM_xmlhttpRequest({
}); });
function responseCheck(task) { function responseCheck(task) {
task = 'Reading\n'; //task = 'Reading\n';
timeThreshold = 600; timeThreshold = 600;
aboveThreshold = ( timeThreshold < time_spent ); aboveThreshold = ( timeThreshold < time_spent );
aboveThreshold = false; aboveThreshold = true; //kept until actived to maintain previous behavior
if (task == 'Reading\n' || task == 'Programming\n'){ if (task == 'Reading\n' || task == 'Programming\n'){
if ( !aboveThreshold ) { if ( !aboveThreshold ) {
//under threshold, just display a warning and the content //under threshold, just display a warning and the content
document.body.innerHTML="You should be focusing on <a href=\"http://fabien.benetou.fr/CognitiveEnvironments/" document.body.innerHTML="You should be focusing on <a href=\""+cognitiveEnvironmentURL+task+"\">"
+ task + "\">"
+ task + "</a> instead,\nare you sure you need that information from that website?" + task + "</a> instead,\nare you sure you need that information from that website?"
+ "<br/>Note that you have already spent <span id='timespent'>" + "<br/>Note that you have already spent <span id='timespent'>"
+ time_spent + "</span> seconds on that website so far!" + time_spent/60 + "</span> minute(s) on that website so far!<br/>"
+ "(which still is under the threshold of "+timeThreshold+" seconds)<hr/>" + "(which still is under the threshold of "+timeThreshold/60+" minutes)<hr/>"
+document.body.innerHTML; +document.body.innerHTML;
t=window.setInterval(mytimer,1000); t=window.setInterval(mytimer,1000);
//regarding the specific syntax //regarding the specific syntax
@ -57,12 +60,11 @@ function responseCheck(task) {
window.addEventListener("unload", setTotalTimeSpent, true); window.addEventListener("unload", setTotalTimeSpent, true);
} else { } else {
//above threshold, only display the warning without the content //above threshold, only display the warning without the content
document.body.innerHTML="You should be focusing on <a href=\"http://fabien.benetou.fr/CognitiveEnvironments/" document.body.innerHTML="You should be focusing on <a href=\""+cognitiveEnvironmentURL+task+"\">"
+ task + "\">"
+ task + "</a> instead,\nare you sure you need that information from that website?" + task + "</a> instead,\nare you sure you need that information from that website?"
+ "<br/>Note that you have already spent <span id='timespent'>" + "<br/>Note that you have already spent <span id='timespent'>"
+ time_spent + "</span> seconds on that website so far!<br/>" + time_spent/60 + "</span> minute(s) on that website so far!<br/>"
+ "(which is above the allowed threshold of "+timeThreshold+" seconds)<hr/>"; + "(which is above the allowed threshold of "+timeThreshold/60+" minutes)<hr/>";
} }
} }
} }

Loading…
Cancel
Save