deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject deltaspike git commit: DELTASPIKE-1149 CLIENTWINDOW tokenizedRedirect should ignore ctrl-key
Date Mon, 23 May 2016 17:13:57 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 5466d6e89 -> 459463ed9


DELTASPIKE-1149 CLIENTWINDOW tokenizedRedirect should ignore ctrl-key

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/459463ed
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/459463ed
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/459463ed

Branch: refs/heads/master
Commit: 459463ed91301b62e321f2345ce9f06fee501a9a
Parents: 5466d6e
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Mon May 23 19:13:44 2016 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Mon May 23 19:13:44 2016 +0200

----------------------------------------------------------------------
 .../resources/deltaspike/windowhandler.js       | 43 ++++++++++++--------
 1 file changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/459463ed/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
index 9789a24..a543b73 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
+++ b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/resources/deltaspike/windowhandler.js
@@ -128,15 +128,22 @@ window.dswh = window.dswh || {
 
                         if (dswh.strategy.CLIENTWINDOW.isHrefDefined(link) === true &&
(!target || target === '_self')) {
                             if (!link.onclick) {
-                                link.onclick = function() {
-                                    if (storeWindowTreeEnabled) {
-                                        dswh.strategy.CLIENTWINDOW.storeWindowTree();
-                                    }
-                                    if (tokenizedRedirectEnabled) {
-                                        dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
-                                        return false;
+                                link.onclick = function(evt) {
+                                    // IE handling added
+                                    evt = evt || window.event;
+                                    
+                                    // skip open in new tab
+                                    if (!evt.ctrlKey) {                                 
  
+                                        if (storeWindowTreeEnabled) {
+                                            dswh.strategy.CLIENTWINDOW.storeWindowTree();
+                                        }
+                                        if (tokenizedRedirectEnabled) {
+                                            dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
+                                            return false;
+                                        }
+
+                                        return true;
                                     }
-                                    return true;
                                 };
                             } else {
                                 // prevent double decoration
@@ -146,18 +153,22 @@ window.dswh = window.dswh || {
                                     (function storeEvent() {
                                         var oldonclick = link.onclick;
                                         link.onclick = function(evt) {
-                                            //ie handling added
+                                            // IE handling added
                                             evt = evt || window.event;
 
                                             var proceed = oldonclick.bind(this)(evt);
                                             if (typeof proceed === 'undefined' || proceed
=== true) {
-                                                if (storeWindowTreeEnabled) {
-                                                    dswh.strategy.CLIENTWINDOW.storeWindowTree();
-                                                }
-
-                                                if (tokenizedRedirectEnabled) {
-                                                    dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
-                                                    return false;
+                                                
+                                                // skip open in new tab
+                                                if (!evt.ctrlKey) { 
+                                                    if (storeWindowTreeEnabled) {
+                                                        dswh.strategy.CLIENTWINDOW.storeWindowTree();
+                                                    }
+
+                                                    if (tokenizedRedirectEnabled) {
+                                                        dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
+                                                        return false;
+                                                    }
                                                 }
                                             }
                                             return proceed;


Mime
View raw message