JavaScript

Client-side JavaScript

Talking at MIX09: Las Vegas and the continuum

One of my dreams is going to come true: Since the very first time I attended MIX in 2006, I have wanted to talk there. MIX has a very special meaning for me. It is in the Venetian conference rooms that I heard about Windows Presentation Foundation and what would later become Silverlight. It is there that me and my two colleagues Andreas and James decided that we wanted WPF for the project we had just started at Siemens. A decision that was definitely the right one, from a technical point of view ......

Microsoft to add jQuery in Visual Studio: Why I think it's great

The news took the community by surprise and the reactions are overwhelmingly positive: Microsoft is going to ship jQuery with the ASP.NET MVC framework (very soon) and with Visual Studio (in a near future). For more details, ScottGu and Scott Hanselman are talking about that in a very complete way. I think it's great news on many levels. First, because I hear that jQuery is a great framework. I must admit I never used it, because I didn't do much web development lately (but I will get back to it ......

Google search on my website

I've been wanting to add a search box to my website for quite some time, and also wanted to play with Google AJAX Search API. Turns out it's a very easy API to use! I simply wrapped their search control in a PositionedNode and FadedNode, and added a higher-lever object to "hide" Google's syntax and offer a higher level interface. So from today, you can now use the "Search" menu to search the website and also (in the same dialog) this blog. Google Search API also offers the possibility to search for ......

Updated PositionedNode (DHTML effect) / Arrived in Tacoma

End of January, I made an update to my PositionedNode DHTML effect, but too busy with WPF activities, I never managed to publish it. Having just sat 14 hours in a plane, I finally took the time to do it. There are 4 major changes: With V1.2, it's now possible to use any CSS unit to position the HTML element, for example em, points (pt), pixels (px). This functionality uses the JavaScript class gslb.CssLength. It's now possible to specify all the style attributes in external CSS files, using either ......

Updated FadedNode (DHTML) / Archived old JavaScript pages

This DHTML fading effect, where a given node's opacity changes smoothly from one minimum value to a maximum value and back, has been updated. The update is very minor: Now it's not necessary anymore to define an opacity in the node's "style" attribute. The opacity can be defined in external CSS files, or even not be defined at all (in which case the opacity is equal to 100%). Also, I archived my old "JavaScript consulting" pages. Most of the advices given on these pages are still valid, but the pages ......

JavaScript guidelines published

In agreement with the head of our R&D department, I published my firm's JavaScript Coding Guidelines. I work for Siemens Building Technologies. We developed these guidelines for a web application project in 2004, based on our C# guidelines. Please note the following: The purpose of publishing this document on the World Wide Web is to promote and encourage consistent practices in the JavaScript programming community. We publish this document as information only. Siemens will not accept any responsibility ......

JavaScript: CSS length manipulation and conversion

CssLength class: In the course of improving my DHTML PositionedNode, one thing I really wanted is to be able to handle other units than just pixels. In order to do that, some conversions are needed. To make this easier, I developed a helper class named CssLength. Converting from one unit to the other can be tricky. The conversion depends on quite a few things (mostly the way font size is set in the node's hierarchy in the DOM), and there is not a simple arithmetic way to convert ems to pixels for ......

JavaScript code minimizer (not obfuscator!)

A few years ago, I translated Douglas Crockford's JsMin from C to C#, because we wanted to use this functionality in our build process. JsMin is a code minimizer for JavaScript. It will remove all comments, empty lines, turn tabs into single spaces, etc... The goal is to reduce the size of JavaScript files to the minimum necessary, without modifying the functionality. Additionally to reducing the script's size, JsMin also makes it more difficult to read, however it is not an obfuscator. Objects, ......

DHTML effect: Positioning

Continuing to clean up the DHTML effects I use on my site (see my previous post), I published a Positioning and Scrolling effect. It's quite handy, in that it allows to easily keep a DOM node (DIV, ...) in sight of the user at all times. This can be used, for example, for a "floating menu" like I have on my main page. The DOM node moves with a variable speed. What I especially like in the way this effect is implemented is that the user can specify his own function to calculate the speed of the DOM ......

DHTML effect: Fading

I am working on a new addition to my RealSimpleBlog control (more about that later), and that gives me the occasion to clean up a few DHTML effects I have on my website. The goal is to make a JavaScript library, which, contrarily to the well known prototype.js or others, should be lean and modular, and use advanced JavaScript programming technique while sticking to accepted best practices for JavaScript programming (quite a program... To achieve this, I have one JavaScript file per effect (this allows ......

Saving files with JavaScript: CExplorer (demo)

Many people assume that client-side JavaScript cannot perform file-system operations on the client computer. Actually, the objects needed are often found in the browsers, and the rest is only a matter of compatibility (the way IE saves files is very different from the way Firefox saves files...) and of permissions. In order to perform critical file-system operations, the script must be granted privileges. There are different ways to get these privileges, and unfortunately, these are very different ......

Setting cookies with JavaScript: CCookie

I posted my CCookie JavaScript object in answer to a question asked in comp.lang.javascript. This object offers an abstraction to the cookie interface present in the web browsers, and allows using methods instead of manipulating the cookie string directly. The code is self documented, and I'll extract the documentation soon. To document my JavaScript object, I use an extended version of the XML code documentation used in C#. The extensions allow to specify the type of a parameter, of a return value... ......