Brief introduction:
I\'m attempting to get at line number of function definition for parsing documentation comments on only public stuff. I\'ve gotten to the point
Firebug has access to protected Chrome features that ordinary JS does not.
But, JS can still access, the raw source, with comments intact, as long as the same-origin policy does not block access.
For example, this code will get the raw source of all embedded scripts and any scripts loaded from the same domain. :
var scipts = document.querySelectorAll ('script');
for (var J = 0, L = scipts.length; J < L; ++J) {
console.log ('Number: ', J);
var node = scipts[J];
if (!node) continue;
if (node.src) {
//$.get (node.src, function (data) {console.log ('Text: ', data); } );
try {
var req = new XMLHttpRequest();
req.open ('GET', node.src, false);
req.send (null);
if (req.status == 200 || req.status == 304)
console.log ('Text: ', req.responseText);
}
catch (err) {
console.log (err);
}
}
else if (node.innerHTML) {
console.log ('Text: ', node.innerHTML);
}
}
The raw script can then be parsed for line numbers and function definitions, etc.