+
Summary
+
Javascript manipulation time: {{totalJSTime}} ms
+
Javascript onDOMReady time: {{phantomasResults.metrics.domContentLoadedEnd - phantomasResults.metrics.domContentLoaded}} ms
+
Scripts count: {{phantomasResults.metrics.jsCount}}
+
DOM elements count: {{phantomasResults.metrics.DOMelementsCount}}
+
DOM max depth: {{phantomasResults.metrics.DOMelementMaxDepth}}
+
DOM queries: {{phantomasResults.metrics.DOMqueries}}
+
DOM inserts: {{phantomasResults.metrics.DOMinserts}}
+
Events bound: {{phantomasResults.metrics.eventsBound}}
+
document.write() calls: {{phantomasResults.metrics.documentWriteCalls}}
+
eval calls: {{phantomasResults.metrics.evalCalls}}
+
Javascript errors: {{phantomasResults.metrics.jsErrors}}
+
jQuery version: {{phantomasResults.metrics.jQueryVersion}}
+
+ Number of jQuery versions loaded: {{phantomasResults.metrics.jQueryDifferentVersions}}
+ ({{version}} & )
+
+
Javascript interactions with the DOM
@@ -143,6 +176,12 @@
-
+
\ No newline at end of file
diff --git a/app/public/scripts/resultsCtrl.js b/app/public/scripts/resultsCtrl.js
index 7f8a92e..09b39f3 100644
--- a/app/public/scripts/resultsCtrl.js
+++ b/app/public/scripts/resultsCtrl.js
@@ -4,11 +4,25 @@ app.controller('ResultsCtrl', function ($scope) {
// Grab results from nodeJS served page
$scope.phantomasResults = window._phantomas_results;
+ $scope.view = 'summary';
$scope.slowRequestsOn = false;
$scope.slowRequestsLimit = 5;
if ($scope.phantomasResults.offenders && $scope.phantomasResults.offenders.javascriptExecutionTree) {
$scope.javascript = JSON.parse($scope.phantomasResults.offenders.javascriptExecutionTree);
+
+ // Read the main elements of the tree and sum the total time
+ $scope.totalJSTime = 0;
+ treeRunner($scope.javascript, function(node) {
+ if (node.data.time) {
+ $scope.totalJSTime += node.data.time;
+ }
+
+ if (node.data.type !== 'main') {
+ // Don't check the children
+ return false;
+ }
+ });
}
$scope.onNodeDetailsClick = function(node) {
@@ -53,4 +67,13 @@ app.controller('ResultsCtrl', function ($scope) {
return out;
}
+ // Goes on every node of the tree and calls the function fn. If fn returns false on a node, its children won't be checked.
+ function treeRunner(node, fn) {
+ if (fn(node) !== false && node.children) {
+ node.children.forEach(function(child) {
+ treeRunner(child, fn);
+ });
+ }
+ }
+
});
\ No newline at end of file