ebrowser v1.0.35

This commit is contained in:
James Feng Cao 2024-06-26 09:14:24 +08:00
parent c60d325354
commit 725917a939
12 changed files with 76 additions and 31 deletions

View file

@ -50,7 +50,7 @@
<li>much less memory footprint than edge/chrome browser and highly performant.</li> <li>much less memory footprint than edge/chrome browser and highly performant.</li>
<li>keyboard friendly with vim-style keymaps and command line support in address bar.</li> <li>keyboard friendly with vim-style keymaps and command line support in address bar.</li>
<li><a href="https://uweb.surge.sh/en/redirect/index.html#">global redirection</a> to bypass censorship.</li> <li><a href="https://uweb.surge.sh/en/redirect/index.html#">global redirection</a> to bypass censorship.</li>
<li>user scripts at will. Ex. pressing &quot;tr&quot; to translate the page (need mapkeys.json config).</li> <li>user scripts at will. Ex. pressing &quot;md&quot; in no-focus mode to preview markdown file.</li>
<li>customizable.</li> <li>customizable.</li>
</ul> </ul>
<p>Note: Usually electron apps are heavyweight as they use browsers for simple things. Ebrowser uses core chromium effectively and very lightweight. Recommend to install electron separately.</p> <p>Note: Usually electron apps are heavyweight as they use browsers for simple things. Ebrowser uses core chromium effectively and very lightweight. Recommend to install electron separately.</p>
@ -183,7 +183,7 @@ npm install ebrowser
<p>You can copy or modify the code/program under the terms of the GPL3.0 or later versions.</p> <p>You can copy or modify the code/program under the terms of the GPL3.0 or later versions.</p>
</div> </div>
<p>Last Modified: 24 June 2024<br> <p>Last Modified: 25 June 2024<br>
<br> <br>
<pre></pre> <pre></pre>
</p> </p>

View file

@ -1,7 +1,7 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta name="generator" content="Hugo 0.127.0"> <meta name="generator" content="Hugo 0.128.0">
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="alternate" type="application/rss+xml" href="../en/index.xml" title="uweb browser: unlimited power"> <link rel="alternate" type="application/rss+xml" href="../en/index.xml" title="uweb browser: unlimited power">

View file

@ -6,7 +6,7 @@
<description>Recent content on uweb browser: unlimited power</description> <description>Recent content on uweb browser: unlimited power</description>
<generator>Hugo</generator> <generator>Hugo</generator>
<language>en</language> <language>en</language>
<lastBuildDate>Mon, 24 Jun 2024 19:36:44 +0800</lastBuildDate> <lastBuildDate>Tue, 25 Jun 2024 09:05:46 +0800</lastBuildDate>
<atom:link href="/en/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="/en/index.xml" rel="self" type="application/rss+xml" />
<item> <item>
<title>Text selection/processing</title> <title>Text selection/processing</title>
@ -216,7 +216,7 @@
<link>/en/ebrowserreadme/</link> <link>/en/ebrowserreadme/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate> <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>/en/ebrowserreadme/</guid> <guid>/en/ebrowserreadme/</guid>
<description>Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).&#xA;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 to bypass censorship. user scripts at will. Ex. pressing &amp;quot;tr&amp;quot; to translate the page (need mapkeys.json config). customizable. Note: Usually electron apps are heavyweight as they use browsers for simple things.</description> <description>Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).&#xA;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 to bypass censorship. user scripts at will. Ex. pressing &amp;quot;md&amp;quot; in no-focus mode to preview markdown file. customizable. Note: Usually electron apps are heavyweight as they use browsers for simple things.</description>
</item> </item>
<item> <item>
<title></title> <title></title>

View file

@ -71,7 +71,7 @@
/> />
</url><url> </url><url>
<loc>/en/</loc> <loc>/en/</loc>
<lastmod>2024-06-24T19:36:44+08:00</lastmod> <lastmod>2024-06-25T09:05:46+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="zh" hreflang="zh"
@ -508,7 +508,7 @@
/> />
</url><url> </url><url>
<loc>/en/ebrowserreadme/</loc> <loc>/en/ebrowserreadme/</loc>
<lastmod>2024-06-24T19:36:44+08:00</lastmod> <lastmod>2024-06-25T09:05:46+08:00</lastmod>
</url><url> </url><url>
<loc>/en/mirrors/</loc> <loc>/en/mirrors/</loc>
<lastmod>2024-06-18T23:17:17+08:00</lastmod> <lastmod>2024-06-18T23:17:17+08:00</lastmod>
@ -539,7 +539,7 @@
/> />
</url><url> </url><url>
<loc>/en/unlist/</loc> <loc>/en/unlist/</loc>
<lastmod>2024-06-24T19:36:44+08:00</lastmod> <lastmod>2024-06-25T09:05:46+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="zh" hreflang="zh"

View file

@ -12,7 +12,7 @@
<link>/en/ebrowserreadme/</link> <link>/en/ebrowserreadme/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate> <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>/en/ebrowserreadme/</guid> <guid>/en/ebrowserreadme/</guid>
<description>Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).&#xA;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 to bypass censorship. user scripts at will. Ex. pressing &amp;quot;tr&amp;quot; to translate the page (need mapkeys.json config). customizable. Note: Usually electron apps are heavyweight as they use browsers for simple things.</description> <description>Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).&#xA;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 to bypass censorship. user scripts at will. Ex. pressing &amp;quot;md&amp;quot; in no-focus mode to preview markdown file. customizable. Note: Usually electron apps are heavyweight as they use browsers for simple things.</description>
</item> </item>
<item> <item>
<title></title> <title></title>

View file

@ -5,7 +5,7 @@ Ebrowser is designed with the philosophy of [Android uweb browser](https://githu
- much less memory footprint than edge/chrome browser and highly performant. - much less memory footprint than edge/chrome browser and highly performant.
- keyboard friendly with vim-style keymaps and command line support in address bar. - 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](https://uweb.surge.sh/en/redirect/index.html#) to bypass censorship.
- user scripts at will. Ex. pressing "tr" to translate the page (need mapkeys.json config). - user scripts at will. Ex. pressing "md" in no-focus mode to preview markdown file.
- customizable. - customizable.
Note: Usually electron apps are heavyweight as they use browsers for simple things. Ebrowser uses core chromium effectively and very lightweight. Recommend to install electron separately. Note: Usually electron apps are heavyweight as they use browsers for simple things. Ebrowser uses core chromium effectively and very lightweight. Recommend to install electron separately.

View file

@ -70,8 +70,9 @@ You should have received a copy of the GNU General Public License along with thi
var bHistory = false; var bHistory = false;
var bQueryHistory = false; var bQueryHistory = false;
var autocMode = 0; //0 for substring, 1 for startsWith var autocMode = 0; //0 for substring, 1 for startsWith
const JSPREFIX_LOAD = "(async ()=>{let d=document;async function _loadJs(u){var a=d.createElement('script');a.type='text/javascript';a.async=false;a.src=u;d.body.appendChild(a);await new Promise(resolve=>a.onload=resolve)}"; const BML_head = "(async ()=>{let d=document;async function _loadJs(u){var a=d.createElement('script');a.type='text/javascript';a.async=false;a.src=u;d.body.appendChild(a);await new Promise(resolve=>a.onload=resolve)}";
const BML_md = JSPREFIX_LOAD + "await _loadJs('https://cdn.jsdelivr.net/npm/marked@12.0.2/marked.min.js');let b=d.body;b.innerHTML=marked.parse(b.textContent)})()"; const BML_tail = "})()";
const BML_md = BML_head + "await _loadJs('https://cdn.jsdelivr.net/npm/marked@12.0.2/marked.min.js');let b=d.body;b.innerHTML=marked.parse(b.textContent)})()";
let lastKeys; let lastKeys;
let lastKeys_millis = 0; let lastKeys_millis = 0;
@ -454,41 +455,85 @@ You should have received a copy of the GNU General Public License along with thi
} }
function autocomplete(inp,container,arr) { function autocomplete(inp,container,arr) {
var currentFocus; var currentFocus;
function clickItem(e){inp.value = e.target.dataset.str;} var lastVal;
function clickItem(e){inp.value = arr[e.target.dataset.index];}
function appendElement(el,dataindex){ function appendElement(el,dataindex){
el.dataset.str = arr[dataindex]; el.dataset.index = dataindex;
el.addEventListener("click", clickItem); el.addEventListener("click", clickItem);
container.appendChild(el); container.appendChild(el);
} }
function itemInnerHTML(b,str,val,iStr){
b.innerHTML = str.substr(0,iStr);
b.innerHTML += "<strong>" + str.substr(iStr, val.length) + "</strong>";
b.innerHTML += str.substr(iStr+val.length);
}
inp.addEventListener("input", function(e) { inp.addEventListener("input", function(e) {
const MAXITEMS = 10; const MAXITEMS = 30;
var b, i, val = this.value; var b, i, val = this.value;
closeAllLists();
if (!val) { return false;} if (!val) { return false;}
currentFocus = -1; currentFocus = -1;
let items = container.children;
let iBase = 0;
let lastV = lastVal;
lastVal = val;
if(val.startsWith(lastV)){
let itemsLen = items.length;
if(itemsLen<=0) return;
i = itemsLen -1;
iBase = items[i].dataset.index +1;
switch(autocMode){
case 0:
for (; i>=0; i--) {
b = items[i];
let str = arr[b.dataset.index];
let iStr = str.indexOf(val);
if(iStr<0) {
b.parentNode.removeChild(b);
continue;
}
itemInnerHTML(b,str,val,iStr);
}
break;
case 1:
for (; i>=0; i--) {
b = items[i];
let str = arr[b.dataset.index];
let oLen = lastval.length;
if(!str.startsWith(val.substring(oLen),oLen)) {
b.parentNode.removeChild(b);
continue;
}
itemInnerHTML(b,str,val,0);
}
break;
}
if(itemsLen<MAXITEMS)
return;
else
if(container.children.length>=MAXITEMS) return;
}else
closeAllLists();
i = iBase;
switch(autocMode){ switch(autocMode){
case 0: case 0:
for (i = 0; i < arr.length; i++) { for (; i < arr.length; i++) {
let iStr = arr[i].indexOf(val); let iStr = arr[i].indexOf(val);
if(iStr<0) continue; if(iStr<0) continue;
{ {
b = document.createElement("DIV"); b = document.createElement("DIV");
b.innerHTML = arr[i].substr(0,iStr); itemInnerHTML(b,arr[i],val,iStr);
b.innerHTML += "<strong>" + arr[i].substr(iStr, val.length) + "</strong>";
b.innerHTML += arr[i].substr(iStr+val.length);
appendElement(b,i); appendElement(b,i);
if(container.children.length>MAXITEMS) break; if(container.children.length>=MAXITEMS) break;
} }
} }
return; return;
case 1://startsWith case 1://startsWith
for (i = 0; i < arr.length; i++) { for (; i < arr.length; i++) {
if (arr[i].substr(0, val.length) === val) { if (arr[i].startsWith(val)) {
b = document.createElement("DIV"); b = document.createElement("DIV");
b.innerHTML = "<strong>" + arr[i].substr(0, val.length) + "</strong>"; itemInnerHTML(b,arr[i],val,0);
b.innerHTML += arr[i].substr(val.length);
appendElement(b,i); appendElement(b,i);
if(container.children.length>MAXITEMS) break; if(container.children.length>=MAXITEMS) break;
} }
} }
} }

View file

@ -4,5 +4,5 @@
"nj":":js bJS=false //No javascript", "nj":":js bJS=false //No javascript",
"uh":":bjs bHistory=bQueryHistory=true //record/Use history", "uh":":bjs bHistory=bQueryHistory=true //record/Use history",
"nh":":bjs bHistory=bQueryHistory=false //No history", "nh":":bjs bHistory=bQueryHistory=false //No history",
"md":":bjs tabJS(BML_md)" "md":":bjs tabJS(BML_md) //markdown preview"
} }

View file

@ -1,4 +1,4 @@
{"version":"1.0.34", {"version":"1.0.35",
"name": "ebrowser", "name": "ebrowser",
"description": "The keyboard-friendly minimal suckless web browser", "description": "The keyboard-friendly minimal suckless web browser",
"main": "webview.js", "main": "webview.js",

View file

@ -437,7 +437,7 @@ if(e)e.blur();try{tabs.children[iTab].stopFindInPage('clearSelection')}catch(er)
win.webContents.executeJavaScript(js,false); win.webContents.executeJavaScript(js,false);
}}, }},
{ label: 'Reload', accelerator: 'F5', click: ()=>{ { label: 'Reload', accelerator: 'F5', click: ()=>{
win.webContents.executeJavaScript("tabs.children[iTab].reloadIgnoringCache()",false); win.webContents.executeJavaScript("tabs.children[iTab].reload()",false);
}}, }},
{ label: 'Devtools', accelerator: 'F12', click: ()=>{ { label: 'Devtools', accelerator: 'F12', click: ()=>{
let js = "try{tabs.children[iTab].openDevTools()}catch(e){console.log(e)}"; let js = "try{tabs.children[iTab].openDevTools()}catch(e){console.log(e)}";

View file

@ -4,7 +4,7 @@
<sitemap> <sitemap>
<loc>/en/sitemap.xml</loc> <loc>/en/sitemap.xml</loc>
<lastmod>2024-06-24T19:36:44+08:00</lastmod> <lastmod>2024-06-25T09:05:46+08:00</lastmod>
</sitemap> </sitemap>

View file

@ -1,7 +1,7 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta name="generator" content="Hugo 0.127.0"> <meta name="generator" content="Hugo 0.128.0">
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="alternate" type="application/rss+xml" href="../zh/index.xml" title="超微浏览器: 威、快、高效、极致优化"> <link rel="alternate" type="application/rss+xml" href="../zh/index.xml" title="超微浏览器: 威、快、高效、极致优化">