Don't move the page around when selecting a specific line in a repo page
diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index 1f8be04..5c54990 100644
--- a/Allura/allura/templates/repo/file.html
+++ b/Allura/allura/templates/repo/file.html
@@ -54,19 +54,19 @@
$(element).bind('click', function() {
// Trick to ignore double and triple clicks
clicks++;
- if (clicks == 1) {
+ if (clicks === 1) {
setTimeout(function() {
- if (clicks == 1) {
+ if (clicks === 1) {
var hash = window.location.hash.substring(1);
if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
$('#' + hash).css('background-color', 'transparent');
}
$(element).css('background-color', '#ffff99');
- window.location.href = '#' + $(element).attr('id');
- };
+ window.history.pushState({}, document.title, window.location.pathname + window.location.search + '#' + $(element).attr('id'));
+ }
clicks = 0;
}, 500);
- };
+ }
});
});
}());