Permalink
Browse files

Change pagesearchresults to ignore right-click etc.

I forgot to include this change with "Make the tocresult links have
hrefs, and handler ignores click with modifier".
  • Loading branch information...
1 parent e9eb7d7 commit f656a09a217e491306b44842c7dfa96bc3984b94 @yonran yonran committed Apr 12, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 static/js/views/pagesearchresults.js
@@ -19,6 +19,11 @@ define([
},
onClickAnchor: function(evt) {
+ if (e.button > 0)
+ return;
+ if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
+ return;
+
var $anchor = this.$(evt.currentTarget);
var href = $anchor.attr('href');
@@ -27,10 +32,8 @@ define([
var searchResultsTopVal = this.$searchResults.scrollTop();
var topVal = $('#' + href).offset().top; // ID selection is the fastest
this.$searchResults.scrollTop(searchResultsTopVal + topVal - 60);
- } else if ($anchor.attr('target') !== '_blank') {
- // External link
- // When we scraped, should turn all external relative links to absolute links.
- window.location.href = href;
+ evt.stopPropagation();
+ evt.preventDefault();
}
},

0 comments on commit f656a09

Please sign in to comment.