npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery.html5loader

v1.8.0

Published

jQuery.html5Loader can preload <b>images</b>, html5 <b>video</b> and <b>audio</b> sources, <b>css</b>, <b>scripts</b> and <b>text</b> files. This plugin needs a <b>JSON</b> file to get the files that must be preloaded (you can use also use a javascript o

Downloads

3

Readme

Introduction

jQuery.html5Loader can preload images, SVGs, html5 video and audio sources, css, scripts and text files. This plugin needs a JSON file to get the files that must be preloaded (you can use also use a javascript object as well), and it provides an easy API to give you the right amount of files loaded in percentage.

All the javascript and css files will be automatically loaded and injected into the DOM

Installation


$ bower install jquery.html5loader

Features

  • smart: it loads just the sources supported by the client running the script.
  • flexible: it returns the current percentage and the object/element loaded, so you could be free to show this info as you prefer
  • fun: inside the package you could find some preloading animation examples, customizable and ready to use

Demos

Production websites using jQuery.html5loader

  • http://www.mobi-myhome.ch
  • http://lindberghallee.ch

USAGE

1 Create a JSON file like this, containing all the files you need to preload ( size in bytes ):

2 Import the plugin into your page:

3 Initialize the plugin setting the callback functions:

API

Methods

  • stopExecution: default false, do not execute the javascript files when they'll be preloaded, this option could be overridden into the json per each javascript file
  • mediaBufferSizeToPreload: default 0.2, decide the the buffer size before considering the media preloaded
  • forceMediaPreload: default true, let the browser decide when the media file has been buffered enough to be played by listening the canplaythrough event
  • onBeforeLoad It is triggered right before the plugin starts loading all the files
  • onComplete It is triggered when the plugin finishes to load all the sources
  • onMediaError This function is called in case there's an error during the preloading
    • obj original object passed to the plugin
    • elm html output (for type "SCRIPT" and "TEXT" this value is just a string)
  • stopExecution (false by default) : default behavior for all the script files, they won't execute when loaded. This behavior can be changed by each script object passed to the plugin
  • onElementLoaded It is triggered anytime a new element of your files list gets loaded, (ATTENTION IF AN ELEMENT IS NOT SUPPORTED IT WILL NEVER PASS TROUGH THIS FUNCTION).
    • obj original object passed to the plugin
    • elm html output (for type "SCRIPT" and "TEXT" this value is just a string)
  • onUpdate it is triggered anytime new bytes are loaded
    • percentage the percentage currently loaded

Loading Segments

It is also possible to load groups of files in sequence by wrapping them in arrays. This could be handy if you need need to preload components with dependencies. e.g Backbone's dependence on underscore.

Loading SVGs

You can also load SVG files providing a fallback image. jQuery.html5Loader will detect automatically if the device supports the SVGs otherwise it will just preload the fallback image.

KNOWN ISSUES

  • Internet Explorer 9 and 10 do not return any value using the method canPlayType on a video or audio element ( http://modernizr.com/docs/#audio ). For these browsers we don't preload any HTML5 media format
  • on mobile devices and on the iPad we cannot load any video or audio element because these devices can't preload those kind of elements until the user start dealing with them

TODO List

  • Write down a valid crossbrowser unit test

CHANGELOG

v1.8.0

  • added: SVGs preloading support
  • added: segments preloading
  • updated: the nprogress example

v1.7.0

  • added: better tablet detection tests
  • added: grunt
  • bugfix: skip media elements loading on mobile/tablet devices

v1.6.9

  • added: mediaBufferSizeToPreload option
  • added: forceMediaPreload option

v1.6.8

  • small refactor
  • added: new media file codecs tests
  • video: vp9
  • audio: opus, wav, m4a
  • added: stopExecution option
  • added: stopExecution option via json
  • added: nprogress demo