Add --quiet argument to :jseval.
This commit is contained in:
parent
8ecc3a3bb0
commit
efcea65596
@ -244,12 +244,15 @@ Toggle the web inspector.
|
|||||||
|
|
||||||
[[jseval]]
|
[[jseval]]
|
||||||
=== jseval
|
=== jseval
|
||||||
Syntax: +:jseval 'js_code'+
|
Syntax: +:jseval [*--quiet*] 'js-code'+
|
||||||
|
|
||||||
Evaluate a JavaScript string.
|
Evaluate a JavaScript string.
|
||||||
|
|
||||||
==== positional arguments
|
==== positional arguments
|
||||||
* +'js_code'+: The string to evaluate.
|
* +'js-code'+: The string to evaluate.
|
||||||
|
|
||||||
|
==== optional arguments
|
||||||
|
* +*-q*+, +*--quiet*+: Don't show resulting JS object.
|
||||||
|
|
||||||
==== note
|
==== note
|
||||||
* This command does not split arguments after the last argument and handles quotes literally.
|
* This command does not split arguments after the last argument and handles quotes literally.
|
||||||
|
@ -1566,15 +1566,19 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
maxsplit=0, no_cmd_split=True)
|
maxsplit=0, no_cmd_split=True)
|
||||||
def jseval(self, js_code):
|
def jseval(self, js_code, quiet=False):
|
||||||
"""Evaluate a JavaScript string.
|
"""Evaluate a JavaScript string.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
js_code: The string to evaluate.
|
js_code: The string to evaluate.
|
||||||
|
quiet: Don't show resulting JS object.
|
||||||
"""
|
"""
|
||||||
frame = self._current_widget().page().mainFrame()
|
frame = self._current_widget().page().mainFrame()
|
||||||
out = frame.evaluateJavaScript(js_code)
|
out = frame.evaluateJavaScript(js_code)
|
||||||
|
|
||||||
|
if quiet:
|
||||||
|
return
|
||||||
|
|
||||||
if out is None:
|
if out is None:
|
||||||
# Getting the actual error (if any) seems to be difficult. The
|
# Getting the actual error (if any) seems to be difficult. The
|
||||||
# error does end up in BrowserPage.javaScriptConsoleMessage(), but
|
# error does end up in BrowserPage.javaScriptConsoleMessage(), but
|
||||||
|
Loading…
Reference in New Issue
Block a user