Restore correct link behavior with modifier keys

Fixes #562
This commit is contained in:
John Firebaugh 2013-12-02 14:25:45 -08:00
parent 031afed7aa
commit 10c8be0cb9

View file

@ -287,8 +287,19 @@ $(document).ready(function () {
OSM.router.load();
$(document).on("click", "a", function(e) {
if (e.isDefaultPrevented() || e.isPropagationStopped()) return;
if (this.host === window.location.host && OSM.router.route(this.pathname + this.search + this.hash)) e.preventDefault();
if (e.isDefaultPrevented() || e.isPropagationStopped())
return;
// Open links in a new tab as normal.
if (e.which > 1 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey)
return;
// Ignore cross-protocol and cross-origin links.
if (location.protocol !== this.protocol || location.host !== this.host)
return;
if (OSM.router.route(this.pathname + this.search + this.hash))
e.preventDefault();
});
$(".search_form").on("submit", function(e) {