parent
e074abcbad
commit
13c35fcc9a
@ -0,0 +1,38 @@ |
||||
{ |
||||
"name": "ev-emitter", |
||||
"main": "ev-emitter.js", |
||||
"homepage": "https://github.com/metafizzy/ev-emitter", |
||||
"authors": [ |
||||
"David DeSandro <desandrocodes@gmail.com>" |
||||
], |
||||
"description": "lil' event emitter", |
||||
"moduleType": [ |
||||
"amd", |
||||
"globals", |
||||
"node" |
||||
], |
||||
"keywords": [ |
||||
"event", |
||||
"emitter", |
||||
"pubsub" |
||||
], |
||||
"license": "MIT", |
||||
"ignore": [ |
||||
"**/.*", |
||||
"node_modules", |
||||
"bower_components", |
||||
"test", |
||||
"tests", |
||||
"sandbox" |
||||
], |
||||
"version": "1.0.3", |
||||
"_release": "1.0.3", |
||||
"_resolution": { |
||||
"type": "version", |
||||
"tag": "v1.0.3", |
||||
"commit": "049cc4a5f5a61642f7333f352b1ef1530636f697" |
||||
}, |
||||
"_source": "https://github.com/metafizzy/ev-emitter.git", |
||||
"_target": "~1.0.0", |
||||
"_originalSource": "ev-emitter" |
||||
} |
@ -0,0 +1,101 @@ |
||||
# EvEmitter |
||||
|
||||
_Lil' event emitter_ — add a little pub/sub |
||||
|
||||
EvEmitter adds publish/subscribe pattern to a browser class. It's a smaller version of [Olical/EventEmitter](https://github.com/Olical/EventEmitter). That EventEmitter is full featured, widely used, and great. This EvEmitter has just the base event functionality to power the event API in libraries like [Isotope](http://isotope.metafizzy.co), [Flickity](http://flickity.metafizzy.co), [Masonry](http://masonry.desandro.com), and [imagesLoaded](http://imagesloaded.desandro.com). |
||||
|
||||
## API |
||||
|
||||
``` js |
||||
// Inherit prototype, IE8+ |
||||
MyClass.prototype = new EvEmitter(); |
||||
|
||||
// Inherit prototype, IE9+ |
||||
MyClass.prototype = Object.create( EvEmitter.prototype ); |
||||
|
||||
// Mixin prototype |
||||
_.extend( MyClass.prototype, EvEmitter.prototype ); |
||||
|
||||
// single instance |
||||
var emitter = new EventEmitter(); |
||||
``` |
||||
|
||||
### on |
||||
|
||||
Add an event listener. |
||||
|
||||
``` js |
||||
emitter.on( eventName, listener ) |
||||
``` |
||||
|
||||
+ `eventName` - _String_ - name of the event |
||||
+ `listener` - _Function_ |
||||
|
||||
### off |
||||
|
||||
Remove an event listener. |
||||
|
||||
``` js |
||||
emitter.off( eventName, listener ) |
||||
``` |
||||
|
||||
### once |
||||
|
||||
Add an event listener to be triggered only once. |
||||
|
||||
``` js |
||||
emitter.once( eventName, listener ) |
||||
``` |
||||
|
||||
### emitEvent |
||||
|
||||
Trigger an event. |
||||
|
||||
``` js |
||||
emitter.emitEvent( eventName, args ) |
||||
``` |
||||
|
||||
+ `eventName` - _String_ - name of the event |
||||
+ `args` - _Array_ - arguments passed to listeners |
||||
|
||||
## Code example |
||||
|
||||
``` js |
||||
// create event emitter |
||||
var emitter = new EventEmitter(); |
||||
|
||||
// listeners |
||||
function hey( a, b, c ) { |
||||
console.log( 'Hey', a, b, c ) |
||||
} |
||||
|
||||
function ho( a, b, c ) { |
||||
console.log( 'Ho', a, b, c ) |
||||
} |
||||
|
||||
function letsGo( a, b, c ) { |
||||
console.log( 'Lets go', a, b, c ) |
||||
} |
||||
|
||||
// bind listeners |
||||
emitter.on( 'rock', hey ) |
||||
emitter.once( 'rock', ho ) |
||||
// trigger letsGo once |
||||
emitter.on( 'rock', letsGo ) |
||||
|
||||
// emit event |
||||
emitter.emitEvent( 'rock', [ 1, 2, 3 ] ) |
||||
// => 'Hey', 1, 2, 3 |
||||
// => 'Ho', 1, 2, 3 |
||||
// => 'Lets go', 1, 2, 3 |
||||
|
||||
// unbind |
||||
emitter.off( 'rock', ho ) |
||||
|
||||
emitter.emitEvent( 'rock', [ 4, 5, 6 ] ) |
||||
// => 'Hey' 4, 5, 6 |
||||
``` |
||||
|
||||
## License |
||||
|
||||
EvEmitter is released under the [MIT License](http://desandro.mit-license.org/). Have at it. |
@ -0,0 +1,28 @@ |
||||
{ |
||||
"name": "ev-emitter", |
||||
"main": "ev-emitter.js", |
||||
"homepage": "https://github.com/metafizzy/ev-emitter", |
||||
"authors": [ |
||||
"David DeSandro <desandrocodes@gmail.com>" |
||||
], |
||||
"description": "lil' event emitter", |
||||
"moduleType": [ |
||||
"amd", |
||||
"globals", |
||||
"node" |
||||
], |
||||
"keywords": [ |
||||
"event", |
||||
"emitter", |
||||
"pubsub" |
||||
], |
||||
"license": "MIT", |
||||
"ignore": [ |
||||
"**/.*", |
||||
"node_modules", |
||||
"bower_components", |
||||
"test", |
||||
"tests", |
||||
"sandbox" |
||||
] |
||||
} |
@ -0,0 +1,109 @@ |
||||
/** |
||||
* EvEmitter v1.0.3 |
||||
* Lil' event emitter |
||||
* MIT License |
||||
*/ |
||||
|
||||
/* jshint unused: true, undef: true, strict: true */ |
||||
|
||||
( function( global, factory ) { |
||||
// universal module definition
|
||||
/* jshint strict: false */ /* globals define, module, window */ |
||||
if ( typeof define == 'function' && define.amd ) { |
||||
// AMD - RequireJS
|
||||
define( factory ); |
||||
} else if ( typeof module == 'object' && module.exports ) { |
||||
// CommonJS - Browserify, Webpack
|
||||
module.exports = factory(); |
||||
} else { |
||||
// Browser globals
|
||||
global.EvEmitter = factory(); |
||||
} |
||||
|
||||
}( typeof window != 'undefined' ? window : this, function() { |
||||
|
||||
"use strict"; |
||||
|
||||
function EvEmitter() {} |
||||
|
||||
var proto = EvEmitter.prototype; |
||||
|
||||
proto.on = function( eventName, listener ) { |
||||
if ( !eventName || !listener ) { |
||||
return; |
||||
} |
||||
// set events hash
|
||||
var events = this._events = this._events || {}; |
||||
// set listeners array
|
||||
var listeners = events[ eventName ] = events[ eventName ] || []; |
||||
// only add once
|
||||
if ( listeners.indexOf( listener ) == -1 ) { |
||||
listeners.push( listener ); |
||||
} |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
proto.once = function( eventName, listener ) { |
||||
if ( !eventName || !listener ) { |
||||
return; |
||||
} |
||||
// add event
|
||||
this.on( eventName, listener ); |
||||
// set once flag
|
||||
// set onceEvents hash
|
||||
var onceEvents = this._onceEvents = this._onceEvents || {}; |
||||
// set onceListeners object
|
||||
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; |
||||
// set flag
|
||||
onceListeners[ listener ] = true; |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
proto.off = function( eventName, listener ) { |
||||
var listeners = this._events && this._events[ eventName ]; |
||||
if ( !listeners || !listeners.length ) { |
||||
return; |
||||
} |
||||
var index = listeners.indexOf( listener ); |
||||
if ( index != -1 ) { |
||||
listeners.splice( index, 1 ); |
||||
} |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
proto.emitEvent = function( eventName, args ) { |
||||
var listeners = this._events && this._events[ eventName ]; |
||||
if ( !listeners || !listeners.length ) { |
||||
return; |
||||
} |
||||
var i = 0; |
||||
var listener = listeners[i]; |
||||
args = args || []; |
||||
// once stuff
|
||||
var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; |
||||
|
||||
while ( listener ) { |
||||
var isOnce = onceListeners && onceListeners[ listener ]; |
||||
if ( isOnce ) { |
||||
// remove listener
|
||||
// remove before trigger to prevent recursion
|
||||
this.off( eventName, listener ); |
||||
// unset once flag
|
||||
delete onceListeners[ listener ]; |
||||
} |
||||
// trigger listener
|
||||
listener.apply( this, args ); |
||||
// get next listener
|
||||
i += isOnce ? 0 : 1; |
||||
listener = listeners[i]; |
||||
} |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
return EvEmitter; |
||||
|
||||
})); |
@ -0,0 +1,27 @@ |
||||
{ |
||||
"name": "ev-emitter", |
||||
"version": "1.0.3", |
||||
"description": "lil' event emitter", |
||||
"main": "ev-emitter.js", |
||||
"scripts": { |
||||
"test": "mocha test/test" |
||||
}, |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/metafizzy/ev-emitter.git" |
||||
}, |
||||
"keywords": [ |
||||
"event", |
||||
"emitter", |
||||
"pubsub" |
||||
], |
||||
"author": "David DeSandro", |
||||
"license": "MIT", |
||||
"bugs": { |
||||
"url": "https://github.com/metafizzy/ev-emitter/issues" |
||||
}, |
||||
"homepage": "https://github.com/metafizzy/ev-emitter#readme", |
||||
"directories": { |
||||
"test": "test" |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
{ |
||||
"name": "imagesloaded", |
||||
"description": "JavaScript is all like _You images done yet or what?_", |
||||
"main": "imagesloaded.js", |
||||
"dependencies": { |
||||
"ev-emitter": "~1.0.0" |
||||
}, |
||||
"devDependencies": { |
||||
"jquery": ">=1.9 <4.0", |
||||
"qunit": "~1.20.0" |
||||
}, |
||||
"ignore": [ |
||||
"**/.*", |
||||
"test", |
||||
"package.json", |
||||
"composer.json", |
||||
"node_modules", |
||||
"bower_components", |
||||
"tests", |
||||
"sandbox/", |
||||
"contributing.md" |
||||
], |
||||
"homepage": "http://imagesloaded.desandro.com", |
||||
"authors": [ |
||||
"David DeSandro" |
||||
], |
||||
"moduleType": [ |
||||
"amd", |
||||
"globals", |
||||
"node" |
||||
], |
||||
"keywords": [ |
||||
"images" |
||||
], |
||||
"license": "MIT", |
||||
"version": "4.1.1", |
||||
"_release": "4.1.1", |
||||
"_resolution": { |
||||
"type": "version", |
||||
"tag": "v4.1.1", |
||||
"commit": "2646b88563dbc19ef44da453be92d9be3bdd78d6" |
||||
}, |
||||
"_source": "https://github.com/desandro/imagesloaded.git", |
||||
"_target": ">=3.0.0", |
||||
"_originalSource": "imagesloaded" |
||||
} |
@ -0,0 +1,362 @@ |
||||
# imagesLoaded |
||||
|
||||
<p class="tagline">JavaScript is all like "You images done yet or what?"</p> |
||||
|
||||
[imagesloaded.desandro.com](http://imagesloaded.desandro.com) |
||||
|
||||
Detect when images have been loaded. |
||||
|
||||
## Install |
||||
|
||||
### Download |
||||
|
||||
+ [imagesloaded.pkgd.min.js](https://npmcdn.com/imagesloaded@4/imagesloaded.pkgd.min.js) minified |
||||
+ [imagesloaded.pkgd.js](https://npmcdn.com/imagesloaded@4/imagesloaded.pkgd.js) un-minified |
||||
|
||||
### CDN |
||||
|
||||
``` html |
||||
<script src="https://npmcdn.com/imagesloaded@4.1/imagesloaded.pkgd.min.js"></script> |
||||
<!-- or --> |
||||
<script src="https://npmcdn.com/imagesloaded@4.1/imagesloaded.pkgd.js"></script> |
||||
``` |
||||
|
||||
### Package managers |
||||
|
||||
Install via [npm](https://www.npmjs.com/package/imagesloaded): `npm install imagesloaded` |
||||
|
||||
Install via [Bower](http://bower.io): `bower install imagesloaded --save` |
||||
|
||||
## jQuery |
||||
|
||||
You can use imagesLoaded as a jQuery Plugin. |
||||
|
||||
``` js |
||||
$('#container').imagesLoaded( function() { |
||||
// images have loaded |
||||
}); |
||||
|
||||
// options |
||||
$('#container').imagesLoaded( { |
||||
// options... |
||||
}, |
||||
function() { |
||||
// images have loaded |
||||
} |
||||
); |
||||
``` |
||||
|
||||
`.imagesLoaded()` returns a [jQuery Deferred object](http://api.jquery.com/category/deferred-object/). This allows you to use `.always()`, `.done()`, `.fail()` and `.progress()`. |
||||
|
||||
``` js |
||||
$('#container').imagesLoaded() |
||||
.always( function( instance ) { |
||||
console.log('all images loaded'); |
||||
}) |
||||
.done( function( instance ) { |
||||
console.log('all images successfully loaded'); |
||||
}) |
||||
.fail( function() { |
||||
console.log('all images loaded, at least one is broken'); |
||||
}) |
||||
.progress( function( instance, image ) { |
||||
var result = image.isLoaded ? 'loaded' : 'broken'; |
||||
console.log( 'image is ' + result + ' for ' + image.img.src ); |
||||
}); |
||||
``` |
||||
|
||||
## Vanilla JavaScript |
||||
|
||||
You can use imagesLoaded with vanilla JS. |
||||
|
||||
``` js |
||||
imagesLoaded( elem, callback ) |
||||
// options |
||||
imagesLoaded( elem, options, callback ) |
||||
// you can use `new` if you like |
||||
new imagesLoaded( elem, callback ) |
||||
``` |
||||
|
||||
+ `elem` _Element, NodeList, Array, or Selector String_ |
||||
+ `options` _Object_ |
||||
+ `callback` _Function_ - function triggered after all images have been loaded |
||||
|
||||
Using a callback function is the same as binding it to the `always` event (see below). |
||||
|
||||
``` js |
||||
// element |
||||
imagesLoaded( document.querySelector('#container'), function( instance ) { |
||||
console.log('all images are loaded'); |
||||
}); |
||||
// selector string |
||||
imagesLoaded( '#container', function() {...}); |
||||
// multiple elements |
||||
var posts = document.querySelectorAll('.post'); |
||||
imagesLoaded( posts, function() {...}); |
||||
``` |
||||
|
||||
Bind events with vanilla JS with .on(), .off(), and .once() methods. |
||||
|
||||
``` js |
||||
var imgLoad = imagesLoaded( elem ); |
||||
function onAlways( instance ) { |
||||
console.log('all images are loaded'); |
||||
} |
||||
// bind with .on() |
||||
imgLoad.on( 'always', onAlways ); |
||||
// unbind with .off() |
||||
imgLoad.off( 'always', onAlways ); |
||||
``` |
||||
|
||||
## Background |
||||
|
||||
Detect when background images have loaded, in addition to `<img>`s. |
||||
|
||||
Set `{ background: true }` to detect when the element's background image has loaded. |
||||
|
||||
``` js |
||||
// jQuery |
||||
$('#container').imagesLoaded( { background: true }, function() { |
||||
console.log('#container background image loaded'); |
||||
}); |
||||
|
||||
// vanilla JS |
||||
imagesLoaded( '#container', { background: true }, function() { |
||||
console.log('#container background image loaded'); |
||||
}); |
||||
``` |
||||
|
||||
[See jQuery demo](http://codepen.io/desandro/pen/pjVMPB) or [vanilla JS demo](http://codepen.io/desandro/pen/avKooW) on CodePen. |
||||
|
||||
Set to a selector string like `{ background: '.item' }` to detect when the background images of child elements have loaded. |
||||
|
||||
``` js |
||||
// jQuery |
||||
$('#container').imagesLoaded( { background: '.item' }, function() { |
||||
console.log('all .item background images loaded'); |
||||
}); |
||||
|
||||
// vanilla JS |
||||
imagesLoaded( '#container', { background: '.item' }, function() { |
||||
console.log('all .item background images loaded'); |
||||
}); |
||||
``` |
||||
|
||||
[See jQuery demo](http://codepen.io/desandro/pen/avKoZL) or [vanilla JS demo](http://codepen.io/desandro/pen/vNrBGz) on CodePen. |
||||
|
||||
## Events |
||||
|
||||
### always |
||||
|
||||
``` js |
||||
// jQuery |
||||
$('#container').imagesLoaded().always( function( instance ) { |
||||
console.log('ALWAYS - all images have been loaded'); |
||||
}); |
||||
|
||||
// vanilla JS |
||||
imgLoad.on( 'always', function( instance ) { |
||||
console.log('ALWAYS - all images have been loaded'); |
||||
}); |
||||
``` |
||||
|
||||
Triggered after all images have been either loaded or confirmed broken. |
||||
|
||||
+ `instance` _imagesLoaded_ - the imagesLoaded instance |
||||
|
||||
### done |
||||
|
||||
``` js |
||||
// jQuery |
||||
$('#container').imagesLoaded().done( function( instance ) { |
||||
console.log('DONE - all images have been successfully loaded'); |
||||
}); |
||||
|
||||
// vanilla JS |
||||
imgLoad.on( 'done', function( instance ) { |
||||
console.log('DONE - all images have been successfully loaded'); |
||||
}); |
||||
``` |
||||
|
||||
Triggered after all images have successfully loaded without any broken images. |
||||
|
||||
### fail |
||||
|
||||
``` js |
||||
$('#container').imagesLoaded().fail( function( instance ) { |
||||
console.log('FAIL - all images loaded, at least one is broken'); |
||||
}); |
||||
|
||||
// vanilla JS |
||||
imgLoad.on( 'fail', function( instance ) { |
||||
console.log('FAIL - all images loaded, at least one is broken'); |
||||
}); |
||||
``` |
||||
|
||||
Triggered after all images have been loaded with at least one broken image. |
||||
|
||||
### progress |
||||
|
||||
``` js |
||||
imgLoad.on( 'progress', function( instance, image ) { |
||||
var result = image.isLoaded ? 'loaded' : 'broken'; |
||||
console.log( 'image is ' + result + ' for ' + image.img.src ); |
||||
}); |
||||
``` |
||||
|
||||
Triggered after each image has been loaded. |
||||
|
||||
+ `instance` _imagesLoaded_ - the imagesLoaded instance |
||||
+ `image` _LoadingImage_ - the LoadingImage instance of the loaded image |
||||
|
||||
<!-- sponsored --> |
||||
|
||||
## Properties |
||||
|
||||
### LoadingImage.img |
||||
|
||||
_Image_ - The `img` element |
||||
|
||||
### LoadingImage.isLoaded |
||||
|
||||
_Boolean_ - `true` when the image has succesfully loaded |
||||
|
||||
### imagesLoaded.images |
||||
|
||||
Array of _LoadingImage_ instances for each image detected |
||||
|
||||
``` js |
||||
var imgLoad = imagesLoaded('#container'); |
||||
imgLoad.on( 'always', function() { |
||||
console.log( imgLoad.images.length + ' images loaded' ); |
||||
// detect which image is broken |
||||
for ( var i = 0, len = imgLoad.images.length; i < len; i++ ) { |
||||
var image = imgLoad.images[i]; |
||||
var result = image.isLoaded ? 'loaded' : 'broken'; |
||||
console.log( 'image is ' + result + ' for ' + image.img.src ); |
||||
} |
||||
}); |
||||
``` |
||||
|
||||
## Browserify |
||||
|
||||
imagesLoaded works with [Browserify](http://browserify.org/). |
||||
|
||||
``` bash |
||||
npm install imagesloaded --save |
||||
``` |
||||
|
||||
``` js |
||||
var imagesLoaded = require('imagesloaded'); |
||||
|
||||
imagesLoaded( elem, function() {...} ); |
||||
``` |
||||
|
||||
Use `.makeJQueryPlugin` to make to use `.imagesLoaded()` jQuery plugin. |
||||
|
||||
``` js |
||||
var $ = require('jquery'); |
||||
var imagesLoaded = require('imagesloaded'); |
||||
|
||||
// provide jQuery argument |
||||
imagesLoaded.makeJQueryPlugin( $ ); |
||||
// now use .imagesLoaded() jQuery plugin |
||||
$('#container').imagesLoaded( function() {...}); |
||||
``` |
||||
|
||||
## Webpack |
||||
|
||||
Install imagesLoaded with npm. |
||||
|
||||
``` bash |
||||
npm install imagesloaded |
||||
``` |
||||
|
||||
You can then `require('imagesloaded')`. |
||||
|
||||
``` js |
||||
// main.js |
||||
var imagesLoaded = require('imagesloaded'); |
||||
|
||||
imagesLoaded( '#container', function() { |
||||
// images have loaded |
||||
}); |
||||
``` |
||||
|
||||
Use `.makeJQueryPlugin` to make `.imagesLoaded()` jQuery plugin. |
||||
|
||||
``` js |
||||
// main.js |
||||
var imagesLoaded = require('imagesloaded'); |
||||
var $ = require('jquery'); |
||||
|
||||
// provide jQuery argument |
||||
imagesLoaded.makeJQueryPlugin( $ ); |
||||
// now use .imagesLoaded() jQuery plugin |
||||
$('#container').imagesLoaded( function() {...}); |
||||
``` |
||||
|
||||
Run webpack. |
||||
|
||||
``` bash |
||||
webpack main.js bundle.js |
||||
``` |
||||
|
||||
## RequireJS |
||||
|
||||
imagesLoaded works with [RequireJS](http://requirejs.org). |
||||
|
||||
You can require [imagesloaded.pkgd.js](http://imagesloaded.desandro.com/imagesloaded.pkgd.js). |
||||
|
||||
``` js |
||||
requirejs( [ |
||||
'path/to/imagesloaded.pkgd.js', |
||||
], function( imagesLoaded ) { |
||||
imagesLoaded( '#container', function() { ... }); |
||||
}); |
||||
``` |
||||
|
||||
Use `.makeJQueryPlugin` to make `.imagesLoaded()` jQuery plugin. |
||||
|
||||
``` js |
||||
requirejs( [ |
||||
'jquery', |
||||
'path/to/imagesloaded.pkgd.js', |
||||
], function( $, imagesLoaded ) { |
||||
// provide jQuery argument |
||||
imagesLoaded.makeJQueryPlugin( $ ); |
||||
// now use .imagesLoaded() jQuery plugin |
||||
$('#container').imagesLoaded( function() {...}); |
||||
}); |
||||
``` |
||||
|
||||
You can manage dependencies with [Bower](http://bower.io). Set `baseUrl` to `bower_components` and set a path config for all your application code. |
||||
|
||||
``` js |
||||
requirejs.config({ |
||||
baseUrl: 'bower_components/', |
||||
paths: { // path to your app |
||||
app: '../' |
||||
} |
||||
}); |
||||
|
||||
requirejs( [ |
||||
'imagesloaded/imagesloaded', |
||||
'app/my-component.js' |
||||
], function( imagesLoaded, myComp ) { |
||||
imagesLoaded( '#container', function() { ... }); |
||||
}); |
||||
``` |
||||
|
||||
## Browser support |
||||
|
||||
+ IE9+ |
||||
+ Android 2.3+ |
||||
+ iOS Safari 4+ |
||||
+ All other modern browsers |
||||
|
||||
Use [imagesLoaded v3](http://imagesloaded.desandro.com/v3/) for IE8 support. |
||||
|
||||
## MIT License |
||||
|
||||
imagesLoaded is released under the [MIT License](http://desandro.mit-license.org/). Have at it. |
@ -0,0 +1,36 @@ |
||||
{ |
||||
"name": "imagesloaded", |
||||
"description": "JavaScript is all like _You images done yet or what?_", |
||||
"main": "imagesloaded.js", |
||||
"dependencies": { |
||||
"ev-emitter": "~1.0.0" |
||||
}, |
||||
"devDependencies": { |
||||
"jquery": ">=1.9 <4.0", |
||||
"qunit": "~1.20.0" |
||||
}, |
||||
"ignore": [ |
||||
"**/.*", |
||||
"test", |
||||
"package.json", |
||||
"composer.json", |
||||
"node_modules", |
||||
"bower_components", |
||||
"tests", |
||||
"sandbox/", |
||||
"contributing.md" |
||||
], |
||||
"homepage": "http://imagesloaded.desandro.com", |
||||
"authors": [ |
||||
"David DeSandro" |
||||
], |
||||
"moduleType": [ |
||||
"amd", |
||||
"globals", |
||||
"node" |
||||
], |
||||
"keywords": [ |
||||
"images" |
||||
], |
||||
"license": "MIT" |
||||
} |
@ -0,0 +1,172 @@ |
||||
/*jshint node: true, strict: false */ |
||||
|
||||
var fs = require('fs'); |
||||
var gulp = require('gulp'); |
||||
var rename = require('gulp-rename'); |
||||
var replace = require('gulp-replace'); |
||||
|
||||
// ----- hint ----- //
|
||||
|
||||
var jshint = require('gulp-jshint'); |
||||
|
||||
gulp.task( 'hint-js', function() { |
||||
return gulp.src('imagesloaded.js') |
||||
.pipe( jshint() ) |
||||
.pipe( jshint.reporter('default') ); |
||||
}); |
||||
|
||||
gulp.task( 'hint-test', function() { |
||||
return gulp.src('test/unit/*.js') |
||||
.pipe( jshint() ) |
||||
.pipe( jshint.reporter('default') ); |
||||
}); |
||||
|
||||
gulp.task( 'hint-task', function() { |
||||
return gulp.src('gulpfile.js') |
||||
.pipe( jshint() ) |
||||
.pipe( jshint.reporter('default') ); |
||||
}); |
||||
|
||||
var jsonlint = require('gulp-json-lint'); |
||||
|
||||
gulp.task( 'jsonlint', function() { |
||||
return gulp.src( '*.json' ) |
||||
.pipe( jsonlint() ) |
||||
.pipe( jsonlint.report('verbose') ); |
||||
});
|
||||
|
||||
gulp.task( 'hint', [ 'hint-js', 'hint-test', 'hint-task', 'jsonlint' ]); |
||||
|
||||
// -------------------------- RequireJS makes pkgd -------------------------- //
|
||||
|
||||
// refactored from gulp-requirejs-optimize
|
||||
// https://www.npmjs.com/package/gulp-requirejs-optimize/
|
||||
|
||||
var gutil = require('gulp-util'); |
||||
var through = require('through2'); |
||||
var requirejs = require('requirejs'); |
||||
var chalk = require('chalk'); |
||||
|
||||
function rjsOptimize( options ) { |
||||
options = options || {}; |
||||
|
||||
requirejs.define('node/print', [], function() { |
||||
return function(msg) { |
||||
if( msg.substring(0, 5) === 'Error' ) { |
||||
gutil.log( chalk.red( msg ) ); |
||||
} else { |
||||
gutil.log( msg ); |
||||
} |
||||
}; |
||||
}); |
||||
|
||||
var stream = through.obj(function (file, enc, cb) { |
||||
if ( file.isNull() ) { |
||||
return cb( null, file ); |
||||
} |
||||
|
||||
options.logLevel = 2; |
||||
|
||||
options.out = function( text ) { |
||||
var outFile = new gutil.File({ |
||||
path: file.relative, |
||||
contents: new Buffer( text ) |
||||
}); |
||||
cb( null, outFile ); |
||||
}; |
||||
|
||||
gutil.log('RequireJS optimizing'); |
||||
requirejs.optimize( options, null, function( err ) { |
||||
var gulpError = new gutil.PluginError( 'requirejsOptimize', err.message ); |
||||
stream.emit( 'error', gulpError ); |
||||
}); |
||||
}); |
||||
|
||||
return stream; |
||||
} |
||||
|
||||
// regex for banner comment
|
||||
var reBannerComment = new RegExp('^\\s*(?:\\/\\*[\\s\\S]*?\\*\\/)\\s*'); |
||||
|
||||
function getBanner() { |
||||
var src = fs.readFileSync( 'imagesloaded.js', 'utf8' ); |
||||
var matches = src.match( reBannerComment ); |
||||
var banner = matches[0].replace( 'imagesLoaded', 'imagesLoaded PACKAGED' ); |
||||
return banner; |
||||
} |
||||
|
||||
function addBanner( str ) { |
||||
return replace( /^/, str ); |
||||
} |
||||
|
||||
gulp.task( 'requirejs', function() { |
||||
var banner = getBanner(); |
||||
// HACK src is not needed
|
||||
// should refactor rjsOptimize to produce src
|
||||
return gulp.src('imagesloaded.js') |
||||
.pipe( rjsOptimize({ |
||||
baseUrl: 'bower_components', |
||||
optimize: 'none', |
||||
include: [ |
||||
'../imagesloaded' |
||||
] |
||||
}) ) |
||||
// remove named module
|
||||
.pipe( replace( "'../imagesloaded',", '' ) ) |
||||
// add banner
|
||||
.pipe( addBanner( banner ) ) |
||||
.pipe( rename('imagesloaded.pkgd.js') ) |
||||
.pipe( gulp.dest('.') ); |
||||
}); |
||||
|
||||
|
||||
// ----- uglify ----- //
|
||||
|
||||
var uglify = require('gulp-uglify'); |
||||
|
||||
gulp.task( 'uglify', [ 'requirejs' ], function() { |
||||
var banner = getBanner(); |
||||
gulp.src('imagesloaded.pkgd.js') |
||||
.pipe( uglify() ) |
||||
// add banner
|
||||
.pipe( addBanner( banner ) ) |
||||
.pipe( rename('imagesloaded.pkgd.min.js') ) |
||||
.pipe( gulp.dest('.') ); |
||||
}); |
||||
|
||||
// ----- version ----- //
|
||||
|
||||
// set version in source files
|
||||
|
||||
var minimist = require('minimist'); |
||||
|
||||
// use gulp version -t 1.2.3
|
||||
gulp.task( 'version', function() { |
||||
var args = minimist( process.argv.slice(3) ); |
||||
var version = args.t; |
||||
if ( !version || !/\d+\.\d+\.\d+/.test( version ) ) { |
||||
gutil.log( 'invalid version: ' + chalk.red( version ) ); |
||||
return; |
||||
} |
||||
gutil.log( 'ticking version to ' + chalk.green( version ) ); |
||||
|
||||
gulp.src('imagesloaded.js') |
||||
.pipe( replace( /imagesLoaded v\d+\.\d+\.\d+/, 'imagesLoaded v' + version ) ) |
||||
.pipe( gulp.dest('.') ); |
||||
|
||||
gulp.src( [ 'bower.json', 'package.json' ] ) |
||||
.pipe( replace( /"version": "\d+\.\d+\.\d+"/, '"version": "' + version + '"' ) ) |
||||
.pipe( gulp.dest('.') ); |
||||
// replace CDN links in README
|
||||
var minorVersion = version.match( /^\d+\.\d+/ )[0]; |
||||
gulp.src('README.md') |
||||
.pipe( replace( /imagesloaded@\d+\.\d+/g, 'imagesloaded@' + minorVersion )) |
||||
.pipe( gulp.dest('.') ); |
||||
}); |
||||
|
||||
// ----- default ----- //
|
||||
|
||||
gulp.task( 'default', [ |
||||
'hint', |
||||
'uglify' |
||||
]); |
@ -0,0 +1,370 @@ |
||||
/*! |
||||
* imagesLoaded v4.1.1 |
||||
* JavaScript is all like "You images are done yet or what?" |
||||
* MIT License |
||||
*/ |
||||
|
||||
( function( window, factory ) { 'use strict'; |
||||
// universal module definition
|
||||
|
||||
/*global define: false, module: false, require: false */ |
||||
|
||||
if ( typeof define == 'function' && define.amd ) { |
||||
// AMD
|
||||
define( [ |
||||
'ev-emitter/ev-emitter' |
||||
], function( EvEmitter ) { |
||||
return factory( window, EvEmitter ); |
||||
}); |
||||
} else if ( typeof module == 'object' && module.exports ) { |
||||
// CommonJS
|
||||
module.exports = factory( |
||||
window, |
||||
require('ev-emitter') |
||||
); |
||||
} else { |
||||
// browser global
|
||||
window.imagesLoaded = factory( |
||||
window, |
||||
window.EvEmitter |
||||
); |
||||
} |
||||
|
||||
})( window, |
||||
|
||||
// -------------------------- factory -------------------------- //
|
||||
|
||||
function factory( window, EvEmitter ) { |
||||
|
||||
'use strict'; |
||||
|
||||
var $ = window.jQuery; |
||||
var console = window.console; |
||||
|
||||
// -------------------------- helpers -------------------------- //
|
||||
|
||||
// extend objects
|
||||
function extend( a, b ) { |
||||
for ( var prop in b ) { |
||||
a[ prop ] = b[ prop ]; |
||||
} |
||||
return a; |
||||
} |
||||
|
||||
// turn element or nodeList into an array
|
||||
function makeArray( obj ) { |
||||
var ary = []; |
||||
if ( Array.isArray( obj ) ) { |
||||
// use object if already an array
|
||||
ary = obj; |
||||
} else if ( typeof obj.length == 'number' ) { |
||||
// convert nodeList to array
|
||||
for ( var i=0; i < obj.length; i++ ) { |
||||
ary.push( obj[i] ); |
||||
} |
||||
} else { |
||||
// array of single index
|
||||
ary.push( obj ); |
||||
} |
||||
return ary; |
||||
} |
||||
|
||||
// -------------------------- imagesLoaded -------------------------- //
|
||||
|
||||
/** |
||||
* @param {Array, Element, NodeList, String} elem |
||||
* @param {Object or Function} options - if function, use as callback |
||||
* @param {Function} onAlways - callback function |
||||
*/ |
||||
function ImagesLoaded( elem, options, onAlways ) { |
||||
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
|
||||
if ( !( this instanceof ImagesLoaded ) ) { |
||||
return new ImagesLoaded( elem, options, onAlways ); |
||||
} |
||||
// use elem as selector string
|
||||
if ( typeof elem == 'string' ) { |
||||
elem = document.querySelectorAll( elem ); |
||||
} |
||||
|
||||
this.elements = makeArray( elem ); |
||||
this.options = extend( {}, this.options ); |
||||
|
||||
if ( typeof options == 'function' ) { |
||||
onAlways = options; |
||||
} else { |
||||
extend( this.options, options ); |
||||
} |
||||
|
||||
if ( onAlways ) { |
||||
this.on( 'always', onAlways ); |
||||
} |
||||
|
||||
this.getImages(); |
||||
|
||||
if ( $ ) { |
||||
// add jQuery Deferred object
|
||||
this.jqDeferred = new $.Deferred(); |
||||
} |
||||
|
||||
// HACK check async to allow time to bind listeners
|
||||
setTimeout( function() { |
||||
this.check(); |
||||
}.bind( this )); |
||||
} |
||||
|
||||
ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); |
||||
|
||||
ImagesLoaded.prototype.options = {}; |
||||
|
||||
ImagesLoaded.prototype.getImages = function() { |
||||
this.images = []; |
||||
|
||||
// filter & find items if we have an item selector
|
||||
this.elements.forEach( this.addElementImages, this ); |
||||
}; |
||||
|
||||
/** |
||||
* @param {Node} element |
||||
*/ |
||||
ImagesLoaded.prototype.addElementImages = function( elem ) { |
||||
// filter siblings
|
||||
if ( elem.nodeName == 'IMG' ) { |
||||
this.addImage( elem ); |
||||
} |
||||
// get background image on element
|
||||
if ( this.options.background === true ) { |
||||
this.addElementBackgroundImages( elem ); |
||||
} |
||||
|
||||
// find children
|
||||
// no non-element nodes, #143
|
||||
var nodeType = elem.nodeType; |
||||
if ( !nodeType || !elementNodeTypes[ nodeType ] ) { |
||||
return; |
||||
} |
||||
var childImgs = elem.querySelectorAll('img'); |
||||
// concat childElems to filterFound array
|
||||
for ( var i=0; i < childImgs.length; i++ ) { |
||||
var img = childImgs[i]; |
||||
this.addImage( img ); |
||||
} |
||||
|
||||
// get child background images
|
||||
if ( typeof this.options.background == 'string' ) { |
||||
var children = elem.querySelectorAll( this.options.background ); |
||||
for ( i=0; i < children.length; i++ ) { |
||||
var child = children[i]; |
||||
this.addElementBackgroundImages( child ); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
var elementNodeTypes = { |
||||
1: true, |
||||
9: true, |
||||
11: true |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { |
||||
var style = getComputedStyle( elem ); |
||||
if ( !style ) { |
||||
// Firefox returns null if in a hidden iframe https://bugzil.la/548397
|
||||
return; |
||||
} |
||||
// get url inside url("...")
|
||||
var reURL = /url\((['"])?(.*?)\1\)/gi; |
||||
var matches = reURL.exec( style.backgroundImage ); |
||||
while ( matches !== null ) { |
||||
var url = matches && matches[2]; |
||||
if ( url ) { |
||||
this.addBackground( url, elem ); |
||||
} |
||||
matches = reURL.exec( style.backgroundImage ); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* @param {Image} img |
||||
*/ |
||||
ImagesLoaded.prototype.addImage = function( img ) { |
||||
var loadingImage = new LoadingImage( img ); |
||||
this.images.push( loadingImage ); |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.addBackground = function( url, elem ) { |
||||
var background = new Background( url, elem ); |
||||
this.images.push( background ); |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.check = function() { |
||||
var _this = this; |
||||
this.progressedCount = 0; |
||||
this.hasAnyBroken = false; |
||||
// complete if no images
|
||||
if ( !this.images.length ) { |
||||
this.complete(); |
||||
return; |
||||
} |
||||
|
||||
function onProgress( image, elem, message ) { |
||||
// HACK - Chrome triggers event before object properties have changed. #83
|
||||
setTimeout( function() { |
||||
_this.progress( image, elem, message ); |
||||
}); |
||||
} |
||||
|
||||
this.images.forEach( function( loadingImage ) { |
||||
loadingImage.once( 'progress', onProgress ); |
||||
loadingImage.check(); |
||||
}); |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.progress = function( image, elem, message ) { |
||||
this.progressedCount++; |
||||
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; |
||||
// progress event
|
||||
this.emitEvent( 'progress', [ this, image, elem ] ); |
||||
if ( this.jqDeferred && this.jqDeferred.notify ) { |
||||
this.jqDeferred.notify( this, image ); |
||||
} |
||||
// check if completed
|
||||
if ( this.progressedCount == this.images.length ) { |
||||
this.complete(); |
||||
} |
||||
|
||||
if ( this.options.debug && console ) { |
||||
console.log( 'progress: ' + message, image, elem ); |
||||
} |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.complete = function() { |
||||
var eventName = this.hasAnyBroken ? 'fail' : 'done'; |
||||
this.isComplete = true; |
||||
this.emitEvent( eventName, [ this ] ); |
||||
this.emitEvent( 'always', [ this ] ); |
||||
if ( this.jqDeferred ) { |
||||
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; |
||||
this.jqDeferred[ jqMethod ]( this ); |
||||
} |
||||
}; |
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
function LoadingImage( img ) { |
||||
this.img = img; |
||||
} |
||||
|
||||
LoadingImage.prototype = Object.create( EvEmitter.prototype ); |
||||
|
||||
LoadingImage.prototype.check = function() { |
||||
// If complete is true and browser supports natural sizes,
|
||||
// try to check for image status manually.
|
||||
var isComplete = this.getIsImageComplete(); |
||||
if ( isComplete ) { |
||||
// report based on naturalWidth
|
||||
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); |
||||
return; |
||||
} |
||||
|
||||
// If none of the checks above matched, simulate loading on detached element.
|
||||
this.proxyImage = new Image(); |
||||
this.proxyImage.addEventListener( 'load', this ); |
||||
this.proxyImage.addEventListener( 'error', this ); |
||||
// bind to image as well for Firefox. #191
|
||||
this.img.addEventListener( 'load', this ); |
||||
this.img.addEventListener( 'error', this ); |
||||
this.proxyImage.src = this.img.src; |
||||
}; |
||||
|
||||
LoadingImage.prototype.getIsImageComplete = function() { |
||||
return this.img.complete && this.img.naturalWidth !== undefined; |
||||
}; |
||||
|
||||
LoadingImage.prototype.confirm = function( isLoaded, message ) { |
||||
this.isLoaded = isLoaded; |
||||
this.emitEvent( 'progress', [ this, this.img, message ] ); |
||||
}; |
||||
|
||||
// ----- events ----- //
|
||||
|
||||
// trigger specified handler for event type
|
||||
LoadingImage.prototype.handleEvent = function( event ) { |
||||
var method = 'on' + event.type; |
||||
if ( this[ method ] ) { |
||||
this[ method ]( event ); |
||||
} |
||||
}; |
||||
|
||||
LoadingImage.prototype.onload = function() { |
||||
this.confirm( true, 'onload' ); |
||||
this.unbindEvents(); |
||||
}; |
||||
|
||||
LoadingImage.prototype.onerror = function() { |
||||
this.confirm( false, 'onerror' ); |
||||
this.unbindEvents(); |
||||
}; |
||||
|
||||
LoadingImage.prototype.unbindEvents = function() { |
||||
this.proxyImage.removeEventListener( 'load', this ); |
||||
this.proxyImage.removeEventListener( 'error', this ); |
||||
this.img.removeEventListener( 'load', this ); |
||||
this.img.removeEventListener( 'error', this ); |
||||
}; |
||||
|
||||
// -------------------------- Background -------------------------- //
|
||||
|
||||
function Background( url, element ) { |
||||
this.url = url; |
||||
this.element = element; |
||||
this.img = new Image(); |
||||
} |
||||
|
||||
// inherit LoadingImage prototype
|
||||
Background.prototype = Object.create( LoadingImage.prototype ); |
||||
|
||||
Background.prototype.check = function() { |
||||
this.img.addEventListener( 'load', this ); |
||||
this.img.addEventListener( 'error', this ); |
||||
this.img.src = this.url; |
||||
// check if image is already complete
|
||||
var isComplete = this.getIsImageComplete(); |
||||
if ( isComplete ) { |
||||
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); |
||||
this.unbindEvents(); |
||||
} |
||||
}; |
||||
|
||||
Background.prototype.unbindEvents = function() { |
||||
this.img.removeEventListener( 'load', this ); |
||||
this.img.removeEventListener( 'error', this ); |
||||
}; |
||||
|
||||
Background.prototype.confirm = function( isLoaded, message ) { |
||||
this.isLoaded = isLoaded; |
||||
this.emitEvent( 'progress', [ this, this.element, message ] ); |
||||
}; |
||||
|
||||
// -------------------------- jQuery -------------------------- //
|
||||
|
||||
ImagesLoaded.makeJQueryPlugin = function( jQuery ) { |
||||
jQuery = jQuery || window.jQuery; |
||||
if ( !jQuery ) { |
||||
return; |
||||
} |
||||
// set local variable
|
||||
$ = jQuery; |
||||
// $().imagesLoaded()
|
||||
$.fn.imagesLoaded = function( options, callback ) { |
||||
var instance = new ImagesLoaded( this, options, callback ); |
||||
return instance.jqDeferred.promise( $(this) ); |
||||
}; |
||||
}; |
||||
// try making plugin
|
||||
ImagesLoaded.makeJQueryPlugin(); |
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
return ImagesLoaded; |
||||
|
||||
}); |
@ -0,0 +1,487 @@ |
||||
/*! |
||||
* imagesLoaded PACKAGED v4.1.1 |
||||
* JavaScript is all like "You images are done yet or what?" |
||||
* MIT License |
||||
*/ |
||||
|
||||
/** |
||||
* EvEmitter v1.0.3 |
||||
* Lil' event emitter |
||||
* MIT License |
||||
*/ |
||||
|
||||
/* jshint unused: true, undef: true, strict: true */ |
||||
|
||||
( function( global, factory ) { |
||||
// universal module definition
|
||||
/* jshint strict: false */ /* globals define, module, window */ |
||||
if ( typeof define == 'function' && define.amd ) { |
||||
// AMD - RequireJS
|
||||
define( 'ev-emitter/ev-emitter',factory ); |
||||
} else if ( typeof module == 'object' && module.exports ) { |
||||
// CommonJS - Browserify, Webpack
|
||||
module.exports = factory(); |
||||
} else { |
||||
// Browser globals
|
||||
global.EvEmitter = factory(); |
||||
} |
||||
|
||||
}( typeof window != 'undefined' ? window : this, function() { |
||||
|
||||
|
||||
|
||||
function EvEmitter() {} |
||||
|
||||
var proto = EvEmitter.prototype; |
||||
|
||||
proto.on = function( eventName, listener ) { |
||||
if ( !eventName || !listener ) { |
||||
return; |
||||
} |
||||
// set events hash
|
||||
var events = this._events = this._events || {}; |
||||
// set listeners array
|
||||
var listeners = events[ eventName ] = events[ eventName ] || []; |
||||
// only add once
|
||||
if ( listeners.indexOf( listener ) == -1 ) { |
||||
listeners.push( listener ); |
||||
} |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
proto.once = function( eventName, listener ) { |
||||
if ( !eventName || !listener ) { |
||||
return; |
||||
} |
||||
// add event
|
||||
this.on( eventName, listener ); |
||||
// set once flag
|
||||
// set onceEvents hash
|
||||
var onceEvents = this._onceEvents = this._onceEvents || {}; |
||||
// set onceListeners object
|
||||
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; |
||||
// set flag
|
||||
onceListeners[ listener ] = true; |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
proto.off = function( eventName, listener ) { |
||||
var listeners = this._events && this._events[ eventName ]; |
||||
if ( !listeners || !listeners.length ) { |
||||
return; |
||||
} |
||||
var index = listeners.indexOf( listener ); |
||||
if ( index != -1 ) { |
||||
listeners.splice( index, 1 ); |
||||
} |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
proto.emitEvent = function( eventName, args ) { |
||||
var listeners = this._events && this._events[ eventName ]; |
||||
if ( !listeners || !listeners.length ) { |
||||
return; |
||||
} |
||||
var i = 0; |
||||
var listener = listeners[i]; |
||||
args = args || []; |
||||
// once stuff
|
||||
var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; |
||||
|
||||
while ( listener ) { |
||||
var isOnce = onceListeners && onceListeners[ listener ]; |
||||
if ( isOnce ) { |
||||
// remove listener
|
||||
// remove before trigger to prevent recursion
|
||||
this.off( eventName, listener ); |
||||
// unset once flag
|
||||
delete onceListeners[ listener ]; |
||||
} |
||||
// trigger listener
|
||||
listener.apply( this, args ); |
||||
// get next listener
|
||||
i += isOnce ? 0 : 1; |
||||
listener = listeners[i]; |
||||
} |
||||
|
||||
return this; |
||||
}; |
||||
|
||||
return EvEmitter; |
||||
|
||||
})); |
||||
|
||||
/*! |
||||
* imagesLoaded v4.1.1 |
||||
* JavaScript is all like "You images are done yet or what?" |
||||
* MIT License |
||||
*/ |
||||
|
||||
( function( window, factory ) { 'use strict'; |
||||
// universal module definition
|
||||
|
||||
/*global define: false, module: false, require: false */ |
||||
|
||||
if ( typeof define == 'function' && define.amd ) { |
||||
// AMD
|
||||
define( [ |
||||
'ev-emitter/ev-emitter' |
||||
], function( EvEmitter ) { |
||||
return factory( window, EvEmitter ); |
||||
}); |
||||
} else if ( typeof module == 'object' && module.exports ) { |
||||
// CommonJS
|
||||
module.exports = factory( |
||||
window, |
||||
require('ev-emitter') |
||||
); |
||||
} else { |
||||
// browser global
|
||||
window.imagesLoaded = factory( |
||||
window, |
||||
window.EvEmitter |
||||
); |
||||
} |
||||
|
||||
})( window, |
||||
|
||||
// -------------------------- factory -------------------------- //
|
||||
|
||||
function factory( window, EvEmitter ) { |
||||
|
||||
|
||||
|
||||
var $ = window.jQuery; |
||||
var console = window.console; |
||||
|
||||
// -------------------------- helpers -------------------------- //
|
||||
|
||||
// extend objects
|
||||
function extend( a, b ) { |
||||
for ( var prop in b ) { |
||||
a[ prop ] = b[ prop ]; |
||||
} |
||||
return a; |
||||
} |
||||
|
||||
// turn element or nodeList into an array
|
||||
function makeArray( obj ) { |
||||
var ary = []; |
||||
if ( Array.isArray( obj ) ) { |
||||
// use object if already an array
|
||||
ary = obj; |
||||
} else if ( typeof obj.length == 'number' ) { |
||||
// convert nodeList to array
|
||||
for ( var i=0; i < obj.length; i++ ) { |
||||
ary.push( obj[i] ); |
||||
} |
||||
} else { |
||||
// array of single index
|
||||
ary.push( obj ); |
||||
} |
||||
return ary; |
||||
} |
||||
|
||||
// -------------------------- imagesLoaded -------------------------- //
|
||||
|
||||
/** |
||||
* @param {Array, Element, NodeList, String} elem |
||||
* @param {Object or Function} options - if function, use as callback |
||||
* @param {Function} onAlways - callback function |
||||
*/ |
||||
function ImagesLoaded( elem, options, onAlways ) { |
||||
// coerce ImagesLoaded() without new, to be new ImagesLoaded()
|
||||
if ( !( this instanceof ImagesLoaded ) ) { |
||||
return new ImagesLoaded( elem, options, onAlways ); |
||||
} |
||||
// use elem as selector string
|
||||
if ( typeof elem == 'string' ) { |
||||
elem = document.querySelectorAll( elem ); |
||||
} |
||||
|
||||
this.elements = makeArray( elem ); |
||||
this.options = extend( {}, this.options ); |
||||
|
||||
if ( typeof options == 'function' ) { |
||||
onAlways = options; |
||||
} else { |
||||
extend( this.options, options ); |
||||
} |
||||
|
||||
if ( onAlways ) { |
||||
this.on( 'always', onAlways ); |
||||
} |
||||
|
||||
this.getImages(); |
||||
|
||||
if ( $ ) { |
||||
// add jQuery Deferred object
|
||||
this.jqDeferred = new $.Deferred(); |
||||
} |
||||
|
||||
// HACK check async to allow time to bind listeners
|
||||
setTimeout( function() { |
||||
this.check(); |
||||
}.bind( this )); |
||||
} |
||||
|
||||
ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); |
||||
|
||||
ImagesLoaded.prototype.options = {}; |
||||
|
||||
ImagesLoaded.prototype.getImages = function() { |
||||
this.images = []; |
||||
|
||||
// filter & find items if we have an item selector
|
||||
this.elements.forEach( this.addElementImages, this ); |
||||
}; |
||||
|
||||
/** |
||||
* @param {Node} element |
||||
*/ |
||||
ImagesLoaded.prototype.addElementImages = function( elem ) { |
||||
// filter siblings
|
||||
if ( elem.nodeName == 'IMG' ) { |
||||
this.addImage( elem ); |
||||
} |
||||
// get background image on element
|
||||
if ( this.options.background === true ) { |
||||
this.addElementBackgroundImages( elem ); |
||||
} |
||||
|
||||
// find children
|
||||
// no non-element nodes, #143
|
||||
var nodeType = elem.nodeType; |
||||
if ( !nodeType || !elementNodeTypes[ nodeType ] ) { |
||||
return; |
||||
} |
||||
var childImgs = elem.querySelectorAll('img'); |
||||
// concat childElems to filterFound array
|
||||
for ( var i=0; i < childImgs.length; i++ ) { |
||||
var img = childImgs[i]; |
||||
this.addImage( img ); |
||||
} |
||||
|
||||
// get child background images
|
||||
if ( typeof this.options.background == 'string' ) { |
||||
var children = elem.querySelectorAll( this.options.background ); |
||||
for ( i=0; i < children.length; i++ ) { |
||||
var child = children[i]; |
||||
this.addElementBackgroundImages( child ); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
var elementNodeTypes = { |
||||
1: true, |
||||
9: true, |
||||
11: true |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { |
||||
var style = getComputedStyle( elem ); |
||||
if ( !style ) { |
||||
// Firefox returns null if in a hidden iframe https://bugzil.la/548397
|
||||
return; |
||||
} |
||||
// get url inside url("...")
|
||||
var reURL = /url\((['"])?(.*?)\1\)/gi; |
||||
var matches = reURL.exec( style.backgroundImage ); |
||||
while ( matches !== null ) { |
||||
var url = matches && matches[2]; |
||||
if ( url ) { |
||||
this.addBackground( url, elem ); |
||||
} |
||||
matches = reURL.exec( style.backgroundImage ); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* @param {Image} img |
||||
*/ |
||||
ImagesLoaded.prototype.addImage = function( img ) { |
||||
var loadingImage = new LoadingImage( img ); |
||||
this.images.push( loadingImage ); |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.addBackground = function( url, elem ) { |
||||
var background = new Background( url, elem ); |
||||
this.images.push( background ); |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.check = function() { |
||||
var _this = this; |
||||
this.progressedCount = 0; |
||||
this.hasAnyBroken = false; |
||||
// complete if no images
|
||||
if ( !this.images.length ) { |
||||
this.complete(); |
||||
return; |
||||
} |
||||
|
||||
function onProgress( image, elem, message ) { |
||||
// HACK - Chrome triggers event before object properties have changed. #83
|
||||
setTimeout( function() { |
||||
_this.progress( image, elem, message ); |
||||
}); |
||||
} |
||||
|
||||
this.images.forEach( function( loadingImage ) { |
||||
loadingImage.once( 'progress', onProgress ); |
||||
loadingImage.check(); |
||||
}); |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.progress = function( image, elem, message ) { |
||||
this.progressedCount++; |
||||
this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; |
||||
// progress event
|
||||
this.emitEvent( 'progress', [ this, image, elem ] ); |
||||
if ( this.jqDeferred && this.jqDeferred.notify ) { |
||||
this.jqDeferred.notify( this, image ); |
||||
} |
||||
// check if completed
|
||||
if ( this.progressedCount == this.images.length ) { |
||||
this.complete(); |
||||
} |
||||
|
||||
if ( this.options.debug && console ) { |
||||
console.log( 'progress: ' + message, image, elem ); |
||||
} |
||||
}; |
||||
|
||||
ImagesLoaded.prototype.complete = function() { |
||||
var eventName = this.hasAnyBroken ? 'fail' : 'done'; |
||||
this.isComplete = true; |
||||
this.emitEvent( eventName, [ this ] ); |
||||
this.emitEvent( 'always', [ this ] ); |
||||
if ( this.jqDeferred ) { |
||||
var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; |
||||
this.jqDeferred[ jqMethod ]( this ); |
||||
} |
||||
}; |
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
function LoadingImage( img ) { |
||||
this.img = img; |
||||
} |
||||
|
||||
LoadingImage.prototype = Object.create( EvEmitter.prototype ); |
||||
|
||||
LoadingImage.prototype.check = function() { |
||||
// If complete is true and browser supports natural sizes,
|
||||
// try to check for image status manually.
|
||||
var isComplete = this.getIsImageComplete(); |
||||
if ( isComplete ) { |
||||
// report based on naturalWidth
|
||||
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); |
||||
return; |
||||
} |
||||
|
||||
// If none of the checks above matched, simulate loading on detached element.
|
||||
this.proxyImage = new Image(); |
||||
this.proxyImage.addEventListener( 'load', this ); |
||||
this.proxyImage.addEventListener( 'error', this ); |
||||
// bind to image as well for Firefox. #191
|
||||
this.img.addEventListener( 'load', this ); |
||||
this.img.addEventListener( 'error', this ); |
||||
this.proxyImage.src = this.img.src; |
||||
}; |
||||
|
||||
LoadingImage.prototype.getIsImageComplete = function() { |
||||
return this.img.complete && this.img.naturalWidth !== undefined; |
||||
}; |
||||
|
||||
LoadingImage.prototype.confirm = function( isLoaded, message ) { |
||||
this.isLoaded = isLoaded; |
||||
this.emitEvent( 'progress', [ this, this.img, message ] ); |
||||
}; |
||||
|
||||
// ----- events ----- //
|
||||
|
||||
// trigger specified handler for event type
|
||||
LoadingImage.prototype.handleEvent = function( event ) { |
||||
var method = 'on' + event.type; |
||||
if ( this[ method ] ) { |
||||
this[ method ]( event ); |
||||
} |
||||
}; |
||||
|
||||
LoadingImage.prototype.onload = function() { |
||||
this.confirm( true, 'onload' ); |
||||
this.unbindEvents(); |
||||
}; |
||||
|
||||
LoadingImage.prototype.onerror = function() { |
||||
this.confirm( false, 'onerror' ); |
||||
this.unbindEvents(); |
||||
}; |
||||
|
||||
LoadingImage.prototype.unbindEvents = function() { |
||||
this.proxyImage.removeEventListener( 'load', this ); |
||||
this.proxyImage.removeEventListener( 'error', this ); |
||||
this.img.removeEventListener( 'load', this ); |
||||
this.img.removeEventListener( 'error', this ); |
||||
}; |
||||
|
||||
// -------------------------- Background -------------------------- //
|
||||
|
||||
function Background( url, element ) { |
||||
this.url = url; |
||||
this.element = element; |
||||
this.img = new Image(); |
||||
} |
||||
|
||||
// inherit LoadingImage prototype
|
||||
Background.prototype = Object.create( LoadingImage.prototype ); |
||||
|
||||
Background.prototype.check = function() { |
||||
this.img.addEventListener( 'load', this ); |
||||
this.img.addEventListener( 'error', this ); |
||||
this.img.src = this.url; |
||||
// check if image is already complete
|
||||
var isComplete = this.getIsImageComplete(); |
||||
if ( isComplete ) { |
||||
this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); |
||||
this.unbindEvents(); |
||||
} |
||||
}; |
||||
|
||||
Background.prototype.unbindEvents = function() { |
||||
this.img.removeEventListener( 'load', this ); |
||||
this.img.removeEventListener( 'error', this ); |
||||
}; |
||||
|
||||
Background.prototype.confirm = function( isLoaded, message ) { |
||||
this.isLoaded = isLoaded; |
||||
this.emitEvent( 'progress', [ this, this.element, message ] ); |
||||
}; |
||||
|
||||
// -------------------------- jQuery -------------------------- //
|
||||
|
||||
ImagesLoaded.makeJQueryPlugin = function( jQuery ) { |
||||
jQuery = jQuery || window.jQuery; |
||||
if ( !jQuery ) { |
||||
return; |
||||
} |
||||
// set local variable
|
||||
$ = jQuery; |
||||
// $().imagesLoaded()
|
||||
$.fn.imagesLoaded = function( options, callback ) { |
||||
var instance = new ImagesLoaded( this, options, callback ); |
||||
return instance.jqDeferred.promise( $(this) ); |
||||
}; |
||||
}; |
||||
// try making plugin
|
||||
ImagesLoaded.makeJQueryPlugin(); |
||||
|
||||
// -------------------------- -------------------------- //
|
||||
|
||||
return ImagesLoaded; |
||||
|
||||
}); |
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,47 @@ |
||||
{ |
||||
"name": "qtip2", |
||||
"description": "Introducing... qTip2. The second generation of the advanced qTip plugin for the ever popular jQuery framework.", |
||||
"version": "2.2.1", |
||||
"homepage": "http://qtip2.com", |
||||
"location": "https://github.com/qTip2/bower", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git://github.com/qTip2/qTip2.git" |
||||
}, |
||||
"author": "Craig Michael Thompson <craig@craigsworks.com> (http://craigsworks.com/)", |
||||
"license": [ |
||||
"MIT" |
||||
], |
||||
"keywords": [ |
||||
"tooltip", |
||||
"tooltips", |
||||
"jquery", |
||||
"qtip", |
||||
"qtip2", |
||||
"simpletip", |
||||
"craig thompson", |
||||
"craig michael thompson", |
||||
"craigsworks", |
||||
"craga89" |
||||
], |
||||
"main": [ |
||||
"./jquery.qtip.js", |
||||
"./basic/jquery.qtip.js" |
||||
], |
||||
"ignore": [ |
||||
"bin" |
||||
], |
||||
"dependencies": { |
||||
"jquery": ">=1.6.0", |
||||
"imagesloaded": ">=3.0.0" |
||||
}, |
||||
"_release": "2.2.1", |
||||
"_resolution": { |
||||
"type": "version", |
||||
"tag": "v2.2.1", |
||||
"commit": "2f67997b5449bb4dea568e82966fb35dc11fb84e" |
||||
}, |
||||
"_source": "https://github.com/qTip2/bower.git", |
||||
"_target": "*", |
||||
"_originalSource": "qtip2" |
||||
} |
@ -0,0 +1,4 @@ |
||||
qTip2 Bower Package |
||||
===== |
||||
|
||||
Clone into an existing `qtip2` repo clone, and run the ./bin/build script to generate the files. Then push to the repo. |
@ -0,0 +1,124 @@ |
||||
/* |
||||
* qTip2 - Pretty powerful tooltips - v2.2.1 |
||||
* http://qtip2.com |
||||
* |
||||
* Copyright (c) 2014 |
||||
* Released under the MIT licenses |
||||
* http://jquery.org/license |
||||
* |
||||
* Date: Sun Sep 7 2014 12:09 GMT+0100+0100 |
||||
* Plugins: None |
||||
* Styles: core |
||||
*/ |
||||
.qtip{ |
||||
position: absolute; |
||||
left: -28000px; |
||||
top: -28000px; |
||||
display: none; |
||||
|
||||
max-width: 280px; |
||||
min-width: 50px; |
||||
|
||||
font-size: 10.5px; |
||||
line-height: 12px; |
||||
|
||||
direction: ltr; |
||||
|
||||
box-shadow: none; |
||||
padding: 0; |
||||
} |
||||
|
||||
.qtip-content{ |
||||
position: relative; |
||||
padding: 5px 9px; |
||||
overflow: hidden; |
||||
|
||||
text-align: left; |
||||
word-wrap: break-word; |
||||
} |
||||
|
||||
.qtip-titlebar{ |
||||
position: relative; |
||||
padding: 5px 35px 5px 10px; |
||||
overflow: hidden; |
||||
|
||||
border-width: 0 0 1px; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.qtip-titlebar + .qtip-content{ border-top-width: 0 !important; } |
||||
|
||||
/* Default close button class */ |
||||
.qtip-close{ |
||||
position: absolute; |
||||
right: -9px; top: -9px; |
||||
z-index: 11; /* Overlap .qtip-tip */ |
||||
|
||||
cursor: pointer; |
||||
outline: medium none; |
||||
|
||||
border: 1px solid transparent; |
||||
} |
||||
|
||||
.qtip-titlebar .qtip-close{ |
||||
right: 4px; top: 50%; |
||||
margin-top: -9px; |
||||
} |
||||
|
||||
* html .qtip-titlebar .qtip-close{ top: 16px; } /* IE fix */ |
||||
|
||||
.qtip-titlebar .ui-icon, |
||||
.qtip-icon .ui-icon{ |
||||
display: block; |
||||
text-indent: -1000em; |
||||
direction: ltr; |
||||
} |
||||
|
||||
.qtip-icon, .qtip-icon .ui-icon{ |
||||
-moz-border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
border-radius: 3px; |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.qtip-icon .ui-icon{ |
||||
width: 18px; |
||||
height: 14px; |
||||
|
||||
line-height: 14px; |
||||
text-align: center; |
||||
text-indent: 0; |
||||
font: normal bold 10px/13px Tahoma,sans-serif; |
||||
|
||||
color: inherit; |
||||
background: transparent none no-repeat -100em -100em; |
||||
} |
||||
|
||||
/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */ |
||||
.qtip-focus{} |
||||
|
||||
/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */ |
||||
.qtip-hover{} |
||||
|
||||
/* Default tooltip style */ |
||||
.qtip-default{ |
||||
border: 1px solid #F1D031; |
||||
|
||||
background-color: #FFFFA3; |
||||
color: #555; |
||||
} |
||||
|
||||
.qtip-default .qtip-titlebar{ |
||||
background-color: #FFEF93; |
||||
} |
||||
|
||||
.qtip-default .qtip-icon{ |
||||
border-color: #CCC; |
||||
background: #F1F1F1; |
||||
color: #777; |
||||
} |
||||
|
||||
.qtip-default .qtip-titlebar .qtip-close{ |
||||
border-color: #AAA; |
||||
color: #111; |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@ |
||||
/* qTip2 v2.2.1 | Plugins: None | Styles: core | qtip2.com | Licensed MIT | Sun Sep 07 2014 00:09:32 */ |
||||
|
||||
.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;direction:ltr;box-shadow:none;padding:0}.qtip-content{position:relative;padding:5px 9px;overflow:hidden;text-align:left;word-wrap:break-word}.qtip-titlebar{position:relative;padding:5px 35px 5px 10px;overflow:hidden;border-width:0 0 1px;font-weight:700}.qtip-titlebar+.qtip-content{border-top-width:0!important}.qtip-close{position:absolute;right:-9px;top:-9px;z-index:11;cursor:pointer;outline:0;border:1px solid transparent}.qtip-titlebar .qtip-close{right:4px;top:50%;margin-top:-9px}* html .qtip-titlebar .qtip-close{top:16px}.qtip-icon .ui-icon,.qtip-titlebar .ui-icon{display:block;text-indent:-1000em;direction:ltr}.qtip-icon,.qtip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;text-decoration:none}.qtip-icon .ui-icon{width:18px;height:14px;line-height:14px;text-align:center;text-indent:0;font:400 bold 10px/13px Tahoma,sans-serif;color:inherit;background:-100em -100em no-repeat}.qtip-default{border:1px solid #F1D031;background-color:#FFFFA3;color:#555}.qtip-default .qtip-titlebar{background-color:#FFEF93}.qtip-default .qtip-icon{border-color:#CCC;background:#F1F1F1;color:#777}.qtip-default .qtip-titlebar .qtip-close{border-color:#AAA;color:#111} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,38 @@ |
||||
{ |
||||
"name": "qtip2", |
||||
"description": "Introducing... qTip2. The second generation of the advanced qTip plugin for the ever popular jQuery framework.", |
||||
"version": "2.2.1", |
||||
"homepage": "http://qtip2.com", |
||||
"location": "https://github.com/qTip2/bower", |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git://github.com/qTip2/qTip2.git" |
||||
}, |
||||
"author": "Craig Michael Thompson <craig@craigsworks.com> (http://craigsworks.com/)", |
||||
"license": [ |
||||
"MIT" |
||||
], |
||||
"keywords": [ |
||||
"tooltip", |
||||
"tooltips", |
||||
"jquery", |
||||
"qtip", |
||||
"qtip2", |
||||
"simpletip", |
||||
"craig thompson", |
||||
"craig michael thompson", |
||||
"craigsworks", |
||||
"craga89" |
||||
], |
||||
"main": [ |
||||
"./jquery.qtip.js", |
||||
"./basic/jquery.qtip.js" |
||||
], |
||||
"ignore": [ |
||||
"bin" |
||||
], |
||||
"dependencies": { |
||||
"jquery": ">=1.6.0", |
||||
"imagesloaded": ">=3.0.0" |
||||
} |
||||
} |
@ -0,0 +1,9 @@ |
||||
/* qTip2 v2.2.1 | Plugins: tips modal viewport svg imagemap ie6 | Styles: core basic css3 | qtip2.com | Licensed MIT | Sun Sep 07 2014 00:09:27 */ |
||||
|
||||
/*! |
||||
* imagesLoaded v3.0.4 |
||||
* JavaScript is all like "You images are done yet or what?" |
||||
* MIT License |
||||
*/ |
||||
!function(a){"use strict";function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){return"[object Array]"===i.call(a)}function d(a){var b=[];if(c(a))b=a;else if("number"==typeof a.length)for(var d=0,e=a.length;e>d;d++)b.push(a[d]);else b.push(a);return b}function e(a,c){function e(a,c,g){if(!(this instanceof e))return new e(a,c);"string"==typeof a&&(a=document.querySelectorAll(a)),this.elements=d(a),this.options=b({},this.options),"function"==typeof c?g=c:b(this.options,c),g&&this.on("always",g),this.getImages(),f&&(this.jqDeferred=new f.Deferred);var h=this;setTimeout(function(){h.check()})}function i(a){this.img=a}e.prototype=new a,e.prototype.options={},e.prototype.getImages=function(){this.images=[];for(var a=0,b=this.elements.length;b>a;a++){var c=this.elements[a];"IMG"===c.nodeName&&this.addImage(c);for(var d=c.querySelectorAll("img"),e=0,f=d.length;f>e;e++){var g=d[e];this.addImage(g)}}},e.prototype.addImage=function(a){var b=new i(a);this.images.push(b)},e.prototype.check=function(){function a(a,e){return b.options.debug&&h&&g.log("confirm",a,e),b.progress(a),c++,c===d&&b.complete(),!0}var b=this,c=0,d=this.images.length;if(this.hasAnyBroken=!1,!d)return void this.complete();for(var e=0;d>e;e++){var f=this.images[e];f.on("confirm",a),f.check()}},e.prototype.progress=function(a){this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded;var b=this;setTimeout(function(){b.emit("progress",b,a),b.jqDeferred&&b.jqDeferred.notify(b,a)})},e.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var b=this;setTimeout(function(){if(b.emit(a,b),b.emit("always",b),b.jqDeferred){var c=b.hasAnyBroken?"reject":"resolve";b.jqDeferred[c](b)}})},f&&(f.fn.imagesLoaded=function(a,b){var c=new e(this,a,b);return c.jqDeferred.promise(f(this))});var j={};return i.prototype=new a,i.prototype.check=function(){var a=j[this.img.src];if(a)return void this.useCached(a);if(j[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWidth)return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");var b=this.proxyImage=new Image;c.bind(b,"load",this),c.bind(b,"error",this),b.src=this.img.src},i.prototype.useCached=function(a){if(a.isConfirmed)this.confirm(a.isLoaded,"cached was confirmed");else{var b=this;a.on("confirm",function(a){return b.confirm(a.isLoaded,"cache emitted confirmed"),!0})}},i.prototype.confirm=function(a,b){this.isConfirmed=!0,this.isLoaded=a,this.emit("confirm",this,b)},i.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},i.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},i.prototype.unbindProxyEvents=function(){c.unbind(this.proxyImage,"load",this),c.unbind(this.proxyImage,"error",this)},e}var f=a.jQuery,g=a.console,h="undefined"!=typeof g,i=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],e):a.imagesLoaded=e(a.EventEmitter,a.eventie)}(window); |
||||
//# sourceMappingURL=imagesloaded.pkg.min.map
|
@ -0,0 +1,617 @@ |
||||
/* |
||||
* qTip2 - Pretty powerful tooltips - v2.2.1 |
||||
* http://qtip2.com |
||||
* |
||||
* Copyright (c) 2014 |
||||
* Released under the MIT licenses |
||||
* http://jquery.org/license |
||||
* |
||||
* Date: Sun Sep 7 2014 12:09 GMT+0100+0100 |
||||
* Plugins: tips modal viewport svg imagemap ie6 |
||||
* Styles: core basic css3 |
||||
*/ |
||||
.qtip{ |
||||
position: absolute; |
||||
left: -28000px; |
||||
top: -28000px; |
||||
display: none; |
||||
|
||||
max-width: 280px; |
||||
min-width: 50px; |
||||
|
||||
font-size: 10.5px; |
||||
line-height: 12px; |
||||
|
||||
direction: ltr; |
||||
|
||||
box-shadow: none; |
||||
padding: 0; |
||||
} |
||||
|
||||
.qtip-content{ |
||||
position: relative; |
||||
padding: 5px 9px; |
||||
overflow: hidden; |
||||
|
||||
text-align: left; |
||||
word-wrap: break-word; |
||||
} |
||||
|
||||
.qtip-titlebar{ |
||||
position: relative; |
||||
padding: 5px 35px 5px 10px; |
||||
overflow: hidden; |
||||
|
||||
border-width: 0 0 1px; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.qtip-titlebar + .qtip-content{ border-top-width: 0 !important; } |
||||
|
||||
/* Default close button class */ |
||||
.qtip-close{ |
||||
position: absolute; |
||||
right: -9px; top: -9px; |
||||
z-index: 11; /* Overlap .qtip-tip */ |
||||
|
||||
cursor: pointer; |
||||
outline: medium none; |
||||
|
||||
border: 1px solid transparent; |
||||
} |
||||
|
||||
.qtip-titlebar .qtip-close{ |
||||
right: 4px; top: 50%; |
||||
margin-top: -9px; |
||||
} |
||||
|
||||
* html .qtip-titlebar .qtip-close{ top: 16px; } /* IE fix */ |
||||
|
||||
.qtip-titlebar .ui-icon, |
||||
.qtip-icon .ui-icon{ |
||||
display: block; |
||||
text-indent: -1000em; |
||||
direction: ltr; |
||||
} |
||||
|
||||
.qtip-icon, .qtip-icon .ui-icon{ |
||||
-moz-border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
border-radius: 3px; |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.qtip-icon .ui-icon{ |
||||
width: 18px; |
||||
height: 14px; |
||||
|
||||
line-height: 14px; |
||||
text-align: center; |
||||
text-indent: 0; |
||||
font: normal bold 10px/13px Tahoma,sans-serif; |
||||
|
||||
color: inherit; |
||||
background: transparent none no-repeat -100em -100em; |
||||
} |
||||
|
||||
/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */ |
||||
.qtip-focus{} |
||||
|
||||
/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */ |
||||
.qtip-hover{} |
||||
|
||||
/* Default tooltip style */ |
||||
.qtip-default{ |
||||
border: 1px solid #F1D031; |
||||
|
||||
background-color: #FFFFA3; |
||||
color: #555; |
||||
} |
||||
|
||||
.qtip-default .qtip-titlebar{ |
||||
background-color: #FFEF93; |
||||
} |
||||
|
||||
.qtip-default .qtip-icon{ |
||||
border-color: #CCC; |
||||
background: #F1F1F1; |
||||
color: #777; |
||||
} |
||||
|
||||
.qtip-default .qtip-titlebar .qtip-close{ |
||||
border-color: #AAA; |
||||
color: #111; |
||||
} |
||||
|
||||
|
||||
/*! Light tooltip style */ |
||||
.qtip-light{ |
||||
background-color: white; |
||||
border-color: #E2E2E2; |
||||
color: #454545; |
||||
} |
||||
|
||||
.qtip-light .qtip-titlebar{ |
||||
background-color: #f1f1f1; |
||||
} |
||||
|
||||
|
||||
/*! Dark tooltip style */ |
||||
.qtip-dark{ |
||||
background-color: #505050; |
||||
border-color: #303030; |
||||
color: #f3f3f3; |
||||
} |
||||
|
||||
.qtip-dark .qtip-titlebar{ |
||||
background-color: #404040; |
||||
} |
||||
|
||||
.qtip-dark .qtip-icon{ |
||||
border-color: #444; |
||||
} |
||||
|
||||
.qtip-dark .qtip-titlebar .ui-state-hover{ |
||||
border-color: #303030; |
||||
} |
||||
|
||||
|
||||
/*! Cream tooltip style */ |
||||
.qtip-cream{ |
||||
background-color: #FBF7AA; |
||||
border-color: #F9E98E; |
||||
color: #A27D35; |
||||
} |
||||
|
||||
.qtip-cream .qtip-titlebar{ |
||||
background-color: #F0DE7D; |
||||
} |
||||
|
||||
.qtip-cream .qtip-close .qtip-icon{ |
||||
background-position: -82px 0; |
||||
} |
||||
|
||||
|
||||
/*! Red tooltip style */ |
||||
.qtip-red{ |
||||
background-color: #F78B83; |
||||
border-color: #D95252; |
||||
color: #912323; |
||||
} |
||||
|
||||
.qtip-red .qtip-titlebar{ |
||||
background-color: #F06D65; |
||||
} |
||||
|
||||
.qtip-red .qtip-close .qtip-icon{ |
||||
background-position: -102px 0; |
||||
} |
||||
|
||||
.qtip-red .qtip-icon{ |
||||
border-color: #D95252; |
||||
} |
||||
|
||||
.qtip-red .qtip-titlebar .ui-state-hover{ |
||||
border-color: #D95252; |
||||
} |
||||
|
||||
|
||||
/*! Green tooltip style */ |
||||
.qtip-green{ |
||||
background-color: #CAED9E; |
||||
border-color: #90D93F; |
||||
color: #3F6219; |
||||
} |
||||
|
||||
.qtip-green .qtip-titlebar{ |
||||
background-color: #B0DE78; |
||||
} |
||||
|
||||
.qtip-green .qtip-close .qtip-icon{ |
||||
background-position: -42px 0; |
||||
} |
||||
|
||||
|
||||
/*! Blue tooltip style */ |
||||
.qtip-blue{ |
||||
background-color: #E5F6FE; |
||||
border-color: #ADD9ED; |
||||
color: #5E99BD; |
||||
} |
||||
|
||||
.qtip-blue .qtip-titlebar{ |
||||
background-color: #D0E9F5; |
||||
} |
||||
|
||||
.qtip-blue .qtip-close .qtip-icon{ |
||||
background-position: -2px 0; |
||||
} |
||||
|
||||
|
||||
.qtip-shadow{ |
||||
-webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); |
||||
-moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); |
||||
box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); |
||||
} |
||||
|
||||
/* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */ |
||||
.qtip-rounded, |
||||
.qtip-tipsy, |
||||
.qtip-bootstrap{ |
||||
-moz-border-radius: 5px; |
||||
-webkit-border-radius: 5px; |
||||
border-radius: 5px; |
||||
} |
||||
|
||||
.qtip-rounded .qtip-titlebar{ |
||||
-moz-border-radius: 4px 4px 0 0; |
||||
-webkit-border-radius: 4px 4px 0 0; |
||||
border-radius: 4px 4px 0 0; |
||||
} |
||||
|
||||
/* Youtube tooltip style */ |
||||
.qtip-youtube{ |
||||
-moz-border-radius: 2px; |
||||
-webkit-border-radius: 2px; |
||||
border-radius: 2px; |
||||
|
||||
-webkit-box-shadow: 0 0 3px #333; |
||||
-moz-box-shadow: 0 0 3px #333; |
||||
box-shadow: 0 0 3px #333; |
||||
|
||||
color: white; |
||||
border: 0 solid transparent; |
||||
|
||||
background: #4A4A4A; |
||||
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,black)); |
||||
background-image: -webkit-linear-gradient(top,#4A4A4A 0,black 100%); |
||||
background-image: -moz-linear-gradient(top,#4A4A4A 0,black 100%); |
||||
background-image: -ms-linear-gradient(top,#4A4A4A 0,black 100%); |
||||
background-image: -o-linear-gradient(top,#4A4A4A 0,black 100%); |
||||
} |
||||
|
||||
.qtip-youtube .qtip-titlebar{ |
||||
background-color: #4A4A4A; |
||||
background-color: rgba(0,0,0,0); |
||||
} |
||||
|
||||
.qtip-youtube .qtip-content{ |
||||
padding: .75em; |
||||
font: 12px arial,sans-serif; |
||||
|
||||
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000); |
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);"; |
||||
} |
||||
|
||||
.qtip-youtube .qtip-icon{ |
||||
border-color: #222; |
||||
} |
||||
|
||||
.qtip-youtube .qtip-titlebar .ui-state-hover{ |
||||
border-color: #303030; |
||||
} |
||||
|
||||
|
||||
/* jQuery TOOLS Tooltip style */ |
||||
.qtip-jtools{ |
||||
background: #232323; |
||||
background: rgba(0, 0, 0, 0.7); |
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323)); |
||||
background-image: -moz-linear-gradient(top, #717171, #232323); |
||||
background-image: -webkit-linear-gradient(top, #717171, #232323); |
||||
background-image: -ms-linear-gradient(top, #717171, #232323); |
||||
background-image: -o-linear-gradient(top, #717171, #232323); |
||||
|
||||
border: 2px solid #ddd; |
||||
border: 2px solid rgba(241,241,241,1); |
||||
|
||||
-moz-border-radius: 2px; |
||||
-webkit-border-radius: 2px; |
||||
border-radius: 2px; |
||||
|
||||
-webkit-box-shadow: 0 0 12px #333; |
||||
-moz-box-shadow: 0 0 12px #333; |
||||
box-shadow: 0 0 12px #333; |
||||
} |
||||
|
||||
/* IE Specific */ |
||||
.qtip-jtools .qtip-titlebar{ |
||||
background-color: transparent; |
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A); |
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)"; |
||||
} |
||||
.qtip-jtools .qtip-content{ |
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323); |
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)"; |
||||
} |
||||
|
||||
.qtip-jtools .qtip-titlebar, |
||||
.qtip-jtools .qtip-content{ |
||||
background: transparent; |
||||
color: white; |
||||
border: 0 dashed transparent; |
||||
} |
||||
|
||||
.qtip-jtools .qtip-icon{ |
||||
border-color: #555; |
||||
} |
||||
|
||||
.qtip-jtools .qtip-titlebar .ui-state-hover{ |
||||
border-color: #333; |
||||
} |
||||
|
||||
|
||||
/* Cluetip style */ |
||||
.qtip-cluetip{ |
||||
-webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); |
||||
-moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); |
||||
box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); |
||||
|
||||
background-color: #D9D9C2; |
||||
color: #111; |
||||
border: 0 dashed transparent; |
||||
} |
||||
|
||||
.qtip-cluetip .qtip-titlebar{ |
||||
background-color: #87876A; |
||||
color: white; |
||||
border: 0 dashed transparent; |
||||
} |
||||
|
||||
.qtip-cluetip .qtip-icon{ |
||||
border-color: #808064; |
||||
} |
||||
|
||||
.qtip-cluetip .qtip-titlebar .ui-state-hover{ |
||||
border-color: #696952; |
||||
color: #696952; |
||||
} |
||||
|
||||
|
||||
/* Tipsy style */ |
||||
.qtip-tipsy{ |
||||
background: black; |
||||
background: rgba(0, 0, 0, .87); |
||||
|
||||
color: white; |
||||
border: 0 solid transparent; |
||||
|
||||
font-size: 11px; |
||||
font-family: 'Lucida Grande', sans-serif; |
||||
font-weight: bold; |
||||
line-height: 16px; |
||||
text-shadow: 0 1px black; |
||||
} |
||||
|
||||
.qtip-tipsy .qtip-titlebar{ |
||||
padding: 6px 35px 0 10px; |
||||
background-color: transparent; |
||||
} |
||||
|
||||
.qtip-tipsy .qtip-content{ |
||||
padding: 6px 10px; |
||||
} |
||||
|
||||
.qtip-tipsy .qtip-icon{ |
||||
border-color: #222; |
||||
text-shadow: none; |
||||
} |
||||
|
||||
.qtip-tipsy .qtip-titlebar .ui-state-hover{ |
||||
border-color: #303030; |
||||
} |
||||
|
||||
|
||||
/* Tipped style */ |
||||
.qtip-tipped{ |
||||
border: 3px solid #959FA9; |
||||
|
||||
-moz-border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
border-radius: 3px; |
||||
|
||||
background-color: #F9F9F9; |
||||
color: #454545; |
||||
|
||||
font-weight: normal; |
||||
font-family: serif; |
||||
} |
||||
|
||||
.qtip-tipped .qtip-titlebar{ |
||||
border-bottom-width: 0; |
||||
|
||||
color: white; |
||||
background: #3A79B8; |
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D)); |
||||
background-image: -webkit-linear-gradient(top, #3A79B8, #2E629D); |
||||
background-image: -moz-linear-gradient(top, #3A79B8, #2E629D); |
||||
background-image: -ms-linear-gradient(top, #3A79B8, #2E629D); |
||||
background-image: -o-linear-gradient(top, #3A79B8, #2E629D); |
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D); |
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)"; |
||||
} |
||||
|
||||
.qtip-tipped .qtip-icon{ |
||||
border: 2px solid #285589; |
||||
background: #285589; |
||||
} |
||||
|
||||
.qtip-tipped .qtip-icon .ui-icon{ |
||||
background-color: #FBFBFB; |
||||
color: #555; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Twitter Bootstrap style. |
||||
* |
||||
* Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11. |
||||
* Does not work with IE 7. |
||||
*/ |
||||
.qtip-bootstrap{ |
||||
/** Taken from Bootstrap body */ |
||||
font-size: 14px; |
||||
line-height: 20px; |
||||
color: #333333; |
||||
|
||||
/** Taken from Bootstrap .popover */ |
||||
padding: 1px; |
||||
background-color: #ffffff; |
||||
border: 1px solid #ccc; |
||||
border: 1px solid rgba(0, 0, 0, 0.2); |
||||
-webkit-border-radius: 6px; |
||||
-moz-border-radius: 6px; |
||||
border-radius: 6px; |
||||
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); |
||||
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); |
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); |
||||
-webkit-background-clip: padding-box; |
||||
-moz-background-clip: padding; |
||||
background-clip: padding-box; |
||||
} |
||||
|
||||
.qtip-bootstrap .qtip-titlebar{ |
||||
/** Taken from Bootstrap .popover-title */ |
||||
padding: 8px 14px; |
||||
margin: 0; |
||||
font-size: 14px; |
||||
font-weight: normal; |
||||
line-height: 18px; |
||||
background-color: #f7f7f7; |
||||
border-bottom: 1px solid #ebebeb; |
||||
-webkit-border-radius: 5px 5px 0 0; |
||||
-moz-border-radius: 5px 5px 0 0; |
||||
border-radius: 5px 5px 0 0; |
||||
} |
||||
|
||||
.qtip-bootstrap .qtip-titlebar .qtip-close{ |
||||
/** |
||||
* Overrides qTip2: |
||||
* .qtip-titlebar .qtip-close{ |
||||
* [...] |
||||
* right: 4px; |
||||
* top: 50%; |
||||
* [...] |
||||
* border-style: solid; |
||||
* } |
||||
*/ |
||||
right: 11px; |
||||
top: 45%; |
||||
border-style: none; |
||||
} |
||||
|
||||
.qtip-bootstrap .qtip-content{ |
||||
/** Taken from Bootstrap .popover-content */ |
||||
padding: 9px 14px; |
||||
} |
||||
|
||||
.qtip-bootstrap .qtip-icon{ |
||||
/** |
||||
* Overrides qTip2: |
||||
* .qtip-default .qtip-icon { |
||||
* border-color: #CCC; |
||||
* background: #F1F1F1; |
||||
* color: #777; |
||||
* } |
||||
*/ |
||||
background: transparent; |
||||
} |
||||
|
||||
.qtip-bootstrap .qtip-icon .ui-icon{ |
||||
/** |
||||
* Overrides qTip2: |
||||
* .qtip-icon .ui-icon{ |
||||
* width: 18px; |
||||
* height: 14px; |
||||
* } |
||||
*/ |
||||
width: auto; |
||||
height: auto; |
||||
|
||||
/* Taken from Bootstrap .close */ |
||||
float: right; |
||||
font-size: 20px; |
||||
font-weight: bold; |
||||
line-height: 18px; |
||||
color: #000000; |
||||
text-shadow: 0 1px 0 #ffffff; |
||||
opacity: 0.2; |
||||
filter: alpha(opacity=20); |
||||
} |
||||
|
||||
.qtip-bootstrap .qtip-icon .ui-icon:hover{ |
||||
/* Taken from Bootstrap .close:hover */ |
||||
color: #000000; |
||||
text-decoration: none; |
||||
cursor: pointer; |
||||
opacity: 0.4; |
||||
filter: alpha(opacity=40); |
||||
} |
||||
|
||||
|
||||
/* IE9 fix - removes all filters */ |
||||
.qtip:not(.ie9haxors) div.qtip-content, |
||||
.qtip:not(.ie9haxors) div.qtip-titlebar{ |
||||
filter: none; |
||||
-ms-filter: none; |
||||
} |
||||
|
||||
|
||||
.qtip .qtip-tip{ |
||||
margin: 0 auto; |
||||
overflow: hidden; |
||||
z-index: 10; |
||||
|
||||
} |
||||
|
||||
/* Opera bug #357 - Incorrect tip position |
||||
https://github.com/Craga89/qTip2/issues/367 */ |
||||
x:-o-prefocus, .qtip .qtip-tip{ |
||||
visibility: hidden; |
||||
} |
||||
|
||||
.qtip .qtip-tip, |
||||
.qtip .qtip-tip .qtip-vml, |
||||
.qtip .qtip-tip canvas{ |
||||
position: absolute; |
||||
|
||||
color: #123456; |
||||
background: transparent; |
||||
border: 0 dashed transparent; |
||||
} |
||||
|
||||
.qtip .qtip-tip canvas{ top: 0; left: 0; } |
||||
|
||||
.qtip .qtip-tip .qtip-vml{ |
||||
behavior: url(#default#VML); |
||||
display: inline-block; |
||||
visibility: visible; |
||||
} |
||||
|
||||
|
||||
#qtip-overlay{ |
||||
position: fixed; |
||||
left: 0; top: 0; |
||||
width: 100%; height: 100%; |
||||
} |
||||
|
||||
/* Applied to modals with show.modal.blur set to true */ |
||||
#qtip-overlay.blurs{ cursor: pointer; } |
||||
|
||||
/* Change opacity of overlay here */ |
||||
#qtip-overlay div{ |
||||
position: absolute; |
||||
left: 0; top: 0; |
||||
width: 100%; height: 100%; |
||||
|
||||
background-color: black; |
||||
|
||||
opacity: 0.7; |
||||
filter:alpha(opacity=70); |
||||
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; |
||||
} |
||||
|
||||
|
||||
.qtipmodal-ie6fix{ |
||||
position: absolute !important; |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue