diff --git a/greasemonkey/virtualblinders.user.js b/greasemonkey/virtualblinders.user.js index ebd5c4c..fe40b45 100644 --- a/greasemonkey/virtualblinders.user.js +++ b/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 ## 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 +# 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. @@ -23,6 +26,7 @@ Note that it does work even when Flash has focus. var t; var MODE="video"; var time_spent = GM_getValue(MODE,0); +var cognitiveEnvironmentURL = "http://fabien.benetou.fr/CognitiveEnvironments/"; GM_xmlhttpRequest({ method: "GET", @@ -34,19 +38,18 @@ GM_xmlhttpRequest({ }); function responseCheck(task) { - task = 'Reading\n'; + //task = 'Reading\n'; timeThreshold = 600; aboveThreshold = ( timeThreshold < time_spent ); - aboveThreshold = false; + aboveThreshold = true; //kept until actived to maintain previous behavior if (task == 'Reading\n' || task == 'Programming\n'){ if ( !aboveThreshold ) { //under threshold, just display a warning and the content - document.body.innerHTML="You should be focusing on " + document.body.innerHTML="You should be focusing on " + task + " instead,\nare you sure you need that information from that website?" + "
Note that you have already spent " - + time_spent + " seconds on that website so far!" - + "(which still is under the threshold of "+timeThreshold+" seconds)
" + + time_spent/60 + " minute(s) on that website so far!
" + + "(which still is under the threshold of "+timeThreshold/60+" minutes)
" +document.body.innerHTML; t=window.setInterval(mytimer,1000); //regarding the specific syntax @@ -57,12 +60,11 @@ function responseCheck(task) { window.addEventListener("unload", setTotalTimeSpent, true); } else { //above threshold, only display the warning without the content - document.body.innerHTML="You should be focusing on " + document.body.innerHTML="You should be focusing on " + task + " instead,\nare you sure you need that information from that website?" + "
Note that you have already spent " - + time_spent + " seconds on that website so far!
" - + "(which is above the allowed threshold of "+timeThreshold+" seconds)
"; + + time_spent/60 + " minute(s) on that website so far!
" + + "(which is above the allowed threshold of "+timeThreshold/60+" minutes)
"; } } }