Skip to content

Instantly share code, notes, and snippets.

@devosc
Created January 4, 2015 15:39
Show Gist options
  • Save devosc/6f52d03e0821faf389b5 to your computer and use it in GitHub Desktop.
Save devosc/6f52d03e0821faf389b5 to your computer and use it in GitHub Desktop.
phpmetrics/slimmerjs
//http://slimerjs.org/
var page = require('webpage').create();
page.viewportSize = { width:1280, height:800 };
page.open('http://localhost/phpmetrics.html')
.then(function(){
window.setTimeout(function() {
page.clipRect = { top: 212, left: 55, width: 300, height: 280 };
page.render('build/logs/phpmetrics-maintainability.png');
page.clipRect = { top: 210, left: 400, width: 300, height: 275 };
page.render('build/logs/phpmetrics-custom.png');
page.clipRect = { top: 255, left: 750, width: 300, height: 275 };
page.render('build/logs/phpmetrics-abstractness.png');
page.evaluate(function () {
return document.querySelector("#link-score a").click();
});
window.setTimeout(function() {
page.clipRect = {top: 170, left: 65, width: 560, height: 560};
page.render('build/logs/phpmetrics-evaluation.png');
page.clipRect = {top: 315, left: 645, width: 560, height: 200};
page.render('build/logs/phpmetrics-evaluation-report.png');
page.close();
phantom.exit();
},
3000);
},
3000);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment