YUI introduction to build hack interfaces
Upcoming SlideShare
Loading in...5
×
 

YUI introduction to build hack interfaces

on

  • 5,350 views

 

Statistics

Views

Total Views
5,350
Views on SlideShare
5,237
Embed Views
113

Actions

Likes
1
Downloads
60
Comments
0

7 Embeds 113

http://developer.yahoo.net 69
http://developer.yahoo.com 25
http://icant.co.uk 5
file:// 5
http://www.slideshare.net 4
http://searchlogger.net 4
http://www.hanrss.com 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

YUI introduction to build hack interfaces YUI introduction to build hack interfaces Presentation Transcript

  • The Yahoo User Interface Library (YUI) Christian Heilmann | http://wait-till-i.com | http://scriptingenabled.org Delhi, India, University Hack Day, January 2009
  • Let’s take a walk... ...on the client side
  • The client side is where strange things happen.
  • Browsers render in fascinating and totally wrong ways.
  • Random code from dubious sources interferes with your godlike, clean and high quality code.
  • ...and you fix more than you develop.
  • The web is a total mess!
  • The reason is that things seemingly work.
  • However, you are not the web and neither is your computer.
  • To make things work for Yahoo we needed to find a way to abstract these issues away from us.
  • And this is why we built the YUI.
  • YUI is a framework to build working web applications.
  • It includes CSS solutions to create layouts that work across browsers and allow for predictable typography.
  • And it takes the pain out of writing JavaScript.
  • Last but very much not least it allows you to create applications using tested and working widgets that extend what HTML gives us.
  • Interface Widgets AutoComplete DataTable Button Layout Calendar Menu Rich Text Charts TabView Container
  • Everything is fully documented.
  • http://developer.yahoo.com/yui/docs/
  • And there are almost 300 examples to look at.
  • http://developer.yahoo.com/yui/examples/
  • The controls are driven by custom events to allow for extending and monitoring them.
  • Say for example you want to make sure to securely chain animation sequences...
  • //This is the first animation; this one will //fire when the button is clicked. var move = new YAHOO.util.Anim(quot;animatorquot;, { left: {from:0, to:75} }, 1); //This is the second animation; it will fire //when the first animation is complete. var changeColor = new YAHOO.util.ColorAnim( quot;animatorquot;, { backgroundColor: {from:quot;#003366quot;, to:quot;#ff0000quot;} }, 1); //Here's the chaining glue: We subscribe to the //first animation's onComplete event, and in //our handler we animate the second animation: move.onComplete.subscribe(function() { changeColor.animate(); });
  • //Here we set up our YUI Button and subcribe to //its click event. When clicked, it will //animate the first animation: var start = new YAHOO.widget.Button(quot;startAnimquot;); start.subscribe(quot;clickquot;, function() { //reset the color value to the start so that //the animation can be run multiple times: YAHOO.util.Dom.setStyle(quot;animatorquot;, quot;backgroundColorquot;, quot;#003366quot;); move.animate(); });
  • //You can also make use of the onStart and onTween //custom events in Animation; here, we'll log all //of changeColor's custom events and peek at their //argument signatures: changeColor.onStart.subscribe(function() { YAHOO.log(quot;changeColor animation is starting.quot;, quot;infoquot;, quot;examplequot;); }); changeColor.onTween.subscribe(function(s, o) { YAHOO.log(quot;changeColor onTween firing with these arguments: quot; + YAHOO.lang.dump(o), quot;infoquot;, quot;examplequot;); }); changeColor.onComplete.subscribe(function(s, o) { YAHOO.log(quot;changeColor onComplete firing with these arguments: quot; + YAHOO.lang.dump(o), quot;infoquot;, quot;examplequot;); });
  • All YUI components come as a debug version which log everything that is going on to the logger.
  • All in all YUI allows you to build web interfaces without having to know all the pain that goes on in the browser world.
  • Built on agreed standards Separated into modules each dealing with one task Constant reporting of what is going on Own Debugging environment
  • Let’s hack using YUI!
  • Step 1: Get the page structure built for you.
  • http://developer.yahoo.com/yui/grids/builder/
  • Step 2: Get some nice data, for example photos from Delhi.
  • http://developer.yahoo.com/yql/console/
  • Step 3: Find a nice way to display it – for example a Carousel
  • http://developer.yahoo.com/yui/examples/ carousel/csl_circular.html
  • Step 4: Add tabs for more content
  • http://developer.yahoo.com/yui/tabview/
  • Step 5: Add a menu for other pages
  • http://developer.yahoo.com/yui/menu/
  • Step 6: Add a Map!
  • http://developer.yahoo.com/maps/ajax/
  • And... L I A F
  • http://yuiblog.com/blog/2006/12/14/maps-plus-yui/
  • After you fixed that:
  • http://isithackday.com/hacks/delhi/
  • Of course this is a mashup, not a hack.
  • It is also not creative at all and has been done to death!
  • But it shows you how you can build a working interface
  • THANKS! Christian Heilmann http://wait-till-i.com http://scriptingenabled.org http://twitter.com/codepo8