1
0
This repository has been archived on 2025-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
redshift-legacy-map/jsdebug.js
mbirth a101d95508 modified abandoned_cellar.js
modified   abandoned_mine.js
modified   beraquel.js
modified   beraquel_forest.js
modified   catacombs.js
modified   caves_of_ngora.js
modified   cellar_of_hranemus.js
modified   decrantes.js
modified   domain_of_ngora.js
modified   dragon_lair.js
modified   dragon_swamp.js
modified   dungeon_of_ngora.js
modified   east_forest.js
modified   east_grendelmoore.js
modified   fire_catacombs.js
modified   fire_empire.js
modified   frozen_catacombs.js
modified   frozen_empire.js
modified   giant_cave.js
modified   grendelmoore.js
modified   home_of_cold_blood.js
modified   home_of_ignorance.js
modified   home_of_patience.js
modified   home_of_tricks.js
modified   jsdebug.js
modified   ksaid_castle_hall.js
modified   ksaid_forest.js
modified   ksaid_greta_house.js
modified   ksaid_passages.js
modified   ksaid_town.js
modified   legacymap.html
modified   legacymap.js
modified   morah_ancient_passage.js
modified   morah_bank_cellar.js
modified   morah_swithand_forest.js
modified   north_grendelmoore.js
modified   ogre_forest.js
modified   sohls_cave.js
modified   sohls_chamber.js
modified   swamp_cave.js
modified   tower_cellar.js
modified   tower_cellar_2.js
modified   tower_level_1.js
modified   tower_level_2.js
modified   tower_level_3.js
modified   tower_level_4.js
modified   unknown_cellar.js
modified   west_forest.js
modified   west_grendelmoore.js
* automatic menu building
2004-12-08 15:29:05 +00:00

94 lines
3.0 KiB
JavaScript

function space(count) {
var o = '';
while (count>0) {
o += ' ';
count--;
}
return o;
}
/**
* Returns object with all siblings as string
* @param objName String name of object to be parsed
* @param depth Number (1 = only values of current object
* 2 = values+objects of current object
* 3 = values+objects+functions of current object
* 4 = values of current and sub-objects
* 5 = values+objects of current and sub-objects
* 6 = values+functions of current and sub-objects)
* @param lev Number Internal use - sub-level
* @return String Pre-formatted with object hierarchy
*/
function getObjectProps(objName, depth, lev) {
if (lev>50) { return ''; }
var obj = eval(objName);
var o = '';
for (var x in obj) {
switch (typeof(obj[x])) {
case 'function':
if (depth==3 || depth==6) {
o += space(lev*2) + objName + '.' + x + ' (' + typeof(obj[x]) + ') = { ... }\n';
}
break;
case 'object':
if (depth>=2) {
switch (x) {
case 'parent':
if (depth != 4) {
o += space(lev*2) + objName + '.' + x + ' ('+typeof(obj[x])+') = { ...PARENT OBJECT... }\n';
}
break;
default:
if (depth>=4) {
if (x.indexOf(' ') != -1 || objName.indexOf('[') != -1) {
obp = getObjectProps(objName+'[\''+x+'\']', depth, lev+1);
} else {
obp = getObjectProps(objName+'.'+x, depth, lev+1);
}
if (obp.indexOf('\n')!=-1) {
o += space(lev*2) + objName + '.' + x + ' ('+typeof(obj[x])+') = {';
o += '\n' + obp;
o += space(lev*2)+'}\n';
} else if (depth!=4) {
o += space(lev*2) + objName + '.' + x + ' ('+typeof(obj[x])+') = { ... }\n';
}
} else {
o += space(lev*2) + objName + '.' + x + ' ('+typeof(obj[x])+') = { ... }\n';
}
break;
}
}
break;
case 'string':
o += space(lev*2) + objName + '.' + x + ' (' + typeof(obj[x]) + ') = \'' + obj[x] + '\'\n';
break;
default:
o += space(lev*2) + objName + '.' + x + ' (' + typeof(obj[x]) + ') = ' + obj[x] + '\n';
break;
}
}
return o;
}
function showObject(objName, depth) {
alert(getObjectProps(objName, depth, 0));
}
function writeObject(objName, depth) {
var obp = getObjectProps(objName, depth, 0);
if (obp.length > 0) {
document.writeln('<PRE>');
document.writeln(obp);
document.writeln('</PRE>');
}
}
function showParsedHTML() {
var jsdwin = window.open();
jsdwin.document.write(document.body.parentNode.outerHTML.replace(/</g, '&lt;'));
}