From 69d5ce74d6f7b8f367bec2b8603ea5cb05ba5593 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Thu, 27 Dec 2012 16:02:32 +0100 Subject: [PATCH] Fix click handler for .clickable items to respect user preference --- frontend/templates/default/shared/main.tpl | 2 +- frontend/templates/default/static/js/cvm.js | 32 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/frontend/templates/default/shared/main.tpl b/frontend/templates/default/shared/main.tpl index d1a78dd..20cada4 100644 --- a/frontend/templates/default/shared/main.tpl +++ b/frontend/templates/default/shared/main.tpl @@ -8,7 +8,7 @@ - +
diff --git a/frontend/templates/default/static/js/cvm.js b/frontend/templates/default/static/js/cvm.js index 5a93a4d..d88304c 100644 --- a/frontend/templates/default/static/js/cvm.js +++ b/frontend/templates/default/static/js/cvm.js @@ -1,9 +1,35 @@ var command_running = false; $(function(){ - $('.clickable').click(function(){ - window.location.href = $(this).data('url'); - }); + $('.clickable').click(function(event) + { + if($(this).data('url')) + { + url = $(this).data('url'); + + if(event.which == 1) + { + if($(this).hasClass('external')) + { + window.open(url); + } + else + { + window.location = url; + } + + event.stopPropagation(); + return false; + } + else if(event.which == 2) + { + window.open(url); + event.stopPropagation(); + return false; + } + } + }); + $('.button-loader').click(function(){ if(command_running === false)