summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpositronium <syroeshka@list.ru>2015-05-13 13:32:23 +0300
committerAlpha <ngcoder@live.com>2015-07-27 10:54:57 -0400
commitf008cca1edaec791d87dc306391fee3e61acda25 (patch)
tree58b1ced3187b01a5a147d15299e9c56eabf94c59
parentdc3539340dba1c6d6308a62a9701fdc3f3343de5 (diff)
downloadwebgrind-f008cca1edaec791d87dc306391fee3e61acda25.zip
webgrind-f008cca1edaec791d87dc306391fee3e61acda25.tar.gz
webgrind-f008cca1edaec791d87dc306391fee3e61acda25.tar.bz2
Now you can use the Back button
-rw-r--r--templates/index.phtml49
1 files changed, 33 insertions, 16 deletions
diff --git a/templates/index.phtml b/templates/index.phtml
index 7c3771a..33e3124 100644
--- a/templates/index.phtml
+++ b/templates/index.phtml
@@ -69,6 +69,8 @@
$("#function_table").trigger("sorton",[[[4,1]]]);
$('#callfilter').trigger('keyup');
+ if (window.location.hash.length > 2)
+ openCallInfo(window.location.hash.replace(/[^0-9]/g, ''));
}
);
}
@@ -114,6 +116,7 @@
callInfoLoaded[functionNr] = true;
+ window.location.hash = "#callinfo_a_"+functionNr;
}
);
@@ -165,26 +168,34 @@
}
function toggleCallInfo(functionNr){
- if(!callInfoLoaded[functionNr]){
- loadCallInfo(functionNr);
- }
-
- $("#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';
+ 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';
+ }
}
-
+
function openCallInfo(functionNr) {
var areaEl = $("#callinfo_area_"+functionNr);
if (areaEl.length) {
if (areaEl.is(":hidden")) toggleCallInfo(functionNr);
- window.scrollTo(0, areaEl.parent().offset().top);
+ else window.location.hash = "#callinfo_a_"+functionNr;
+ window.scrollTo(0, areaEl.parent().offset().top);
+ setTimeout(function(){areaEl.parent().parent().css({'background-color' : '#DFECE0'})}, 300);
+ setTimeout(function(){areaEl.parent().parent().css({'background-color' : ''})}, 600);
}
}
-
+
function functionTableRow(data, linkToFunctionLine){
if (data.file=='php%3Ainternal') {
openLink = '<a title="Lookup function" href="<?php echo ini_get('xdebug.manual_url')?>/'+data.functionName.substr(5)+'" target="_blank"><img src="img/file.png" alt="O"></a>';;
@@ -200,7 +211,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">&nbsp;&nbsp;'+data.functionName+' \
</a> \
<div class="callinfo_area" id="callinfo_area_'+data.nr+'"></div> \
@@ -261,7 +272,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):?>
@@ -279,6 +290,12 @@
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>
@@ -290,7 +307,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>