From cffc63a29e91b14f31ab18f5bf119942751adc88 Mon Sep 17 00:00:00 2001 From: Michael Price Date: Mon, 12 Mar 2018 03:01:38 -0400 Subject: [PATCH] Don't navigate on links meant to execute javascript on click. Signed-off-by: Michael Price --- .../static/appearance/js/partial_navigation.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mayan/apps/appearance/static/appearance/js/partial_navigation.js b/mayan/apps/appearance/static/appearance/js/partial_navigation.js index 5a251254fa..dce1136e24 100644 --- a/mayan/apps/appearance/static/appearance/js/partial_navigation.js +++ b/mayan/apps/appearance/static/appearance/js/partial_navigation.js @@ -115,9 +115,19 @@ PartialNavigation.prototype.onAnchorClick = function ($this, event) { return true; } + if (url.indexOf('javascript:;') > -1) { + // Ignore links meant to execute javascript on click. + return true; + } + + if (url === '#') { + // Ignore links with hash at the. + return true; + } + event.preventDefault(); - if ((url !== '#') && !($this.hasClass('disabled') || $this.parent().hasClass('disabled'))) { + if (!($this.hasClass('disabled') || $this.parent().hasClass('disabled'))) { this.setLocation(url); } }