commit e48bec8216ca3d19565366a7e1935a3b275cb252
parent e58c54057f8bf02886bf6a8a2e759be3aac699b5
Author: Ryan Wolf <rwolf@borderstylo.com>
Date: Tue, 14 Dec 2010 17:52:41 -0800
submodules, build, more win
Diffstat:
8 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,2 @@
+antimony.xpi
+build/*
diff --git a/.gitmodules b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "vendor/commonjs-ffext"]
+ path = vendor/commonjs-ffext
+ url = git@github.com:borderstylo/commonjs-ffext.git
+[submodule "vendor/windex"]
+ path = vendor/windex
+ url = git@github.com:borderstylo/windex.git
diff --git a/Makefile b/Makefile
@@ -1,6 +1,12 @@
package : clean
cd addon/ && zip -r ../antimony.xpi chrome/ defaults/ locale/ chrome.manifest install.rdf
+
+build : clean
+ cp -R addon/* build/ && \
+ cp vendor/windex/windex.js addon/chrome/modules/ && \
+ cp vendor/commonjs-ffext/common.js addon/chrome/modules/
+
clean :
- rm -f antimony.xpi
+ rm -fr antimony.xpi build/*
diff --git a/build/.gitignore b/build/.gitignore
diff --git a/client.js b/client.js
@@ -1,13 +1,17 @@
var request = require('request');
-var runOnPage = function (url, f, callback) {
+var Client = function (host) {
+ this.host = host;
+};
+
+Client.prototype.runOnPage = function (url, f, callback) {
var data = {
type: 'page',
url: url,
script: f.toString()
};
var params = {
- uri: 'http://localhost:1235/client',
+ uri: 'http://' + this.host + '/client',
method: 'POST',
body: JSON.stringify(data)
};
@@ -17,13 +21,4 @@ var runOnPage = function (url, f, callback) {
});
};
-runOnPage(
- 'http://jquery.com',
- function (callback) {
- $(document.body).html('Boo yeah!');
- callback($(document.body).html());
- },
- function (data) {
- console.log(data);
- }
-);
+module.exports = Client;
diff --git a/example/cnn.js b/example/cnn.js
@@ -0,0 +1,16 @@
+var Client = require('../client');
+
+var client = new Client('localhost:1235');
+
+client.runOnPage(
+ 'http://cnn.com/',
+ function (callback) {
+ $(document.body).html('Boo Yeah!');
+ setTimeout(function () {
+ callback(document.title);
+ }, 3000);
+ },
+ function (data) {
+ console.log(data);
+ }
+);
diff --git a/vendor/commonjs-ffext b/vendor/commonjs-ffext
@@ -0,0 +1 @@
+Subproject commit 73fce38803f6d08b6c96b1169dcb182282b745d2
diff --git a/vendor/windex b/vendor/windex
@@ -0,0 +1 @@
+Subproject commit 64e66002ffdd28ff71c44a4c1ed882ce07e6eed0