* You are viewing Posts Tagged ‘JavaScript’

HeatMap – For Apex Performance 1.1 & GreaseMonkey Alternative

Fixed a problem with HeatMap using Object.extend and the $ function as remnants of its dependence on Prototype.js. It is now fully library independent. It will however, still work with seamlessly with Prototype and JQuery. I am also providing a GreaseMonkey version for all the FireFox users out there. I was pressed by Joe Bauser for the GreaseMonkey version  so he can easily port the code for use in his upcoming FireFox extension aimed at Apex development.

HeatMap stand alone (simple js): HeatMap 1.1

HeatMap GreaseMonkey Script: Heat Map 1.1 GreaseMonkey

Properly Cloning Arrays in JavaScript

This one came up during a discussion about Prototype 1.5.1 while looking through its documentation. Basically when you do the following in JavaScript, you are not copying the array, but rather creating another reference to it. In order to properly clone or duplicate an array you have two choices; loop through the array and copying its values or using the concat method. I personally suggest the concat method since its cleaner and keeps the operations withing the native code of your browser.

function cloneArray( originalArray )
{
return originalArray.concat();
}
As always there is a pre-extended version of this functionality in the Array … Continue Reading