This repository has been archived by the owner on Jun 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.js
109 lines (90 loc) · 2.79 KB
/
bootstrap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Feedly Synchronizer AddOn for Mozilla Thunderbird
// Developed by Antonio Miras Aróstegui
// Published under Mozilla Public License, version 2.0 (https://www.mozilla.org/MPL/2.0/)
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
// BEGIN: Code taken from Bitcoin Venezuela Add-On. (c) Alexander Salas
(function(global) {
var modules = {};
global.require = function require(src) {
if (modules[src])
return modules[src];
var scope = { require : global.require, exports : {} };
var tools = {};
Components.utils.import("resource://gre/modules/Services.jsm", tools);
var baseURI = tools.Services.io.newURI(__SCRIPT_URI_SPEC__, null, null);
try {
var uri = tools.Services.io.newURI(
"packages/" + src + ".js", null, baseURI);
tools.Services.scriptloader.loadSubScript(uri.spec, scope);
} catch (e) {
var uri = tools.Services.io.newURI(src, null, baseURI);
tools.Services.scriptloader.loadSubScript(uri.spec, scope);
}
return modules[src] = scope.exports;
};
})(this);
(function(global) {
global.include = function include(src) {
let o = {};
Components.utils.import("resource://gre/modules/Services.jsm", o);
let uri = o.Services.io.newURI(src, null, o.Services.io.newURI(__SCRIPT_URI_SPEC__, null, null));
o.Services.scriptloader.loadSubScript(uri.spec, global);
};
})(this);
var { unload } = require("unload");
// END: Code taken from Bitcoin Venezuela Add-On. (c) Alexander Salas
var win = null;
var addonId = "FeedlySync@AMArostegui";
var uriResolver;
function install(data) {
// Order of includes matter
include("src/fsprefs.js");
include("packages/prefs.js");
include("src/utils.js");
include("src/guiElements.js");
include("src/feedevents.js");
include("packages/l10n.js");
include("packages/unload.js");
include("packages/window-utils.js");
include("src/auth.js");
include("src/tests.js");
log.writeLn("Install");
}
function uninstall() {
}
var { runOnLoad, runOnWindows, watchWindows } = require("window-utils");
function startup(data, reason) {
log.writeLn("Startup. Reason = " + reason);
uriResolver = {
getResourceURI: function(filePath) {
return __SCRIPT_URI_SPEC__ + "/../" + filePath;
}
};
l10n(uriResolver, "FeedlySync.properties");
unload(l10n.unload);
setDefaultPrefs();
watchWindows(main, "mail:3pane");
}
function shutdown(data, reason) {
log.writeLn("Shutdown. Reason = " + reason);
feedEvents.removeListener();
unload();
}
function main(window) {
win = window;
guiElements.startup(syncTBFeedly, runTests, uriResolver);
synch.startup();
feedEvents.addListener();
syncTBFeedly();
}
function syncTBFeedly() {
// Uncomment this line to try against the sandbox
// auth.testing = true;
let action = function() {
synch.begin();
};
synch.authAndRun(action);
}
function runTests() {
tests.begin();
}