cleanup
This commit is contained in:
parent
c9a98cea3b
commit
9a8ec436ee
|
|
@ -47,6 +47,8 @@ function collectYSlowMetrics(pageData, p) {
|
|||
|
||||
var docs = pageData.yslow.comps.filter(isDoc);
|
||||
|
||||
var assetTypes = ['js', 'css', 'img', 'cssimg', 'font', 'flash', 'iframe'];
|
||||
|
||||
docs.forEach(function(doc) {
|
||||
p = {
|
||||
score: pageData.yslow.o,
|
||||
|
|
@ -78,84 +80,24 @@ function collectYSlowMetrics(pageData, p) {
|
|||
pageWeight: {
|
||||
'v': util.getSize(pageData.yslow.comps),
|
||||
'unit': 'bytes'
|
||||
},
|
||||
assets: {
|
||||
js: {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'js';
|
||||
}).length,
|
||||
'unit': ''
|
||||
},
|
||||
css: {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'css';
|
||||
}).length,
|
||||
'unit': ''
|
||||
},
|
||||
img: {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'image';
|
||||
}).length,
|
||||
'unit': ''
|
||||
},
|
||||
cssimg: {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'cssimage';
|
||||
}).length,
|
||||
'unit': ''
|
||||
},
|
||||
font: {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'font';
|
||||
}).length,
|
||||
'unit': ''
|
||||
},
|
||||
flash: {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'flash';
|
||||
}).length,
|
||||
'unit': ''
|
||||
},
|
||||
iframe: {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'iframe';
|
||||
}).length,
|
||||
'unit': ''
|
||||
},
|
||||
jsWeight: {
|
||||
'v': util.getSize(pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'js';
|
||||
})),
|
||||
'unit': 'bytes'
|
||||
},
|
||||
cssWeight: {
|
||||
'v': util.getSize(pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'css';
|
||||
})),
|
||||
'unit': 'bytes'
|
||||
},
|
||||
imgWeight: {
|
||||
'v': util.getSize(pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'img';
|
||||
})),
|
||||
'unit': 'bytes'
|
||||
},
|
||||
fontWeight: {
|
||||
'v': util.getSize(pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'font';
|
||||
})),
|
||||
'unit': 'bytes'
|
||||
},
|
||||
flashWeight: {
|
||||
'v': util.getSize(pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === 'flash';
|
||||
})),
|
||||
'unit': 'bytes'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
p.yslow.assets = {};
|
||||
assetTypes.forEach(function(asset) {
|
||||
p.yslow.assets[asset] = {
|
||||
'v': pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === asset;
|
||||
}).length,
|
||||
'unit': ''
|
||||
}
|
||||
p.yslow.assets[asset + 'Weight'] = {
|
||||
'v': util.getSize(pageData.yslow.comps.filter(function(c) {
|
||||
return c.type === asset;
|
||||
})),
|
||||
'unit': 'bytes'
|
||||
}
|
||||
});
|
||||
});
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue