1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 09:17:59 +01:00

add liberator.eval()

This commit is contained in:
Doug Kearns
2008-09-01 03:06:29 +00:00
parent aa687a20a7
commit f76d0c3ccd
3 changed files with 13 additions and 9 deletions

View File

@@ -232,7 +232,7 @@ const liberator = (function () //{{{
{
try
{
var cmd = eval("with (liberator) {" + args + "}");
var cmd = liberator.eval(args);
liberator.execute(cmd);
}
catch (e)
@@ -300,7 +300,7 @@ const liberator = (function () //{{{
{
try
{
eval("with (liberator) {" + args + "}");
liberator.eval(args);
}
catch (e)
{
@@ -359,7 +359,7 @@ const liberator = (function () //{{{
else
{
while (i--)
eval("with (liberator) {" + args + "}");
liberator.eval(args);
}
if (special)
@@ -405,7 +405,7 @@ const liberator = (function () //{{{
if (args && args[0] == ":")
liberator.execute(args);
else
eval("with (liberator) {" + args + "}");
liberator.eval(args);
if (special)
return;
@@ -590,6 +590,12 @@ const liberator = (function () //{{{
return false; // so you can do: if (...) return liberator.beep();
},
// with (liberator) means, liberator is the default namespace "inside" eval
eval: function (str)
{
return eval("with (liberator) {" + str + "}");
},
// Execute an ex command like str=":zoom 300"
execute: function (str, modifiers)
{