magpie-ea / magpie-modules

the reusable front-end bits in the _magpie modules
MIT License
7 stars 1 forks source link

Document inactivity tracker | timer #28

Open x-ji opened 5 years ago

x-ji commented 5 years ago

e.g. Tell the user up front that the experiment will be terminated if they remain inactive for 10 minutes

Exmaple: https://stackoverflow.com/questions/667555/how-to-detect-idle-time-in-javascript-elegantly

JannisBush commented 5 years ago

I implemented a simple and flexible inactivity tracker here.

It should be backwards compatible. To add the timer with defaults, include timer: {} in babeInit in main.js (and use the new babe.full.js and babe.css-files from the development branch. )

Here, is an example showing all default values:

babeInit({
    ...
        timer: {
            // Defaults:
            // minutes: 10, // How many minutes the timer should run
            // show_info_time: 0.2, // Percentage of time left, after which the user gets informed
            // snack_text: "Still here?", // Text on the information bar
            // show_info_time_time: true, // Also show the remaining time on the bar
            // new_title: "Still here?", // New page title that is flashed
            // end_function: function() {location.reload(true)} // Function that is invoked after timeout (page refresh)
        },
   ...
});

After the timer is finished, the page will be refreshed, i.e. the experiment will be terminated. (This function can be changed, e.g. to also save same intermediary results, etc.) When 80% (configurable) of the time is over, the user gets informed by a snackbar on the page and a flashing page title, he can then interact with the experiment to reset the timer.

Would this fulfill our needs or do we need additional features?

What is currently not included, but could be useful:

michael-franke commented 5 years ago

Thanks Jannis, this looks good.

On 22. Mar 2019, at 23:43, JannisBush notifications@github.com wrote:

I implemented a simple and flexible inactivity tracker here.

It should be backwards compatible. To add the timer with defaults, include timer: {} in babeInit in main.js (and use the new babe.full.js and babe.css-files from the development branch. )

Here, is an example showing all default values:

babeInit({ ... timer: { // Defaults: // minutes: 10, // How many minutes the timer should run // show_info_time: 0.2, // Percentage of time left, after which the user gets informed // snack_text: "Still here?", // Text on the information bar // show_info_time_time: true, // Also show the remaining time on the bar // new_title: "Still here?", // New page title that is flashed // end_function: function() {location.reload(true)} // Function that is invoked after timeout (page refresh) }, ... });

After the timer is finished, the page will be refreshed, i.e. the experiment will be terminated. (This function can be changed, e.g. to also save same intermediary results, etc.) When 80% (configurable) of the time is over, the user gets informed by a snackbar on the page and a flashing page title, he can then interact with the experiment to reset the timer.

Would this fulfill our needs or do we need additional features?

What is currently not included, but could be useful:

• Telling the user upfront, that the experiment gets terminated after X minutes. (Could be done by the experiment programmer in the intro view, alternatively we can add something here or we don't tell the user) • Only run the timer on some views (similar to the progress bar), e.g. possibility to exclude the introduction views (before the experiment starts), the questionnaire ,"break" views. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.