Compare commits

..

3 commits

Author SHA1 Message Date
James Feng Cao
00ccd791ed ebrowser v1.0.40 2024-06-28 15:22:22 +08:00
James Feng Cao
8367164d73 ebrowser v1.0.39 2024-06-28 14:24:17 +08:00
James Feng Cao
ad1d9e33b7 ebrowser v1.0.38 2024-06-28 09:48:56 +08:00
8 changed files with 64 additions and 13 deletions

View file

@ -71,6 +71,9 @@ npm install ebrowser
<p>Mirror urls could be used like &quot;:update https://uwebzh.netlify.app/misc/ebrowser&quot;. All the mirrors listed on <a href="https://uwebzh.netlify.app/en/readme/index.html">uweb browser</a> could be used. The update url needs to be changed accordingly to be the folder &quot;misc/ebrowser&quot; under the mirror site root url.</p> <p>Mirror urls could be used like &quot;:update https://uwebzh.netlify.app/misc/ebrowser&quot;. All the mirrors listed on <a href="https://uwebzh.netlify.app/en/readme/index.html">uweb browser</a> could be used. The update url needs to be changed accordingly to be the folder &quot;misc/ebrowser&quot; under the mirror site root url.</p>
<h4 id="key-shortcuts">Key shortcuts</h4> <h4 id="key-shortcuts">Key shortcuts</h4>
<ul> <ul>
<li>Alt: show menu</li>
<li>ALT+&lt;-: go backward</li>
<li>ALT+-&gt;: go forward</li>
<li>CTRL+C: stop loading</li> <li>CTRL+C: stop loading</li>
<li>CTRL+G: address bar to show page url</li> <li>CTRL+G: address bar to show page url</li>
<li>CTRL+L: focus to address bar</li> <li>CTRL+L: focus to address bar</li>
@ -79,8 +82,6 @@ npm install ebrowser
<li>CTRL+TAB: switch to next tab</li> <li>CTRL+TAB: switch to next tab</li>
<li>CTRL+SHIFT+TAB: switch to previous tab</li> <li>CTRL+SHIFT+TAB: switch to previous tab</li>
<li>CTRL+W: close Tab</li> <li>CTRL+W: close Tab</li>
<li>ALT+&lt;-: go backward</li>
<li>ALT+-&gt;: go forward</li>
<li>CTRL+SHIFT+R: enable global redirection (&quot;gredirect.json&quot;)</li> <li>CTRL+SHIFT+R: enable global redirection (&quot;gredirect.json&quot;)</li>
<li>CTRL+R: disable global redirection</li> <li>CTRL+R: disable global redirection</li>
<li>ESC: remove focus. similar to vi normal mode.</li> <li>ESC: remove focus. similar to vi normal mode.</li>
@ -89,6 +90,7 @@ npm install ebrowser
<li>F12: devtools</li> <li>F12: devtools</li>
</ul> </ul>
<h4 id="address-bar-commands">Address bar commands</h4> <h4 id="address-bar-commands">Address bar commands</h4>
<p>Like any popular browser, the very first word in address bar if defined in &quot;search.json&quot; identifies a search engine. Moreover, the address bar serves as command line interface:</p>
<ul> <ul>
<li>&quot;/&quot; for find-in-page</li> <li>&quot;/&quot; for find-in-page</li>
<li>&quot;:&quot; for address bar commands <li>&quot;:&quot; for address bar commands
@ -120,6 +122,11 @@ npm install ebrowser
</li> </li>
<li>&quot;!&quot; address bar commands<br> <li>&quot;!&quot; address bar commands<br>
&quot;!xx ...&quot; evaluates &quot;xx.js&quot; with the whole text as arguments[0].</li> &quot;!xx ...&quot; evaluates &quot;xx.js&quot; with the whole text as arguments[0].</li>
<li>i: internal urls, which will be consistent with <a href="https://jamesfengcao.gitlab.io/uweb/en/links/index.html">uweb</a>.
<ul>
<li>&quot;i:0/js/xxx.js:[url]&quot; loads the &quot;[url]&quot; with bookmarklet &quot;js/xxx.js&quot;.</li>
</ul>
</li>
</ul> </ul>
<h4 id="commands-in-no-focus-mode-this-mode-is-similar-to-vi-normal-mode">Commands in no-focus mode (this mode is similar to vi Normal mode)</h4> <h4 id="commands-in-no-focus-mode-this-mode-is-similar-to-vi-normal-mode">Commands in no-focus mode (this mode is similar to vi Normal mode)</h4>
<p>Pressing &quot;ESC&quot; to enter no-focus mode if not sure.</p> <p>Pressing &quot;ESC&quot; to enter no-focus mode if not sure.</p>
@ -183,7 +190,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: 25 June 2024<br> <p>Last Modified: 28 June 2024<br>
<br> <br>
<pre></pre> <pre></pre>
</p> </p>

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>Tue, 25 Jun 2024 09:05:46 +0800</lastBuildDate> <lastBuildDate>Fri, 28 Jun 2024 10:09:04 +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>

View file

@ -71,7 +71,7 @@
/> />
</url><url> </url><url>
<loc>/en/</loc> <loc>/en/</loc>
<lastmod>2024-06-25T09:05:46+08:00</lastmod> <lastmod>2024-06-28T10:09:04+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-25T09:05:46+08:00</lastmod> <lastmod>2024-06-28T10:09:04+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-25T09:05:46+08:00</lastmod> <lastmod>2024-06-28T10:09:04+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="zh" hreflang="zh"

View file

@ -33,6 +33,9 @@ Type ":update" in the address bar and press "enter" key to update.
Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser". All the mirrors listed on [uweb browser](https://uwebzh.netlify.app/en/readme/index.html) could be used. The update url needs to be changed accordingly to be the folder "misc/ebrowser" under the mirror site root url. Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser". All the mirrors listed on [uweb browser](https://uwebzh.netlify.app/en/readme/index.html) could be used. The update url needs to be changed accordingly to be the folder "misc/ebrowser" under the mirror site root url.
#### Key shortcuts #### Key shortcuts
- Alt: show menu
- ALT+<-: go backward
- ALT+->: go forward
- CTRL+C: stop loading - CTRL+C: stop loading
- CTRL+G: address bar to show page url - CTRL+G: address bar to show page url
- CTRL+L: focus to address bar - CTRL+L: focus to address bar
@ -41,8 +44,6 @@ Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser
- CTRL+TAB: switch to next tab - CTRL+TAB: switch to next tab
- CTRL+SHIFT+TAB: switch to previous tab - CTRL+SHIFT+TAB: switch to previous tab
- CTRL+W: close Tab - CTRL+W: close Tab
- ALT+<-: go backward
- ALT+->: go forward
- CTRL+SHIFT+R: enable global redirection ("gredirect.json") - CTRL+SHIFT+R: enable global redirection ("gredirect.json")
- CTRL+R: disable global redirection - CTRL+R: disable global redirection
- ESC: remove focus. similar to vi normal mode. - ESC: remove focus. similar to vi normal mode.
@ -51,6 +52,7 @@ Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser
- F12: devtools - F12: devtools
#### Address bar commands #### Address bar commands
Like any popular browser, the very first word in address bar if defined in "search.json" identifies a search engine. Moreover, the address bar serves as command line interface:
- "/" for find-in-page - "/" for find-in-page
- ":" for address bar commands - ":" for address bar commands
- ac [bookmark/history path w/o ext] : load ".rec" file for autocomplete. - ac [bookmark/history path w/o ext] : load ".rec" file for autocomplete.
@ -75,6 +77,8 @@ Mirror urls could be used like ":update https://uwebzh.netlify.app/misc/ebrowser
- 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. - 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 - "!" address bar commands
"!xx ..." evaluates "xx.js" with the whole text as arguments[0]. "!xx ..." evaluates "xx.js" with the whole text as arguments[0].
- i: internal urls, which will be consistent with [uweb](https://jamesfengcao.gitlab.io/uweb/en/links/index.html).
- "i:0/js/xxx.js:[url]" loads the "[url]" with bookmarklet "js/xxx.js".
#### Commands in no-focus mode (this mode is similar to vi Normal mode) #### Commands in no-focus mode (this mode is similar to vi Normal mode)
Pressing "ESC" to enter no-focus mode if not sure. Pressing "ESC" to enter no-focus mode if not sure.

View file

@ -255,7 +255,9 @@ You should have received a copy of the GNU General Public License along with thi
}while(false); }while(false);
if(inputE === document.activeElement){ if(inputE === document.activeElement){
if (9===e.keyCode){//tab completion if (9===e.keyCode){
e.preventDefault();
tabs.children[iTab].focus();
} }
return; return;
} }
@ -429,6 +431,9 @@ You should have received a copy of the GNU General Public License along with thi
break NOREC; break NOREC;
if(58===c5 && 47===q.charCodeAt(7))//https:// if(58===c5 && 47===q.charCodeAt(7))//https://
break NOREC; break NOREC;
}else if(58===q.charCodeAt(1)){
internalLink(q);
return;
}else if(q.startsWith("javascript:")){ }else if(q.startsWith("javascript:")){
tabs.children[iTab].executeJavaScript(q.substring(11),false); tabs.children[iTab].executeJavaScript(q.substring(11),false);
recQueryHistory(q); recQueryHistory(q);
@ -449,11 +454,42 @@ You should have received a copy of the GNU General Public License along with thi
break; break;
} }
url = bang(q, iS); url = bang(q, iS);
if(58===url.charCodeAt(1)){
internalLink(url);
recQueryHistory(q);
return;
}
}while(false); }while(false);
recQueryHistory(q); recQueryHistory(q);
}while(false); }while(false);
tabs.children[iTab].src=url; tabs.children[iTab].src=url;
} }
function internalLink(url){
let cmd = url.charCodeAt(2);
let subcmd = url.charCodeAt(3);
let iColon = url.indexOf(':',2);
switch(cmd){
case 48://'0' i:0
switch(subcmd){
case 47://'/' i:0/
if(106===url.charCodeAt(4) && 115===url.charCodeAt(5) && 47===url.charCodeAt(6)){
//i:0/js/xx:[url]
let fname = url.slice(4,iColon);
let pname = path.join(__dirname,fname);
if(fs.existsSync(pname)){
(async ()=>{
try {
let js = await fs.promises.readFile(pname,'utf8');
let t=tabs.children[iTab];
t.dataset.jsonce=js;
t.src = url.substring(iColon+1);
}catch(e){}
})();
}
}
}
}
}
function autocomplete(inp,container,arr) { function autocomplete(inp,container,arr) {
var currentFocus; var currentFocus;
function clickItem(e){inp.value = arr[e.target.dataset.index];} function clickItem(e){inp.value = arr[e.target.dataset.index];}
@ -554,6 +590,7 @@ function autocomplete(inp,container,arr) {
currentFocus = -1; currentFocus = -1;
} }
closeAllLists(); closeAllLists();
lastVal = null;
} }
}); });
function addActive(x) { function addActive(x) {

View file

@ -1,4 +1,4 @@
{"version":"1.0.37", {"version":"1.0.40",
"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",
@ -9,6 +9,7 @@
"README.md", "README.md",
"translate.*", "translate.*",
"mapkeys.json", "mapkeys.json",
"js/*.js",
"config" "config"
], ],
"scripts": { "scripts": {

View file

@ -17,5 +17,7 @@
"git":"https://github.com/search?type=Repositories&q=%s", "git":"https://github.com/search?type=Repositories&q=%s",
"gt":"https://kkgithub.com/search?type=Repositories&q=%s", "gt":"https://kkgithub.com/search?type=Repositories&q=%s",
"360":"https://so.360.com/s?q=%s", "360":"https://so.360.com/s?q=%s",
"tg":"i:0/js/hash2textarea.js:https://www.tiangong.cn/#%s",
"cg":"i:0/js/hash2textarea.js:https://chatglm.cn/main/detail#%s",
"bd":"https://m.baidu.com/s?wd=%s" "bd":"https://m.baidu.com/s?wd=%s"
} }

View file

@ -4,7 +4,7 @@
<sitemap> <sitemap>
<loc>/en/sitemap.xml</loc> <loc>/en/sitemap.xml</loc>
<lastmod>2024-06-25T09:05:46+08:00</lastmod> <lastmod>2024-06-28T10:09:04+08:00</lastmod>
</sitemap> </sitemap>