Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

jQuery isn't required

  • Loading branch information...
commit 1c37147939c28cb3ca8a684afc40152cc4918a0c 1 parent 296ebca
@chriso authored
View
9 .gitmodules
@@ -1,12 +1,9 @@
-[submodule "vendor/jquery"]
- path = vendor/jquery
- url = https://github.com/coolaj86/node-jquery.git
[submodule "vendor/htmlparser"]
path = vendor/htmlparser
url = https://github.com/tautologistics/node-htmlparser.git
-[submodule "vendor/jsdom"]
- path = vendor/jsdom
- url = https://github.com/tmpvar/jsdom.git
[submodule "vendor/validator"]
path = vendor/validator
url = https://chriso@github.com/chriso/node-validator.git
+[submodule "vendor/soupselect"]
+ path = vendor/soupselect
+ url = https://github.com/harryf/node-soupselect.git
View
15 lib/node.io/dom.js
@@ -4,7 +4,9 @@
* MIT Licensed
*/
-var Job = require('./job').JobProto, soupselect;
+var Job = require('./job').JobProto,
+ utils = require('./utils'),
+ soupselect;
/**
* The CSS selector function. See the documentation for usage examples.
@@ -47,12 +49,17 @@ Job.prototype.parseHtml = function (data, callback, response) {
ProcessExternalResources: false,
QuerySelector: false
};
- var $, window = require('../../vendor/jsdom/lib/jsdom').jsdom(data, null, {features:features}).createWindow(),
- jquery = require('../../vendor/jquery/lib/jquery-1.5'),
- default_$ = jquery.create(window);
+ try {
+ var $, window = require('jsdom').jsdom(data, null, {features:features}).createWindow(),
+ jquery = require('jquery'),
+ default_$ = jquery.create(window);
+ } catch (e) {
+ utils.fatal('jQuery is not installed. Run `npm install jquery`');
+ }
$ = function (selector, context) {
return context ? jquery.create(context) : default_$(selector);
};
+ console.log(e);process.exit();
callback.apply(this, [null, $, data, headers, response]);
} else {
var self = this, handler, parser, $, htmlparser = require('../../vendor/htmlparser/lib/htmlparser');
View
4 lib/node.io/index.js
@@ -28,11 +28,11 @@ exports.create = function (obj) {
obj = {run: obj};
}
var options = obj.options || {};
- utils.put(options, {
+ options = utils.put({
timeout: 10,
auto_retry: true,
spoof: true
- });
+ }, options);
return new job.Job(options, obj);
};
View
2  lib/node.io/processor.js
@@ -265,7 +265,7 @@ Processor.prototype.loadJob = function (job, callback) {
//Check if the job is a builtin
var builtins = ['digest','eval','pagerank','query','resolve','statuscode','validate','word_count'];
if (builtins.indexOf(job) !== -1) {
- callback(null, job, require(__dirname + '/../../builtin/' + job + '.coffee'));
+ callback(null, job, require(__dirname + '/../../builtin/' + job + '.js'));
}
//Jobs in the current working directory are given top priority
1  vendor/jquery
@@ -1 +0,0 @@
-Subproject commit ffd339bb836369d4a50e422e92cd0d46abc378a9
1  vendor/jsdom
@@ -1 +0,0 @@
-Subproject commit f39becd333665a29a4ff2f3a5c47d8486c36555f
1  vendor/soupselect
@@ -0,0 +1 @@
+Subproject commit 2de2537a87058f029def5424beb24994a32c71fd

0 comments on commit 1c37147

Please sign in to comment.
Something went wrong with that request. Please try again.