mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 08:08:00 +01:00
add liberator.eval()
This commit is contained in:
@@ -659,7 +659,7 @@ lookup:
|
||||
// handle pure javascript files specially
|
||||
if (/\.js$/.test(filename))
|
||||
{
|
||||
eval("with (liberator) {" + str + "}");
|
||||
liberator.eval(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -671,7 +671,7 @@ lookup:
|
||||
{
|
||||
if (heredocEnd.test(line))
|
||||
{
|
||||
eval("with (liberator) {" + heredoc + "}");
|
||||
liberator.eval(heredoc);
|
||||
heredoc = "";
|
||||
heredocEnd = null;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -259,9 +259,7 @@ liberator.CommandLine = function () //{{{
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: move to liberator.eval()?
|
||||
// with (liberator) means, liberator is the default namespace "inside" eval
|
||||
arg = eval("with (liberator) {" + arg + "}");
|
||||
arg = liberator.eval(arg);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user