previous behavior as default behavior until improved
This commit is contained in:
@@ -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 <a href=\"http://fabien.benetou.fr/CognitiveEnvironments/"
|
||||
+ task + "\">"
|
||||
document.body.innerHTML="You should be focusing on <a href=\""+cognitiveEnvironmentURL+task+"\">"
|
||||
+ task + "</a> instead,\nare you sure you need that information from that website?"
|
||||
+ "<br/>Note that you have already spent <span id='timespent'>"
|
||||
+ time_spent + "</span> seconds on that website so far!"
|
||||
+ "(which still is under the threshold of "+timeThreshold+" seconds)<hr/>"
|
||||
+ time_spent/60 + "</span> minute(s) on that website so far!<br/>"
|
||||
+ "(which still is under the threshold of "+timeThreshold/60+" minutes)<hr/>"
|
||||
+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 <a href=\"http://fabien.benetou.fr/CognitiveEnvironments/"
|
||||
+ task + "\">"
|
||||
document.body.innerHTML="You should be focusing on <a href=\""+cognitiveEnvironmentURL+task+"\">"
|
||||
+ task + "</a> instead,\nare you sure you need that information from that website?"
|
||||
+ "<br/>Note that you have already spent <span id='timespent'>"
|
||||
+ time_spent + "</span> seconds on that website so far!<br/>"
|
||||
+ "(which is above the allowed threshold of "+timeThreshold+" seconds)<hr/>";
|
||||
+ time_spent/60 + "</span> minute(s) on that website so far!<br/>"
|
||||
+ "(which is above the allowed threshold of "+timeThreshold/60+" minutes)<hr/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user