quality of life tweaks, particularly around x.com

This commit is contained in:
NunoSempere 2024-07-20 17:25:54 -04:00
parent a0f79388e9
commit 1c9fbe1122
6 changed files with 11 additions and 6 deletions

View File

@ -4,7 +4,7 @@
// Key user config
#define WIDTH 1920 // 960 for half-width, 1920 for full width
// #define HEIGHT 1080
#define HEIGHT 1000
#define HEIGHT 990
#define BAR_SIZE 960
// More user config

View File

@ -35,7 +35,7 @@ int libre_redirect(const char* uri, char* output)
// previously: "https://old.reddit.com", "https://teddit.nunosempere.com",
// https://github.com/redlib-org/redlib-instances/blob/main/instances.md
"https://vitalik.eth.limo",
"https://invidious.nerdvpn.de",
"https://invidious.private.coffee",
"https://search.nunosempere.com",
"https://scribe.rip",
"https://translate.riverside.rocks",

View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STYLE_N 7831 + 1000
#define STYLE_N 8048 + 1000
void read_style_js(char* string)
{

View File

@ -1,5 +1,5 @@
#pragma once
#define STYLE_N 7831 + 1000
#define STYLE_N 8048 + 1000
void read_style_js(char* string);

View File

@ -1,8 +1,10 @@
// Inspired by the Stylus app: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/>
// NOTE: This file is moved to /opt/rosenrot, so editing it here doesn't have direct effects on the runtime!!
// Main part of the code: switch on the domain and select the corresponding style
var styles = null;
console.log(document.domain);
// console.log(document.domain);
switch (document.domain) {
case "forum.effectivealtruism.org":
styles = `
@ -98,6 +100,7 @@ switch (document.domain) {
`;
break;
case "twitter.com":
case "x.com":
styles = `
/* hide promoted tweets */
:has(meta[property="og:site_name"][content="Twitter"])
@ -114,7 +117,7 @@ switch (document.domain) {
display: none !important;
}
[data-testid^="sidebarColumn"] {
display: none;
display: none !important;
}
/* Hide DMs v2 */
@ -181,6 +184,7 @@ switch (document.domain) {
`;
break;
default:
console.log(`Domain: ${document.domain}`)
console.log("No custom style");
}

View File

@ -91,6 +91,7 @@ void handle_signal_load_changed(WebKitWebView* self, WebKitLoadEvent load_event,
redirect_if_annoying(self, webkit_web_view_get_uri(self));
break;
case WEBKIT_LOAD_FINISHED: {
set_custom_style(self);
/* Add gtk tab title */
const char* webpage_title = webkit_web_view_get_title(self);
const int max_length = 25;