Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-horseman

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-horseman - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

4

CHANGELOG.md
# Change Log
All notable changes to this project will be documented in this file.
##2.2.0 - 2015-09-29
### Added
- `.crop()`. Closes #51.
##2.1.0 - 2015-09-27

@@ -5,0 +9,0 @@ ### Added

79

lib/actions.js

@@ -297,4 +297,6 @@ var fs = require("fs");

debug('.screenshot()');
self.page.render(path);
setTimeout(resolve, 1500);
self.page.render(path, function(err){
if (err) reject(err);
else resolve();
});
});

@@ -335,37 +337,50 @@ });

};
/*
exports.boundingRectangle = function( selector ){
return this.evaluate( function( selector ){
if ( window.jQuery ){
return $( selector )[0].getBoundingClientRect();
} else {
var element = document.querySelector(selector);
return element.getBoundingClientRect();
}
}, selector);
var self = this;
return this.evaluate(function( selector ){
if ( window.jQuery ){
return $( selector )[0].getBoundingClientRect();
} else {
var element = document.querySelector(selector);
return element.getBoundingClientRect();
}
}, selector);
};
exports.crop = function( area, path ){
if ( typeof area === "string" ){
area = this.boundingRectangle( area );
}
var rect = {
top : area.top,
left : area.left,
width : area.width,
height : area.height
};
var self = this;
this.page.get('clipRect', function(err, prevClipRect){
self.page.set('clipRect', rect, function(){
self.screenshot(path);
self.page.set('clipRect', prevClipRect, function(){
self.pause.unpause('clipRect');
});
});
});
this.pause.pause('clipRect');
return this;
var self = this;
function doCrop(area){
var rect = {
top : area.top,
left : area.left,
width : area.width,
height : area.height
};
return self.ready.then(function() {
return new Promise( function( resolve, reject ){
self.page.get('clipRect', function(err, prevClipRect){
self.page.set('clipRect', rect, function(){
self.screenshot(path).then(function(){
self.page.set('clipRect', prevClipRect, function(err){
if (err) reject(err);
else resolve();
});
});
});
});
});
});
}
if ( typeof area === "string" ){
return this
.boundingRectangle(area)
.then(doCrop);
} else {
return doCrop(area);
}
};
*/
exports.screenshotBase64 = function(type) {

@@ -372,0 +387,0 @@

{
"name": "node-horseman",
"version": "2.1.0",
"version": "2.2.0",
"description": "Run PhantomJS from Node",

@@ -5,0 +5,0 @@ "repository": {

Horseman
=========
[![Build Status](https://img.shields.io/travis/johntitus/node-horseman/master.svg?style=flat)](https://travis-ci.org/johntitus/node-horseman)
[![Build Status](https://travis-ci.org/johntitus/node-horseman.svg?branch=master)](https://travis-ci.org/johntitus/node-horseman)

@@ -262,2 +262,5 @@ Horseman lets you run [PhantomJS](http://phantomjs.org/) from Node.

#### .crop(area, path)
Takes a cropped screenshot of the page. `area` can be a string identifying an html element on the screen to crop to, or a getBoundingClientRect object.
#### .pdf(path, [paperSize])

@@ -264,0 +267,0 @@ Renders the page as a PDF. The default paperSize is [US Letter](http://en.wikipedia.org/wiki/Letter_%28paper_size%29).

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc