summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2014-12-07 10:53:03 -0500
committerAlex Xu <alex_y_xu@yahoo.ca>2014-12-07 10:53:03 -0500
commitb8b74f38babd5186cc538b4aeae7c0dba7c7c8b6 (patch)
treeeb180e55546ac9c6eba7895bc7af8aef06eb722b
parent9d43f129d4ad56dded752aa75c4dd2bb5af48b9e (diff)
downloadeib-b8b74f38babd5186cc538b4aeae7c0dba7c7c8b6.tar.xz
eib-b8b74f38babd5186cc538b4aeae7c0dba7c7c8b6.zip
Add features, README.rst.
-rw-r--r--README.rst10
-rw-r--r--src/bootstrap.js35
2 files changed, 28 insertions, 17 deletions
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..ba142e1
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,10 @@
+How to use
+----------
+
+1. Build the XPI and install it. On Windows, use the "Send to ZIP" function and create a ZIP of the files in the src directory (not OF the src directory).
+2. Add your trusted sites to the extensions.eib.trusted preference as follows:
+ a. Open about:addons.
+ b. Select Preferences for EVE-IGB Bridge.
+ c. Input ["http://site1", "http://site2"], etc. JSON array of strings, matched at the start of the URL.
+3. Open "http://127.0.0.1:26001/" in the EVE in-game browser. We recommend that you set this page as your home page since there's nothing else the IGB is useful for.
+4. Open one of your trusted sites and start clicking. A recommended starter is http://wiki.eveuniversity.com/ for their ship fittings.
diff --git a/src/bootstrap.js b/src/bootstrap.js
index b01697f..7d4bf8f 100644
--- a/src/bootstrap.js
+++ b/src/bootstrap.js
@@ -43,13 +43,14 @@ EIB.listen = function () {
resp += "Content-Type: text/html\r\n\r\n";
resp += "<!DOCTYPE html><html><head><title>EVE-IGB Bridge</title>";
if (headers["EVE_TRUSTED"]) {
- resp += "<script>";
+ resp += '<script>';
if (headers["EVE_TRUSTED"] == "Yes") {
- resp += EIB.pending.join("\r\n");
- EIB.pending = [];
- resp += 'setTimeout(function () {';
- resp += ' window.location.reload();';
- resp += '}, 100);';
+ var delay = 100;
+ if (EIB.pending.length) {
+ resp += EIB.pending.shift();
+ delay = 1000;
+ }
+ resp += 'setTimeout(function () { location.reload(); }, ' + delay + ');';
} else {
resp += 'CCPEVE.requestTrust("http://127.0.0.1:' + EIB.serverSocket.port + '");';
}
@@ -80,6 +81,7 @@ var HttpObserver = {
for (var header in EIB.headers) {
channel.setRequestHeader(header, EIB.headers[header], false);
}
+ channel.setRequestHeader("User-Agent", channel.getRequestHeader("User-Agent") + " EVE-IGB", false);
}
}
};
@@ -107,24 +109,23 @@ var WindowListener = {
var TrustedReparser = {
observe: function () {
- if (!EIB.prefs.prefHasUserValue("trusted")) {
- EIB.prefs.setCharPref("trusted", "[]");
- }
- EIB.trusted = JSON.parse(EIB.prefs.getCharPref("trusted"));
+ EIB.trusted = EIB.prefs.prefHasUserValue("trusted") ?
+ JSON.parse(EIB.prefs.getCharPref("trusted")) :
+ [];
}
};
function startup(data, reason) {
EIB.listen();
- EIB.prefs = Services.prefs.getBranch("extensions.eib.");
- EIB.prefs.addObserver("trusted", TrustedReparser, false);
- TrustedReparser.observe();
-
forEachOpenWindow(loadIntoWindow);
Services.wm.addListener(WindowListener);
Services.obs.addObserver(HttpObserver, "http-on-modify-request", false);
+
+ EIB.prefs = Services.prefs.getBranch("extensions.eib.");
+ EIB.prefs.addObserver("trusted", TrustedReparser, false);
+ TrustedReparser.observe();
}
function shutdown(data, reason) {
@@ -135,12 +136,12 @@ function shutdown(data, reason) {
EIB.serverSocket.close();
delete EIB.serverSocket;
- EIB.prefs.removeObserver("trusted", TrustedReparser);
-
forEachOpenWindow(unloadFromWindow);
Services.wm.removeListener(WindowListener);
Services.obs.removeObserver(HttpObserver, "http-on-modify-request");
+
+ EIB.prefs.removeObserver("trusted", TrustedReparser);
}
function checkTrusted(href) {
@@ -157,7 +158,7 @@ function injectCCPEVE(e) {
["openEveMail", "showInfo", "showPreview", "showRouteTo", "showMap", "showFitting", "showContract", "showMarketDetails", "setDestination", "addWaypoint", "joinChannel", "joinMailingList", "createContract", "buyType", "findInContracts", "addToMarketQuickBar", "addContact", "removeContact", "addCorpContact", "removeCorpContact", "block", "addBounty", "inviteToFleet", "startConversation", "showContracts", "showOnMap", "editMember", "awardDecoration", "sendMail", "showContents", "bookmark"].forEach(function (n) {
Object.defineProperty(CCPEVE, n, {
value: Cu.exportFunction(function () {
- EIB.pending.push('CCPEVE.' + n + '(' + Array.prototype.join.call(arguments, ',') + ');');
+ EIB.pending.push('CCPEVE.' + n + '(' + JSON.stringify([].slice.call(arguments)).slice(1, -1) + ');');
return null;
}, CCPEVE)
});