1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-11 04:34:13 +01:00

Fix duplicate plugin help entries. Closes issue #51.

This commit is contained in:
Kris Maglione
2010-10-06 11:52:57 -04:00
parent 97f043d32f
commit f8dc6097aa
2 changed files with 14 additions and 13 deletions

View File

@@ -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 += <h2 xmlns={NS.uri} tag={context.INFO.@name + '-plugin'}>{context.INFO.@summary}</h2> +
context.INFO;

View File

@@ -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;
}