/** * Function : dump() * Arguments: The data - array,hash(associative array),object * The level - OPTIONAL * Returns : The textual representation of the array. * This function was inspired by the print_r function of PHP. * This will accept some data as the argument and return a * text that will be a more readable version of the * array/hash/object that is given. * Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php */ function dump(arr,level) { var dumped_text = ""; if(!level) level = 0; //The padding given at the beginning of the line. var level_padding = ""; for(var j=0;j \"" + value + "\"\n"; } } } else { //Stings/Chars/Numbers etc. dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; } return dumped_text; } function var_dump(element, limit, depth) { depth = depth?depth:0; limit = limit?limit:1; returnString = '
    '; for(property in element) { //Property domConfig isn't accessable if (property != 'domConfig') { returnString += '
  1. '+ property + ' (' + (typeof element[property]) +')'; if (typeof element[property] == 'number' || typeof element[property] == 'boolean') returnString += ' : ' + element[property] + ''; if (typeof element[property] == 'string' && element[property]) returnString += ':
    ' + element[property].replace(//g, '&gt;') + '
    '; if ((typeof element[property] == 'object') && (depth < limit)) returnString += var_dump(element[property], limit, (depth + 1)); returnString += '
  2. '; } } returnString += '
'; if(depth == 0) { winpop = window.open("", "","width=800,height=600,scrollbars,resizable"); winpop.document.write('
'+returnString+ '
'); winpop.document.close(); } return returnString; } function htmlEncode(s) { //return s; return s.replace(/&(?!\w+([;\s]|$))/g, "&") .replace(//g, ">"); } function addDiv(id_name, div_name, into_div_name, flash, html, script) { var id = $('#'+id_name).val(); html = '
' + html.replace(/%{id}/g, id) .replace(/%{remove(:([^}]*))?}/g, '' + '' + ("$2" == "" ? "$2" : 'remove') + '' + '') + '
'; if (script) { html += ''; } $("#debug").append(htmlEncode(html)); $("#"+into_div_name).append(html); if (flash) { $('#'+div_name+'-'+id) .animate({ backgroundColor: "yellow" }, 300) .animate({ backgroundColor: "white" }, 500); } id = id - 0 + 1; $('#'+id_name).val(id); } function removeElement(elem_id) { $('#'+elem_id).remove(); }