From 25dedb09e1321ae70fe0598d98a3a6e4d15d1215 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 15 Feb 2023 03:24:47 +0100 Subject: tweaks: around bloomberg webpage --- README.md | 2 ++ plugins/libre_redirect/libre_redirect.c | 4 ++-- plugins/stand_in/stand_in.h | 2 +- plugins/style/style.c | 2 +- plugins/style/style.h | 2 +- plugins/style/style.js | 9 +++++++-- rose.c | 8 ++++++++ 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 989cb70..027c0b5 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Personal tweaks for [rose](https://github.com/mini-rose/rose), a minimal browser This is my personal version. Contribute upstream to [github.com/mini-rose/rose](https://github.com/mini-rose/) instead. ### To do + - [ ] Document stand_in.c better - [ ] Look at using relative rather than absolute paths - [ ] Figure out if downloading files is doable. @@ -24,6 +25,7 @@ This is my personal version. Contribute upstream to [github.com/mini-rose/rose]( - [ ] Double check newtab/next-tab behavior - [ ] Find out what each of the css elements refers to. - [ ] Use something other than Whatsapp as an example syslink. +- [ ] Mask user agent Done: diff --git a/plugins/libre_redirect/libre_redirect.c b/plugins/libre_redirect/libre_redirect.c index 8650326..4beb400 100644 --- a/plugins/libre_redirect/libre_redirect.c +++ b/plugins/libre_redirect/libre_redirect.c @@ -40,7 +40,7 @@ int libre_redirect(const char* uri, char* output) "https://www.reddit.com", "https://medium.com", "https://translate.google.com", - "https://forum.effectivealtruism.org", + // "https://forum.effectivealtruism.org", "https://www.bloomberg.com", "https://twitter.com" }; @@ -50,7 +50,7 @@ int libre_redirect(const char* uri, char* output) "https://teddit.nunosempere.com", "https://scribe.rip", "https://simplytranslate.org/", - "https://ea.greaterwrong.com", + // "https://ea.greaterwrong.com", "https://archive.is/https://www.bloomberg.com", "https://nitter.net" }; diff --git a/plugins/stand_in/stand_in.h b/plugins/stand_in/stand_in.h index e221734..062acf7 100644 --- a/plugins/stand_in/stand_in.h +++ b/plugins/stand_in/stand_in.h @@ -9,7 +9,7 @@ #define LIBRE_N 0 #define STYLE_N 0 -#define READABILITY_N 0 +#define READABILITY_N 84638 + 1 int libre_redirect(const char* uri, char* uri_filtered); void str_init(char* str, int n); diff --git a/plugins/style/style.c b/plugins/style/style.c index 1605e56..03222fe 100644 --- a/plugins/style/style.c +++ b/plugins/style/style.c @@ -1,7 +1,7 @@ #include #include #include -#define STYLE_N 1358 + 1 +#define STYLE_N 1393 + 1 void read_style_js(char* string){ FILE *fp=fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rose-browser/plugins/style/style.js", "r"); diff --git a/plugins/style/style.h b/plugins/style/style.h index 73adfdb..5e5d76b 100644 --- a/plugins/style/style.h +++ b/plugins/style/style.h @@ -1,7 +1,7 @@ #ifndef STYLE #define STYLE -#define STYLE_N 1358 + 1 +#define STYLE_N 1393 + 1 void read_style_js(char* string); diff --git a/plugins/style/style.js b/plugins/style/style.js index 600506f..bc0540e 100644 --- a/plugins/style/style.js +++ b/plugins/style/style.js @@ -1,7 +1,9 @@ // Replicates the Stylus app: +var styles = null; + if (document.domain == "forum.effectivealtruism.org"){ - var styles = ` + styles = ` .Layout-main { margin-left: 100px; } @@ -24,7 +26,7 @@ if (document.domain == "forum.effectivealtruism.org"){ } if (document.domain == "mail.proton.me" ){ - var styles = ` + styles = ` .item-container-row.read, .item-container.read { background-color: white; } @@ -35,6 +37,9 @@ if (document.domain == "mail.proton.me" ){ background-color: var(--selection-background-color) !important; } ` +} + +if(styles != null){ var styleSheet = document.createElement('style') styleSheet.innerText = styles document.head.appendChild(styleSheet) diff --git a/rose.c b/rose.c index 4f668d6..89189c0 100644 --- a/rose.c +++ b/rose.c @@ -123,6 +123,14 @@ void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook * switch (load_event) { /* see */ case WEBKIT_LOAD_STARTED: + if(CUSTOM_STYLE_ENABLED){ + char* style_js = malloc(STYLE_N+1); + read_style_js(style_js); + webkit_web_view_run_javascript(notebook_get_webview(notebook), + style_js, + NULL, NULL, NULL); + free(style_js); + } if(LIBRE_REDIRECT_ENABLED){ redirect_if_annoying(self, webkit_web_view_get_uri(self)); } -- cgit v1.2.3