74 lines
2.2 KiB
HTML
74 lines
2.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
<title>$script.js demo</title>
|
|
<style type="text/css">
|
|
body {
|
|
overflow: hidden;
|
|
text-align: center;
|
|
font-family: 'helvetica neue', helvetica, arial;
|
|
}
|
|
h1 {
|
|
font-weight: 300;
|
|
}
|
|
</style>
|
|
<script src="../src/script.js"></script>
|
|
<script type="text/javascript">
|
|
// usage
|
|
$script.ready('jquery', function() {
|
|
console.log('jquery is ready');
|
|
})
|
|
.ready('jquery', function() {
|
|
console.log('jquery is still ready');
|
|
})
|
|
.ready('yui', function() {
|
|
console.log('yui is ready');
|
|
})
|
|
.ready('anim', function() {
|
|
console.log('the animation lib is ready');
|
|
})
|
|
.ready(['jquery', 'anim'], function() {
|
|
console.log('jquery and animation are both ready');
|
|
// jQuery and YUI make love together
|
|
new YAHOO.util.ColorAnim($('<h1 id="test">boosh</h1>').appendTo('body'), {
|
|
color: {
|
|
from: '#ee0000',
|
|
to: '#76ee00'
|
|
},
|
|
fontSize: {
|
|
to: 300,
|
|
unit: 'px'
|
|
}
|
|
}, .7, YAHOO.util.Easing.bounceOut).animate();
|
|
})
|
|
|
|
$script('http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js', 'jquery');
|
|
|
|
// duplicate call to same lib. $script.js will not load it
|
|
$script('http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js', 'jqueryagain');
|
|
|
|
// also don't bother loading a file with the same id. bad juju may occur
|
|
$script('http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.js', 'jquery');
|
|
|
|
$script('http://yui.yahooapis.com/2.8.2r1/build/yahoo-dom-event/yahoo-dom-event.js', 'yui', function() {
|
|
$script('http://yui.yahooapis.com/2.8.2r1/build/animation/animation-min.js', 'anim');
|
|
});
|
|
|
|
setTimeout(function() {
|
|
// test to make sure deferred 'ready' calls still work
|
|
$script.ready(['jquery', 'anim'], function() {
|
|
console.log('game is still on for jquery and anim');
|
|
})
|
|
.ready('yui', function() {
|
|
console.log('yui stand alone still works');
|
|
});
|
|
|
|
}, 2000);
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
</body>
|
|
</html>
|