Commit Graph

193 Commits (578aa6c236d014814ca73c2bf92886e2f73ba312)

Author SHA1 Message Date
IceArmy 69b06da140 Revert "Exit program properly when we call phantom.exit" 2011-06-20 10:14:08 -07:00
IceArmy d29c6732b5 Pass source and lineNumber for console redirection.
onConsoleMessage callback can handle two (optional) arguments, e.g.

    page.onConsoleMessage = function (msg, lineNo, source) {
        ....
    };
2011-06-19 22:34:29 -07:00
IceArmy 1be23d0be9 Regenerate resources 2011-06-19 21:19:01 -07:00
IceArmy 3d0c56af40 Fix the last problem with setTimeout and setInterval 2011-06-19 21:18:14 -07:00
IceArmy 1fb67c49e7 Fix bug where output couldn't be piped/redirected 2011-06-19 18:40:44 -07:00
IceArmy c44838227d Fix bug where phantom.exit wouldn't exit properly 2011-06-19 17:26:39 -07:00
IceArmy 7a9e0c8599 Exit on start script error 2011-06-19 13:37:03 -07:00
IceArmy 56039cae7f Fix issue 131 - 'Properly exit page' causes changed stack trace 2011-06-19 02:49:13 -07:00
IceArmy 9a85d01687 Add newline to CSConverter.convert 2011-06-19 01:23:44 -07:00
IceArmy 11e29fe45c Regenerate resources 2011-06-19 01:23:01 -07:00
IceArmy 0e765f2a95 Exit program properly when we call phantom.exit
Previously, calling phantom.exit would set the exit code and finish running the
JavaScript until it was done, then exit the program with your code. Basically
it didn't actually exit the program. It caused many code fallthrough problems,
but is now fixed. :)
2011-06-19 01:20:45 -07:00
Ariya Hidayat 6e2b362850 Change scriptLookupDir to libraryPath. 2011-06-17 20:52:19 -07:00
IceArmy d78b481777 Regenerate resources 2011-06-17 01:04:40 -07:00
IceArmy 520010fab8 Simplify bootstrap defineSetter code into function 2011-06-17 01:04:19 -07:00
IceArmy 9ed0c2951e On Coffee convert error, just warn and return nothing.
The reason for this is for consistencies sake. When we have a JavaScript
evaluation error, it shows the error, but doesn't exit the program.
Since we can inject CoffeeScripts as well as JS, it wouldn't be
consistent to exit the program. So we just warn instead.
2011-06-16 21:30:10 -07:00
IceArmy e52ed4a54a Report CoffeeScript compile errors 2011-06-16 17:28:36 -07:00
IceArmy 61459fab45 Use phantom.scriptName instead of phantom.args[0] 2011-06-15 14:30:31 -07:00
IceArmy fb99a4868d Merge branch 'master' of https://github.com/ariya/phantomjs 2011-06-15 03:01:10 -07:00
IceArmy c8c58f11c7 Pass script's filename as arg[0] 2011-06-15 02:57:14 -07:00
Francisco Souza 9347cc6fff Created script for running pyphantomjs after install
e.g.: $ pyphantomjs <file>
2011-06-14 19:21:03 -03:00
IceArmy 309d3b5aaa Allow scriptLookupDir to be set for phantom object 2011-06-12 14:38:34 -07:00
IceArmy 25ac6d35ca phantom.injectJs should use the starting scripts directory, not the app directory 2011-06-12 14:04:07 -07:00
IceArmy 233e8cfff9 Fix 'local variable referenced before assignment' in coffee2js() 2011-06-12 13:53:15 -07:00
IceArmy 19b5b31781 Properly load plugins from the app directories plugins subfolder, not from our CWD 2011-06-12 12:50:16 -07:00
IceArmy 6c57775e63 Regenerate resources 2011-06-12 01:23:29 -07:00
IceArmy 6056bc0fa9 Added support for 'injectJs' and 'includeJs'
Updated bootstrap.js to latest. Also contains:
- Fix reference to handlers in onResourceReceived
- Private handlers
- Use closure to make 'handlers' really private.
- Handle onAlert event just like the other events.
- Handle 'onConsoleMessage' event just like the other events.
2011-06-12 01:23:15 -07:00
IceArmy a83d98b654 When sys.exit'ing, don't bother using qCritical, but just sys.exit with the message instead 2011-06-12 01:20:53 -07:00
IceArmy 5ba2bb4e2f Implement cross platform way of finding the Qt4 plugins directory 2011-06-11 01:28:16 -07:00
IceArmy e32ea74eaf Properly work with any directory
Add imageformats folder and dependencies QtXml and QtSvg, to fix problem where files of type jpeg, gif, svg, .., were not supported
Copy directories examples, plugins, over on build.
Copy files README.md, LICENSE, over on build.
2011-06-10 21:17:10 -07:00
IceArmy 6a8da550cb 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-09 00:30:55 -07:00
IceArmy 5ca07d99ba Expose more properties for onResourceRequested and onResourceReceived. 2011-06-09 00:30:55 -07:00
IceArmy 3c665681f4 Fix possible bug where if CoffeeScript starts with a shebang (hashbang) #!, then // gets put in front of it; but this is not a comment in CoffeeScript, so it causes a problem with the conversion. 2011-06-08 19:00:07 -07:00
IceArmy 91ceec1e9b Add a unique id to associate resource request and receive. 2011-06-08 14:34:30 -07:00
IceArmy 15e596e30c Add hook to handleStarted() 2011-06-08 04:58:20 -07:00
IceArmy d4548b9ad9 Transform all yes,no args into True,False in parseArgs() 2011-06-08 03:14:13 -07:00
IceArmy f0801ad356 Regenerate resources 2011-06-08 03:14:13 -07:00
IceArmy 5c6338c060 Remove encode() from utils.py 2011-06-08 03:14:13 -07:00
IceArmy 0e3b765cc4 Add 'onResourceReceived' event, fired when resource is being received. 2011-06-08 03:13:18 -07:00
Ariya Hidayat ea62c17b91 Fix typo, it's C5E and not CSE. 2011-06-07 11:27:10 -07:00
IceArmy 81627896c2 Support every possible PDF format 2011-06-07 10:57:08 -07:00
IceArmy f419a958a4 Make build_binary.py able to import no matter what 2011-06-07 09:34:07 -07:00
IceArmy 33f0930d8c Regenerate resources 2011-06-07 02:32:12 -07:00
IceArmy 48704069c2 Enumerate all headers in the HTTP request. 2011-06-07 02:32:12 -07:00
IceArmy 4b3cf65b2e Get away with manual qDebug() since we can use the API now. 2011-06-07 02:32:12 -07:00
IceArmy 8314ad3197 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 02:31:33 -07:00
IceArmy 189703cffc rename setup.py (for building binaries) to build_binary.py 2011-06-06 23:09:06 -07:00
IceArmy ce27e879a2 Setup setup.py information 2011-06-06 22:46:05 -07:00
IceArmy 5f66b1c32b Add AUTHORS file for contributors 2011-06-06 22:31:36 -07:00
Francisco Souza 08c6d232af Added licensing headers to Python files 2011-06-06 23:59:07 -03:00
Francisco Souza bfcc186d93 Using markdown 2011-06-06 23:27:23 -03:00
Francisco Souza 7342d0f818 Merge branch 'master' of https://github.com/ariya/phantomjs 2011-06-06 23:25:39 -03:00
IceArmy 99c62d41ef Regenerate resources 2011-06-06 14:17:13 -07:00
IceArmy d941691f93 Introduce "onLoadFinished" event, fired when loading is completed.
It is now possible to specify only the URL in the open() function.
The loading callback can be set using onLoadFinished.

Example use:

var page = new WebPage();
    page.onLoadFinished = function () {
        console.log("Done!");
        phantom.exit();
    };
    page.open("http://example.com");
2011-06-06 14:16:48 -07:00
IceArmy 841dc41f41 Introduce 'onLoadStarted' event which will fire upon page loads.
An example use:

var page = new WebPage();
      page.onLoadStarted = function() {
          console.log('start loading...Please wait');
      };
      page.open("http://example.com", function (status) {
          console.log('Done ' + status);
          phantom.exit();
      });
2011-06-06 14:15:08 -07:00
IceArmy 435c66c153 Cleanup INSTALL.md 2011-06-05 17:40:27 -07:00
IceArmy 5b04c4e55b Convert README and INSTALL to markdown
Also cleaned them up a bit.
2011-06-05 17:13:03 -07:00
Francisco Souza 42e81c1297 Added INSTALL section just before LICENSING 2011-06-05 20:07:30 -03:00
IceArmy fd95c86d2b Rip out --upload-file command-line option 2011-06-05 16:02:42 -07:00
IceArmy 47acc56153 Bring back file upload support.
Instead of using command-line option, file can be uploaded using
WebPage.uploadFile function, e.g.:

  var page = new WebPage();
  page.open(....., function () {
      page.uploadFile('input#attachment', '/path/to/file');
  });

uploadFile() accepts selector name (first argument), this is used to identify
which input element will need the filename (second argument).
2011-06-05 16:02:34 -07:00
Francisco Souza c8dfe1e30a Merge branch 'master' of git://github.com/ariya/phantomjs 2011-06-05 20:00:43 -03:00
Francisco Souza 9ee9361d49 Changes on description, project naming and readme 2011-06-05 20:00:12 -03:00
Francisco Souza 029b7f7768 Using version from utils module 2011-06-05 19:57:29 -03:00
Francisco Souza 9b12ce3f89 Changed the name of package from phantom to pyphantomjs 2011-06-05 19:55:07 -03:00
IceArmy 1796eb5d7c Mark argparse as dependency for Python 2.6 2011-06-04 14:07:51 -07:00
IceArmy fba248781a Reorder import statements as per pep 8 2011-06-03 21:50:13 -07:00
IceArmy a9bf0b964a Move loadStatusChanged signal to top 2011-06-03 15:38:14 -07:00
IceArmy 9b69c83e2a Simplify WebPage signal sending 2011-06-03 15:38:14 -07:00
Francisco Souza e87918c993 Added argparse as dependency for installation 2011-06-03 16:43:26 -03:00
Francisco Souza 47123eff2e Removed setup.py as dependency 2011-06-03 16:32:02 -03:00
Francisco Souza 804ff1bb0b Excluding swp from sdist 2011-06-03 16:30:08 -03:00
Francisco Souza c4ecbbc706 Moving structure for better integration with PyPI 2011-06-03 16:22:58 -03:00
Francisco Souza 7069b707ab Added setup.py and phantom package (for PyPI) 2011-06-03 16:21:03 -03:00
IceArmy 69ff230f3a Revert "Fix bug where WebPage.evaluate had a syntax error."
This reverts commit d2c520a777.
2011-06-01 12:14:20 -07:00
IceArmy d2c520a777 Fix bug where WebPage.evaluate had a syntax error.
It now creates a proper anonymous function (which passes this for global context)
2011-06-01 02:09:07 -07:00
IceArmy 0d78768e4d Fix bug that caused operation body to fail 2011-06-01 00:53:07 -07:00
IceArmy d19901cdf8 Handle badly encoded URL's 2011-06-01 00:29:35 -07:00
IceArmy e93bea5a21 Fix bug where script wouldn't exit properly 2011-05-31 23:29:06 -07:00
IceArmy 82c6735fd0 Declare m_returnValue to 0 2011-05-31 23:29:06 -07:00
IceArmy 456356e876 Simplify CSConverter()'s convert() return statement
Simplify Phantom()'s loadImages and loadPlugins
2011-05-31 22:02:41 -07:00
IceArmy a313d1befd PyPhantomJS version 1.2.0
Refactored most of functionalities to WebPage object
WebPage object can have settings
Support different HTTP operations for loading a page
Simplify buffer handling in render()
Refactor render(), split the buffer rendering to its own function
Render the web page using the tiling approach
WebPage callback for it's console message
Make exit() synchronous
WebPage callback for its JS alert
Updated all examples
2011-05-31 16:23:06 -07:00
IceArmy 73329e73aa Update CoffeeScript to version 1.1.1 2011-05-13 01:10:49 -07:00
IceArmy 652a3c3c76 Added did_action() to find out how many times a hook has been fired 2011-05-07 00:19:55 -07:00
IceArmy e8d1928ebb Fix tiny error where if script is not called directly (so we import it to use it elsewhere), then Bunch and do_action will not be defined in main script. 2011-05-07 00:19:27 -07:00
IceArmy 8c12af3ce5 Did a complete rewrite of the plugin system!
It is now event based, and is MUCH easier than before to write your plugins!
2011-05-06 23:46:51 -07:00
IceArmy 4fc9692176 Get list of .pyc plugins as well, that way you can provide only a bytecode plugin with no .py plugin and it'll still load up fine 2011-05-05 15:43:12 -07:00
IceArmy 66dc5625b3 Raise RuntimeError on loadPlugin's KeyError, explaining the problem 2011-05-05 12:24:30 -07:00
IceArmy e3e82648dd Documented run function(s) and passed args in plugincontroller
Reorganize loadPlugins to run any named function with any set of arguments. all dict arguments will be automatically converted to bunches

Put same func hooks into 1 hook that calls different methods (pre and post)
2011-05-04 23:11:18 -07:00
IceArmy 354bb22a68 Add plugin URL to README 2011-05-04 17:59:17 -07:00
IceArmy 5d861ccdf9 Simplify loadPlugin's bunched globals and locals 2011-05-04 16:52:58 -07:00
IceArmy f320d76284 Simplified plugin code
_globals and _locals are now attributed objects like they should be, instead of being a dict (makes it easier to use them)
2011-05-04 16:15:51 -07:00
IceArmy 15c854405e Add flusher to SafeStreamFilter 2011-05-04 12:32:17 -07:00
IceArmy b1d8fd1f8c Add pre/post __init__ hook to Phantom() for more flexibility 2011-05-04 11:11:37 -07:00
IceArmy 3ac8c79856 Update plugincontroller Hook doc strings 2011-05-04 10:56:36 -07:00
IceArmy 37dd766478 No need to worry about clashing plugin class/method names. It's already automatically taken care of :) 2011-05-04 10:47:54 -07:00
IceArmy f923085c52 Place hooks at better spots to allow more flexibility 2011-05-04 10:47:28 -07:00
IceArmy b25d10bf7c Create loadPlugins helper function 2011-05-04 10:47:08 -07:00
IceArmy d156bad091 New plugin system allows you to add/modify internal code without actually changing it!
Read the string in plugincontroller for a short how to explanation
2011-05-04 02:53:20 -07:00
IceArmy e51ffbcae0 Added option: --ignore-ssl-errors=[yes|no]
Fixed bug where disk-cache would not be enabled unless you also specified --verbose (oops!)
2011-05-03 16:49:34 -07:00
IceArmy fed6b0cc03 Alphabetize usage message 2011-05-03 16:49:13 -07:00
IceArmy f1ea757c24 Removed unneeded scriptDir detection 2011-05-03 16:48:41 -07:00