• Stars
    star
    181
  • Rank 212,110 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 14 years ago
  • Updated over 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tiny JavaScript snippet to make links snappy on touch devices

Work in progress!

Energize is a work in progress, but it's functional. Bug reports, pull requests, etc, highlighly appreciated as always!

How do I use it?

Just include energize.js before any of your code that deals with click events (including any libraries and frameworks). The reason is that energize.js fires simulated click events and also needs to suppress the "ghost click", the real click event that is fired later. This is done via stopPropagation, which stops the the event from firing for other handlers listening for the click event. Since handlers fire in the order they were added, energize.js needs to add its own click handler first.

Why use energize?

Touch devices sometimes add an artificial delay to click events, just to make sure the user isn't double-tapping to zoom. In the case where you don't mind disabling double-tap to zoom functionality (or in cases where you've disabled viewport zooming), there's no reason to preserve the click delay. That's where energize.js comes in!

Why not just bind to ontouchend?

Because the user might touch an element in order to scroll, which results in ontouchend firing at the end of the scroll event. Do you want a click event to fire when the user was intending to scroll?

Why fire simulated click events? Why not just tie into something like Fast Button?

Because you have to add click events to EVERYTHING you want to speed up. This will mean there will be potentially be some fast UI and some slow UI on your pages. Ok, that's not so bad if you're using some form of abstraction for all click events (i.e. not using addEventListener directly).

BUT interaction with native form elements such as buttons aren't sped up unless you manually add events to them. Because of this, Energize takes the philosophy of listening for clicks bubbling up to the top and handles them appropriately so you don't have to worry about them.

More Repositories

1

jstoxml

JavaScript object to XML converter (useful for RSS, podcasts, GPX, AMP, etc)
JavaScript
168
star
2

touche

Touché: bringing touch events to non-touch browsers (how touching!). No dependencies. No code bloat.
JavaScript
144
star
3

tle.js

🛰️ Satellite TLE tools in JavaScript: get lat/lon of satellites, get look angles, plot orbit lines, extract individual TLE elements, etc
JavaScript
127
star
4

eslint-plugin-test-selectors

Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.
JavaScript
27
star
5

jsconf-2014

JSConf 2014 talk: Realtime Satellite Tracking in the Browser
JavaScript
21
star
6

mobile-console

Debug console bookmarklet for mobile devices. Overrides console.log, replacing it with an on-screen console that appears at the bottom of the window. mobile-console also logs all messages to a remote server, which can write the messages to a log or display them on a desktop browser.
7
star
7

transcoder

A simple utility for web developers to convert to base64, hex, binary, md5, etc, as well as useful tools such as a CSS minifier, jsMin, Closure Compiler (coming soon), and a JavaScript-based QR code generator. With desktop drag and drop capability!
PHP
6
star
8

negative-scroll-blur

Make stuff blurry when there's negative top scroll
JavaScript
5
star
9

trackthatsatellite.com

100% clientside satellite tracker
JavaScript
5
star
10

normalize-mobile.css

Normalize.css for mobile minus desktop fixes (also minus IE star/underscore hacks)
5
star
11

gps-time.js

Small utility to convert times between GPS epoch (midnight January 6, 1980) and Unix epoch (midnight January 1, 1970), taking into account leap seconds.
JavaScript
5
star
12

s5mod

Modification and updates to the s5 presentation platform
JavaScript
3
star
13

jest-bug-test-file-stub

JavaScript
3
star
14

link-aggregator

Pulls together topical links from a variety of sources, ranking them by popularity
JavaScript
3
star
15

react-hover-slideshow

Iterates through an image slideshow based on cursor/touch position.
JavaScript
3
star
16

covid-19-map-south-carolina

Interactive map of COVID-19 cases by zip code in South Carolina
JavaScript
2
star
17

simple-cors-server

Simple HTTP server with CORS enabled (similar to Python's SimpleHTTPServer)
JavaScript
2
star
18

deep-object-assign-with-reduce

Deep merging of objects with the same function signature as Object.assign() (useful for overriding default options objects)
JavaScript
2
star
19

frontendstuff

frontendstuff.com
JavaScript
2
star
20

Leveler

Brings older JavaScript implementation up to the level by providing new methods (string trim, Date.now, etc.)
JavaScript
1
star
21

covid-19-data-south-carolina

JavaScript
1
star
22

little-time

Minimalist timestamp manipulator and formatter inspired by moment.js
JavaScript
1
star
23

flickryql

Flickr + YQL
1
star
24

page-curl

Flipboard-style page curl effects
1
star
25

sudoku

Simple sudoku solver in JavaScript (just for fun!)
JavaScript
1
star
26

react-hook-visible-satellites

React hook that returns satellites currently visible in the sky overhead.
JavaScript
1
star
27

parse-scraped-times

Helper for managing the insane variations in writing times in HTML. Needed for getting published/updated times of articles and websites in general.
JavaScript
1
star
28

cbsi-tech-talks

CBSi Tech Talks stuff - notes, etc
1
star
29

gallery-flickr

Useful Flickr widget for YUI3
JavaScript
1
star
30

writers-friend

Distraction-free simple writing experience for the local browser (no network calls)
JavaScript
1
star