GithubHelp home page GithubHelp logo

isabella232 / counter-with-stopwatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from surveycto/counter-with-stopwatch

0.0 0.0 0.0 508 KB

Count the number of times something happens, and also track how long the whole event takes.

License: Apache License 2.0

JavaScript 28.35% CSS 10.37% HTML 61.28%

counter-with-stopwatch's Introduction

Counter with stopwatch

Description

Use this field plug-in to add a stopwatch and a counter to your field. The stopwatch can display the elapsed time in seconds, deciseconds, centiseconds, and milliseconds. The counter can keep track of the number of occurrences of something. You can reset the current value of either the stopwatch, or the counter, or both.

This field plug-in also inherits functionality from the baseline-text field plug-in.

Download now

Features

  • Stopwatch for keeping track of time passed
  • Button to start and pause stopwatch as needed
  • Button to increase counter value, and button to decrease value (cannot go below 0)
  • Button to reset stopwatch
  • Button to reset counter
  • Warning when about to reset the counter or stopwatch
  • Customization of unit for stopwatch

Data format

Both the count and the time passed are stored in a space-separated list:

[count] [time (in ms)]

For example, if the count is set to 3, and the stopwatch is stopped at 10,364 milliseconds, the field will have this value:

3 10364

The time is always saved in milliseconds, even if the display is set to another unit. You can use the selected-at() function in order to get each individual value. For example, if the field is called "stopwatch1", you can use this expression to get the counter value:

selected-at(${stopwatch1}, 0)

The field value is re-stored whenever the stopwatch time or counter value has changed. The enumerator/respondent can come back and continue where they left off with the same amount of time passed and the same count value. For example, if the enumerator leaves the field with 5 seconds passed, even while the stopwatch is still running, when they return, the stopwatch will still say 5 seconds have passed.

How to use

Getting started

To use this field plug-in as-is:

  1. Download the sample form from this repo and upload it to your SurveyCTO server.
  2. Download the counterwithstopwatch.fieldplugin.zip file from this repo, and attach it to the sample form on your SurveyCTO server.
  3. Adjust the parameter if you would like to use a different unit (see below).

Parameters

Key Value Default
time-unit (optional) This is the unit of time measurement that will be displayed. s

You can use the following display units:

Abbr. Full name Unit in 1 second
s seconds 1
ds deciseconds 10
cs centiseconds 100
ms milliseconds 1000

If no parameters are supplied, seconds will be shown by default. Make sure the unit is in single quotes, like this:

custom-counter-with-stopwatch(time-unit='cs')

Default SurveyCTO feature support

Feature / Property Support
Supported field type(s) text
Default values Yes
Custom constraint message No
Custom required message No
Read only No
media:image Yes
media:audio Yes
media:video Yes
number appearance No
numbers_decimal appearance No
numbers_phone appearance No
show_formatted appearance No

More resources

counter-with-stopwatch's People

Contributors

amrikcooper avatar cking0987 avatar theomnimax 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.