Giter Site home page Giter Site logo

jquery-idle-hands's Introduction

Idle Hands

A jQuery plugin for managing user inactivity timeoutes across browsers windows.

Requirements

  • jQuery - Idle Hands uses the jQuery library to more easily interact with the DOM and make ajax calls.
  • Basil.js - Idle Hands uses Basil.js as a localStorage wrapper to more easily persist data across browser windows and tabs.

Usage

<script>
    $(function () {
        $.idleHands()
    });
</script>

With Custom Settings

<script>
    $(function () {
        $.idleHands({
            applicationId: 'my_application',
            heartRate: 5,
            inactivityDialogDuration: 10,
            inactivityLogoutUrl: 'https://www.google.com',
            maxInactivitySeconds: 15
        });
    });
</script>

Settings

Name Default Value Description
activityEvents 'click keypress scroll wheel mousewheel mousemove' This is a string of DOM event types which count as user activity.
applicationId 'idle-hands' This is a unique identifier used to namespace local storage and HTML classes/IDs. It should be changed to something unique to your application.
dialogMessage 'Your session is about to expire due to inactivity.' This is the message that appears inside of the inactivity dialog above the timer.
dialogTimeRemainingLabel 'Time remaining' This is the message that appears in the inactivity dialog before the number of seconds remaining.
dialogTitle 'Session Expiration Warning' This is the message that appears at the very top of the inactivity dialog.
heartbeatUrl window.location.href This is the "keep-alive" URL. Idle Hands will make an AJAX request to this URL once every heartRage number of seconds. This can be used to prevent your application session from expiring before the inactivity timer finishes counting down.
heartRate 300 This is how often Idle Hands will make an AJAX request to heartbeatUrl.
inactivityLogoutUrl 'https://www.google.com' This is the URL that users will be redirected to if the inactivity dialog timer reaches 0 seconds.
inactivityDialogDuration 45 This is how before a user is logged out that the inactivity dialog will display for.
localStoragePrefix null Keys in key/value pairs saved in the browser are prefixed with this value to help prevent conflicts with other applications storing data in the browser. When left null, this defaults to applicationId.
logoutNowButtonText 'Logout Now' This is the text that will display on the logout button in the inactivity dialog.
manualLogoutUrl null This is the URL that users will be redirected to if they click the logout button on the inactivity dialog. When left null, this will default to inactivityLogoutUrl.
maxInactivitySeconds 60 This is the number of seconds a user can remain inactive before they are automatically redirected to inactivityLogoutUrl.
stayLoggedInButtonText 'Stay Logged In' This is the text that will display on the reset button in the inactivity dialog.

jquery-idle-hands's People

Contributors

totallyquiche avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.