From 693d2e52277de09f8746a0b9da84f2d05718a5b8 Mon Sep 17 00:00:00 2001 From: Jelmer van Arnhem Date: Sat, 16 Feb 2019 15:47:38 +0100 Subject: [PATCH 1/2] add devtools command --- app/js/command.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/js/command.js b/app/js/command.js index c2991074..b53d9c63 100644 --- a/app/js/command.js +++ b/app/js/command.js @@ -37,7 +37,16 @@ const execute = command => { UTIL.notify("The quit command takes no arguments", "warn") return } - //reload command + //devtools command + if (["dev", "devtools"].indexOf(command) !== -1) { + devtools() + return + } + if (command.startsWith("dev ") || command.startsWith("devtools ")) { + UTIL.notify("The devtools command takes no arguments", "warn") + return + } + //version command if (["r", "reload"].indexOf(command) !== -1) { SETTINGS.loadFromDisk() return @@ -46,7 +55,7 @@ const execute = command => { UTIL.notify("The reload command takes no arguments", "warn") return } - //reload command + //version command if (["v", "version"].indexOf(command) !== -1) { version() return @@ -90,6 +99,10 @@ const quit = () => { remote.app.exit(0) } +const devtools = () => { + TABS.currentPage().openDevTools() +} + const version = () => { MODES.setMode("normal") const versionUrl = url.format({ From c55cee7e5e74862641f344e7a7ee574f282a4fef Mon Sep 17 00:00:00 2001 From: Jelmer van Arnhem Date: Sat, 16 Feb 2019 15:58:06 +0100 Subject: [PATCH 2/2] add devtools docs --- README.md | 3 ++- app/help.html | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0391dd0a..1284484a 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ but this can be changed as described below in "Configuring Vieb". Vieb supports the following commands: - `:q` or `:quit` will quit Vieb, and is the recommended way to do so +- `:dev` or `:devtools` open the devtools for the current website in a new window - `:r` or `:reload` will reload the settings from the viebrc.json file - `:v` or `:version` to display all version and release information - `:h` or `:help` to display the help documentation, @@ -141,7 +142,7 @@ When starting Vieb with npm, it's required to enter the arguments like this: It should be noted that the developer console is not the one linked to any websites, but is the internal console of the Vieb application. -Opening the developer tools for the current website is not supported yet. +Opening the developer tools for the current website can be done with the `:dev` command. # Configuring Vieb diff --git a/app/help.html b/app/help.html index 20eaa7fa..142a1de0 100644 --- a/app/help.html +++ b/app/help.html @@ -332,6 +332,7 @@

Startup

Lastly, you can provide "--debug" or "--console" to open the Vieb debug console, which is the internal console of Vieb and not the one used to debug websites. Aside from these arguments the remaining ones will be opened as a url. + For the website console, see the devtools command. These urls can take any form if you include the protocol/schema, or will automatically be prefixed with "https://". You can provide as many urls as you want, @@ -463,6 +464,12 @@

version

It is used to diplay version information about Vieb. There are versions listed for Vieb and Chromium, and you can also navigate to the github repository from the version page. + The version command is also available as "v". +

devtools

+ The devtools command takes no arguments. + This command can be used to open to open the developer tools for the current website. + The short version of this command is "dev". + To open the Vieb developer/debug console, see the startup options.

set

This command has already been mostly explained in this paragraph. To summarize, this command can be used to set any setting during runtime,