diff --git a/lib/chrome.js b/lib/chrome.js index d44dbcb..1db696d 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -3,11 +3,33 @@ ///////////////////////////////////////////////////////////////////////////////// var SHELL = require("lib/shell"); -var ChromeBrowser = function() {}; +var binPath = "%PROGRAMFILES%\\Google\\Chrome\\Application\\chrome.exe"; -ChromeBrowser.prototype.open = function(profile) { - +var Chrome = function() { + this.profileName = "Default"; + this.proxyPort = 1080; + + this.setProfileName = function(s) { + this.profileName = s; + }; + + this.setProxyPort = function(s) { + this.proxyPort = s; + }; + + this.open = function(url) { + SHELL.createProcess([ + binPath, + "--profile-directory=" + this.profileName, + "--proxy-server=socks5://127.0.0.1:" + this.proxyPort, + url + ]); + }; }; -exports.open = ChromeBrowser.open; - +exports.start = function(url, proxyPort, profileName) { + var instance = new Chrome(); + instance.setProfileName(profileName); + instance.setProxyPort(proxyPort); + instance.open(url); +}; diff --git a/lib/xml.js b/lib/xml.js index 141dc1d..38bdc46 100644 --- a/lib/xml.js +++ b/lib/xml.js @@ -139,15 +139,9 @@ var XMLObject = function(dom) { }; }; -exports.create = function() { - return (new XMLObject()).getDOM(); -}; exports.load = function(s) { return (new XMLObject()).load(s); }; -exports.createElement = function(s) { - return (new XMLObject()).createElement(s); -}; exports.VERSIONINFO = "XML interface (xml.js) version 0.1"; exports.global = global;