From d28fe3eed22b027256a34881a1490e63833ae8a2 Mon Sep 17 00:00:00 2001
From: James Feng Cao
Date: Mon, 24 Jun 2024 09:58:02 +0800
Subject: [PATCH] ebrowser to use alt+<- / -> for page backward/forward
---
ebrowser.md | 12 ++-
en/ebrowserreadme/index.html | 15 +++-
en/index.xml | 2 +-
en/sitemap.xml | 6 +-
misc/ebrowser/index.html | 162 ++++++++++++++++++++++++++++++++---
misc/ebrowser/package.json | 2 +-
misc/ebrowser/webview.js | 21 +++--
sitemap.xml | 2 +-
8 files changed, 191 insertions(+), 31 deletions(-)
diff --git a/ebrowser.md b/ebrowser.md
index b09f418f..0255f9cc 100644
--- a/ebrowser.md
+++ b/ebrowser.md
@@ -41,8 +41,8 @@ Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser
- CTRL+TAB: switch to next tab
- CTRL+SHIFT+TAB: switch to previous tab
- CTRL+W: close Tab
-- CTRL+<-: go backward
-- CTRL+->: go forward
+- ALT+<-: go backward
+- ALT+->: go forward
- CTRL+SHIFT+R: enable global redirection ("gredirect.json")
- CTRL+R: disable global redirection
- ESC: remove focus. similar to vi normal mode.
@@ -64,6 +64,7 @@ Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser
- {[options](https://www.electronjs.org/docs/latest/api/session#sescleardataoptions)}
- ext [extension path]: load unpacked Chrome extension.
- gr [gredirect index]: global redirection with corresponding index. Use the first global redirection url if no argument. Disable global redirection with any index out of the range.
+ - js [js code] : execute JS code at OS level. Note: "javascript:..." is special url and thus works in the current web page, while ":js ..." commands can do any OS operations.
- nc/uc : No Cookie forwarding/Use Cookie forwarding with global redirection.
- nh/uh for No/Use url history.
- nj/uj for No/Use external Javascript files.
@@ -74,7 +75,7 @@ Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser
- update [updateurl] : update the app. updateurl is optional.
- pdf [filename w/o extension] {[options](https://www.electronjs.org/docs/latest/api/web-contents#contentsprinttopdfoptions)} : print to PDF file. All arguments are optional; empty option "{}" to capture long screenshot as vector graphics.
- "!" address bar commands
- "!xx ..." evaluates "xx.js" with the whole address bar text as arguments[0].
+ "!xx ..." evaluates "xx.js" with the whole text as arguments[0].
#### Commands in no-focus mode (this mode is similar to vi Normal mode)
Pressing "ESC" to enter no-focus mode if not sure.
@@ -94,6 +95,11 @@ The other commands are defined in "mapkeys.json", which will map keys to address
- "proxy.json": name-[ProxyConfig](https://www.electronjs.org/docs/latest/api/structures/proxy-config) pairs
- "uas.json" : name-useragent pairs
+#### Javascript at three levels
+- Web page: urls like "javascript:" or bookmarklet command ":bml" run in web page.
+- Browser (or renderer process) : "!xx" evaluates "xx.js", which could manipulate address bar etc.
+- OS level (or main process) : ":js" to execute the following js code with all OS APIs available.
+
#### New usages
- Vector designing with web tech to replace Adobe Illustrator/Inkscape.
- Design with web tech.
diff --git a/en/ebrowserreadme/index.html b/en/ebrowserreadme/index.html
index 04745b6c..b92eed8b 100644
--- a/en/ebrowserreadme/index.html
+++ b/en/ebrowserreadme/index.html
@@ -79,8 +79,8 @@ npm install ebrowser
CTRL+TAB: switch to next tab
CTRL+SHIFT+TAB: switch to previous tab
CTRL+W: close Tab
-CTRL+<-: go backward
-CTRL+->: go forward
+ALT+<-: go backward
+ALT+->: go forward
CTRL+SHIFT+R: enable global redirection ("gredirect.json")
CTRL+R: disable global redirection
ESC: remove focus. similar to vi normal mode.
@@ -107,6 +107,7 @@ npm install ebrowser
ext [extension path]: load unpacked Chrome extension.
gr [gredirect index]: global redirection with corresponding index. Use the first global redirection url if no argument. Disable global redirection with any index out of the range.
+js [js code] : execute JS code at OS level. Note: "javascript:..." is special url and thus works in the current web page, while ":js ..." commands can do any OS operations.
nc/uc : No Cookie forwarding/Use Cookie forwarding with global redirection.
nh/uh for No/Use url history.
nj/uj for No/Use external Javascript files.
@@ -119,7 +120,7 @@ npm install ebrowser
"!" address bar commands
-"!xx ..." evaluates "xx.js" with the whole address bar text as arguments[0].
+"!xx ..." evaluates "xx.js" with the whole text as arguments[0].
Commands in no-focus mode (this mode is similar to vi Normal mode)
Pressing "ESC" to enter no-focus mode if not sure.
@@ -140,6 +141,12 @@ npm install ebrowser
"proxy.json": name-ProxyConfig pairs
"uas.json" : name-useragent pairs
+Javascript at three levels
+
+- Web page: urls like "javascript:" or bookmarklet command ":bml" run in web page.
+- Browser (or renderer process) : "!xx" evaluates "xx.js", which could manipulate address bar etc.
+- OS level (or main process) : ":js" to execute the following js code with all OS APIs available.
+
New usages
-
@@ -166,7 +173,7 @@ npm install ebrowser
You can copy or modify the code/program under the terms of the GPL3.0 or later versions.
-Last Modified: 19 June 2024
+
Last Modified: 24 June 2024
diff --git a/en/index.xml b/en/index.xml
index 1bad2447..64da65c0 100644
--- a/en/index.xml
+++ b/en/index.xml
@@ -6,7 +6,7 @@
Recent content on uweb browser: unlimited power
Hugo
en
- Wed, 19 Jun 2024 09:41:18 +0800
+ Mon, 24 Jun 2024 09:46:43 +0800
-
Text selection/processing
diff --git a/en/sitemap.xml b/en/sitemap.xml
index 69d38983..b0193e0f 100644
--- a/en/sitemap.xml
+++ b/en/sitemap.xml
@@ -71,7 +71,7 @@
/>
/en/
- 2024-06-19T09:41:18+08:00
+ 2024-06-24T09:46:43+08:00
/en/ebrowserreadme/
- 2024-06-19T09:41:18+08:00
+ 2024-06-24T09:46:43+08:00
/en/mirrors/
2024-06-18T23:17:17+08:00
@@ -539,7 +539,7 @@
/>
/en/unlist/
- 2024-06-19T09:41:18+08:00
+ 2024-06-24T09:46:43+08:00
.
-->
-
+
diff --git a/misc/ebrowser/package.json b/misc/ebrowser/package.json
index 1936482b..af622bc2 100644
--- a/misc/ebrowser/package.json
+++ b/misc/ebrowser/package.json
@@ -1,4 +1,4 @@
-{"version":"1.0.29",
+{"version":"1.0.30",
"name": "ebrowser",
"description": "The keyboard-friendly minimal suckless web browser",
"main": "webview.js",
diff --git a/misc/ebrowser/webview.js b/misc/ebrowser/webview.js
index 11848969..c4585467 100644
--- a/misc/ebrowser/webview.js
+++ b/misc/ebrowser/webview.js
@@ -1,5 +1,10 @@
/* Copyright (C) 2024 Richard Hao Cao
- */
+Ebrowser is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+Ebrowser is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with this program. If not, see .
+*/
const {
app, BrowserWindow, Menu, shell, clipboard,
session, protocol, net, dialog
@@ -24,7 +29,7 @@ else {
}
topMenu();
-const repositoryurl = "https://gitlab.com/jamesfengcao/uweb/-/raw/master/misc/ebrowser/";
+var repositoryurl = "https://gitlab.com/jamesfengcao/uweb/-/raw/master/misc/ebrowser/";
const fs = require('fs');
const readline = require('readline');
const path = require('path')
@@ -204,9 +209,13 @@ function addrCommand(cmd){
forwardCookie();
return;
case "nh":
- bHistory = false; return;
+ bHistory = false;
+ win.webContents.executeJavaScript("bQueryHistory=false",false);
+ return;
case "uh":
- bHistory = true; return;
+ bHistory = true;
+ win.webContents.executeJavaScript("bQueryHistory=true",false);
+ return;
case "nj":
bJS = false; return;
case "uj":
@@ -422,11 +431,11 @@ function topMenu(){
win.setTitle(r);
});
}},
- { label: 'Go backward', accelerator: 'Ctrl+Left', click: ()=>{
+ { label: 'Go backward', accelerator: 'Alt+Left', click: ()=>{
let js="tabs.children[iTab].goBack()";
win.webContents.executeJavaScript(js,false);
}},
- { label: 'Go forward', accelerator: 'Ctrl+Right', click: ()=>{
+ { label: 'Go forward', accelerator: 'Alt+Right', click: ()=>{
let js="tabs.children[iTab].goForward()";
win.webContents.executeJavaScript(js,false);
}},
diff --git a/sitemap.xml b/sitemap.xml
index dee3d524..ce84a540 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -4,7 +4,7 @@
/en/sitemap.xml
- 2024-06-19T09:41:18+08:00
+ 2024-06-24T09:46:43+08:00