mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 13:52:26 +01:00
add liberator.eval()
This commit is contained in:
@@ -659,7 +659,7 @@ lookup:
|
|||||||
// handle pure javascript files specially
|
// handle pure javascript files specially
|
||||||
if (/\.js$/.test(filename))
|
if (/\.js$/.test(filename))
|
||||||
{
|
{
|
||||||
eval("with (liberator) {" + str + "}");
|
liberator.eval(str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -671,7 +671,7 @@ lookup:
|
|||||||
{
|
{
|
||||||
if (heredocEnd.test(line))
|
if (heredocEnd.test(line))
|
||||||
{
|
{
|
||||||
eval("with (liberator) {" + heredoc + "}");
|
liberator.eval(heredoc);
|
||||||
heredoc = "";
|
heredoc = "";
|
||||||
heredocEnd = null;
|
heredocEnd = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ const liberator = (function () //{{{
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var cmd = eval("with (liberator) {" + args + "}");
|
var cmd = liberator.eval(args);
|
||||||
liberator.execute(cmd);
|
liberator.execute(cmd);
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
@@ -300,7 +300,7 @@ const liberator = (function () //{{{
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
eval("with (liberator) {" + args + "}");
|
liberator.eval(args);
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
@@ -359,7 +359,7 @@ const liberator = (function () //{{{
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (i--)
|
while (i--)
|
||||||
eval("with (liberator) {" + args + "}");
|
liberator.eval(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (special)
|
if (special)
|
||||||
@@ -405,7 +405,7 @@ const liberator = (function () //{{{
|
|||||||
if (args && args[0] == ":")
|
if (args && args[0] == ":")
|
||||||
liberator.execute(args);
|
liberator.execute(args);
|
||||||
else
|
else
|
||||||
eval("with (liberator) {" + args + "}");
|
liberator.eval(args);
|
||||||
|
|
||||||
if (special)
|
if (special)
|
||||||
return;
|
return;
|
||||||
@@ -590,6 +590,12 @@ const liberator = (function () //{{{
|
|||||||
return false; // so you can do: if (...) return liberator.beep();
|
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 an ex command like str=":zoom 300"
|
||||||
execute: function (str, modifiers)
|
execute: function (str, modifiers)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -259,9 +259,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO: move to liberator.eval()?
|
arg = liberator.eval(arg);
|
||||||
// with (liberator) means, liberator is the default namespace "inside" eval
|
|
||||||
arg = eval("with (liberator) {" + arg + "}");
|
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user