Archive for May, 2008

Flickr Style Image Note Part 1: Hacking the YUI Image Cropper Tool

Friday, May 9th, 2008

I was thinking about how to go about building the image noting service built into flickr as seen above when I ran across the YUI Image Cropper Tool, which contained most of the functionality I wanted. You can view a functional example on YUI’s page at: http://developer.yahoo.com/yui/examples/imagecropper/feedback_crop.html

We are going to base our example from this, and contunie to build onto it throughout many articles.  In this article we will focus on creating the form that moves with the crop tool.

The first step that comes to mind is attaching a form to the selection tool. The first thing to do was to check to see if the crop too is rendered. You can check this by checking to see if the crop tools onready event has fired:

crop.on('contentReady', yourClosure(){});

The second step is fairly straight forward and to create the div with an id and insert the related html:

var tempnod=document.createElement('div');
tempnod.id='vote';
tempnoeinnerHTML='<input type="text" id="comment" value="Comment Here!!">
<br><button id="save" type="button">Save</button>
<button id="cancel" type="button">Cancel</button>';
Dom.get('yui_img_wrap').appendChild(tempnod);

The Third step is to add the event listeners for the save and cancel buttons:

Event.on('save','click',saveFun);
Event.on('cancel','click',cancelFun);

The forth step set the style dynamically in the image cropper’s move event in order to position the form with the crop tool.  Please note the additon of 10 pixels as a bit of buffer space.:

Dom.setStyle('vote','left',region.left+'px');
Dom.setStyle('vote','top',(region.top+region.height+10)+'px');

Don’t forget to set up your styles to reflect your changes and set the orginal cordinates of your comment box:

#vote {
position: absolute;
 left:20px;
 top:125px;
}
#comment{
 margin:2px;
 width:200px;
 background: #FFFFD3;
 text-align:center;
}
#save{
 background: #0063DC;
 color:#fff;
 font-weight:bold;
}
#cancel{
 background: #DDD;
 color:#666;
 font-weight:bold;
}

Feel free to check out a working example at: http://www.zomie.com/examples/imagecomment.html

Later on I will come up with something for the save and cancel functions…

 

Yahoo Media Tech Talk About Shine

Tuesday, May 6th, 2008

My colleagues and I from shine.yahoo.com were asked to give a presentation about the technologies that went into Shine for the Yahoo Media Group. The presentation was titled “The Good, The Bad, and The internalsystemnottobementioned”. My part of the presentation was in regards to the Rich Text Editor used on Shine. Since it was my baby throughout the development of the site. My presentation was titled “How the Text was Won”.  I am sure you can see a theme here…

I have cut up a simple version of the presentation that can be viewed here if you are interested:
http://www.zomie.com/examples/shinerte_simple.pdf

Also feel free to see a few pictures from the tech talk:
http://flickr.com/photos/14261072@N08/tags/ymgtalk/

I will work to publish a few articles about customizing the Rich Text Editor in upcoming months.

 

YUI Tech Talk Mentions Shine’s Rich Text Editor

Sunday, May 4th, 2008

I think you could say I hand a hand in it :P

Dav Glass did a wonderful job on the talk and the widget.  If you want to learn something about Rich Text Editors I suggest watching. 

He starts talking about Shine around 7 mins remaining: