pjscrape v.0.1


Namespace _pjs

Defined in:
pjscrape_client.js

Namespace for client-side utility functions. This will be available to scrapers as _pjs or window._pjs.

Static Fields

Field
_pjs.$ :{jQuery}
Reference to jQuery.
_pjs.getAnchorUrls :{String[]}
Convenience function - find all anchor tags on the page matching the given selector (or jQuery object) and return an array of fully qualified URLs
_pjs.getPattern :{Object[]|Array[]}
Get a set of records by looking for repeated patterns in the .content() of the selected element.
_pjs.getText :{String[]}
Convenience function - find all tags on the page matching the given selector (or jQuery object) and return inner text for each
_pjs.isLocalUrl :{Boolean}
Check whether a URL is local to this site
_pjs.ready :{Boolean}
Flag that will be set to true when $(document).ready is called.
_pjs.toFullUrl :{String}
Convert a local URL to a fully qualified URL (with domain name, etc)
_pjs.waitFor
Wait for a condition to occur, then execute the callback
Wait for an element to appear, then execute the callback
Namespace Detail
_pjs
Static Field Details
_pjs.$ :{jQuery}
Reference to jQuery. This is guaranteed to be the pjscrape.js version of the jQuery library. Scrapers using the 'noConflict' config option should use this reference in their code.
_pjs.getAnchorUrls :{String[]}
Convenience function - find all anchor tags on the page matching the given selector (or jQuery object) and return an array of fully qualified URLs
Parameters (optional)
selector {String|jQuery} Selector or jQuery object to find anchor elements
includeOffsite {Boolean} Whether to include off-site links
Returns:
{String[]} Array of fully qualified URLs
_pjs.getPattern :{Object[]|Array[]}
Get a set of records by looking for repeated patterns in the .content() of the selected element. Patterns can be supplied as either objects or arrays; the record format will match the input format. Pattern pieces can be either selector strings, regular expressions, or "text" for unwrapped text blocks. Interstitial cruft (br tags, line breaks, etc) will be ignored if they don't have any text other than whitespace. Pattern pieces can also be specified as objects, in the format {pattern: [pattern piece], ...options}, in order to specify additional options. Available options are optional (boolean), ignore (boolean, require but don't return content), inner (boolean, scrape again in the previous element), scrape (custom function to scrape content from matched element), and test (custom function to test if element matches).
Parameters (optional)
selector {String|jQuery} Selector or jQuery object to find elements
pattern {Object|Array} Pattern to look for
Returns:
{Object[]|Array[]} Records in format matching the pattern format
_pjs.getText :{String[]}
Convenience function - find all tags on the page matching the given selector (or jQuery object) and return inner text for each
Parameters (optional)
selector {String|jQuery} Selector or jQuery object to find elements
Returns:
{String[]} Array of text contents
_pjs.isLocalUrl :{Boolean}
Check whether a URL is local to this site
Parameters (optional)
url {String} URL to check
Returns:
{Boolean} Whether this URL is local
_pjs.ready :{Boolean}
Flag that will be set to true when $(document).ready is called. Generally your code will not need to deal with this - use the "ready" configuration parameter instead.
_pjs.toFullUrl :{String}
Convert a local URL to a fully qualified URL (with domain name, etc)
Parameters (optional)
url {String} URL to convert
Returns:
{String} Fully qualified URL
_pjs.waitFor
Wait for a condition to occur, then execute the callback
Parameters (optional)
test {Function} Test function; should return true when ready
callback {Function} Callback function to execute
_pjs.waitForElement
Wait for an element to appear, then execute the callback
Parameters (optional)
selector {String} JQuery selector to look for
callback {Function} Callback function to execute
©2011 Nick Rabinowitz
Documentation generated by JsDoc Toolkit 2.3.2 on Mon Oct 24 2011 12:16:49 GMT-0700 (PDT)