import from la bonne adresse and first refactoring for ouidade.com
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "doc-ready",
|
||||
"version": "1.0.4",
|
||||
"description": "Let's get this party started... on document ready",
|
||||
"main": "doc-ready.js",
|
||||
"dependencies": {
|
||||
"eventie": "^1"
|
||||
},
|
||||
"homepage": "https://github.com/desandro/doc-ready",
|
||||
"authors": [
|
||||
"David DeSandro"
|
||||
],
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"DOM",
|
||||
"document",
|
||||
"ready"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"examples",
|
||||
"package.json",
|
||||
"component.json",
|
||||
"index.html"
|
||||
],
|
||||
"_release": "1.0.4",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "cec8e49744a1e18b14a711eea77e201bb70de544"
|
||||
},
|
||||
"_source": "git://github.com/desandro/doc-ready.git",
|
||||
"_target": "~1.0.4",
|
||||
"_originalSource": "doc-ready"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# docReady
|
||||
|
||||
Cross browser document ready helper. Supported by IE8+ and good browsers.
|
||||
|
||||
```js
|
||||
docReady( function() {
|
||||
console.log("DOM is ready. Let's party");
|
||||
});
|
||||
```
|
||||
|
||||
Props to [dperini/ContentLoaded](https://github.com/dperini/ContentLoaded) for original code
|
||||
|
||||
## Install
|
||||
|
||||
Install with [Bower](http://bower.io) `bower install doc-ready`
|
||||
|
||||
Install with npm `npm install doc-ready`
|
||||
|
||||
Install with [Component](http://github.com/component/component) `component install desandro/doc-ready`
|
||||
|
||||
## MIT License
|
||||
|
||||
docReady is released under the [MIT license](http://desandro.mit-license.org).
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "doc-ready",
|
||||
"version": "1.0.4",
|
||||
"description": "Let's get this party started... on document ready",
|
||||
"main": "doc-ready.js",
|
||||
"dependencies": {
|
||||
"eventie": "^1"
|
||||
},
|
||||
"homepage": "https://github.com/desandro/doc-ready",
|
||||
"authors": [
|
||||
"David DeSandro"
|
||||
],
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"DOM",
|
||||
"document",
|
||||
"ready"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"examples",
|
||||
"package.json",
|
||||
"component.json",
|
||||
"index.html"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*!
|
||||
* docReady v1.0.4
|
||||
* Cross browser DOMContentLoaded event emitter
|
||||
* MIT license
|
||||
*/
|
||||
|
||||
/*jshint browser: true, strict: true, undef: true, unused: true*/
|
||||
/*global define: false, require: false, module: false */
|
||||
|
||||
( function( window ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var document = window.document;
|
||||
// collection of functions to be triggered on ready
|
||||
var queue = [];
|
||||
|
||||
function docReady( fn ) {
|
||||
// throw out non-functions
|
||||
if ( typeof fn !== 'function' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( docReady.isReady ) {
|
||||
// ready now, hit it
|
||||
fn();
|
||||
} else {
|
||||
// queue function when ready
|
||||
queue.push( fn );
|
||||
}
|
||||
}
|
||||
|
||||
docReady.isReady = false;
|
||||
|
||||
// triggered on various doc ready events
|
||||
function onReady( event ) {
|
||||
// bail if already triggered or IE8 document is not ready just yet
|
||||
var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete';
|
||||
if ( docReady.isReady || isIE8NotReady ) {
|
||||
return;
|
||||
}
|
||||
|
||||
trigger();
|
||||
}
|
||||
|
||||
function trigger() {
|
||||
docReady.isReady = true;
|
||||
// process queue
|
||||
for ( var i=0, len = queue.length; i < len; i++ ) {
|
||||
var fn = queue[i];
|
||||
fn();
|
||||
}
|
||||
}
|
||||
|
||||
function defineDocReady( eventie ) {
|
||||
// trigger ready if page is ready
|
||||
if ( document.readyState === 'complete' ) {
|
||||
trigger();
|
||||
} else {
|
||||
// listen for events
|
||||
eventie.bind( document, 'DOMContentLoaded', onReady );
|
||||
eventie.bind( document, 'readystatechange', onReady );
|
||||
eventie.bind( window, 'load', onReady );
|
||||
}
|
||||
|
||||
return docReady;
|
||||
}
|
||||
|
||||
// transport
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( [ 'eventie/eventie' ], defineDocReady );
|
||||
} else if ( typeof exports === 'object' ) {
|
||||
module.exports = defineDocReady( require('eventie') );
|
||||
} else {
|
||||
// browser global
|
||||
window.docReady = defineDocReady( window.eventie );
|
||||
}
|
||||
|
||||
})( window );
|
||||
Reference in New Issue
Block a user