MooTools Archives
Since we’ve already figured out how to create TinyURL URLs remotely using PHP, we may as well create a small Ajax-enabled tiny URL creator. Using MooTools to do so is almost too easy.
The XHTML (Form)
<p><strong>URL:</strong> <input type="text" id="url" size="40" /> <input type="button" id="geturl" value="Get URL" /></p>
<p id="newurl"></p>
We need an input box where the user will enter their a URL, a button to trigger the process, and a placeholder to put the new, tiny URL.
One feature I heard Moo developers hinting at was the future addition of event delegation to the MooTools javascript library. MooTools Core Developer, Aaron Newton, wrote a post today about a plugin he’s created that does just that.
From the article:
Event delegation is a common practice where by you attach an event listener to a parent object to monitor its children rather than attach events to all the children. It’s far more efficient when you have numerous items on a page that you want to interact with.
I don’t know of any concrete plans to incorporate this functionality into MooTools 1.3 but I assume they will. I strongly suggest MooTools developers read Aaron’s article at Clientcide. I also recommend this article for jQuery users as John Resig recently boasted of this addition to jQuery.
The ability to place content into a user’s clipboard can be extremely convenient for the user. Instead of clicking and dragging down what could be a lengthy document, the user can copy the contents of a specific area by a single click of a mouse. Here’s how to use the MooTools Clipboard plugin enhanced by a “messenger” DIV that pops in when content has been copied.
The CSS
.messenger { width:150px; text-align:center; padding:5px 8px; font-weight:bold; position:absolute; right:2%; top:2%; font:12px arial; }
You can make the messenger look however you’d like. The messenger isn’t core to the plugin, so this CSS may not be needed.