From 45a9abebe3bbf9829893e74a449ec65c7ac31f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Fri, 5 Sep 2014 12:05:00 +0200 Subject: [PATCH] Better DOM duplicated queries handling --- app/public/scripts/resultsCtrl.js | 2 +- phantomas_custom/modules/domQYLT/domQYLT.js | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/public/scripts/resultsCtrl.js b/app/public/scripts/resultsCtrl.js index 279a743..cf687ca 100644 --- a/app/public/scripts/resultsCtrl.js +++ b/app/public/scripts/resultsCtrl.js @@ -57,7 +57,7 @@ app.controller('ResultsCtrl', function ($scope) { // Read all the duplicated queries and calculate a more appropriated score $scope.duplicatedQueriesCountAll = 0; if ($scope.phantomasResults.offenders.DOMqueriesDuplicated) { - var regex = /^{.*}: *(\d+) queries$/; + var regex = /\): *(\d+) queries$/; $scope.phantomasResults.offenders.DOMqueriesDuplicated.forEach(function(query) { var regexResult = regex.exec(query); if (regexResult) { diff --git a/phantomas_custom/modules/domQYLT/domQYLT.js b/phantomas_custom/modules/domQYLT/domQYLT.js index 819c501..b79dff3 100644 --- a/phantomas_custom/modules/domQYLT/domQYLT.js +++ b/phantomas_custom/modules/domQYLT/domQYLT.js @@ -221,14 +221,7 @@ exports.module = function(phantomas) { //phantomas.log('DOM query: by %s - "%s" (using %s on context %s)', type, query, fnName, context); phantomas.incrMetric('DOMqueries'); - var domQuery = { - type: type, - query: query, - fnName: fnName, - context: context - }; - - DOMqueries.push(JSON.stringify(domQuery)); + DOMqueries.push(type + ' "' + query + '" with ' + fnName + ' (in context ' + context + ')'); }); phantomas.on('report', function() {