|
@@ -15,9 +15,9 @@ var policies = {
|
|
|
"tool": "phantomas",
|
|
|
"label": "DOM max depth",
|
|
|
"message": "<p>A deep DOM makes the CSS matching with DOM elements difficult.</p><p>It also slows down JavaScript modifications to the DOM because changing the dimensions of an element makes the browser re-calculate the dimensions of it's parents. Same thing for JavaScript events, that bubble up to the document root.</p>",
|
|
|
- "isOkThreshold": 12,
|
|
|
- "isBadThreshold": 22,
|
|
|
- "isAbnormalThreshold": 30,
|
|
|
+ "isOkThreshold": 14,
|
|
|
+ "isBadThreshold": 24,
|
|
|
+ "isAbnormalThreshold": 32,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var domArrays = offenders.map(offendersHelpers.domPathToArray);
|
|
@@ -32,89 +32,38 @@ var policies = {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Number of iframes",
|
|
|
"message": "<p>iFrames are the most complex HTML elements. They are pages, just like the main page, and the browser needs to create a new page context, which has a cost.</p>",
|
|
|
- "isOkThreshold": 3,
|
|
|
+ "isOkThreshold": 4,
|
|
|
"isBadThreshold": 15,
|
|
|
"isAbnormalThreshold": 30,
|
|
|
- "hasOffenders": false
|
|
|
+ "hasOffenders": true
|
|
|
},
|
|
|
"DOMidDuplicated": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "IDs duplicated",
|
|
|
"message": "<p>IDs of HTML elements must be document-wide unique. This can cause problems with getElementById returning the wrong element.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 5,
|
|
|
+ "isBadThreshold": 10,
|
|
|
"isAbnormalThreshold": 50,
|
|
|
- "hasOffenders": true,
|
|
|
- "offendersTransformFn": function(offenders) {
|
|
|
- return {
|
|
|
- count: offenders.length,
|
|
|
- list: offenders.map(function(offender) {
|
|
|
- var parts = /^(.*): ?(\d+) ?occurrences$/.exec(offender);
|
|
|
-
|
|
|
- if (!parts) {
|
|
|
- debug('DOMidDuplicated offenders transform function error with "%s"', offender);
|
|
|
- return {
|
|
|
- parseError: offender
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- id: parts[1],
|
|
|
- occurrences: parseInt(parts[2], 10)
|
|
|
- };
|
|
|
- })
|
|
|
- };
|
|
|
- }
|
|
|
+ "hasOffenders": true
|
|
|
},
|
|
|
- "DOMaccesses": {
|
|
|
- "tool": "jsExecutionTransformer",
|
|
|
- "label": "DOM access",
|
|
|
- "message": "<p>This metric counts the number of calls to DOM related functions (both native DOM functions and jQuery functions) on page load.</p><p>The more your JavaScript code accesses the DOM, the slower the page will load.</p><p>Try, as much as possible, to have an HTML page fully generated by the server instead of making changes with JS.</p><p>Try to reduce the number of queries by refactoring your JavaScript code.</p><p>Binding too many events also has a cost. Try to use <a href=\"https://learn.jquery.com/events/event-delegation/\" target=\"_blank\">event delegation</a> as much as possible.</p>",
|
|
|
- "isOkThreshold": 200,
|
|
|
+ "scriptDuration": {
|
|
|
+ "tool": "phantomas",
|
|
|
+ "label": "Total JS execution time",
|
|
|
+ "message": "<p>This is the number of milliseconds spent by the browser on JavaScript execution during page load.</p><p>For more details, try using the performance tab in Chrome DevTools. It is a bit complicated at first sight, but you'll be able to analyze exactly where this execution time is spent.</p>",
|
|
|
+ "isOkThreshold": 500,
|
|
|
"isBadThreshold": 2000,
|
|
|
"isAbnormalThreshold": 4000,
|
|
|
- "hasOffenders": false
|
|
|
- },
|
|
|
- "queriesWithoutResults": {
|
|
|
- "tool": "jsExecutionTransformer",
|
|
|
- "label": "Queries without result",
|
|
|
- "message": "<p>Number of queries that return no result. Both native and jQuery DOM requests are counted.</p><p>It suggests the query is not used on the page, probably because it is some dead code.</p><p>Or maybe the code is trying to find an HTML block that is not always here. Look at the JS Timeline to see if the scripts correctly figures out the HTML block is not here and immediatly stops interacting further with the DOM.</p>",
|
|
|
- "isOkThreshold": 0,
|
|
|
- "isBadThreshold": 150,
|
|
|
- "isAbnormalThreshold": 250,
|
|
|
- "hasOffenders": false
|
|
|
+ "hasOffenders": false,
|
|
|
+ "unit": 'ms'
|
|
|
},
|
|
|
- "DOMqueriesAvoidable": {
|
|
|
- "tool": "phantomas",
|
|
|
- "label": "Duplicated DOM queries",
|
|
|
- "message": "<p>This is the number of queries that could be avoided by removing all duplicated queries.</p><p>Simply save the result of a query in a variable. Ok it is not always simple, especially with third-party scripts, but at least do it with your own code.</p>",
|
|
|
- "isOkThreshold": 0,
|
|
|
- "isBadThreshold": 300,
|
|
|
- "isAbnormalThreshold": 600,
|
|
|
- "hasOffenders": true,
|
|
|
- "takeOffendersFrom": "DOMqueriesDuplicated",
|
|
|
- "offendersTransformFn": function(offenders) {
|
|
|
- return {
|
|
|
- count: offenders.length,
|
|
|
- list: offenders.map(function(offender) {
|
|
|
- var parts = /^[^"]* ?"(.*)" ?with ?(.*) ?\(in ?context ?(.*)\): ?(.*)\s?queries$/.exec(offender);
|
|
|
-
|
|
|
- if (!parts) {
|
|
|
- debug('DOMqueriesAvoidable offenders transform function error with "%s"', offender);
|
|
|
- return {
|
|
|
- parseError: offender
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- query: parts[1],
|
|
|
- context: offendersHelpers.domPathToDomElementObj(parts[3]),
|
|
|
- fn: parts[2],
|
|
|
- count: parseInt(parts[4], 10)
|
|
|
- };
|
|
|
- })
|
|
|
- };
|
|
|
- }
|
|
|
+ "DOMaccesses": {
|
|
|
+ "tool": "domAccessAgregator",
|
|
|
+ "label": "DOM access",
|
|
|
+ "message": "<p>This metric estimates the number of times the JavaScript reads, changes or binds the DOM.</p><p>The more your JavaScript code accesses the DOM, the slower the page will load.</p><p>Try, as much as possible, to have an HTML page fully generated by the server instead of making changes with JS.</p><p>Try to reduce the number of queries by refactoring your JavaScript code.</p><p>Binding too many events also has a cost.</p>",
|
|
|
+ "isOkThreshold": 500,
|
|
|
+ "isBadThreshold": 2500,
|
|
|
+ "isAbnormalThreshold": 5000,
|
|
|
+ "hasOffenders": true
|
|
|
},
|
|
|
"eventsScrollBound": {
|
|
|
"tool": "phantomas",
|
|
@@ -147,25 +96,13 @@ var policies = {
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
- "DOMaccessesOnScroll": {
|
|
|
- "tool": "jsExecutionTransformer",
|
|
|
- "label": "DOM access on scroll",
|
|
|
- "message": "<p>This rule counts the number of DOM-accessing functions calls on a scroll event, such as queries, readings, writings, bindings and jQuery functions.</p><p>Two scroll events are triggered quickly, one after the other, and only the second one is analyzed so throttled functions are ignored.</p><p>One of the main reasons of a poor scrolling experience is when too much JS is executed on each scroll event. Note that some devices such as smartphones and MacBooks send more scroll events than others.</p><p>Reduce the number of DOM accesses inside scroll listeners. Put DOM queries outside them when possible. Use <a href=\"http://blogorama.nerdworks.in/javascriptfunctionthrottlingan/\" target=\"_blank\">throttling or debouncing</a>.</p>",
|
|
|
- "isOkThreshold": 1,
|
|
|
- "isBadThreshold": 20,
|
|
|
- "isAbnormalThreshold": 35,
|
|
|
- "hasOffenders": true,
|
|
|
- "offendersTransformFn": function(offenders) {
|
|
|
- return offenders;
|
|
|
- }
|
|
|
- },
|
|
|
"jsErrors": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "JavaScript errors",
|
|
|
- "message": "<p>Just to let you know there are some errors on the page.</p><p><b>Please note that some errors only occur in the PhantomJS browser, so you might need to double check on other browsers.</b></p>",
|
|
|
+ "message": "<p>Just to let you know there are some errors on the page.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
"isBadThreshold": 1,
|
|
|
- "isAbnormalThreshold": 4,
|
|
|
+ "isAbnormalThreshold": 5,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return {
|
|
@@ -195,8 +132,8 @@ var policies = {
|
|
|
"label": "document.write calls",
|
|
|
"message": "<p>They slow down the page construction, especially if they are used to insert scripts in the page. Remove them ASAP.</p><p>If you cannot remove them because they come from a third-party script (such as ads), have a look at <a href=\"https://github.com/krux/postscribe\" target=\"_blank\">PostScribe</a>.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 3,
|
|
|
- "isAbnormalThreshold": 8,
|
|
|
+ "isBadThreshold": 2,
|
|
|
+ "isAbnormalThreshold": 6,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return {
|
|
@@ -250,22 +187,13 @@ var policies = {
|
|
|
"isAbnormalThreshold": 1,
|
|
|
"hasOffenders": true
|
|
|
},
|
|
|
- "consoleMessages": {
|
|
|
- "tool": "phantomas",
|
|
|
- "label": "Console messages",
|
|
|
- "message": "<p>Try to keep your console clean when in production. Debugging is good for development only.</p><p>Writing in the console has a cost, especially when dumping large object variables.</p><p>There is also a problem with Internet Explorer 8, not knowing the console object.</p>",
|
|
|
- "isOkThreshold": 3,
|
|
|
- "isBadThreshold": 20,
|
|
|
- "isAbnormalThreshold": 50,
|
|
|
- "hasOffenders": false
|
|
|
- },
|
|
|
"globalVariables": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Global variables",
|
|
|
"message": "<p>It is a bad practice because they clutter up the global namespace. If two scripts use the same variable name in the global scope, it can cause conflicts and it is generally hard to debug.</p><p>Global variables also take a (very) little bit longer to be accessed than variables in the local scope of a function.</p>",
|
|
|
- "isOkThreshold": 40,
|
|
|
- "isBadThreshold": 200,
|
|
|
- "isAbnormalThreshold": 700,
|
|
|
+ "isOkThreshold": 20,
|
|
|
+ "isBadThreshold": 300,
|
|
|
+ "isAbnormalThreshold": 800,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return {
|
|
@@ -347,76 +275,45 @@ var policies = {
|
|
|
"message": "<p>jQuery is a heavy library. You should <b>never</b> load jQuery more than once on the same page.</p>",
|
|
|
"isOkThreshold": 1,
|
|
|
"isBadThreshold": 2,
|
|
|
- "isAbnormalThreshold": 2,
|
|
|
+ "isAbnormalThreshold": 3,
|
|
|
"hasOffenders": true
|
|
|
},
|
|
|
- "jQueryCallsOnEmptyObject": {
|
|
|
- "tool": "jsExecutionTransformer",
|
|
|
- "label": "Calls on empty objects",
|
|
|
- "message": "<p>This metric counts the number of jQuery functions called on an empty jQuery object. The call was useless.</p><p>This can be helpful to detect dead or unused code.</p>",
|
|
|
- "isOkThreshold": 1,
|
|
|
- "isBadThreshold": 100,
|
|
|
- "isAbnormalThreshold": 180,
|
|
|
- "hasOffenders": false
|
|
|
- },
|
|
|
- "jQueryNotDelegatedEvents": {
|
|
|
- "tool": "jsExecutionTransformer",
|
|
|
- "label": "Events not delegated",
|
|
|
- "message": "<p>This is the number of events that are bound with the .bind() or the .on() function without using <a href=\"https://learn.jquery.com/events/event-delegation/\" target=\"_blank\">event delegation</a>.</p><p>This means jQuery binds each element contained in the object one by one. This is bad for performance.</p>",
|
|
|
- "isOkThreshold": 1,
|
|
|
- "isBadThreshold": 100,
|
|
|
- "isAbnormalThreshold": 180,
|
|
|
- "hasOffenders": false
|
|
|
- },
|
|
|
"cssParsingErrors": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "CSS syntax error",
|
|
|
"message": "<p>Yellow Lab Tools failed to parse a CSS file. I doubt the problem comes from the css parser.</p><p>Maybe a <a href=\"http://jigsaw.w3.org/css-validator\" target=\"_blank\">CSS validator</a> can help you.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 1,
|
|
|
+ "isBadThreshold": 2,
|
|
|
"isAbnormalThreshold": 20,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return {
|
|
|
count: offenders.length,
|
|
|
list: offenders.map(function(offender) {
|
|
|
- if (offender === '[inline CSS] (Empty CSS was provided)') {
|
|
|
+ if (offender === '[inline CSS]') {
|
|
|
return {
|
|
|
- error: 'Empty style tag',
|
|
|
+ error: 'Empty <style> tag',
|
|
|
file: null,
|
|
|
line: null,
|
|
|
column: null
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- var parts = /^(?:(?:<([^ \(]*)>|\[inline CSS\]) ?)?(?:\((((?! @ ).)*)(?: @ (\d+):(\d+))?\))?$/.exec(offender);
|
|
|
-
|
|
|
- if (parts) {
|
|
|
+ if (offender.value) {
|
|
|
return {
|
|
|
- error: parts[2] || 'Unknown parsing error' + (parts[1] ? '. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.' : ''),
|
|
|
- file: parts[1] || null,
|
|
|
- line: (parts[4] && parts[5]) ? parseInt(parts[4], 10) : null,
|
|
|
- column: (parts[4] && parts[5]) ? parseInt(parts[5], 10) : null
|
|
|
+ error: offender.value.message || 'Unknown parsing error. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.',
|
|
|
+ file: offender.url || null,
|
|
|
+ line: offender.value.position ? offender.value.position.start.line : null,
|
|
|
+ column: offender.value.position ? offender.value.position.start.column : null
|
|
|
};
|
|
|
- }
|
|
|
-
|
|
|
- // Try another syntax
|
|
|
- parts = /^(.*) <(.*)> @ (\d+):(\d+)$/.exec(offender);
|
|
|
-
|
|
|
- if (parts) {
|
|
|
+ } else {
|
|
|
return {
|
|
|
- error: parts[1] || 'Unknown parsing error',
|
|
|
- file: parts[2] || null,
|
|
|
- line: parseInt(parts[3], 10),
|
|
|
- column: parseInt(parts[4], 10)
|
|
|
+ error: 'Unknown parsing error. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.',
|
|
|
+ file: offender,
|
|
|
+ line: null,
|
|
|
+ column: null
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- debug('cssParsingErrors offenders transform function error with "%s"', offender);
|
|
|
- return {
|
|
|
- parseError: offender
|
|
|
- };
|
|
|
})
|
|
|
};
|
|
|
}
|
|
@@ -425,51 +322,18 @@ var policies = {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Rules count",
|
|
|
"message": "<p>Having a huge number of CSS rules hurts performances. If the number of CSS rules is higher than the number of DOM elements, there is clearly a problem.</p><p>Huge stylesheets generally occur when the different pages of a website load all the CSS, concatenated in a single stylesheet, even if a large part of the rules are page-specific. Solution is to create one main CSS file with global rules and one custom file per page.</p>",
|
|
|
- "isOkThreshold": 1000,
|
|
|
- "isBadThreshold": 3000,
|
|
|
- "isAbnormalThreshold": 4500,
|
|
|
- "hasOffenders": true,
|
|
|
- "offendersTransformFn": function(offenders) {
|
|
|
- var hasInline = false;
|
|
|
- var inlineCount = 0;
|
|
|
- var files = [];
|
|
|
-
|
|
|
- offenders.forEach(function(line) {
|
|
|
- if (line.indexOf('[inline CSS]: ') === 0) {
|
|
|
- hasInline = true;
|
|
|
- inlineCount += parseInt(line.substr(14));
|
|
|
- } else {
|
|
|
- var parts = /^<(.*)>: (\d+)$/.exec(line);
|
|
|
-
|
|
|
- if (parts) {
|
|
|
- files.push({
|
|
|
- file: parts[1],
|
|
|
- rules: parseInt(parts[2], 10)
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if (hasInline) {
|
|
|
- files.push({
|
|
|
- file: 'inline CSS',
|
|
|
- rules: inlineCount
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- count: files.length,
|
|
|
- list: files
|
|
|
- };
|
|
|
- }
|
|
|
+ "isOkThreshold": 2000,
|
|
|
+ "isBadThreshold": 5000,
|
|
|
+ "isAbnormalThreshold": 8000,
|
|
|
+ "hasOffenders": true
|
|
|
},
|
|
|
"cssComplexSelectors": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Complex selectors",
|
|
|
- "message": "<p>Complex selectors are CSS selectors with 4 or more expressions, like \"#header ul li .foo\".</p><p>They are adding more work for the browser, and this could be avoided by simplifying selectors. The <a href=\"http://getbem.com\" target=\"_blank\">B.E.M. methodology</a> is an useful way to simplify your CSS.</p>",
|
|
|
+ "message": "<p>Complex selectors are CSS selectors with 4 or more expressions, like \"#header ul li .foo\".</p><p>They are adding more work for the browser, and this could be avoided by simplifying selectors. The <a href=\"http://getbem.com\" target=\"_blank\">B.E.M. methodology</a> is a useful way to simplify your CSS.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 800,
|
|
|
- "isAbnormalThreshold": 2000,
|
|
|
+ "isBadThreshold": 1000,
|
|
|
+ "isAbnormalThreshold": 24000,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(function(offender) {
|
|
@@ -484,18 +348,18 @@ var policies = {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Colors count",
|
|
|
"message": "<p>This is the number of different colors defined in CSS.</p><p>Your CSS will be easier to maintain if you keep a small color set.</p>",
|
|
|
- "isOkThreshold": 50,
|
|
|
- "isBadThreshold": 150,
|
|
|
- "isAbnormalThreshold": 400,
|
|
|
+ "isOkThreshold": 100,
|
|
|
+ "isBadThreshold": 200,
|
|
|
+ "isAbnormalThreshold": 500,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders, ruleObject) {
|
|
|
var deduplicatedObj = {};
|
|
|
|
|
|
offenders.map(function(offender) {
|
|
|
- var parts = /^([^ ]*) \((\d+) times\)$/.exec(offender);
|
|
|
+ var parts = /^([^ ]*) \((\d+) times\)$/.exec(offender.value.message);
|
|
|
|
|
|
if (!parts) {
|
|
|
- debug('cssColors offenders transform function error with "%s"', offender);
|
|
|
+ debug('cssColors offenders transform function error with "%s"', offender.value.message);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -531,8 +395,8 @@ var policies = {
|
|
|
"label": "Similar colors",
|
|
|
"message": "<p>This is the list of colors found in the stylesheets, that are very close to each other. The eye can barely see the difference.</p><p>Use this list to reduce the number of colors in your palette, it will be easier to maintain.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 40,
|
|
|
- "isAbnormalThreshold": 80,
|
|
|
+ "isBadThreshold": 60,
|
|
|
+ "isAbnormalThreshold": 120,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return {
|
|
@@ -545,9 +409,9 @@ var policies = {
|
|
|
"tool": "mediaQueriesChecker",
|
|
|
"label": "Breakpoints count",
|
|
|
"message": "<p>This is the number of different breakpoints found in the stylesheets' media queries.</p><p>Please note this rule is based on <i>min-width</i>, <i>max-width</i>, <i>min-device-width</i> and <i>max-device-width</i> media queries only.</p><p>Your CSS will be easier to maintain if you keep a reasonable number of breakpoints. Try to make a fluid design - using percents - to avoid the creation of numerous breakpoints.</p>",
|
|
|
- "isOkThreshold": 6,
|
|
|
- "isBadThreshold": 40,
|
|
|
- "isAbnormalThreshold": 60,
|
|
|
+ "isOkThreshold": 10,
|
|
|
+ "isBadThreshold": 50,
|
|
|
+ "isAbnormalThreshold": 80,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var offendersTable = [];
|
|
@@ -567,9 +431,9 @@ var policies = {
|
|
|
"tool": "mediaQueriesChecker",
|
|
|
"label": "Not mobile-first media queries",
|
|
|
"message": "<p>This is the number of CSS rules inside media queries that address small screens.</p><p>The common good practice, when creating a responsive website, is to write it \"mobile-first\". More explanation in <a href=\"http://www.sitepoint.com/introduction-mobile-first-media-queries\" target=\"_blank\">this great article</a>.</p>",
|
|
|
- "isOkThreshold": 50,
|
|
|
- "isBadThreshold": 250,
|
|
|
- "isAbnormalThreshold": 1000,
|
|
|
+ "isOkThreshold": 60,
|
|
|
+ "isBadThreshold": 400,
|
|
|
+ "isAbnormalThreshold": 1200,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return offendersHelpers.orderByFile(offenders);
|
|
@@ -598,12 +462,12 @@ var policies = {
|
|
|
"label": "Duplicated selectors",
|
|
|
"message": "<p>This is when two or more selectors are strictly identical and should be merged.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 50,
|
|
|
- "isAbnormalThreshold": 100,
|
|
|
+ "isBadThreshold": 100,
|
|
|
+ "isAbnormalThreshold": 200,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(function(offender) {
|
|
|
- var parts = /^(.*) \((\d+) times\) ?<(.*)>$/.exec(offender);
|
|
|
+ var parts = /^(.*) \((\d+) times\)$/.exec(offender.value.message);
|
|
|
|
|
|
if (!parts) {
|
|
|
debug('cssDuplicatedSelectors offenders transform function error with "%s"', offender);
|
|
@@ -615,7 +479,7 @@ var policies = {
|
|
|
return {
|
|
|
rule: parts[1],
|
|
|
occurrences: parseInt(parts[2], 10),
|
|
|
- file: parts[3]
|
|
|
+ file: offender.value.url
|
|
|
};
|
|
|
});
|
|
|
|
|
@@ -627,8 +491,8 @@ var policies = {
|
|
|
"label": "Duplicated properties",
|
|
|
"message": "<p>This is the number of property definitions duplicated within a selector.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 60,
|
|
|
- "isAbnormalThreshold": 120,
|
|
|
+ "isBadThreshold": 100,
|
|
|
+ "isAbnormalThreshold": 200,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(function(offender) {
|
|
@@ -661,7 +525,7 @@ var policies = {
|
|
|
"message": "<p>Very easy to fix: remove all empty rules.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
"isBadThreshold": 50,
|
|
|
- "isAbnormalThreshold": 100,
|
|
|
+ "isAbnormalThreshold": 120,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(offendersHelpers.cssOffenderPattern);
|
|
@@ -707,8 +571,8 @@ var policies = {
|
|
|
"label": "Uses of !important",
|
|
|
"message": "<p>It can be useful, but only as a last resort. It is a bad practice because it overrides the normal cascading logic. The more you use !important, the more you need it again to over-override. This conducts to a poor maintainability.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 75,
|
|
|
- "isAbnormalThreshold": 200,
|
|
|
+ "isBadThreshold": 200,
|
|
|
+ "isAbnormalThreshold": 500,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(function(offender) {
|
|
@@ -741,8 +605,8 @@ var policies = {
|
|
|
"label": "Old IE fixes",
|
|
|
"message": "<p>What browser do you need to support? Once you've got the answer, take a look at these old rules that pollute your CSS code and remove them.</p><p>IE6:<ul><li>* html</li><li>html > body (everything but IE6)</li></ul><p><p>IE7:<ul><li><b>*</b>height: 123px;</li><li>height: 123px <b>!ie</b>;</li></ul><p><p>IE9:<ul><li>-ms-filter</li><li>progid:DXImageTransform.Microsoft</li></ul></p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 50,
|
|
|
- "isAbnormalThreshold": 150,
|
|
|
+ "isBadThreshold": 100,
|
|
|
+ "isAbnormalThreshold": 300,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(function(offender) {
|
|
@@ -797,8 +661,8 @@ var policies = {
|
|
|
"label": "Old prefixes",
|
|
|
"message": "<p>Many property prefixes such as -moz- or -webkit- are not needed anymore, or by very few people. Sometimes, they have never even existed. You can remove them or replace them with the non-prefixed version. This will help reducing your stylesheets weight.</p><p>The prefixes database comes from <a href=\"http://caniuse.com/\" target=\"_blank\">Can I Use</a>.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 50,
|
|
|
- "isAbnormalThreshold": 200,
|
|
|
+ "isBadThreshold": 100,
|
|
|
+ "isAbnormalThreshold": 400,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var properties = {};
|
|
@@ -850,8 +714,8 @@ var policies = {
|
|
|
"label": "Redundant body selectors",
|
|
|
"message": "<p>This is one way to remove complexity from a CSS rule. Generally, when \"body\" is specified in a rule it can be removed, because an element is necessarily inside the body.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 60,
|
|
|
- "isAbnormalThreshold": 200,
|
|
|
+ "isBadThreshold": 120,
|
|
|
+ "isAbnormalThreshold": 400,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(function(offender) {
|
|
@@ -868,8 +732,8 @@ var policies = {
|
|
|
"label": "Redundant tags selectors",
|
|
|
"message": "<p>Some tags included inside other tags are obvious. For example, when \"ul li\" is specified in a rule, \"ul\" can be removed because the \"li\" tag is nearly always inside an \"ul\" container (the \"ol\" container is quite rare). Same thing for \"tr td\", \"select option\", ...</p><p>Lowering compexity in CSS selectors can make the page load a little faster.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
- "isBadThreshold": 60,
|
|
|
- "isAbnormalThreshold": 200,
|
|
|
+ "isBadThreshold": 120,
|
|
|
+ "isAbnormalThreshold": 400,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
var parsedOffenders = offenders.map(function(offender) {
|
|
@@ -899,17 +763,17 @@ var policies = {
|
|
|
"totalWeight": {
|
|
|
"tool": "redownload",
|
|
|
"label": "Total weight",
|
|
|
- "message": "<p>The weight is of course very important if you want the page to load fast. Try to stay under 1MB, which is already very long to download over a slow connection.</p><p>Please note that Yellow Lab Tools' engine (PhantomJS) is not compatible with image srcset (unless you use a polyfill). This can lead to incorrect page weight.</p>",
|
|
|
- "isOkThreshold": 1048576,
|
|
|
- "isBadThreshold": 2621440,
|
|
|
- "isAbnormalThreshold": 4194304,
|
|
|
+ "message": "<p>The weight is of course very important if you want the page to load fast. Try to stay under 1MB, which is already very long to download over a slow connection.</p>",
|
|
|
+ "isOkThreshold": 1572864,
|
|
|
+ "isBadThreshold": 3145728,
|
|
|
+ "isAbnormalThreshold": 5242880,
|
|
|
"hasOffenders": true,
|
|
|
"unit": 'bytes'
|
|
|
},
|
|
|
"imageOptimization": {
|
|
|
"tool": "redownload",
|
|
|
"label": "Image optimization",
|
|
|
- "message": "<p>This metric measures the number of bytes that could be saved by optimizing images.</p><p>Image optimization is generally one of the easiest way to reduce a page weight, and as a result, the page load time. Don't use Photoshop or other image editing tools, they're not very good for optimization. Use specialized tools such as <a href=\"https://kraken.io/\" target=\"_blank\">Kraken.io</a> or the excellent <a href=\"https://imageoptim.com/\" target=\"_blank\">ImageOptim</a> on Mac. For SVG images, you can use <a href=\"https://jakearchibald.github.io/svgomg/\" target=\"_blank\">SVGOMG</a></p><p>The tools in use in YellowLabTools are not set to their maximum optimization power (JPEG quality 85), so you might be able to compress even more!</p><p>Please note that Yellow Lab Tools' engine (PhantomJS) is not compatible with image srcset (unless you use a polyfill). This can lead to incorrect page weight.</p>",
|
|
|
+ "message": "<p>This metric measures the number of bytes that could be saved by optimizing images.</p><p>Image optimization is generally one of the easiest way to reduce a page weight, and as a result, the page load time. Don't use Photoshop or other image editing tools, they're not very good for optimization. Use specialized tools such as <a href=\"https://kraken.io/\" target=\"_blank\">Kraken.io</a> or the excellent <a href=\"https://imageoptim.com/\" target=\"_blank\">ImageOptim</a> on Mac. For SVG images, you can use <a href=\"https://jakearchibald.github.io/svgomg/\" target=\"_blank\">SVGOMG</a>.</p><p>The tools in use in YellowLabTools are not set to their maximum optimization power (JPEG quality 85), so you might be able to compress even more!</p>",
|
|
|
"isOkThreshold": 20480,
|
|
|
"isBadThreshold": 204800,
|
|
|
"isAbnormalThreshold": 307200,
|
|
@@ -919,19 +783,19 @@ var policies = {
|
|
|
"imagesTooLarge": {
|
|
|
"tool": "redownload",
|
|
|
"label": "Oversized images",
|
|
|
- "message": "<p>This is the number of images with a width >800px on mobile or >1500px on desktop. Try reducing their size.</p><p>Please ignore if the file is used as a sprite.</p><p>Please note that Yellow Lab Tools' engine (PhantomJS) is not compatible with image srcset (unless you use a polyfill). This can lead to incorrect detection.</p>",
|
|
|
+ "message": "<p>This is the number of images with a width >1200px on mobile, >1800px on tablet, >2400 on desktop, >3200px on HD desktop. Try reducing their size.</p><p>Please ignore if the file is used as a sprite.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
"isBadThreshold": 5,
|
|
|
"isAbnormalThreshold": 10,
|
|
|
"hasOffenders": true
|
|
|
},
|
|
|
- "gzipCompression": {
|
|
|
+ "compression": {
|
|
|
"tool": "redownload",
|
|
|
- "label": "Gzip compression",
|
|
|
- "message": "<p>Measures the number of bytes that could be saved by compressing file transfers.</p><p>Gzip is a powerfull weight reducer and should be enabled on text-based assets in your server's configuration. Note that gzipping small files (< 1 KB) is arguable, and that some assets such as images should not be gzipped as they are already compressed. <a href=\"https://gist.github.com/gmetais/971ce13a1fbeebd88445\" target=\"_blank\">Here</a> is a list of Content-Types that should be gzipped.</p>",
|
|
|
- "isOkThreshold": 5125,
|
|
|
- "isBadThreshold": 81920,
|
|
|
- "isAbnormalThreshold": 153600,
|
|
|
+ "label": "Brotli compression",
|
|
|
+ "message": "<p>Measures the number of bytes that could be saved by compressing textual files.</p><p>Gzip is a good old algorithm that offers great improvements. But Brotli is a new-generation algorithm and provides even better results. All major server systems are now compatible with Brotli.</p><p>Note that compressing small files (< 1 KB) is arguable, and that some assets such as images should not be gzipped as they are already compressed. <a href=\"https://gist.github.com/gmetais/971ce13a1fbeebd88445\" target=\"_blank\">Here</a> is a list of Content-Types that should be compressed.</p>",
|
|
|
+ "isOkThreshold": 20480,
|
|
|
+ "isBadThreshold": 204800,
|
|
|
+ "isAbnormalThreshold": 409600,
|
|
|
"hasOffenders": true,
|
|
|
"unit": 'bytes'
|
|
|
},
|
|
@@ -948,40 +812,20 @@ var policies = {
|
|
|
"totalRequests": {
|
|
|
"tool": "redownload",
|
|
|
"label": "Requests number",
|
|
|
- "message": "<p>This is one of the most important performance rule. Every request is slowing down the page loading.</p><p>There are several technics to reduce their number:<ul><li>Concatenate JS files</li><li>Concatenate CSS files</li><li>Embed or inline small JS or CSS files in the HTML</li><li>Create sprites</li><li>Base64 encode small images in HTML or stylesheets</li><li>Use lazyloading for images</li></ul></p>",
|
|
|
- "isOkThreshold": 20,
|
|
|
- "isBadThreshold": 120,
|
|
|
- "isAbnormalThreshold": 200,
|
|
|
+ "message": "<p>Each request slows down the page loading, especially on the protocol HTTP/1, but also a little on HTTP/2.</p><p>There are several technics to reduce their number:<ul><li>Concatenate JS files</li><li>Concatenate CSS files</li><li>Embed or inline small JS or CSS files in the HTML</li><li>Create sprites</li><li>Base64 encode small images in HTML or stylesheets</li><li>Use lazyloading for images</li></ul></p>",
|
|
|
+ "isOkThreshold": 80,
|
|
|
+ "isBadThreshold": 240,
|
|
|
+ "isAbnormalThreshold": 320,
|
|
|
"hasOffenders": true
|
|
|
},
|
|
|
"domains": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Different domains",
|
|
|
"message": "<p>For each domain met, the browser needs to make a DNS look-up, which is slow. Avoid having to many different domains and the page should render faster.</p><p>By the way, domain sharding is not a good practice anymore.</p>",
|
|
|
- "isOkThreshold": 10,
|
|
|
- "isBadThreshold": 25,
|
|
|
- "isAbnormalThreshold": 50,
|
|
|
- "hasOffenders": true,
|
|
|
- "offendersTransformFn": function(offenders) {
|
|
|
- return {
|
|
|
- count: offenders.length,
|
|
|
- list: offenders.map(function(offender) {
|
|
|
- var parts = /^([^ ]*): (\d+) request\(s\)$/.exec(offender);
|
|
|
-
|
|
|
- if (!parts) {
|
|
|
- debug('domains offenders transform function error with "%s"', offender);
|
|
|
- return {
|
|
|
- file: offender
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- domain: parts[1],
|
|
|
- requests: parseInt(parts[2])
|
|
|
- };
|
|
|
- })
|
|
|
- };
|
|
|
- }
|
|
|
+ "isOkThreshold": 12,
|
|
|
+ "isBadThreshold": 30,
|
|
|
+ "isAbnormalThreshold": 60,
|
|
|
+ "hasOffenders": true
|
|
|
},
|
|
|
"notFound": {
|
|
|
"tool": "phantomas",
|
|
@@ -1022,15 +866,6 @@ var policies = {
|
|
|
"isAbnormalThreshold": 5,
|
|
|
"hasOffenders": true
|
|
|
},
|
|
|
- "smallRequests": {
|
|
|
- "tool": "redownload",
|
|
|
- "label": "Small requests",
|
|
|
- "message": "<p>List of all requests that are less than 2 KB. Try to merge them with other files.</p>",
|
|
|
- "isOkThreshold": 10,
|
|
|
- "isBadThreshold": 50,
|
|
|
- "isAbnormalThreshold": 80,
|
|
|
- "hasOffenders": true
|
|
|
- },
|
|
|
"lazyLoadableImagesBelowTheFold": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Below the fold images",
|
|
@@ -1055,7 +890,7 @@ var policies = {
|
|
|
"message": "<p>This is the number of custom web fonts loaded on the page.</p><p>Webfonts are beautiful, but heavy. You should keep their number as low as possible.</p>",
|
|
|
"isOkThreshold": 1,
|
|
|
"isBadThreshold": 5,
|
|
|
- "isAbnormalThreshold": 7,
|
|
|
+ "isAbnormalThreshold": 8,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return offenders;
|
|
@@ -1064,7 +899,7 @@ var policies = {
|
|
|
"heavyFonts": {
|
|
|
"tool": "redownload",
|
|
|
"label": "Overweighted webfonts",
|
|
|
- "message": "<p>This metric is the sum of all bytes above 40KB in loaded fonts. Over this size, the font is probably not optimized for the web.</p><p>It can be a compresson issue, a font that contains too many glyphs or a font with complex shapes.</p><p>Sorry, Yellow Lab Tools is not yet compatible with the WOFF2 font format that generates 20-30% smaller fonts. You can proceed to a manual verification on a modern browser.</p>",
|
|
|
+ "message": "<p>This metric is the sum of all bytes above 40KB in loaded fonts. Over this size, the font is probably not optimized for the web.</p><p>It can be a compresson issue, a font that contains too many glyphs or a font with complex shapes.</p>",
|
|
|
"isOkThreshold": 0,
|
|
|
"isBadThreshold": 102400,
|
|
|
"isAbnormalThreshold": 204800,
|
|
@@ -1074,7 +909,7 @@ var policies = {
|
|
|
return offenders;
|
|
|
}
|
|
|
},
|
|
|
- "unusedUnicodeRanges": {
|
|
|
+ /*"unusedUnicodeRanges": {
|
|
|
"tool": "redownload",
|
|
|
"label": "Unused Unicode ranges",
|
|
|
"message": "<p>This metric counts the number of unused Unicode ranges inside each font. For example, one font could include Cyrillic glyphs but none of them are used on the page.</p><p>It also reveals the number of ligatures (letters that are represented differently when close to each other) and hidden chars (glyphs not linked to the unicode system that can't be displayed on the web).</p><p>Because of technical limitations, Yellow Lab Tools checks each font against the glyphs of the entire page. As a result, estimated use is >= to reality. For example, if you read that 10 glyphs are \"possibly used\", it means that these 10 glyphs are used on the page but nothing guaranties that they are displayed using this font.</p><p>Tools such as <a href=\"https://www.fontsquirrel.com/tools/webfont-generator\" target=\"_blank\">Font Squirrel</a> can remove some unicode ranges from a font.</p><p>In the case of an icon font, make sure you only keep the icons that are used on the website and to remove the others. Several tools are able to extract SVG images from a font, then some other tools can generate a font from the SVGs you want to keep.</p>",
|
|
@@ -1085,43 +920,73 @@ var policies = {
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return offenders;
|
|
|
}
|
|
|
+ },*/
|
|
|
+ "nonWoff2Fonts": {
|
|
|
+ "tool": "redownload",
|
|
|
+ "label": "WOFF 2",
|
|
|
+ "message": "<p>The fonts listed here could be lighter if they were served with the latest WOFF 2 font file format. Some online tools can help you easily convert older formats to WOFF 2.</p>",
|
|
|
+ "isOkThreshold": 0,
|
|
|
+ "isBadThreshold": 51200,
|
|
|
+ "isAbnormalThreshold": 122880,
|
|
|
+ "hasOffenders": true,
|
|
|
+ "unit": 'bytes'
|
|
|
},
|
|
|
- "http2": {
|
|
|
- "label": "HTTP/2 or SPDY",
|
|
|
- "message": "<p>HTTP/2 is the latest version of the HTTP protocol and is designed to optimize load speed. SPDY is deprecated but still very well supported.</p><p>The latest versions of all major browsers are now compatible. The difficulty is on the server side, where technologies are not quite ready yet.</p>",
|
|
|
+ "oldHttpProtocol": {
|
|
|
+ "label": "HTTP protocols",
|
|
|
+ "message": "<p>HTTP/2 is the latest version of the HTTP protocol. It is designed to optimize load speed. HTTP/3 will come soon and should be even faster!</p><p>When a domain sends more than 4 requests over HTTP/1, this metric counts one point for each new request. Below 5 requests, the benefits of HTTP/2 are generally less significant.</p>",
|
|
|
"hasOffenders": true,
|
|
|
"scoreFn": function(data) {
|
|
|
- if (!data.toolsResults.http2) {
|
|
|
- return null;
|
|
|
+ var count = 0;
|
|
|
+
|
|
|
+ var offenders = data.toolsResults.phantomas.offenders.oldHttpProtocol;
|
|
|
+
|
|
|
+ if (offenders) {
|
|
|
+ offenders.forEach(function(offender) {
|
|
|
+ if (offender.requests > 4) {
|
|
|
+ count += offender.requests - 4;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- var isHttp2 = data.toolsResults.http2.metrics.http2;
|
|
|
+ var isOkThreshold = 0;
|
|
|
+ var isBadThreshold = 25;
|
|
|
+ var isAbnormalThreshold = 100;
|
|
|
|
|
|
+ var score = (isBadThreshold - count) * 100 / (isBadThreshold - isOkThreshold);
|
|
|
+ var abnormalityScore = (isAbnormalThreshold - count) * 100 / (isAbnormalThreshold - isOkThreshold);
|
|
|
+
|
|
|
+
|
|
|
var result = {
|
|
|
- value: isHttp2 ? 'Yes' : 'No',
|
|
|
- score: isHttp2 ? 100 : 0,
|
|
|
- bad: !isHttp2,
|
|
|
- abnormal: false,
|
|
|
- abnormalityScore: 0
|
|
|
+ value: count,
|
|
|
+ score: Math.min(Math.max(Math.round(score), 0), 100),
|
|
|
+ bad: count > isBadThreshold,
|
|
|
+ abnormal: count > isAbnormalThreshold,
|
|
|
+ abnormalityScore: Math.min(Math.round(abnormalityScore), 0),
|
|
|
+ offendersObj: {
|
|
|
+ count: data.toolsResults.phantomas.metrics.oldHttpProtocol,
|
|
|
+ list: data.toolsResults.phantomas.offenders.oldHttpProtocol || []
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
- if (data.toolsResults.http2.offenders) {
|
|
|
- result.offendersObj = {
|
|
|
- count: data.toolsResults.http2.offenders.http2.length,
|
|
|
- list: data.toolsResults.http2.offenders.http2
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
return result;
|
|
|
}
|
|
|
},
|
|
|
+ "oldTlsProtocol": {
|
|
|
+ "tool": "phantomas",
|
|
|
+ "label": "TLS protocols",
|
|
|
+ "message": "<p>Counts the number of domains that use TLS versions < 1.3. This is the latest version and it includes a faster \"handshake\" technology.</p><p>The 1.0 and 1.1 versions are deprecated because they are unsafe, switch to 1.2 or above as soon as possible.</p><p>The version 1.3 includes an even faster option called 0-RTT, check your server compatibility on <a href='https://www.ssllabs.com/ssltest/' target=\"_blank\">SSL Labs</a>.</p>",
|
|
|
+ "isOkThreshold": 0,
|
|
|
+ "isBadThreshold": 5,
|
|
|
+ "isAbnormalThreshold": 15,
|
|
|
+ "hasOffenders": true
|
|
|
+ },
|
|
|
"cachingDisabled": {
|
|
|
"tool": "phantomas",
|
|
|
"label": "Caching disabled",
|
|
|
"message": "<p>Counts responses with caching disabled (max-age=0)</p><p>Fix immediatly if on static assets.</p>",
|
|
|
- "isOkThreshold": 0,
|
|
|
- "isBadThreshold": 12,
|
|
|
- "isAbnormalThreshold": 25,
|
|
|
+ "isOkThreshold": 2,
|
|
|
+ "isBadThreshold": 15,
|
|
|
+ "isAbnormalThreshold": 30,
|
|
|
"hasOffenders": true
|
|
|
},
|
|
|
"cachingNotSpecified": {
|
|
@@ -1138,29 +1003,14 @@ var policies = {
|
|
|
"label": "Caching too short",
|
|
|
"message": "<p>Responses with too short caching time (less than a week).</p><p>The longer you cache, the better. Add versionning to your static assets, if it's not already done, and set their cache time to one year.</p>",
|
|
|
"isOkThreshold": 5,
|
|
|
- "isBadThreshold": 20,
|
|
|
- "isAbnormalThreshold": 40,
|
|
|
+ "isBadThreshold": 25,
|
|
|
+ "isAbnormalThreshold": 50,
|
|
|
"hasOffenders": true,
|
|
|
"offendersTransformFn": function(offenders) {
|
|
|
return {
|
|
|
count: offenders.length,
|
|
|
list: offenders
|
|
|
- .map(function(offender) {
|
|
|
- var parts = /^([^ ]*) cached for (-?\d+(\.\d+)?) s$/.exec(offender);
|
|
|
-
|
|
|
- if (!parts) {
|
|
|
- debug('cachingTooShort offenders transform function error with "%s"', offender);
|
|
|
- return {
|
|
|
- file: offender
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- file: parts[1],
|
|
|
- ttl: Math.round(parseFloat(parts[2]))
|
|
|
- };
|
|
|
-
|
|
|
- }).sort(function(a, b) {
|
|
|
+ .sort(function(a, b) {
|
|
|
|
|
|
return a.ttl - b.ttl;
|
|
|
|