mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 05:23:21 +00:00
57 lines
2.0 KiB
HTML
57 lines
2.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
<head>
|
|
<title>YUI Loader Utility Example: Loading YUI TreeView and Calendar with the YUI Loader Utility</title>
|
|
</head>
|
|
|
|
<body class="yui-skin-sam">
|
|
|
|
<h1>YUI Loader Utility Example: Loading the YUI Calendar Control with the YUI Loader Utility</h1>
|
|
|
|
<p>In this example, we bring a YUI component onto the page using the <a href="http://developer.yahoo.com/yui/loader/">YUI Loader Utility</a>. This example implements YUI Loader via a <code>YAHOO.util.YUILoader</code> instance. We load the YUI Loader script file, then specify in configuration which component we want loaded on the page — and what we want to do once it <em>is</em> loaded.</p>
|
|
|
|
<div id="calendar_container"></div>
|
|
|
|
<script src="../../build/yuiloader/yuiloader.js"></script>
|
|
|
|
<script>
|
|
|
|
var loader = new YAHOO.util.YUILoader({
|
|
|
|
require: ['calendar'], // what components?
|
|
|
|
base: '../../build/',//where do they live?
|
|
|
|
//filter: "DEBUG", //use debug versions (or apply some
|
|
//some other filter?
|
|
|
|
//loadOptional: true, //load all optional dependencies?
|
|
|
|
//onSuccess is the function that YUI Loader
|
|
//should call when all components are successfully loaded.
|
|
onSuccess: function() {
|
|
//Once the YUI Calendar Control and dependencies are on
|
|
//the page, we'll verify that our target container is
|
|
//available in the DOM and then instantiate a default
|
|
//calendar into it:
|
|
YAHOO.util.Event.onAvailable("calendar_container", function() {
|
|
var myCal = new YAHOO.widget.Calendar("mycal_id", "calendar_container");
|
|
myCal.render();
|
|
})
|
|
},
|
|
|
|
// should a failure occur, the onFailure function will be executed
|
|
onFailure: function(o) {
|
|
alert("error: " + YAHOO.lang.dump(o));
|
|
}
|
|
|
|
});
|
|
|
|
// Calculate the dependency and insert the required scripts and css resources
|
|
// into the document
|
|
loader.insert();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|