|
@@ -11,11 +11,6 @@ var PhantomasWrapper = function() {
|
|
|
|
|
|
/**
|
|
|
* This is the phantomas launcher. It merges user chosen options into the default options
|
|
|
- * Available options :
|
|
|
- *
|
|
|
- * - timeout : in seconds (default 60)
|
|
|
- * - jsDeepAnalysis : should we inspect subrequests in the javascript execution tree?
|
|
|
- *
|
|
|
*/
|
|
|
this.execute = function(data) {
|
|
|
|
|
@@ -27,7 +22,9 @@ var PhantomasWrapper = function() {
|
|
|
// Cusomizable options
|
|
|
'timeout': task.options.timeout || 60,
|
|
|
'js-deep-analysis': task.options.jsDeepAnalysis || false,
|
|
|
- 'user-agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36',
|
|
|
+ 'user-agent': (task.options.device === 'desktop') ? 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36' : null,
|
|
|
+ 'tablet': (task.options.device === 'tablet'),
|
|
|
+ 'phone': (task.options.device === 'phone'),
|
|
|
'screenshot': task.options.screenshot || false,
|
|
|
|
|
|
// Mandatory
|
|
@@ -64,7 +61,13 @@ var PhantomasWrapper = function() {
|
|
|
value = '"' + value + '"';
|
|
|
}
|
|
|
|
|
|
- optionsString += ' ' + '--' + opt + '=' + value;
|
|
|
+ if (value === true) {
|
|
|
+ optionsString += ' ' + '--' + opt;
|
|
|
+ } else if (value === false || value === null) {
|
|
|
+ // Nothing
|
|
|
+ } else {
|
|
|
+ optionsString += ' ' + '--' + opt + '=' + value;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
debug('node node_modules/phantomas/bin/phantomas.js --url=' + task.url + optionsString + ' --verbose');
|