diff options
-rw-r--r-- | templates/index.phtml | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/templates/index.phtml b/templates/index.phtml index 870eaf8..6887746 100644 --- a/templates/index.phtml +++ b/templates/index.phtml @@ -97,6 +97,8 @@ $("#function_table").trigger("sorton",[[[4,1]]]); $('#callfilter').trigger('keyup'); + if (window.location.hash.length > 2) + openCallInfo(window.location.hash.replace(/[^0-9]/g, '')); } ); } @@ -141,6 +143,7 @@ insertCallInfo(functionNr, 'called_from_table_', 'Called From', data.calledFrom); callInfoLoaded[functionNr] = true; + window.location.hash = "#callinfo_a_"+functionNr; } ); } @@ -188,23 +191,34 @@ } function toggleCallInfo(functionNr) { - if (!callInfoLoaded[functionNr]) { - loadCallInfo(functionNr); + var $ciar = $("#callinfo_area_"+functionNr); + var fmimg = $("#fold_marker_"+functionNr).get(0); + var current = $("#fold_marker_"+functionNr).get(0).src; + if ($ciar.is(":visible")) { + $ciar.hide(); + fmimg.src = 'img/right.gif'; + } else { + if (!callInfoLoaded[functionNr]) { + loadCallInfo(functionNr); + } else { + window.location.hash = "#callinfo_a_"+functionNr; + } + $ciar.show(); + fmimg.src = 'img/down.gif'; } - - $("#callinfo_area_"+functionNr).toggle(); - current = $("#fold_marker_"+functionNr).get(0).src; - if (current.substr(current.lastIndexOf('/')+1) == 'right.gif') - $("#fold_marker_"+functionNr).get(0).src = 'img/down.gif'; - else - $("#fold_marker_"+functionNr).get(0).src = 'img/right.gif'; } function openCallInfo(functionNr) { var areaEl = $("#callinfo_area_"+functionNr); if (areaEl.length) { - if (areaEl.is(":hidden")) toggleCallInfo(functionNr); + if (areaEl.is(":hidden")) { + toggleCallInfo(functionNr); + } else { + window.location.hash = "#callinfo_a_"+functionNr; + } window.scrollTo(0, areaEl.parent().offset().top); + setTimeout(function(){areaEl.parent().parent().css({'background-color' : '#DFECE0'})}, 50); + setTimeout(function(){areaEl.parent().parent().css({'background-color' : ''})}, 600); } } @@ -223,7 +237,7 @@ <img src="img/call_'+data.humanKind+'.png" title="'+data.humanKind+'"> \ </td> \ <td> \ - <a href="javascript:toggleCallInfo('+data.nr+')"> \ + <a id="callinfo_a_'+data.nr+'" href="javascript:toggleCallInfo('+data.nr+')"> \ <img id="fold_marker_'+data.nr+'" src="img/right.gif"> '+data.functionName+' \ </a> \ <div class="callinfo_area" id="callinfo_area_'+data.nr+'"></div> \ @@ -283,7 +297,7 @@ $("#function_table").bind("sortStart",sortBlock).bind("sortEnd",$.unblockUI); if (document.location.hash) { - update(document.location.hash.substr(1)); + update(); } <?php if(Webgrind_Config::$checkVersion):?> @@ -301,6 +315,13 @@ row.css('display', 'none'); }); }); + + if (typeof window.addEventListener == "function") { + window.addEventListener("hashchange", function(e) { + if (window.location.hash.length > 2) + openCallInfo(window.location.hash.replace(/[^0-9]/g, '')); + }); + } }); </script> </head> @@ -311,7 +332,7 @@ <p>profiling in the browser</p> </div> <div id="options"> - <form method="get" onsubmit="update();return false;"> + <form method="get" onsubmit="window.location.hash='';update();return false;"> <div style="float:right;margin-left:10px"> <input type="submit" value="update"> </div> |