1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-08 05:25:48 +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(); let body = XML();
for (let [, context] in Iterator(plugins.contexts)) 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> + body += <h2 xmlns={NS.uri} tag={context.INFO.@name + '-plugin'}>{context.INFO.@summary}</h2> +
context.INFO; context.INFO;

View File

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