Posts

Showing posts from June, 2009

The Importance of 'this' Scope Management Through Javascript Event Handlers

During the development of vBulletin 3.x, much of our Javascript code started to take on a far more object-oriented style. With more widespread use of client-side scripting for features that would appear multiple times on a page, such as popup-menus vBMenu and collapsible elements vBCollapse , having encapsulated code made development much easier. With one exception - event handling. Let's take some very simple code to illustrate the problem. The purpose of this code is to force all links to be diverted through a different script. It's overkill, but it illustrates the problem. function linkRedirect(link_element) { this.redirect_base = "http://example.com/redirect?url="; this.link_element = link_element; this.link_element.addEventListener("click", this.handleClick, false); } linkRedirect.prototype.handleClick = function(e) { e.preventDefault(); // The following will not work window.location = this.redirect_base + escape(this.link_element.getAttribut

Garlic and Ginger Chicken Fried Rice

Image
This is a recipe I've been making for a long time now. It's not traditional chinese in any way shape or form, nor does it claim to be. It's just easy to cook and delicious, take it or leave it. Since Jo was diagnosed coeliac, I've had to make a few changes to the recipe, such as making hers with gluten-free ingredients, but essentially it's remained the same since I started cooking it many years ago, with minor tweaks here and there. Firstly, let's have a list of ingredients. Thai fragrant jasmine rice (or american long grain if you can't get jasmine - just not easy cook rice - that stuff is rancid!) Fresh eggs Chicken (or turkey) breasts Frozen peas Fresh root ginger Fresh garlic Light soy sauce (I like to use golden label superior soy, but light soy is fine) Worcestershire sauce (Lea and Perrins) Chinese five-spice powder Chinese shaohsing rice wine (or dry sherry) Pure sesame oil Cornflour / corn starch Salt Monosodium glutamate (MSG, yeah I know I know,

The Leap of Faith

A person told me not so long ago that I was standing on the ledge of a metaphorical window, and that I was under the impression that it was very high up. That person told me that in fact, the window was not high at all, and that I should step back off the ledge and I would find the ground a safe distance below me. That person was wrong. The ground was even further below than I had initially thought. The fall was long and terrifying, and when I finally saw the ground it was far from where I wanted to be.

vBulletin Style Blogs at vBulletin.com

I have now posted part two of my series of blogs detailing some of the highlights of the vBulletin 4 style system. Part one dealt with markup and included some screenshots: First Look: The vBulletin 4.0 Style Part two, posted today, lays out some of the ways that administrators can make use of new features of the style system in vBulletin 4.0: vBulletin 4 - Style Variables

Rainy Days

I've had this account registered for a while now, saving it for a rainy day. Check back from time to time, especially if the forecast is for storms.