From 03cc1d56c7dee565e7b12b1d0f0f935a1cdcc264 Mon Sep 17 00:00:00 2001 From: Emily Hazlehurst Date: Fri, 17 Jan 2025 17:20:09 +0000 Subject: [PATCH 1/2] CDPT-1994: TypeError: e().offset is undefined (#301) - Check whether the banner exists before getting the offset and top position --- .../app/themes/justice/src/patch/js/ccfw-frontend.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/app/themes/justice/src/patch/js/ccfw-frontend.js b/public/app/themes/justice/src/patch/js/ccfw-frontend.js index 6a6d802c..859b8e79 100644 --- a/public/app/themes/justice/src/patch/js/ccfw-frontend.js +++ b/public/app/themes/justice/src/patch/js/ccfw-frontend.js @@ -56,10 +56,13 @@ import { CCFW } from './ccfw-gtm' this.$el.show() this.$cookieSettingsButton.hide() - // the cookie banner is now at the top, so we scroll to the top - $([document.documentElement, document.body]).animate({ - scrollTop: $('#ccfw-page-banner').offset().top - }, 200) + const banner = $('#ccfw-page-banner'); + // If the cookie banner exists, scroll to the top + if (banner.length > 0) { + $([document.documentElement, document.body]).animate({ + scrollTop: banner.offset().top + }, 200) + } }, hideBanner: function () { this.$el.hide() From 97533a6eda72a2e25ef7adc2e60355368dd2c675 Mon Sep 17 00:00:00 2001 From: Emily Hazlehurst Date: Fri, 17 Jan 2025 17:35:46 +0000 Subject: [PATCH 2/2] CDPT-2273: TypeError: l() is not a function (#302) - Remove legacy code referring to a slider component that's no longer in use --- .../themes/justice/src/js/legacy/scripts.js | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/public/app/themes/justice/src/js/legacy/scripts.js b/public/app/themes/justice/src/js/legacy/scripts.js index f114b8cf..16df259a 100644 --- a/public/app/themes/justice/src/js/legacy/scripts.js +++ b/public/app/themes/justice/src/js/legacy/scripts.js @@ -7,25 +7,6 @@ jQuery(document).ready(function () { * The following code is legacy and is not yet fully understood. */ - //tab-group - jQuery('.tab-group .tabs').each(function () { - //get tabs for this group - jQuery(this).children('li').each(function (i) { - jQuery(this).click(function (e, auto) { - if (typeof auto == "undefined") jQuery(document).stopTime('highlight'); - e.preventDefault(); - var thisTabGrp = jQuery(this).closest('.tab-group'); - //toggle selected tab - jQuery(thisTabGrp).children('.tabs').children('li.selected').removeClass(); - jQuery(this).addClass('selected'); - //toggle tab contents - jQuery(thisTabGrp).children('.tab-content').children().each(function (j) { - i == j ? jQuery(this).fadeIn(250, 'swing') : jQuery(this).fadeOut(250, 'swing'); - }); - }); - }); - }); - //top nav sub jQuery('.menu-top li[class!="more"] .flyout-container div[class^="content"]').each(function () { var cols = 1; @@ -57,15 +38,6 @@ jQuery(document).ready(function () { } }); - //highlight auto-cycle - if (jQuery('#highlight').length > 0) { - setInterval(function() { - var index = jQuery('#highlight .tabs li.selected').index(); - var size = jQuery('#highlight .tabs li').length; - index < size - 1 ? jQuery('#highlight .tabs li:eq(' + (index + 1) + ')').trigger('click', ['auto']) : jQuery('#highlight .tabs li:eq(0)').trigger('click', ['auto']); - }, 5000); - } - //split lv2-listing if (jQuery('div.lv2-listing').length > 0) { var ul = '