tweaks: around bloomberg webpage

This commit is contained in:
NunoSempere 2023-02-15 03:24:47 +01:00
parent a27b4357af
commit 25dedb09e1
7 changed files with 22 additions and 7 deletions

View File

@ -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:

View File

@ -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"
};

View File

@ -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);

View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#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");

View File

@ -1,7 +1,7 @@
#ifndef STYLE
#define STYLE
#define STYLE_N 1358 + 1
#define STYLE_N 1393 + 1
void read_style_js(char* string);

View File

@ -1,7 +1,9 @@
// Replicates the Stylus app: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/>
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)

8
rose.c
View File

@ -123,6 +123,14 @@ void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook *
switch (load_event) {
/* see <https://webkitgtk.org/reference/webkit2gtk/2.5.1/WebKitWebView.html> */
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));
}