From f8dc6097aa538eca60243848b394963c47f98d2b Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 6 Oct 2010 11:52:57 -0400 Subject: [PATCH] Fix duplicate plugin help entries. Closes issue #51. --- common/content/dactyl.js | 2 +- common/content/io.js | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index f5295ff4..bcf420d7 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -496,7 +496,7 @@ const Dactyl = Module("dactyl", { let body = XML(); for (let [, context] in Iterator(plugins.contexts)) - if (context.INFO instanceof XML) + if (context && context.INFO instanceof XML) body +=

{context.INFO.@summary}

+ context.INFO; diff --git a/common/content/io.js b/common/content/io.js index 5f4ab0db..6660ecac 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -9,25 +9,26 @@ /** @scope modules */ -plugins.contexts = plugins; +plugins.contexts = {}; function Script(file) { let self = plugins[file.path]; if (self) { if (self.onUnload) self.onUnload(); - return self; } - else - self = { __proto__: plugins }; - plugins[file.path] = self; - self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); - self.PATH = file.path; - self.CONTEXT = self; + else { + self = { __proto__: plugins }; + plugins[file.path] = self; + self.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); + self.PATH = file.path; + self.CONTEXT = self; - // This belongs elsewhere - if (io.getRuntimeDirectories("plugins").some( - function (dir) dir.contains(file, false))) - plugins[self.NAME] = self; + // This belongs elsewhere + if (io.getRuntimeDirectories("plugins").some( + function (dir) dir.contains(file, false))) + plugins[self.NAME] = self; + } + plugins.contexts[file.path] = self; return self; }