Minor sanity check fixes in functions - don't attempt to deep clone an object that might not exist, check for the existance of a native Array.swap before implementing our own, and properly check for jQuery support when displaying changes (ideally this'll be moved out anyway)

This commit is contained in:
Veno Server 2009-10-02 02:16:49 -05:00
parent f865073ea8
commit 30e385c55f

View file

@ -6,12 +6,14 @@
/* Define some basic prototypes that we'll require later.. */
if(!Array.prototype.swap) {
Array.prototype.swap = function(a, b) {
var tmp = this[a];
this[a] = this[b];
this[b] = tmp;
return true; /* For the sake of being complete */
}
}
/* allows numeric sorting for built in js sort */
function sortNumber(a,b) { return a - b;}
@ -42,6 +44,7 @@ var franz = {
},
clone: function(obj) {
if(typeof obj !== "undefined") {
/* Recursively iterate through objects and clone them (Don't even try to put this on the Object prototype (recursion fail)) */
var returnObj = (obj instanceof Array) ? [] : {};
@ -55,6 +58,7 @@ var franz = {
}
return returnObj;
}
},
loadImg: function(img_src) {
@ -169,7 +173,7 @@ var franz = {
}
document.getElementById("log_colors").innerHTML = docStr;
if(typeof jQuery != "undefined") {
if(typeof jQuery !== "undefined") {
$("#container_bottom").fadeIn("fast");
setTimeout(function() { $("#testLayout").fadeIn("slow"); }, 500);
}