Commit Graph

128 Commits (75bbbebb894199ab9e9be5ee184e3e1d53a45e57)

Author SHA1 Message Date
rgieseke e09da4e1d8 netsniff.coffee: Remove dot in prototype check. 2011-06-17 09:05:19 +02:00
rgieseke 7e4a5fd33e injectme.coffee: Add CoffeeScript version. 2011-06-17 09:04:08 +02:00
rgieseke 913b214d91 useragent.coffe: Change useragent as in js version. 2011-06-17 08:45:41 +02:00
rgieseke e5064db060 pizza.coffee: Add missing onConsoleMessage. 2011-06-17 08:25:35 +02:00
rgieseke 2c8e9bd5b4 Examples: new coffeescript versions. 2011-06-16 22:56:06 +02:00
Ivan De Marino e2ee86e0ac Minor cleanup on 'sleepsort.js' 2011-06-16 14:48:41 +01:00
Ivan De Marino d00ed3f2fc sleepsort.js - This must go in for 1.2 :P
* It's so silly, it has to.
* Also, it shows how "powerful" the function scoping is
2011-06-16 11:46:10 +01:00
Ariya Hidayat 6b28a956ac Refer to function argument 'startTime', not from page. 2011-06-13 08:11:40 -07:00
Ivan De Marino 22ee075cc2 Removing "page.click()" for now.
There is need for a discussion to decide how to do this.
2011-06-10 17:08:46 +01:00
Ivan De Marino 75403737c4 Added "includeJs()" to "page".
* It includes a script in the page
* It uses a callback to ensure any code dependent on the include runs afterwards
* It uses the signal "javaScriptAlertSent" to do the trick (is there another way to be notified of the "onLoad" event from outside the page context?)
* It uses a "private" slot "_appendScriptElement" to pass the script url in the page context (is there a better way?)
2011-06-10 17:08:46 +01:00
Ivan De Marino a0f8f2491d "loadJsFile()" -> "injectJs"
* According to Issue #32 (http://code.google.com/p/phantomjs/issues/detail?id=32) I added a "lookup logic" that searchs for the file following those steps:
*# Search for file at given path (relative to PWD or absolute - no difference)
*# Is file there? Inject it
*# Is file not there? Try looking for it in "scriptLookupDir"
*# Is file there? Inject it
*# Is file not there? abort
* "scriptLookupDir" is an extra property for WebPage, that, as by it's name, defines a place where to look to script to inject
* Script can alter the scriptLookupDir, if they want
* Updated "injectme.js" accordingly
2011-06-10 17:08:45 +01:00
Ivan De Marino bb0b820f72 Merge remote-tracking branch 'upstream/master' into utilities 2011-06-09 11:50:54 +01:00
IceArmy 0bfd28e67d example/netsniff.coffee: Format the output to HAR 1.2 specification. 2011-06-09 00:58:03 -07:00
Ariya Hidayat c2c6cbc287 example/netsniff.js: Format the output to HAR 1.2 specification. 2011-06-08 23:47:14 -07:00
Ariya Hidayat 751e471068 Better timing for onResourceRequested and onResourceReceived.
We record the time right inside the network access manager. This gives
better accuracy than doing it from JavaScript side, no loss due to the
latency of signal slot connection.
2011-06-08 23:32:14 -07:00
Ariya Hidayat 1cae77a3e0 Add 'onResourceReceived' event, fired when resource is being received.
This is now being used in the netsniff.js example.
2011-06-08 01:10:00 -07:00
Ivan De Marino 5b6f2731c4 Added support for "page.click()" and "page.loadJsFile()".
* click() accepts a "querySelectorAll" input - can click on multiple things in one call
* loadJsFile() is synchronous at loading JS in the page
* added 2 examples in JavaScript to show how to use (and test) the new methods
* NOTE: someone will have to generate the .coffee version - I tried using "http://ricostacruz.com/js2coffee/" but it hangs and I'm not willing to learn why :P - I don't like Coffee Script.
2011-06-07 17:20:22 +01:00
IceArmy 805c824ff3 Convert netsniff.js to CoffeeScript 2011-06-07 02:52:01 -07:00
Ariya Hidayat 8722399c0a Add "onResourceRequested" event, fired when request is started.
To see how this is being used, see the new examples/netsniff.js.

http://code.google.com/p/phantomjs/issues/detail?id=2
2011-06-07 00:06:08 -07:00
Ariya Hidayat cf8a890f8b loadspeed.js: Fixed missing semicolons. 2011-06-06 23:52:39 -07:00
IceArmy 88f9434a0c Convert run-jasmine.js to CoffeeScript 2011-06-06 19:01:45 -07:00
IceArmy 331be469bc Convert run-qunit.js to CoffeeScript 2011-06-06 18:57:46 -07:00
IceArmy 6390f92550 Convert imagebin.js to CoffeeScript 2011-06-06 18:52:33 -07:00
Ariya Hidayat 3170b2b4b6 imagebin.js: Example of file upload inside form.
Warning: this script has zero error checking.
2011-06-05 01:11:59 -07:00
IceArmy 253469b03e Improve waitfor.coffee readability 2011-06-02 17:18:25 -07:00
IceArmy 5e876a6517 Improve weather.coffee a little 2011-06-02 17:18:11 -07:00
IceArmy ac354d7804 Convert render_multi_url.js to CoffeeScript 2011-06-02 00:46:50 -07:00
IceArmy bdf4fb4571 Convert post.js to CoffeeScript 2011-06-02 00:46:50 -07:00
IceArmy 6b2c492796 Port tweets.coffee to PhantomJS 1.2 2011-06-02 00:46:50 -07:00
IceArmy 39d8522c3a Port weather.coffee to PhantomJS 1.2 2011-06-02 00:46:50 -07:00
IceArmy dd0d437b89 Port countdown.coffee to PhantomJS 1.2 2011-06-01 23:20:47 -07:00
IceArmy 80131a2353 Port waitfor.coffee to PhantomJS 1.2 2011-06-01 19:51:17 -07:00
Ivan De Marino e59054247c Converted 'cycle_multiple_urls.js' to PhantomJS 1.2 (and renamed to 'render_multi_url.js').
Given that I practically rewrote it, I took the liberty to rename it based on my personal taste ;)
2011-06-01 18:37:57 +01:00
Ivan De Marino 93d2c30248 Converted 'run-jasmine.js' to PhantomJS 1.2 2011-06-01 17:30:27 +01:00
Ivan De Marino afce9b83b0 Converted 'run-qunit.js' to PhantomJS 1.2 AND fixed a stupid mistake in 'waitFor' 2011-06-01 17:24:32 +01:00
Ivan De Marino f8e59f92f8 Ported 'waitfor.js' to Phantom 1.2.
* There is a problem though: the script causes a "segfault" on phantom.exit() - I didn't investigated why yet
2011-06-01 16:29:44 +01:00
Ivan De Marino 78cab6b4b1 Converted "weather.js" for PhantomJS 1.2 2011-06-01 14:55:35 +01:00
Ivan De Marino 811c56b6f3 Ported 'countdown.js' to PhantomJS 1.2 2011-06-01 14:25:22 +01:00
Ivan De Marino b91f5b9632 Converted "tweets.js" to PhantomJS 1.2.
First impression: PhantomJS 1.2 makes a lot of sense.
But there are issues if we try to pass a DOM node as a return value for calls to "evaluate"
2011-06-01 14:18:08 +01:00
Ariya Hidayat a7a8a6749a Merge pull request #49 from rgieseke/cs-examples
Port CoffeeScript examples to use WebPage object.
2011-05-29 12:33:03 -07:00
rgieseke 2a8fac45b4 Indent with 2 spaces. 2011-05-29 14:21:25 +02:00
rgieseke 5b8a40e763 Remove unused variable. 2011-05-29 14:01:55 +02:00
Ariya Hidayat 5be29972cf WebPage callback for its console message.
See http://code.google.com/p/phantomjs/issues/detail?id=12.

By default, WebPage is "silent" and does not report its console message.
This can be overridden easily, e.g:

  var page = new WebPage();
  page.onConsoleMessage = function (msg) {
    console.log(msg);
  };
  page.open(.....);
2011-05-28 21:16:18 -07:00
Ariya Hidayat b1af26ecc0 Support different HTTP operations for loading a page.
http://code.google.com/p/phantomjs/issues/detail?id=88
2011-05-28 02:06:20 -07:00
Ariya Hidayat 7e099abaf2 User-agent is part of WebPage settings, not WebPage object itself. 2011-05-27 22:50:33 -07:00
rgieseke 08c6faff71 More CoffeeScript examples using WebPage. 2011-05-27 12:09:15 +02:00
rgieseke 4f68bf7067 Use WebPage in useragent.coffee example. 2011-05-26 11:08:33 +02:00
rgieseke dcd91d73d1 Use WebPage in pizza.coffee example. 2011-05-26 11:07:37 +02:00
rgieseke fc5b799db0 Use WebPage in direction.coffee example. 2011-05-26 11:06:41 +02:00
rgieseke 95c13d46fd Use WebPage in loadspeed.coffee. 2011-05-26 11:05:03 +02:00