diff --git a/assets-src/js/main/cards.js b/assets-src/js/main/cards.js index c77e58b..660465d 100644 --- a/assets-src/js/main/cards.js +++ b/assets-src/js/main/cards.js @@ -23,11 +23,17 @@ var cardEnhancement = function () { }); } - card.addEventListener('click', function() { - var noTextSelected = !window.getSelection().toString(); + card.addEventListener('click', function(event) { + if (event.redispatched || event.target === mainLink) { + return; + } + + let noTextSelected = !window.getSelection().toString(); if (noTextSelected) { - mainLink.click(); + const event2 = new MouseEvent("click", event); + event2.redispatched = true; + mainLink.dispatchEvent(event2); } }); }); diff --git a/web/dist/js/main.js b/web/dist/js/main.js index 65e1b59..c2c2b40 100644 --- a/web/dist/js/main.js +++ b/web/dist/js/main.js @@ -53,10 +53,15 @@ var cardEnhancement = function cardEnhancement() { }); }); } - card.addEventListener('click', function () { + card.addEventListener('click', function (event) { + if (event.redispatched || event.target === mainLink) { + return; + } var noTextSelected = !window.getSelection().toString(); if (noTextSelected) { - mainLink.click(); + var event2 = new MouseEvent("click", event); + event2.redispatched = true; + mainLink.dispatchEvent(event2); } }); }); diff --git a/web/dist/js/main.min.js b/web/dist/js/main.min.js index d1c685e..8a87404 100644 --- a/web/dist/js/main.min.js +++ b/web/dist/js/main.min.js @@ -1 +1 @@ -!function(){var e=[,function(e,t,n){"use strict";n.r(t),n.d(t,{exists:function(){return r}});var r=function(e){return"undefined"!==e&&null!==e&&(e.length>=0||e.innerHTML.length>=0)}},function(e,t,n){"use strict";n.r(t),n.d(t,{cardEnhancement:function(){return a}});var r=n(1),a=function(){var e=Array.prototype.slice.call(document.querySelectorAll('[data-component="card"]'));(0,r.exists)(e)&&e.forEach((function(e){var t=e.querySelector(".card__link"),n=Array.prototype.slice.call(e.querySelectorAll("[data-click]"));n&&n.forEach((function(e){return e.addEventListener("click",(function(e){return e.stopPropagation()}))})),e.addEventListener("click",(function(){!window.getSelection().toString()&&t.click()}))}))}},function(e,t,n){"use strict";n.r(t),n.d(t,{collapsibles:function(){return a}});var r=n(1),a=function(){var e=Array.prototype.slice.call(document.querySelectorAll('[data-component="collapsibles"]'));(0,r.exists)(e)&&e.forEach((function(e){Array.prototype.slice.call(e.querySelectorAll('[data-heading="collapsibles"]')).forEach((function(e,t){e.innerHTML='',e.nextElementSibling.setAttribute("aria-hidden","true");var n=e.querySelector("button"),r=n.querySelector(".js-collapsible-label");n.addEventListener("click",(function(t){var a="true"===n.getAttribute("aria-expanded");n.setAttribute("aria-expanded",!a),e.nextElementSibling.setAttribute("aria-hidden",a),r.textContent=1==a?"Show":"Hide"}))}))}))}},function(e,t,n){"use strict";n.r(t),n.d(t,{disclosureWidget:function(){return a}});var r=n(1),a=(n(5),function(){var e=Array.prototype.slice.call(document.querySelectorAll('[data-toggle="true"]')),t=function(){e.forEach((function(e){"true"===e.getAttribute("aria-expanded")&&e.setAttribute("aria-expanded","false")}))};(0,r.exists)(e)&&(e.forEach((function(e){e.removeAttribute("style"),e.setAttribute("aria-expanded","false")})),document.addEventListener("click",(function(e){if(e.target.matches('[data-toggle="true"]')){var n=e.target.nextElementSibling;e.target.matches('[aria-expanded="false"]')?(t(),e.target.setAttribute("aria-expanded","true"),n.setAttribute("data-item-expanded","true")):(e.target.setAttribute("aria-expanded","false"),n.removeAttribute("data-item-expanded"))}else{if(e.target.closest('[data-item-expanded="true"]'))return;t()}})),document.addEventListener("keyup",(function(e){if(!e.defaultPrevented){var n=e.key||e.keyCode;"Escape"!==n&&"Esc"!==n&&27!==n||t()}})))})},function(){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null})},function(e,t,n){"use strict";n.r(t),n.d(t,{formErrorSummary:function(){return a}});var r=n(1),a=function(){var e=document.querySelector('[data-component="error-summary"]');(0,r.exists)(e)&&e.focus()}},function(e,t,n){"use strict";n.r(t),n.d(t,{navSingleLevel:function(){return r}}),n(8);var r=function(e,t){e.parentElement;var n=document.querySelector('[data-trigger="mobile-nav"]'),r=Object.assign({},{breakpoint:1024,mobileIcon:''},t);function a(e){e.target.matches('[data-trigger="mobile-nav"]')&&(e.target.matches('[aria-expanded="true"]')?e.target.setAttribute("aria-expanded","false"):e.target.setAttribute("aria-expanded","true"))}function i(e){if(!e.defaultPrevented){var t=e.key||e.keyCode;"Escape"!==t&&"Esc"!==t&&27!==t||"inline-flex"===n.style.display&&n.setAttribute("aria-expanded","false")}}this.init=function(){!function(){n.innerHTML+=r.mobileIcon,n.setAttribute("aria-expanded","false"),n.style.display="inline-flex";var e=r.breakpoint/16,t=window.matchMedia("(min-width: "+e+"em)");function a(e){e.matches?(n.setAttribute("aria-expanded","true"),n.style.display="none"):(n.setAttribute("aria-expanded","false"),n.style.display="inline-flex")}t.addListener(a),a(t)}(),document.addEventListener("click",a),document.addEventListener("keyup",i)}}},function(){"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){"use strict";if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),r=1;r