From 1d342ada5355fbbb092dc29af5996a07732eb182 Mon Sep 17 00:00:00 2001 From: Isaiah Coleman Date: Wed, 15 Jan 2025 13:42:25 -0500 Subject: [PATCH 1/2] Adding basic tracking for jquery migrate errors through matomo --- pn-site/js/init.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pn-site/js/init.js b/pn-site/js/init.js index 1496a7de..c3d919d8 100644 --- a/pn-site/js/init.js +++ b/pn-site/js/init.js @@ -1,4 +1,5 @@ function init() { + initjQueryMigrate(); jQuery("div#hd h1").on('click', () => { window.location = "/" }); jQuery("li.dialog").each(function(i) { jQuery(this).after("
  • " + this.title + "
  • "); @@ -74,6 +75,16 @@ function init() { getCampaign(); } +function initjQueryMigrate() { + jQuery.migrateMute = true; + jQuery.migrateTrace = false; + jQuery.migrateWarnings.push = (message) => { + stacktrace = new Error().stack; + const cleanedStacktrace = stacktrace.replace(/^.*at jQuery\.migrateWarnings\.push.*$/gm, ''); + _paq.push(['trackEvent', 'warning.jqmigrate', message + '\n' + cleanedStacktrace]); + }; +} + function getPath() { var result = window.location.href.substring(window.location.href.indexOf(window.location.pathname)); if (window.location.search.length > 0) { From 0fc685c9090a976ab6b22d58a037196ac5c0e14a Mon Sep 17 00:00:00 2001 From: Isaiah Coleman Date: Wed, 15 Jan 2025 14:55:53 -0500 Subject: [PATCH 2/2] Cleanup syntax --- pn-site/js/init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pn-site/js/init.js b/pn-site/js/init.js index c3d919d8..b9ced1b9 100644 --- a/pn-site/js/init.js +++ b/pn-site/js/init.js @@ -79,7 +79,7 @@ function initjQueryMigrate() { jQuery.migrateMute = true; jQuery.migrateTrace = false; jQuery.migrateWarnings.push = (message) => { - stacktrace = new Error().stack; + const stacktrace = new Error().stack; const cleanedStacktrace = stacktrace.replace(/^.*at jQuery\.migrateWarnings\.push.*$/gm, ''); _paq.push(['trackEvent', 'warning.jqmigrate', message + '\n' + cleanedStacktrace]); };