mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-04 10:55:46 +01:00
Automatically add plugins context to plugins[file.leafName]
This commit is contained in:
@@ -28,18 +28,26 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
}}} ***** END LICENSE BLOCK *****/
|
}}} ***** END LICENSE BLOCK *****/
|
||||||
|
|
||||||
plugins.contexts = {};
|
plugins.contexts = {};
|
||||||
function Script(name)
|
function Script(file)
|
||||||
{
|
{
|
||||||
let self = plugins.contexts[name]
|
let self = plugins.contexts[file.path]
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
if (self.onUnload)
|
if (self.onUnload)
|
||||||
self.onUnload();
|
self.onUnload();
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
plugins.contexts[name] = this;
|
plugins.contexts[file.path] = this;
|
||||||
this.NAME = name;
|
this.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/, function (_0, _1) _1.toUpperCase());
|
||||||
|
this.PATH = file.path;
|
||||||
this.__context__ = this;
|
this.__context__ = this;
|
||||||
|
|
||||||
|
// This belongs elsewhere
|
||||||
|
for (let [,dir] in Iterator(io.getRuntimeDirectories("plugin")))
|
||||||
|
{
|
||||||
|
if (dir.contains(file, false))
|
||||||
|
plugins[name] = this.NAME;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Script.prototype = plugins;
|
Script.prototype = plugins;
|
||||||
|
|
||||||
@@ -833,7 +841,7 @@ lookup:
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
liberator.loadScript(uri.spec, new Script(file.path));
|
liberator.loadScript(uri.spec, new Script(file));
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user