"menu.json": array of strings for user-defined menus. The array has submenu name and address bar commands alternately.
-
"download.json" : array of strings to define buttons for downloading dialog. The even-indexed strings are texts to show on the button. The odd-indexed strings are address bar commands with "%u" as the downloaded url.
Customized menus: json files as array of strings with menuitem name and address bar commands alternately.
+
+
"menu.json": array of strings for user-defined menus. The array has submenu name and address bar commands alternately. The odd-indexed strings are address bar commands with "%u" as the downloaded url.
+
"select.json": to define menus for text selections. The odd-indexed strings are address bar commands with "%s" as the text selection.
+
"download.json" : array of strings to define context menu and buttons for downloading dialog. The even-indexed strings are texts to show on the button. The odd-indexed strings are address bar commands with "%u" as the downloaded url.
+
+
Javascript at three levels
@@ -194,8 +200,8 @@ npm install ebrowser
You can copy or modify the code/program under the terms of the GPL3.0 or later versions.
-
Last Modified: 4 July 2024
-
+
Last Modified: 12 July 2024
+reorg ebrowserreadme.md
Last Modified: 10 July 2024
-
+add en/useragents.md
diff --git a/misc/ebrowser/README.md b/misc/ebrowser/README.md
index c77d1e69..18d084bd 100644
--- a/misc/ebrowser/README.md
+++ b/misc/ebrowser/README.md
@@ -4,7 +4,7 @@ Ebrowser is designed with the philosophy of [Android uweb browser](https://githu
- lightweight (less than 20k bytes) without bundled electron.
- much less memory footprint than edge/chrome browser and highly performant.
- keyboard friendly with vim-style keymaps and command line support in address bar.
-- [global redirection](https://uweb.surge.sh/en/redirect/index.html#) to bypass censorship.
+- global redirection to bypass censorship.
- user CSS/JS at will. Ex. pressing "md" in no-focus mode to preview markdown file.
- global CSS/JS for all sites at will.
- CSS/JS for domains, similar to [uweb](https://jamesfengcao.gitlab.io/uweb/en/sitejs/index.html), but use sitejs/[domain].js or sitecss/[domain].css, not [domain root].js/css.
@@ -92,15 +92,17 @@ The other commands are defined in "mapkeys.json", which will map keys to address
#### Configuration files
- "config": lines of address bar commands.
-- "search.json": [search engines](https://jamesfengcao.gitlab.io/uweb/en/search/index.html) as shortcut-queryUrl pairs, where "%s" would be replaced by search query.
+- "search.json": search engines as shortcut-queryUrl pairs, where "%s" would be replaced by search query.
- "default.autoc": predefined strings for address bar auto completion.
- "gredirect.json": global redirection urls as array of urls
- "redirect.json": domain-replacementDomain pairs, default to be applied.
- "mapkeys.json": keys-addressbarCommands pairs. The addressbar commands are multiple lines of address bar command separated by "\n".
- "proxy.json": name-[ProxyConfig](https://www.electronjs.org/docs/latest/api/structures/proxy-config) pairs
-- "uas.json" : name-useragent pairs
-- "menu.json": array of strings for [user-defined menus](https://jamesfengcao.gitlab.io/uweb/en/urls/index.html). The array has submenu name and address bar commands alternately.
-- "download.json" : array of strings to define buttons for downloading dialog. The even-indexed strings are texts to show on the button. The odd-indexed strings are address bar commands with "%u" as the downloaded url.
+- "uas.json" : name-useragent pairs.
+- Customized menus: json files as array of strings with menuitem name and address bar commands alternately.
+ - "menu.json": array of strings for user-defined menus. The array has submenu name and address bar commands alternately. The odd-indexed strings are address bar commands with "%u" as the downloaded url.
+ - "select.json": to define menus for text selections. The odd-indexed strings are address bar commands with "%s" as the text selection.
+ - "download.json" : array of strings to define context menu and buttons for downloading dialog. The even-indexed strings are texts to show on the button. The odd-indexed strings are address bar commands with "%u" as the downloaded url.
#### Javascript at three levels
- Web page: url like "javascript:" or bookmarklet command ":bml" runs in web page.
diff --git a/misc/ebrowser/index.html b/misc/ebrowser/index.html
index dc35e215..6e130640 100644
--- a/misc/ebrowser/index.html
+++ b/misc/ebrowser/index.html
@@ -345,8 +345,7 @@ You should have received a copy of the GNU General Public License along with thi
setTimeout(()=>{
if(lastKeys.length != keyLen) return;
lastKeys = null;
- for(var cmd of cmds.split("\n"))
- handleQuery(cmd);
+ handleQueries(cmds);
}, 500);
}
}
@@ -587,6 +586,10 @@ You should have received a copy of the GNU General Public License along with thi
}
}
}
+ function handleQueries(cmds){
+ for(var cmd of cmds.split("\n"))
+ handleQuery(cmd);
+ }
async function jsonAppend(filePath, charcode, str){
let fd;
try{
diff --git a/misc/ebrowser/package.json b/misc/ebrowser/package.json
index 41912810..311b6099 100644
--- a/misc/ebrowser/package.json
+++ b/misc/ebrowser/package.json
@@ -1,4 +1,4 @@
-{"version":"1.0.57",
+{"version":"1.0.58",
"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 a41a8a88..1e73fb92 100644
--- a/misc/ebrowser/webview.js
+++ b/misc/ebrowser/webview.js
@@ -52,6 +52,7 @@ var proxies = {};
var proxy;
var useragents = {};
var downloadMenus; //[]
+var selectMenus = [];
var defaultUA =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/" +
process.versions.chrome +" Safari/537.36";
@@ -125,6 +126,13 @@ async function createWindow () {
}catch (e){console.log(e)}
});
+ fs.readFile(path.join(__dirname,'select.json'), 'utf8', (err, jsonStr) => {
+ if (err) return;
+ try {
+ selectMenus = JSON.parse(jsonStr);
+ }catch (e){console.log(e)}
+ });
+
win.webContents.on('page-title-updated',(event,cmd)=>{
addrCommand(cmd);
});
@@ -134,7 +142,7 @@ async function createWindow () {
if(!downloadMenus) return;
let buttons = ["OK", "Cancel", translate("Copy")];
buttons.push(downloadMenus.filter((item, index) => (index&1) === 0));
- const button = dialog.showMessageBoxSync(mainWindow, {
+ const button = dialog.showMessageBoxSync(win, {
"type": "question",
"title": translate("Download"),
"message": `Do you want to download the file?`,
@@ -151,7 +159,7 @@ async function createWindow () {
break;
default:
let cmd = downloadMenus[2*button-5].replace('%u',item.getURL());
- let js = `handleQuery(\`${cmd}\`)`;
+ let js = `handleQueries(\`${cmd}\`)`;
win.webContents.executeJavaScript(js,false);
}
e.preventDefault();
@@ -348,8 +356,20 @@ function cbWindowOpenHandler(details){
function cbTitleUpdate(event,title){
win.setTitle(title);
}
+function menuSelection(menuTemplate, text){
+ for(let i=0; i {
+ let cmd = selectMenus[i+1].replace('%s',text);
+ let js = `handleQueries(\`${cmd}\`)`;
+ win.webContents.executeJavaScript(js,false);
+ }
+ });
+ }
+}
function menuArray(labelprefix, linkUrl){
- const menuTemplate = [
+ let menuTemplate = [
{
label: labelprefix+translate('Open'),
click: () => {
@@ -375,7 +395,7 @@ function menuArray(labelprefix, linkUrl){
label: labelprefix+downloadMenus[i],
click: () => {
let cmd = downloadMenus[i+1].replace('%u',linkUrl);
- let js = `handleQuery(\`${cmd}\`)`;
+ let js = `handleQueries(\`${cmd}\`)`;
win.webContents.executeJavaScript(js,false);
}
});
@@ -395,6 +415,8 @@ function onContextMenu(event, params){
}else if((url=params.srcURL)){
mTemplate.push({label:url,enabled:false});
mTemplate.push.apply(mTemplate,menuArray("src: ",url));
+ }else if((url=params.selectionText)){
+ menuSelection(mTemplate,url);
}else
return;
@@ -411,7 +433,7 @@ async function topMenu(){
let submenu = [];
for(let i=0;i{
win.webContents.executeJavaScript(js,false);
diff --git a/sitemap.xml b/sitemap.xml
index 633afd2c..6b7cf0b0 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -4,14 +4,14 @@
/en/sitemap.xml
- 2024-07-10T11:21:12+08:00
+ 2024-07-12T10:48:12+08:00/zh/sitemap.xml
- 2024-07-09T11:56:44+08:00
+ 2024-07-12T10:49:39+08:00
diff --git a/zh/_posts/index.xml b/zh/_posts/index.xml
index 22659b2c..ea4b7ca8 100644
--- a/zh/_posts/index.xml
+++ b/zh/_posts/index.xml
@@ -6,7 +6,7 @@
Recent content in _Posts on 超微浏览器: 威、快、高效、极致优化Hugozh
- Sat, 29 Jun 2024 22:26:41 +0800
+ Fri, 12 Jul 2024 10:49:39 +0800操作选中(富)文本/元素
@@ -132,7 +132,7 @@
/zh/useragents/
Sat, 01 Jan 2022 00:00:00 +0000/zh/useragents/
- 超微浏览器下点击配置链接可自动添加浏览器标识,强制清空后台重启后可用。
Edge for android
Edge for windows
更多标识
+ 超微浏览器/ebrowser下点击配置链接可自动添加浏览器标识,强制清空后台重启后可用。
Edge for android
Edge for windows
更多标识安卓系统出错诊断
diff --git a/zh/index.xml b/zh/index.xml
index 6c80c057..3f06a6a1 100644
--- a/zh/index.xml
+++ b/zh/index.xml
@@ -6,7 +6,7 @@
Recent content on 超微浏览器: 威、快、高效、极致优化Hugozh
- Tue, 09 Jul 2024 11:56:44 +0800
+ Fri, 12 Jul 2024 10:49:39 +0800操作选中(富)文本/元素
@@ -167,7 +167,7 @@
/zh/useragents/
Sat, 01 Jan 2022 00:00:00 +0000/zh/useragents/
- 超微浏览器下点击配置链接可自动添加浏览器标识,强制清空后台重启后可用。
Edge for android
Edge for windows
更多标识
+ 超微浏览器/ebrowser下点击配置链接可自动添加浏览器标识,强制清空后台重启后可用。
Edge for android
Edge for windows
更多标识安卓系统出错诊断
diff --git a/zh/sitemap.xml b/zh/sitemap.xml
index 4f56c9b6..b628ec14 100644
--- a/zh/sitemap.xml
+++ b/zh/sitemap.xml
@@ -3,7 +3,7 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml">
/zh/_posts/
- 2024-06-29T22:26:41+08:00
+ 2024-07-12T10:49:39+08:00/zh/tags/ssh/
- 2024-05-24T09:41:58+08:00
+ 2024-07-12T10:49:39+08:00/zh/tags/
- 2024-05-24T09:41:58+08:00
+ 2024-07-12T10:49:39+08:00/zh/tags/termux/
- 2024-05-24T09:41:58+08:00
+ 2024-07-12T10:49:39+08:00/zh/tags/windows/
- 2024-05-24T09:41:58+08:00
+ 2024-07-12T10:49:39+08:00/zh/textprocess/
- 2024-05-24T09:41:58+08:00
+ 2024-07-12T10:49:39+08:00/zh/
- 2024-07-09T11:56:44+08:00
+ 2024-07-12T10:49:39+08:00/zh/tags/%E5%89%AA%E8%B4%B4%E6%9D%BF/
- 2024-05-24T09:41:58+08:00
+ 2024-07-12T10:49:39+08:00/zh/tags/%E7%94%B5%E8%A7%86/2024-04-02T11:46:25+08:00
@@ -365,7 +365,7 @@
/>
/zh/useragents/
- 2024-06-05T11:11:01+08:00
+ 2024-07-11T09:13:16+08:00Recent content in Tags on 超微浏览器: 威、快、高效、极致优化
Hugozh
- Fri, 24 May 2024 09:41:58 +0800
+ Fri, 12 Jul 2024 10:49:39 +0800Ssh
diff --git a/zh/tags/ssh/index.xml b/zh/tags/ssh/index.xml
index b2fa898e..fc547104 100644
--- a/zh/tags/ssh/index.xml
+++ b/zh/tags/ssh/index.xml
@@ -6,7 +6,7 @@
Recent content in Ssh on 超微浏览器: 威、快、高效、极致优化Hugozh
- Fri, 24 May 2024 09:41:58 +0800
+ Fri, 12 Jul 2024 10:49:39 +0800操作选中(富)文本/元素
diff --git a/zh/tags/termux/index.xml b/zh/tags/termux/index.xml
index 0ce34a7d..420857cd 100644
--- a/zh/tags/termux/index.xml
+++ b/zh/tags/termux/index.xml
@@ -6,7 +6,7 @@
Recent content in Termux on 超微浏览器: 威、快、高效、极致优化Hugozh
- Fri, 24 May 2024 09:41:58 +0800
+ Fri, 12 Jul 2024 10:49:39 +0800操作选中(富)文本/元素
diff --git a/zh/tags/windows/index.xml b/zh/tags/windows/index.xml
index 6b9de659..91c7f271 100644
--- a/zh/tags/windows/index.xml
+++ b/zh/tags/windows/index.xml
@@ -6,7 +6,7 @@
Recent content in Windows on 超微浏览器: 威、快、高效、极致优化Hugozh
- Fri, 24 May 2024 09:41:58 +0800
+ Fri, 12 Jul 2024 10:49:39 +0800操作选中(富)文本/元素
diff --git a/zh/tags/剪贴板/index.xml b/zh/tags/剪贴板/index.xml
index 49559ef3..be8beace 100644
--- a/zh/tags/剪贴板/index.xml
+++ b/zh/tags/剪贴板/index.xml
@@ -6,7 +6,7 @@
Recent content in 剪贴板 on 超微浏览器: 威、快、高效、极致优化Hugozh
- Fri, 24 May 2024 09:41:58 +0800
+ Fri, 12 Jul 2024 10:49:39 +0800操作选中(富)文本/元素
diff --git a/zh/textprocess/index.html b/zh/textprocess/index.html
index 01323f71..fef2519e 100644
--- a/zh/textprocess/index.html
+++ b/zh/textprocess/index.html
@@ -56,7 +56,7 @@