PageTimer

Summary: A draggable countdown timer. URL redirect on timer expiration.
Version: 20160726
Prerequisites: None
Maintainer: LSMeng
License: GPL3+
Categories: Security
Users: (view? / edit)
Discussion: PageTimer-Talk?

All sections are optional, you can remove those that do not apply to your recipe, and add new ones.

Description

Demo available at Jsfiddle:
https://jsfiddle.net/pofLh4ff/1/

This recipe adds a dynamic countdown timer which redirects to a designated URL on timer expiration.The URL to redirect defaults to the PmWiki logout page. The timer is written in a way such that computer sleep can also be taken into account; on resuming from computer sleep, the timer immediately updates the correct remaining time and redirects if necessary. The timer can be dragged and moved, and its position will be memorized.

Installation

  • Download pagetimer.zipΔ
  • Place pagetimer.php in your /cookbook/ directory, the /pagetimer/ dir with all files in your /pub/ directory.
  • Add to local/config.php this line:
    include_once("$FarmD/cookbook/pagetimer.php");

Configuration

The countdown timer expiration duration, the countdown timer expiration duration in the case the computer goes to sleep, the URL to redirect on timer expiration, and the timer font size can be configured.

Simply set these variables in config.php:

  • $PageTimerExpDuration = 600; //(default to 600 secons)
  • $PageTimerExpDurationSleep = 300; //(default to 300 seconds)
  • $PageTimerRedirectUrl = "$ScriptUrl?n=$pagename&action=logout"; //(default to the Pmwiki logout page)
  • $PageTimerFontSize = '14px'; //(default to 14 px)

Notes

I am an academic researcher who have been using Pmwiki as my private website for documenting research progress, and occasionally some personal and sensitive stuff. Sometimes I use my laptop in a public place; sometimes I share a computer with my colleagues. It would be nice to automatically lock my website in case I leave my seat for a while. I wanted a solution that works on the client side so that the page redirects to log out automatically, instead of being logged out by the next move on the server side, in which case other people might still be able to peek at the page that's left open. Also, I would like the countdown timer to take the computer standby time into account, which makes more sense to me. This recipe provides such a solution.

Change log / Release notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

  • 20160726 - first release.

Contributors

  • Recipe written and maintained by LSMeng.

See also

Comments

See discussion at PageTimer-Talk?.

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.