summaryrefslogtreecommitdiff
path: root/common/content/liberator-overlay.js
blob: ae32b8a244257a110611d56709f46794e173219e (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
62
63
64
65
// Copyright (c) 2008-2008 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

(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");
                dump(e.stack + "\n");
            }
        }
    }

    let prefix = [BASE];

    ["base.js",
     "modules.js",
     "autocommands.js",
     "buffer.js",
     "commandline.js",
     "commands.js",
     "completion.js",
     "configbase.js",
     "config.js",
     "liberator.js",
     "editor.js",
     "events.js",
     "finder.js",
     "hints.js",
     "io.js",
     "javascript.js",
     "mappings.js",
     "marks.js",
     "modes.js",
     "options.js",
     "services.js",
     "statusline.js",
     "style.js",
     "template.js",
     "util.js",
     ].forEach(load);

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

})();

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