1 2/* ëë²ê·¸ */ 3function debug(text){ 4 var debugLayerObj = $("#debug-layer")[0]; 5 6 text = var_dump(text); 7 8 if(!debugLayerObj){ 9 var debugLayerWrapObj = $("<div class='relative' style='z-index:1000'><div id='debug-layer'></div></div>").prependTo('body'); 10 debugLayerObj = $("#debug-layer")[0]; 11 12 $(debugLayerObj) 13 .css({ 14 'color' : 'red', 15 'font-size' : '11px', 16 'padding' : '10px', 17 'z-index' : '1000' 18 }) 19 .dialog({ 20 'title':'Javascript Debug', 21 'width' : '400', 22 'height' : '200', 23 'position' : 'center' 24 }); 25 } 26 27 var nowTime = new Date().getHours() + ':' + new Date().getMinutes() + ':' + new Date().getSeconds(); 28 29 $(debugLayerObj).dialog('open').html('[' + nowTime + ']<pre> ' + text + '</pre><br />' + debugLayerObj.innerHTML); 30} 31 32/* var_dump */ 33function var_dump(variable, maxdepth, _depth){ 34 var type = _gettype(variable); 35 var length_str = type == 'Array' || type == 'String' ? '(' + variable.length + ')' : ''; 36 var indents = ''; 37 _depth = _depth ? _depth : 0; 38 var return_str = type + length_str + ' '; 39 if(maxdepth && maxdepth == _depth){ 40 try{ 41 if(type == 'String'){ 42 return_str += '"' + _addslashes(variable) + '"'; 43 } 44 else if(type == 'Null'){ 45 return_str += 'null'; 46 } 47 else{ 48 return_str += variable.toString(); 49 } 50 } 51 catch(e){ 52 try{ 53 return_str += variable; 54 } 55 catch(e){ 56 return_str += "[ERROR]" + e.name + ' : ' + e.message; 57 return_str = return_str.replace(/\s*$/,''); 58 } 59 } 60 return return_str; 61 } 62 for(var i=0; i<_depth+1; i++){ 63 indents += '\t'; 64 } 65 if(type == 'Object' || (type != 'Null' && type != 'String' && type != 'Boolean' && type != 'Array' && type != 'Number' && type != 'Function')){ 66 return_str += '{\n'; 67 var tmp_prop = new Array(); 68 for(var prop in variable){ 69 tmp_prop.push(prop); 70 } 71 for(var i=0; i<tmp_prop.length; i++){ 72 return_str += indents + '["' + _addslashes(tmp_prop[i]) + '"] => '; 73 try{ 74 return_str += var_dump(variable[tmp_prop[i]], maxdepth, _depth + 1) + "\n"; 75 } 76 catch(e){ 77 return_str += "[ERROR]" + e.name + ' : ' + e.message; 78 return_str = return_str.replace(/\s*$/,'\n'); 79 } 80 } 81 return_str += indents.substr(1) + '}'; 82 } 83 else if(type == 'Array'){ 84 return_str += '{\n'; 85 for(var i=0; i<variable.length; i++){ 86 return_str += indents + '['+i+'] => '; 87 try{ 88 return_str += var_dump(variable[i], maxdepth, _depth + 1) + "\n"; 89 } 90 catch(e){ 91 return_str += "[ERROR]" + e.name + ' : ' + e.message; 92 return_str = return_str.replace(/\s*$/,'\n'); 93 } 94 } 95 return_str += indents.substr(1) + '}'; 96 } 97 else if(type == 'String'){ 98 return_str += '"' + _addslashes(variable) + '"'; 99 } 100 else if(type == 'Null'){ 101 return_str += 'null'; 102 } 103 else{ 104 return_str += variable.toString(); 105 } 106 return return_str; 107} 108 109function _gettype(variable){ 110 if(variable === null){ 111 var type = 'Null'; 112 } 113 else{ 114 var type = Object.prototype.toString.call(variable); 115 type = type.substr(8,type.length-9); 116 } 117 return type; 118} 119 120function _addslashes(variable){ 121 //Only Single Quotes 122 return variable.replace(/\\/,"\\\\").replace(/"/,"\\\""); 123}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.