Welcome YUI!, script.aculo.us gets fresh
November 21, 2008
We've been hosting most of the big powerhouse Javascript libraries and so far it's been a huge success. However, without YUI!, our collection has been incomplete. Well, I'm not saying that now we're complete and won't add more libraries, just that we're less incomplete than we were... you know what I mean.
Anyways, after getting legal approval (people actually read those licenses), we pushed it live. We are equally as excited about this as Yahoo! and the Javascript community.
So let's take a look at how you use it:
<head>That code will load the YUI loader which then loads the button and calendar widgets (combined as one script) and calls onSuccess when they are loaded. If lazy loading scripts isn't your thing, then you can use the dependency configurator to configure the perfect script URL. In my case, to achieve the same results as above, I would use:
<script src="http://www.google.com/jsapi" type="text/javascript"
charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
google.load('yui', '2.6.0');
function init() {
var loader = new YAHOO.util.YUILoader({
require: ["button", "calendar"],
base: "http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/",
onSuccess: function() {
// start playing with buttons and calendars!
}
});
loader.insert();
}
google.setOnLoadCallback(init);
</script>
</head>
<body>
<div id="calContainer"></div>
</body>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/button/assets/skins/sam/button.css">Also, we've updated script.aculo.us to the new minor release version 1.8.2. For those of you who are using our aliases, you've already been updated!
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/calendar/assets/skins/sam/calendar.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/element/element-beta-min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/button/button-min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/calendar/calendar-min.js"></script>
As always, stop by in our group or IRC channel to give us a piece of your mind.