summaryrefslogtreecommitdiff
path: root/common/content/liberator-overlay.js
blob: b2cd0656c978d6b74cc219844d44d8d9672167b0 (plain)
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

(function () {
    const modules = {};
    const BASE = "chrome://liberator/content/";

    modules.modules = modules;

    const loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
                                     .getService(Components.interfaces.mozIJSSubScriptLoader);
    function load(script)
    {
        for (let [i, base] in Iterator(prefix))
        {
            try
            {
                loader.loadSubScript(base + script, modules);
                return;
            }
            catch (e)
            {
                if (i + 1 < prefix.length)
                    continue;
                if (Components.utils.reportError)
                    Components.utils.reportError(e);
                dump("liberator: Loading script " + script + ": " + e + "\n");
            }
        }
    }

    Components.utils.import("resource://liberator/storage.jsm", modules);

    let prefix = [BASE];

    ["services.js",
     "liberator.js",
     "configbase.js",
     "config.js"].forEach(load);
    modules.config.__proto__ = modules.configbase;

    ["util.js",
     "style.js",
     "buffer.js",
     "commands.js",
     "completion.js",
     "editor.js",
     "events.js",
     "finder.js",
     "hints.js",
     "io.js",
     "mappings.js",
     "modes.js",
     "options.js",
     "template.js",
     "ui.js"].forEach(load);

    prefix.unshift("chrome://" + modules.config.name.toLowerCase() + "/content/");
    modules.config.scripts.forEach(load);

})();

// vim: set fdm=marker sw=4 ts=4 et: