.TP
.B source
Toggle between normal view and source view for the current page.
+.TP
+.BI eval " JAVASCRIPT"
+Runs the given \fIJAVASCRIPT\fP in the current page and display the evaluated
+value.
.SH FILES
.I $XDG_CONFIG_HOME/PROJECT/config
.RS
{"hist-prev", command_history, {1}},
{"run", command_run_multi, {0}},
{"bookmark-add", command_bookmark, {1}},
+ {"eval", command_eval, {0}},
};
vb_set_mode(VB_MODE_NORMAL, false);
return true;
}
+
+gboolean command_eval(const Arg *arg)
+{
+ gboolean success;
+ char *value = NULL;
+
+ success = vb_eval_script(
+ webkit_web_view_get_main_frame(vb.gui.webview), arg->s, NULL, &value
+ );
+ if (success) {
+ vb_echo_force(VB_MSG_NORMAL, false, value);
+ } else {
+ vb_echo_force(VB_MSG_ERROR, true, value);
+ }
+ g_free(value);
+ vb_set_mode(VB_MODE_NORMAL, false);
+
+ return success;
+}
gboolean command_zoom(const Arg *arg);
gboolean command_history(const Arg *arg);
gboolean command_bookmark(const Arg *arg);
+gboolean command_eval(const Arg *arg);
#endif /* end of include guard: _COMMAND_H */