Do everything with javascript

Category Archives: Javascript

Dumping Firefox XUL object

I am not sure is it correct to call it XUL object, what I mean to do is transversing javascript object. It sounds silly as we got firebug but it makes sense when working on firefox addon where the script debugger in firebug doesn’t work for javascript running in chrome.
There is a XUL reference in [...]

Nice way to check dom node className

It happen quite often to me that I need to check the element className in the event handler and to determine what function to trigger. element.className contains all the class name separated by space. e.g. “classA classB classCCC”. So it is bad to check the className like:
if (element.className === “classA”) {…}
or
if (element.className.indexOf(“classC”) > -1) [...]

Detecting page dimension with Javascript

I just come to a problem that need to create a canvas element the will cover on top of the whole page. This prevented me from using style.width and style.height as the drawing will become scaled by the style setting. So I have to calculate the exact page width and height then assign it to [...]

Using custom event on jQuery

When doing Javascript, it is common to handle different DOM event like click, mouseover, keydown… This is cool that with the DOM triggering those events, we can create custom handling / behaviors on it. Say, when user click on the button, a edit panel fade in. But this is not good enough when we have [...]

A play with "frontend application"

After created the yqlClient, it looks like I can do something fun with it. I love investing in stock market that sounds good if I can do something about it.
Here i created a quote panel which use YUI, jquery, flot extension on jquery, my yqlClient…etc. Everything done with HTML, CSS, Javascript. 0 lines PHP. But [...]

A Javascript YQL client

The YQL API support the JSONP format which allow you to specify a Javascript function to handle the data (XML / JSON) return from the API. A normal JSON will return a string which is a javascript object like:
{key1:”value1″,key2:10.35}
While a JSONP will look like:
js_function({key1:”value1″,key2:10.35});
Which the return string from server will be a valid javascript function [...]

Using YQL as crawler for Javascript

It is a good fun to play with Yahoo! Query Language (YQL). YQL is a service enables applications to query, filter, and combine data from different sources across the Internet. Many data in the Yahoo! network can be retrieved from YQL with a SQL like syntax.
SELECT * FROM flickr.photos.search WHERE text=”cat”
Means to do a flickr [...]

Timestamp convertor

I just come across to work with an API related to timestamp and need to do some time unit conversion. Have tried to found some timestamp converter from the web and firefox addon, but none of converter I find suit my need. So just spend a day to create a converter with a calendar on [...]