From 48b3a2bbfbd4f6dd3647d3d50a763d08a9b0f6d4 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 4 Aug 2021 21:38:12 -0400 Subject: [PATCH] Fix CRM.url to not encode hash on WP --- js/crm.ajax.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 563e57a6df..609e1074a1 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -22,8 +22,12 @@ mode = CRM.config && CRM.config.isFrontend ? 'front' : 'back'; } query = query || ''; - var url, - frag = path.split('?'); + var url, frag, hash = ''; + if (path.indexOf('#') > -1) { + hash = '#' + path.split('#')[1]; + path = path.split('#')[0]; + } + frag = path.split('?'); // Encode url path only if slashes in placeholder were also encoded if (tplURL[mode].indexOf('civicrm/placeholder-url-path') >= 0) { url = tplURL[mode].replace('civicrm/placeholder-url-path', frag[0]); @@ -39,7 +43,7 @@ if (frag[1]) { url += (url.indexOf('?') < 0 ? '?' : '&') + frag[1]; } - return url; + return url + hash; }; $.fn.crmURL = function () { -- 2.25.1