From 791052ddee56b281ad7f5aad3e04e0c9fdaaa69b Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 29 Apr 2015 12:35:54 -0400 Subject: [PATCH] provide a more targetted location setting The previous fix to make #target work correctly failed in an infinite loop on the null case where no hash was set. Trying a more targeted approach. Change-Id: I7deaee9b8a3a3ba815640c7cb2faea84032387bb --- web/share/elastic-recheck.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/web/share/elastic-recheck.js b/web/share/elastic-recheck.js index 8d515c0c..38717f62 100644 --- a/web/share/elastic-recheck.js +++ b/web/share/elastic-recheck.js @@ -42,6 +42,13 @@ function update_graph_for_bug(main, bug) { div.css('height', 'auto'); div.parent().css('opacity', '0.5'); } + + // if we've updated the bug number in question, and our requested + // location is this bug, reset the window location to visually + // scroll us to this point. + if ( ("#" + bug) == window.location.hash ) { + window.location.replace(window.location.href); + } } function update_critical_dates(data) { @@ -93,11 +100,6 @@ function update() { update_graph_for_bug(main, bug); }, 1); }); - - // we have anchor tags, however on first load the relevant - // sections don't exist, so after we load graph points, change - // our anchor as well. - window.location.replace(window.location.href); }); };