mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 21:08:12 +01:00
Cleanup some stuffs.
This commit is contained in:
@@ -102,7 +102,6 @@ function Liberator()
|
|||||||
this.HELP_TAGS = {};
|
this.HELP_TAGS = {};
|
||||||
this.FILE_MAP = {};
|
this.FILE_MAP = {};
|
||||||
this.OVERLAY_MAP = {};
|
this.OVERLAY_MAP = {};
|
||||||
this.NAMESPACES = [];
|
|
||||||
}
|
}
|
||||||
Liberator.prototype = {
|
Liberator.prototype = {
|
||||||
contractID: "@mozilla.org/network/protocol;1?name=liberator",
|
contractID: "@mozilla.org/network/protocol;1?name=liberator",
|
||||||
@@ -122,9 +121,12 @@ Liberator.prototype = {
|
|||||||
|
|
||||||
init: function (obj)
|
init: function (obj)
|
||||||
{
|
{
|
||||||
for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP", "NAMESPACES"])
|
for each (let prop in ["HELP_TAGS", "FILE_MAP", "OVERLAY_MAP"])
|
||||||
for (let [k, v] in Iterator(obj[prop]))
|
{
|
||||||
|
this[prop] = this[prop].constructor();
|
||||||
|
for (let [k, v] in Iterator(obj[prop] || {}))
|
||||||
this[prop][k] = v
|
this[prop][k] = v
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scheme: "liberator",
|
scheme: "liberator",
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ CompletionContext.prototype = {
|
|||||||
lists.pop());
|
lists.pop());
|
||||||
if (!substrings) // FIXME: How is this undefined?
|
if (!substrings) // FIXME: How is this undefined?
|
||||||
return [];
|
return [];
|
||||||
return util.Array.uniq(substrings);
|
return util.Array.uniq(Array.slice(substrings));
|
||||||
},
|
},
|
||||||
// Temporary
|
// Temporary
|
||||||
get longestAllSubstring()
|
get longestAllSubstring()
|
||||||
@@ -1049,8 +1049,10 @@ function Completion() //{{{
|
|||||||
let end = (frame == -1 ? lastIdx : get(frame + 1)[OFFSET]);
|
let end = (frame == -1 ? lastIdx : get(frame + 1)[OFFSET]);
|
||||||
|
|
||||||
cacheKey = null;
|
cacheKey = null;
|
||||||
let obj = [[cache.evalContext, "Local Variables"], [userContext, "Global Variables"],
|
let obj = [[cache.evalContext, "Local Variables"],
|
||||||
[modules, "modules"], [window, "window"]]; // Default objects;
|
[userContext, "Global Variables"],
|
||||||
|
[modules, "modules"],
|
||||||
|
[window, "window"]]; // Default objects;
|
||||||
// Is this an object dereference?
|
// Is this an object dereference?
|
||||||
if (dot < statement) // No.
|
if (dot < statement) // No.
|
||||||
dot = statement - 1;
|
dot = statement - 1;
|
||||||
|
|||||||
@@ -1205,6 +1205,8 @@ const liberator = (function () //{{{
|
|||||||
XML.ignoreWhiteSpace = false;
|
XML.ignoreWhiteSpace = false;
|
||||||
XML.prettyPrinting = false;
|
XML.prettyPrinting = false;
|
||||||
services.get("subscriptLoader").loadSubScript(uri, context);
|
services.get("subscriptLoader").loadSubScript(uri, context);
|
||||||
|
if (liberator.initialized)
|
||||||
|
liberator.initHelp();
|
||||||
},
|
},
|
||||||
|
|
||||||
eval: function (str, context)
|
eval: function (str, context)
|
||||||
@@ -1420,9 +1422,10 @@ const liberator = (function () //{{{
|
|||||||
initHelp: function ()
|
initHelp: function ()
|
||||||
{
|
{
|
||||||
let namespaces = [config.name.toLowerCase(), "liberator"];
|
let namespaces = [config.name.toLowerCase(), "liberator"];
|
||||||
let tagMap = {};
|
services.get("liberator:").init({});
|
||||||
let fileMap = {};
|
let tagMap = services.get("liberator:").HELP_TAGS;
|
||||||
let overlayMap = {};
|
let fileMap = services.get("liberator:").FILE_MAP;
|
||||||
|
let overlayMap = services.get("liberator:").OVERLAY_MAP;
|
||||||
function XSLTProcessor(sheet)
|
function XSLTProcessor(sheet)
|
||||||
{
|
{
|
||||||
let xslt = Cc["@mozilla.org/document-transformer;1?type=xslt"].createInstance(Ci.nsIXSLTProcessor);
|
let xslt = Cc["@mozilla.org/document-transformer;1?type=xslt"].createInstance(Ci.nsIXSLTProcessor);
|
||||||
@@ -1491,18 +1494,7 @@ const liberator = (function () //{{{
|
|||||||
</document>.toXMLString();
|
</document>.toXMLString();
|
||||||
fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help];
|
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);
|
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
|
// this function is called when the chrome is ready
|
||||||
startup: function ()
|
startup: function ()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
let start = Date.now();
|
let start = Date.now();
|
||||||
liberator.log("Initializing liberator object...", 0);
|
liberator.log("Initializing liberator object...", 0);
|
||||||
@@ -2029,17 +2019,14 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
liberator.triggerObserver("enter", null);
|
liberator.triggerObserver("enter", null);
|
||||||
autocommands.trigger(config.name + "Enter", {});
|
autocommands.trigger(config.name + "Enter", {});
|
||||||
|
|
||||||
|
liberator.initialized = true;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
statusline.update();
|
statusline.update();
|
||||||
|
|
||||||
liberator.dump("loaded in " + (Date.now() - start) + " ms");
|
liberator.dump("loaded in " + (Date.now() - start) + " ms");
|
||||||
liberator.log(config.name + " fully initialized", 0);
|
liberator.log(config.name + " fully initialized", 0);
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
liberator.reportError(e);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
shutdown: function ()
|
shutdown: function ()
|
||||||
|
|||||||
Reference in New Issue
Block a user