1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 15:47:58 +01:00

Cleanup some stuffs.

This commit is contained in:
Kris Maglione
2009-11-03 19:50:10 -05:00
parent d4b818b7d7
commit 68dd615648
3 changed files with 18 additions and 27 deletions

View File

@@ -102,7 +102,6 @@ function Liberator()
this.HELP_TAGS = {};
this.FILE_MAP = {};
this.OVERLAY_MAP = {};
this.NAMESPACES = [];
}
Liberator.prototype = {
contractID: "@mozilla.org/network/protocol;1?name=liberator",
@@ -122,9 +121,12 @@ Liberator.prototype = {
init: function (obj)
{
for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP", "NAMESPACES"])
for (let [k, v] in Iterator(obj[prop]))
for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP"])
{
this[prop] = this[prop].constructor();
for (let [k, v] in Iterator(obj[prop] || {}))
this[prop][k] = v
}
},
scheme: "liberator",

View File

@@ -262,7 +262,7 @@ CompletionContext.prototype = {
lists.pop());
if (!substrings) // FIXME: How is this undefined?
return [];
return util.Array.uniq(substrings);
return util.Array.uniq(Array.slice(substrings));
},
// Temporary
get longestAllSubstring()
@@ -1049,8 +1049,10 @@ function Completion() //{{{
let end = (frame == -1 ? lastIdx : get(frame + 1)[OFFSET]);
cacheKey = null;
let obj = [[cache.evalContext, "Local Variables"], [userContext, "Global Variables"],
[modules, "modules"], [window, "window"]]; // Default objects;
let obj = [[cache.evalContext, "Local Variables"],
[userContext, "Global Variables"],
[modules, "modules"],
[window, "window"]]; // Default objects;
// Is this an object dereference?
if (dot < statement) // No.
dot = statement - 1;

View File

@@ -1205,6 +1205,8 @@ const liberator = (function () //{{{
XML.ignoreWhiteSpace = false;
XML.prettyPrinting = false;
services.get("subscriptLoader").loadSubScript(uri, context);
if (liberator.initialized)
liberator.initHelp();
},
eval: function (str, context)
@@ -1420,9 +1422,10 @@ const liberator = (function () //{{{
initHelp: function ()
{
let namespaces = [config.name.toLowerCase(), "liberator"];
let tagMap = {};
let fileMap = {};
let overlayMap = {};
services.get("liberator:").init({});
let tagMap = services.get("liberator:").HELP_TAGS;
let fileMap = services.get("liberator:").FILE_MAP;
let overlayMap = services.get("liberator:").OVERLAY_MAP;
function XSLTProcessor(sheet)
{
let xslt = Cc["@mozilla.org/document-transformer;1?type=xslt"].createInstance(Ci.nsIXSLTProcessor);
@@ -1491,18 +1494,7 @@ const liberator = (function () //{{{
</document>.toXMLString();
fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help];
services.get("liberator:").init({
HELP_TAGS: tagMap, FILE_MAP: fileMap,
OVERLAY_MAP: overlayMap, NAMESPACES: namespaces
});
addTags("plugins", util.httpGet("liberator://help/plugins").responseXML);
// TODO: Don't do this.
services.get("liberator:").init({
HELP_TAGS: tagMap, FILE_MAP: fileMap,
OVERLAY_MAP: overlayMap, NAMESPACES: namespaces
});
},
/**
@@ -1877,8 +1869,6 @@ const liberator = (function () //{{{
// this function is called when the chrome is ready
startup: function ()
{
try
{
let start = Date.now();
liberator.log("Initializing liberator object...", 0);
@@ -2029,17 +2019,14 @@ const liberator = (function () //{{{
liberator.triggerObserver("enter", null);
autocommands.trigger(config.name + "Enter", {});
liberator.initialized = true;
}, 0);
statusline.update();
liberator.dump("loaded in " + (Date.now() - start) + " ms");
liberator.log(config.name + " fully initialized", 0);
}
catch (e)
{
liberator.reportError(e);
}
},
shutdown: function ()