user scripts at will. Ex. pressing "md" in no-focus mode to preview markdown file.
+
CSS/JS for domains, similar to uweb, but use sitejs/[domain].js or sitecss/[domain].css, not [domain root].js/css.
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.
@@ -149,7 +150,7 @@ npm install ebrowser
Javascript at three levels
-
Web page: urls like "javascript:" or bookmarklet command ":bml" run in web page.
+
Web page: url like "javascript:" or bookmarklet command ":bml" runs in web page.
Browser (or renderer process) :
":bjs" to execute the following js code at browser level.
diff --git a/en/index.xml b/en/index.xml
index e8a8d00f..9ca7acc3 100644
--- a/en/index.xml
+++ b/en/index.xml
@@ -6,7 +6,7 @@
Recent content on uweb browser: unlimited powerHugoen
- Sat, 29 Jun 2024 08:47:08 +0800
+ Sat, 29 Jun 2024 21:05:42 +0800Text selection/processing
@@ -216,7 +216,7 @@
/en/ebrowserreadme/
Mon, 01 Jan 0001 00:00:00 +0000/en/ebrowserreadme/
- Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).
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 "md" in no-focus mode to preview markdown file. customizable. Note: Usually electron apps are heavyweight as they use browsers for simple things.
+ Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).
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 "md" in no-focus mode to preview markdown file. CSS/JS for domains, similar to uweb, but use sitejs/[domain].
diff --git a/en/sitemap.xml b/en/sitemap.xml
index f0d3431b..247fee2a 100644
--- a/en/sitemap.xml
+++ b/en/sitemap.xml
@@ -71,7 +71,7 @@
/>
/en/
- 2024-06-29T08:47:08+08:00
+ 2024-06-29T21:05:42+08:00/en/ebrowserreadme/
- 2024-06-29T08:47:08+08:00
+ 2024-06-29T21:05:42+08:00/en/mirrors/2024-06-18T23:17:17+08:00
@@ -539,7 +539,7 @@
/>
/en/unlist/
- 2024-06-29T08:47:08+08:00
+ 2024-06-29T21:05:42+08:00/en/ebrowserreadme/
Mon, 01 Jan 0001 00:00:00 +0000/en/ebrowserreadme/
- Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).
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 "md" in no-focus mode to preview markdown file. customizable. Note: Usually electron apps are heavyweight as they use browsers for simple things.
+ Ebrowser: keyboard-friendly minimal suckless web browser Ebrowser is designed with the philosophy of Android uweb browser (gitlab).
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 "md" in no-focus mode to preview markdown file. CSS/JS for domains, similar to uweb, but use sitejs/[domain].
diff --git a/misc/ebrowser/README.md b/misc/ebrowser/README.md
index dc3fffe4..8530fc43 100644
--- a/misc/ebrowser/README.md
+++ b/misc/ebrowser/README.md
@@ -6,6 +6,7 @@ Ebrowser is designed with the philosophy of [Android uweb browser](https://githu
- 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.
- user scripts at will. Ex. pressing "md" in no-focus mode to preview markdown file.
+- 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.
- 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.
@@ -99,7 +100,7 @@ The other commands are defined in "mapkeys.json", which will map keys to address
- "uas.json" : name-useragent pairs
#### Javascript at three levels
-- Web page: urls like "javascript:" or bookmarklet command ":bml" run in web page.
+- Web page: url like "javascript:" or bookmarklet command ":bml" runs in web page.
- Browser (or renderer process) :
- ":bjs" to execute the following js code at browser level.
- "!xx" evaluates "xx.js", which could manipulate address bar etc.
diff --git a/misc/ebrowser/index.html b/misc/ebrowser/index.html
index 079c87b4..3decf854 100644
--- a/misc/ebrowser/index.html
+++ b/misc/ebrowser/index.html
@@ -69,6 +69,10 @@ You should have received a copy of the GNU General Public License along with thi
var historyFile = path.join(__dirname,'history.rec');
var bHistory = false;
var bQueryHistory = false;
+ let sitecssP = path.join(__dirname,"sitecss");
+ let sitejsP = path.join(__dirname,"sitejs");
+ var bDomainJS = fs.existsSync(sitejsP);
+ var bDomainCSS = fs.existsSync(sitecssP);
var autocMode = 0; //0 for substring, 1 for startsWith
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_tail = "})()";
@@ -136,20 +140,52 @@ You should have received a copy of the GNU General Public License along with thi
iTab = i;
tabs.children[iTab].classList.add('curWV');
}
+ async function loadJSFile(tab,jsF){
+ if(fs.existsSync(jsF)){
+ try {
+ let js = await fs.promises.readFile(jsF,'utf8');
+ tab.executeJavaScript(js,false);
+ }catch(e){}
+ }
+ }
+ function cbStartLoading(e){
+ if(!bDomainCSS) return;
+ let tab = e.target;
+ let domain = new URL(tab.getURL()).hostname;
+ let jsF = path.join(sitecssP, domain+".js");
+ loadJSFile(tab,jsF);
+ jsF = path.join(sitecssP, domain+".css");
+ if(fs.existsSync(jsF)){
+ (async ()=>{
+ try {
+ let css = await fs.promises.readFile(jsF,'utf8');
+ tab.insertCSS(css);
+ }catch(e){}
+ })();
+ }
+ }
function cbFinishLoad(e){
let tab = e.target;
+ let url = tab.getURL();
+ if(bHistory){
+ let histItem = tab.getTitle()+" "+url+"\n";
+ fs.appendFile(historyFile, histItem, (err) => {});
+ }
let js = tab.dataset.jsonce;
if(js){
tab.dataset.jsonce = null;
tab.executeJavaScript(js,false);
}
- if(!bHistory) return;
- let histItem = tab.getTitle()+" "+tab.getURL()+"\n";
- fs.appendFile(historyFile, histItem, (err) => {});
+ if(bDomainJS){
+ let domain = new URL(url).hostname;
+ let jsF = path.join(sitejsP, domain+".js");
+ loadJSFile(tab,jsF);
+ }
}
function initTab(tab){
tab.allowpopups = true;
tab.addEventListener('did-finish-load',cbFinishLoad);
+ tab.addEventListener('did-start-loading',cbStartLoading);
}
function newTab(){
var tab = document.createElement('webview');
diff --git a/misc/ebrowser/package.json b/misc/ebrowser/package.json
index ff195792..0dfdf970 100644
--- a/misc/ebrowser/package.json
+++ b/misc/ebrowser/package.json
@@ -1,4 +1,4 @@
-{"version":"1.0.44",
+{"version":"1.0.45",
"name": "ebrowser",
"description": "The keyboard-friendly minimal suckless web browser",
"main": "webview.js",
diff --git a/misc/ebrowser/sitecss/baidu.com.css b/misc/ebrowser/sitecss/baidu.com.css
new file mode 100644
index 00000000..5d808093
--- /dev/null
+++ b/misc/ebrowser/sitecss/baidu.com.css
@@ -0,0 +1 @@
+.ec_wise_ad,.ec_wise_pp,.na-like-container{transform:scale(0)!important;display:none!important}
diff --git a/misc/ebrowser/sitejs/mypikpak.net.js b/misc/ebrowser/sitejs/mypikpak.net.js
new file mode 100644
index 00000000..25fa2192
--- /dev/null
+++ b/misc/ebrowser/sitejs/mypikpak.net.js
@@ -0,0 +1,12 @@
+(function() {
+ const originFetch = fetch;
+ window.fetch = (...arg) => {
+ if (arg[0].indexOf('area_accessible') > -1) {
+ return new Promise(() => {
+ throw new Error();
+ });
+ } else {
+ return originFetch(...arg);
+ }
+ }
+})();
diff --git a/sitemap.xml b/sitemap.xml
index 1c0ba2f4..8463ee1d 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -4,7 +4,7 @@
/en/sitemap.xml
- 2024-06-29T08:47:08+08:00
+ 2024-06-29T21:05:42+08:00