• This repository has been archived on 09/Nov/2017
  • Stars
    star
    1,391
  • Rank 33,781 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 16 years ago
  • Updated almost 9 years ago

Reviews

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

Repository Details

πŸ’€ An ancient tiny JS and CSS loader from the days before everyone had written one. Unmaintained.

LazyLoad

Note: LazyLoad is no longer being maintained. I'm not responding to issues or pull requests, since I don't use this project anymore and don't have time to work on it. Please feel free to fork it if you want to continue development on it.

LazyLoad is a tiny (only 966 bytes minified and gzipped), dependency-free JavaScript utility that makes it super easy to load external JavaScript and CSS files on demand.

Whenever possible, LazyLoad will automatically load resources in parallel while ensuring execution order when you specify an array of URLs to load. In browsers that don't preserve the execution order of asynchronously-loaded scripts, LazyLoad will safely load the scripts sequentially.

Use LazyLoad when you need a small, fast, safe dynamic JS or CSS loader, but don't need the overhead of dependency management or other extra functionality that larger script loaders provide.

Downloads

Usage

Using LazyLoad is simple. Just call the appropriate method -- css() to load CSS, js() to load JavaScript -- and pass in a URL or array of URLs to load. You can also provide a callback function if you'd like to be notified when the resources have finished loading, as well as an argument to pass to the callback and a context in which to execute the callback.

// Load a single JavaScript file and execute a callback when it finishes.
LazyLoad.js('http://example.com/foo.js', function () {
  alert('foo.js has been loaded');
});

// Load multiple JS files and execute a callback when they've all finished.
LazyLoad.js(['foo.js', 'bar.js', 'baz.js'], function () {
  alert('all files have been loaded');
});

// Load a CSS file and pass an argument to the callback function.
LazyLoad.css('foo.css', function (arg) {
  alert(arg);
}, 'foo.css has been loaded');

// Load a CSS file and execute the callback in a different scope.
LazyLoad.css('foo.css', function () {
  alert(this.foo); // displays 'bar'
}, null, {foo: 'bar'});

Supported Browsers

  • Firefox 2+
  • Google Chrome
  • Internet Explorer 6+
  • Opera 9+
  • Safari 3+
  • Mobile Safari
  • Android

Other browsers may work, but haven't been tested. It's a safe bet that anything based on a recent version of Gecko or WebKit will probably work.

Caveats

All browsers support parallel loading of CSS. However, only Firefox and Opera currently support parallel script loading while preserving execution order. To ensure that scripts are always executed in the correct order, LazyLoad will load all scripts sequentially in browsers other than Firefox and Opera. Hopefully other browsers will improve their parallel script loading behavior soon.

License

Copyright (c) 2011 Ryan Grove ([email protected]). All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

rawgit

Served files from raw.githubusercontent.com, but with the correct content types. No longer actively developed.
JavaScript
2,390
star
2

sanitize

Ruby HTML and CSS sanitizer.
HTML
2,020
star
3

larch

πŸ’€ Larch copies messages from one IMAP server to another. No longer maintained.
Ruby
616
star
4

jsmin-php

πŸ’€ PHP port of Douglas Crockford's JSMin JavaScript minifier. No longer maintained.
PHP
423
star
5

parse-xml

A fast, safe, compliant XML parser for Node.js and browsers.
JavaScript
259
star
6

crass

A Ruby CSS parser that's fully compliant with the CSS Syntax Level 3 specification.
Ruby
139
star
7

combohandler

A simple Yahoo!-style combo handler in Node.js.
JavaScript
116
star
8

node-elastical

πŸ’€ Elastical has moved to https://github.com/ramv/node-elastical and this repo is no longer maintained. Please update your bookmarks!
JavaScript
101
star
9

thoth

πŸ’€ An unmaintained and probably broken Ruby blog engine.
Ruby
67
star
10

emergencykitten

Sometimes you just need a kitten.
JavaScript
66
star
11

jsmin

πŸ’€ Ruby library for minifying JavaScript. Based on Douglas Crockford's jsmin.c. Unmaintained.
JavaScript
51
star
12

textual-sulaco

Sulaco, a style for the Textual IRC client
HTML
44
star
13

synchrotron

Watches a local directory and syncs files to another directory or a remote destination using rsync whenever changes occur.
JavaScript
40
star
14

cssmin

πŸ’€ Ruby library for minifying CSS. Unmaintained.
Ruby
38
star
15

selleck

πŸ’€ Now maintained at https://github.com/yui/selleck
JavaScript
38
star
16

storage-lite

πŸ’€ Lightweight YUI 3 API for persistent cross-browser key/value storage similar to the HTML5 localStorage API. Unmaintained.
JavaScript
29
star
17

pie.gd

Config files, scripts, and documentation for the pie.gd Mastodon instance.
Dockerfile
23
star
18

lectroid

πŸ’€ A really boring blog engine. Unmaintained.
JavaScript
17
star
19

cachetest

πŸ’€ A Sinatra app for testing browser cache characteristics. Unmaintained.
Ruby
16
star
20

trogdor

πŸ’€ A fast, simple search-as-you-type implementation in JavaScript using the Yahoo! Search BOSS API. Unmaintained.
JavaScript
16
star
21

jslib-stats

πŸ’€ Node.js-based crawler that gathers JavaScript library usage stats by executing and inspecting JS. Unmaintained.
JavaScript
12
star
22

vim-yui3

πŸ’€ Vim syntax for YUI3. Unmaintained.
JavaScript
11
star
23

yuitweets

πŸ’€ A Bayesian tweet classifier that can learn the difference between tweets about the YUI Library and tweets about J-pop idols named Yui. Unmaintained.
Ruby
10
star
24

node-tokeninput

πŸ’€ YUI 3 Node plugin that turns a text input field into a tokenized input field similar to Cocoa's NSTokenField control. Unmaintained.
JavaScript
6
star
25

javascript-yui3.tmbundle

πŸ’€ TextMate bundle for YUI 3. Unmaintained.
JavaScript
6
star
26

denyssh

πŸ’€ Blocks SSH brute force attacks using PF. Unmaintained.
Ruby
5
star
27

tweetslurp

πŸ’€ Backs up tweets to a JSON file. Unmaintained.
JavaScript
4
star
28

jshint

πŸ’€ The Kinder, Gentler JavaScript Code Quality Tool
JavaScript
3
star
29

crackup

πŸ’€ Crappy remote backup. Unmaintained.
Ruby
3
star
30

sanitize-web

A super simple web interface to Sanitize, mostly for testing purposes.
HTML
3
star
31

sandbox

πŸ’€ YUI 3 module that simplifies the process of creating isolated iframe sandboxes in which to evaluate JavaScript code for tasks like profiling or unit testing. Unmaintained.
JavaScript
2
star
32

jetpants

πŸ’€
JavaScript
2
star
33

weld

πŸ’€ Combines and minifies CSS and JavaScript files at runtime and build time. Unmaintained.
Ruby
2
star
34

sniffle

πŸ’€ CLI app that learns and identifies user agent strings using a Redis-backed naive Bayes classifier. Just a silly experiment. Unmaintained.
JavaScript
2
star
35

denyspam

πŸ’€ Monitors a mail server log file and uses a firewall to temporarily block or redirect incoming packets from hosts that display spammer-like behavior. Unmaintained.
1
star
36

parse-xml-benchmark

Benchmarks for @rgrove/parse-xml
JavaScript
1
star