Created
April 22, 2012 15:51
-
-
Save bialecki/2464827 to your computer and use it in GitHub Desktop.
New main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
var pageMod = require('page-mod'); | |
var data = require('self').data; | |
var request = require('request').Request; | |
exports.main = function(options, callbacks) { | |
var pageMod = require("page-mod"); | |
pageMod.PageMod({ | |
include: "*.khanacademy.org", | |
contentScriptWhen: 'end', | |
contentScriptFile: [ | |
data.url('jquery-1.4.4.min.js'), | |
data.url('content-script.js') | |
], | |
onAttach: function(worker) { | |
worker.port.on('myURL', function(url) { | |
console.log('This is the url:'); | |
var newRequest = new request({ | |
url: 'http://localhost:8080/track/page', | |
onComplete: function (response) { | |
console.log('The response is the following : ' + response); | |
} | |
}).post(); | |
}); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment