artoo.js The client-side scraping companion.

Settings


artoo.js ships with a variety of settings for you to adjust.

You can change the library's settings either by changing them directly through JavaScript:

artoo.settings.debug = true;

// Or if you need to merge settings:
artoo.loadSettings({
  debug: false
});

Or by specifying a precise configuration in a custom bookmarklet generated by artoo.js' grunt task.



Root

  • autoExec boolean [true] : should the given script be evaluated when artoo is started?
  • autoInit boolean [true] : should artoo launch his initialization routine when loaded? If the routine is not automatically launched, you'll have to do it yourself with artoo.init().
  • reExec boolean [true] : should the given script be evaluated every time the bookmarklet is invoked in the page?
  • debug boolean [false] : should debug mode be activated.
  • scriptUrl string [null] : the url of a distant script to be injected and executed as soon as artoo is started.
  • eval string [null] : the string of a script to be executed through eval as soon as artoo is started.
  • reload boolean [false] : should artoo be reloaded when injected more than once.

Dependencies

artoo enables you to load some remote dependencies alongside jQuery when he is injected within a webpage.

Note that the injected dependencies will be injected safely into your webpage by checking whether they can be injected into the global scope or not.

To do so, just add an array of desired dependencies in the settings.

Example

Requesting the async library through a cdn.

{
  "dependencies": [
    {
      "name": "async",
      "url": "//cdnjs.cloudflare.com/ajax/libs/async/0.9.0/async.js",
      "globals": ["async"]
    }
  ]
}

Options

  • name string : name of the dependency as registered in artoo.deps.
  • url string : remote url where it is possible to load the dependency.
  • globals string|array : array of variable names or single variable names that will be injected to the global scope by the loaded dependency so we can track inject them safely.
  • force ?boolean [false] : should the dependency be forced into the global scope?

Usage

// Given we requested async

// If no conflicts occured
async.series(task);

// A conflict occured, dependencies are available through 'artoo.deps'
artoo.deps.async.series(task);

Cache

  • cache.delimiter string ['%'] : the delimiter to be used to wrap cache's storage keys.

Instructions

  • instructions.autoRecord boolean [true] : should artoo starts to record instructions on his own?

jQuery

  • jquery.force boolean [false] : should artoo force jQuery injection?
  • jquery.version string [2.1.1] : jQuery version to be injected.

Log

  • log.enabled boolean [true] : should artoo be able to log?
  • log.welcome boolean [true] : should the logo be displayed on start?

Store

  • store.engine string ['local'] : engine to use for artoo.store. Either local or session.