From 1d342ada5355fbbb092dc29af5996a07732eb182 Mon Sep 17 00:00:00 2001 From: Isaiah Coleman Date: Wed, 15 Jan 2025 13:42:25 -0500 Subject: [PATCH] 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) {