Unobtrusive Javascript and BeTwittered

I'm far from an expert on the topic of "unobtrusive Javascript," but I've seen some real benefits over the past couple of days. I've spent several hours re-writing BeTwittered, with some design ideas already in my head. One is the need to separate the front end (the web page) from the back end (the server and the data) Another idea was to move heavily to Javascript on the client-side, and to make it unobtrusive. The basic idea is to remove javascript code from the HTML. What you end up with is an HTML page that is easier to understand at a glance, and also lot's of Javascript code that binds to DOM events. The Javascript, in my case, is now much more organized. So far, it's made progress amazingly easy, and made my little hobby a lot more fun. This translates to better productivity.

My opinon? If you are fairly comfortable with HTML and Javascript, it may be time to start looking at separating the two. A Google search on the topic of "unobtrusive javascript" should get you lots of resources to get started. If you are just starting out with HTML and Javascript, if things like the DOM, object properties and "event binding" still lie far outside your comfort zone, you may want to wait a bit. There is a bit of a paradigm shift, so it's probably best to get very comfortable with the basics first. If you are a "pro" you've probably stopped reading this post and maybe cringed a bit at my take on this. I bet I could start a flame war with a comment on an all or nothing approach. :-) But I wont. It looks to me like hiding ALL of the code from the HTML makes it hard to understand what the hell will happen when you serve up a page.

Comments

Update: BeTwittered now

Update: BeTwittered now autodetects width, and makes some changes according to size. the main visible change: The tabs are replaced by a menu, and the adsense ads at the bottom no longer dictate the gadget width (no more horizontal scrollbar effect)
Thanks!
Robert

Hi Alexandre, Thanks very

Hi Alexandre,

Thanks very much for the help on this. I've seen the same issues with people that add BeTwittered in a column in blogspot blogs. I'll dive into this problem to see if I can add some code to detect when BeTwittered is really narrow. I can probably shrink the tabs, ads, dialogs etc.

Again, thanks for pointing this out. I wasn't aware of the gmail integration. I'll check it out.

Robert

hello robert I've been using

hello robert I've been using be twittered gadget for iGoogle for some time and love it. Recently gmail is allowing adding gadgets for gmail in gmail labs, and I figured out betwittered would be a perfect match.

I am contacting you to let you know that be twittered scales rather well to the smaller column of gmail, but still needs some twiks.

For example, the settings panel is too wide and in order to remove buddies photos i had to guess. Secondly the google ad in the bottom forces a horizontal scroll so that i had to force myself to adblock your ad (something i am not comfortable with being a webdeveloper myself). Finally something else is forcing a little horizontal scrol but cant figure out what.

good luck