Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 0c40a91

Browse files
committed
2.1.1
1 parent 2f7dbf1 commit 0c40a91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3749
-5
lines changed

ChangeLog

Lines changed: 401 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE.BSD

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Redistribution and use in source and binary forms, with or without
2+
modification, are permitted provided that the following conditions are met:
3+
4+
* Redistributions of source code must retain the above copyright
5+
notice, this list of conditions and the following disclaimer.
6+
* Redistributions in binary form must reproduce the above copyright
7+
notice, this list of conditions and the following disclaimer in the
8+
documentation and/or other materials provided with the distribution.
9+
* Neither the name of the <organization> nor the
10+
names of its contributors may be used to endorse or promote products
11+
derived from this software without specific prior written permission.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
17+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1-
# phantomjs-builds
2-
A repository for the sole purpose of holding on to historical builds of phantomjs.
1+
# [PhantomJS](http://phantomjs.org) - Scriptable Headless WebKit
32

4-
We have the following builds:
5-
*
3+
PhantomJS ([phantomjs.org](http://phantomjs.org)) is a headless WebKit scriptable with JavaScript. The latest [stable release](http://phantomjs.org/release-2.0.html) is version 2.0.
64

7-
We use releases because GitHub has a really [nice release binary policy](https://help.github.com/articles/distributing-large-binaries/).
5+
**Note**: Please **do not** create a GitHub pull request **without** reading the [Contribution Guide](https://github.com/ariya/phantomjs/blob/master/CONTRIBUTING.md) first. Failure to do so may result in the rejection of the pull request.
6+
7+
## Use Cases
8+
9+
- **Headless web testing**. Lightning-fast testing without the browser is now possible!
10+
- **Page automation**. [Access and manipulate](http://phantomjs.org/page-automation.html) web pages with the standard DOM API, or with usual libraries like jQuery.
11+
- **Screen capture**. Programmatically [capture web contents](http://phantomjs.org/screen-capture.html), including CSS, SVG and Canvas. Build server-side web graphics apps, from a screenshot service to a vector chart rasterizer.
12+
- **Network monitoring**. Automate performance analysis, track [page loading](http://phantomjs.org/network-monitoring.html) and export as standard HAR format.
13+
14+
## Features
15+
16+
- **Multiplatform**, available on major operating systems: Windows, Mac OS X, Linux, and other Unices.
17+
- **Fast and native implementation** of web standards: DOM, CSS, JavaScript, Canvas, and SVG. No emulation!
18+
- **Pure headless (no X11) on Linux**, ideal for continuous integration systems. Also runs on Amazon EC2, Heroku, and Iron.io.
19+
- **Easy to install**: [Download](http://phantomjs.org/download.html), unpack, and start having fun in just 5 minutes.
20+
21+
## Questions?
22+
23+
- Explore the complete [documentation](http://phantomjs.org/documentation/).
24+
- Read tons of [user articles](http://phantomjs.org/buzz.html) on using PhantomJS.
25+
- Join the [mailing-list](http://groups.google.com/group/phantomjs) and discuss with other PhantomJS fans.
26+
27+
PhantomJS is free software/open source, and is distributed under the [BSD license](http://opensource.org/licenses/BSD-3-Clause). It contains third-party code, see the included `third-party.txt` file for the license information on third-party code.
28+
29+
PhantomJS is created and maintained by [Ariya Hidayat](http://ariya.ofilabs.com/about) (Twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)), with the help of [many contributors](https://github.com/ariya/phantomjs/contributors). Follow the official Twitter stream [@PhantomJS](http://twitter.com/PhantomJS) to get the frequent development updates.

bin/phantomjs

64.8 MB
Binary file not shown.

examples/arguments.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"use strict";
2+
var system = require('system');
3+
if (system.args.length === 1) {
4+
console.log('Try to pass some args when invoking this script!');
5+
} else {
6+
system.args.forEach(function (arg, i) {
7+
console.log(i + ': ' + arg);
8+
});
9+
}
10+
phantom.exit();

examples/child_process-examples.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"use strict";
2+
var spawn = require("child_process").spawn
3+
var execFile = require("child_process").execFile
4+
5+
var child = spawn("ls", ["-lF", "/rooot"])
6+
7+
child.stdout.on("data", function (data) {
8+
console.log("spawnSTDOUT:", JSON.stringify(data))
9+
})
10+
11+
child.stderr.on("data", function (data) {
12+
console.log("spawnSTDERR:", JSON.stringify(data))
13+
})
14+
15+
child.on("exit", function (code) {
16+
console.log("spawnEXIT:", code)
17+
})
18+
19+
//child.kill("SIGKILL")
20+
21+
execFile("ls", ["-lF", "/usr"], null, function (err, stdout, stderr) {
22+
console.log("execFileSTDOUT:", JSON.stringify(stdout))
23+
console.log("execFileSTDERR:", JSON.stringify(stderr))
24+
})
25+
26+
setTimeout(function () {
27+
phantom.exit(0)
28+
}, 2000)

examples/colorwheel.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"use strict";
2+
var page = require('webpage').create();
3+
page.viewportSize = { width: 400, height : 400 };
4+
page.content = '<html><body><canvas id="surface"></canvas></body></html>';
5+
page.evaluate(function() {
6+
var el = document.getElementById('surface'),
7+
context = el.getContext('2d'),
8+
width = window.innerWidth,
9+
height = window.innerHeight,
10+
cx = width / 2,
11+
cy = height / 2,
12+
radius = width / 2.3,
13+
imageData,
14+
pixels,
15+
hue, sat, value,
16+
i = 0, x, y, rx, ry, d,
17+
f, g, p, u, v, w, rgb;
18+
19+
el.width = width;
20+
el.height = height;
21+
imageData = context.createImageData(width, height);
22+
pixels = imageData.data;
23+
24+
for (y = 0; y < height; y = y + 1) {
25+
for (x = 0; x < width; x = x + 1, i = i + 4) {
26+
rx = x - cx;
27+
ry = y - cy;
28+
d = rx * rx + ry * ry;
29+
if (d < radius * radius) {
30+
hue = 6 * (Math.atan2(ry, rx) + Math.PI) / (2 * Math.PI);
31+
sat = Math.sqrt(d) / radius;
32+
g = Math.floor(hue);
33+
f = hue - g;
34+
u = 255 * (1 - sat);
35+
v = 255 * (1 - sat * f);
36+
w = 255 * (1 - sat * (1 - f));
37+
pixels[i] = [255, v, u, u, w, 255, 255][g];
38+
pixels[i + 1] = [w, 255, 255, v, u, u, w][g];
39+
pixels[i + 2] = [u, u, w, 255, 255, v, u][g];
40+
pixels[i + 3] = 255;
41+
}
42+
}
43+
}
44+
45+
context.putImageData(imageData, 0, 0);
46+
document.body.style.backgroundColor = 'white';
47+
document.body.style.margin = '0px';
48+
});
49+
50+
page.render('colorwheel.png');
51+
52+
phantom.exit();

examples/countdown.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"use strict";
2+
var t = 10,
3+
interval = setInterval(function(){
4+
if ( t > 0 ) {
5+
console.log(t--);
6+
} else {
7+
console.log("BLAST OFF!");
8+
phantom.exit();
9+
}
10+
}, 1000);

examples/detectsniff.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Detect if a web page sniffs the user agent or not.
2+
3+
"use strict";
4+
var page = require('webpage').create(),
5+
system = require('system'),
6+
sniffed,
7+
address;
8+
9+
page.onInitialized = function () {
10+
page.evaluate(function () {
11+
12+
(function () {
13+
var userAgent = window.navigator.userAgent,
14+
platform = window.navigator.platform;
15+
16+
window.navigator = {
17+
appCodeName: 'Mozilla',
18+
appName: 'Netscape',
19+
cookieEnabled: false,
20+
sniffed: false
21+
};
22+
23+
window.navigator.__defineGetter__('userAgent', function () {
24+
window.navigator.sniffed = true;
25+
return userAgent;
26+
});
27+
28+
window.navigator.__defineGetter__('platform', function () {
29+
window.navigator.sniffed = true;
30+
return platform;
31+
});
32+
})();
33+
});
34+
};
35+
36+
if (system.args.length === 1) {
37+
console.log('Usage: detectsniff.js <some URL>');
38+
phantom.exit(1);
39+
} else {
40+
address = system.args[1];
41+
console.log('Checking ' + address + '...');
42+
page.open(address, function (status) {
43+
if (status !== 'success') {
44+
console.log('FAIL to load the address');
45+
phantom.exit();
46+
} else {
47+
window.setTimeout(function () {
48+
sniffed = page.evaluate(function () {
49+
return navigator.sniffed;
50+
});
51+
if (sniffed) {
52+
console.log('The page tried to sniff the user agent.');
53+
} else {
54+
console.log('The page did not try to sniff the user agent.');
55+
}
56+
phantom.exit();
57+
}, 1500);
58+
}
59+
});
60+
}

examples/echoToFile.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// echoToFile.js - Write in a given file all the parameters passed on the CLI
2+
"use strict";
3+
var fs = require('fs'),
4+
system = require('system');
5+
6+
if (system.args.length < 3) {
7+
console.log("Usage: echoToFile.js DESTINATION_FILE <arguments to echo...>");
8+
phantom.exit(1);
9+
} else {
10+
var content = '',
11+
f = null,
12+
i;
13+
for ( i= 2; i < system.args.length; ++i ) {
14+
content += system.args[i] + (i === system.args.length-1 ? '' : ' ');
15+
}
16+
17+
try {
18+
fs.write(system.args[1], content, 'w');
19+
} catch(e) {
20+
console.log(e);
21+
}
22+
23+
phantom.exit();
24+
}

0 commit comments

Comments
 (0)