serach and replace all "{" width "<div class='expander' onclick='toogle(this.nextSibling)'>{</div>"
serach and replace all "}" width "</div>"
search and replace all "/**\n" width "<div class='comment'>";
search and replace all "*/\n" width "</div><div style='float:right;'>[commentImage]</div>";
etc.
maybe js search functionality...
<head>
<style>
body{ font-family:verdana;}
.file{ display:none;}
h2{ margin:0px, padding:0px; font-size:12pt;
cursor:hand; cursor:pointer;
}
.bracket{
cursor:hand; cursor:pointer;
color:red;
font-weight:bold;
background-color:yellow;
padding-left:10px; padding-right:10px;
}
.cc{
position:absolute;
cursor:hand; cursor:pointer;
color:red;
font-weight:bold;
background-color:yellow;
}
.comment{
color:green;
display:none;
position:absolute;
background-color:#DDDDDD;
border:solid 1px #999999;
}
.inside{
display:none;
border:solid 1px red;
margin:2px;
margin-left:10px;
padding:4px;
}
</style>
<script>
//----------------------------------
function _absLeft(obj) { return (obj.offsetParent)? obj.offsetLeft+_absLeft(obj.offsetParent) : obj.offsetLeft; }
function _absTop(obj) { return (obj.offsetParent)? obj.offsetTop+_absTop(obj.offsetParent) : obj.offsetTop; }
function toggle(obj){ obj.style.display = (obj.style.display == "block") ? obj.style.display = "none" : obj.style.display = "block"; }
//----------------------------------
function showC(e,obj){
var nn = obj.nextSibling;
nn.style.top = _absTop(obj) +"px";
nn.style.left = (_absLeft(obj) + obj.offsetWidth +5 )+"px";
nn.style.display = "block";
}
//----------------------------------
function hideC(e,obj){
var nn = obj.nextSibling;
nn.style.display = "none";
}
//----------------------------------
</script>
</head>
<body>
click on <span class='bracket'>{</span> Symbol and mouseover <span class='cc'>[...]</span>
to open a file: click on the name.
<?php
$start = dirname(__FILE__)."/dyntable/";
getAlljs($start);
/******************************************
* find files recursively all folders and print
*/
function getAlljs($dir){
$files = findMatchFiles($dir, "/.js/i");
if(is_array($files))
foreach($files as $file){
echo "<h2 onclick='toggle(this.nextSibling)'>$file</h2><div class='file'>";
parseFile($dir,$file);
echo "</div><!-- end file $file -->\n\n";
}
$dirs = findDirs($dir);
if(is_array($dirs))
foreach($dirs as $odir){
getAlljs($dir.$odir."/");
}
}
/******************************************
* find files
*/
function parseFile($dir, $file){
$data = file_get_contents($dir.$file);
$data = str_replace(array("\n\n", "{", "}", "/*", "*/"),
array(
"\n",
"<span class='bracket' onclick='toggle(this.nextSibling)'>{</span><span class='inside'>",
"</span>}",
"<span class='cc' onmouseover='showC(event, this)' onmouseout='hideC(event, this)'>[...]</span><div class='comment'>/*",
"*/</div>"), $data);
echo "<pre>\n$data</pre>";
}
/******************************************
* find files
*/
function findMatchFiles($dir,$regexp){
@$dir = dir($dir);
if($dir){
if ($regexp != null) {
while ($file = $dir->read()) {
if (preg_match($regexp, $file)) {
$result_array[] = $file;
}
}
}
$dir->close();
return $result_array;
}else
return array();
}
/******************************************
* find directories
*/
function findDirs($odir){
@$dir = dir($odir);
if($dir){
while ($file = $dir->read()) {
if ($file != "." && $file != "..") {
if (is_dir($odir.$file)) {
$result_array[] = $file;
}
}
}
$dir->close();
return $result_array;
}else
return array();
}
?>
</body>
This topic is archived.