Skip to content

Commit de012b6

Browse files
authored
Merge pull request #19 from kind-hearted/master
Not work, need to update phantomjs
2 parents c0d09f6 + 7232520 commit de012b6

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var PHANTOMJS_SCRIPT_DIR = path.join(__dirname, 'phantomjs');
99
var PHANTOMJS_SCRIPT_FILE = path.join(PHANTOMJS_SCRIPT_DIR, 'index.js');
1010
var _ = require('./util.js');
1111
var _exists = fs.existsSync || path.existsSync;
12-
var phantomjs = require('phantomjs');
12+
var phantomjs = require('phantomjs-prebuilt');
1313
var binPath = phantomjs.path;
1414

1515
/**

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"diff"
1414
],
1515
"dependencies": {
16-
"phantomjs": "~1.9.16"
16+
"phantomjs-prebuilt": "^2.1.14"
1717
},
1818
"repository": {
1919
"type": "git",

phantomjs/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,12 @@ M.prototype.highlight = function(left, right, diff, lOffset, rOffset, callback){
331331
log('diff [' + left + '] width [' + right + ']');
332332
log('has [' + diff.length + '] changes');
333333
var render = this.getRenderOptions();
334-
var lScreenshot = this.root + '/' + left + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
335-
var rScreenshot = this.root + '/' + right + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
334+
var protocol = 'file://' + (IS_WIN ? '/' : '');
335+
var lScreenshot = protocol + this.root + '/' + left + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
336+
var rScreenshot = protocol + this.root + '/' + right + '/' + SCREENSHOT_FILENAME + '.' + render.ext;
336337
var dScreenshot = this.root + '/diff/' + left + '-' + right + '.' + render.ext;
337338
var html = phantom.libraryPath + '/' + HIGHLIGHT_HTML_FILENAME;
338-
var url = 'file://' + (IS_WIN ? '/' : '') + html + '?';
339+
var url = protocol + html + '?';
339340
var opt = {
340341
page : {
341342
settings: {

0 commit comments

Comments
 (0)