diff options
Diffstat (limited to 'plugins/style')
| -rw-r--r-- | plugins/style/README.md | 5 | ||||
| -rwxr-xr-x | plugins/style/recompute_STYLE_N.sh | 8 | ||||
| -rw-r--r-- | plugins/style/style.c | 29 | ||||
| -rw-r--r-- | plugins/style/style.h | 8 | ||||
| -rw-r--r-- | plugins/style/style.js | 26 | 
5 files changed, 76 insertions, 0 deletions
| diff --git a/plugins/style/README.md b/plugins/style/README.md new file mode 100644 index 0000000..e0aad62 --- /dev/null +++ b/plugins/style/README.md @@ -0,0 +1,5 @@ +## Customize css style for individual websites. + +- Replicates: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/>.  +- The template is similar to the readability folder. +- You will also want to customize the `style.c` file. diff --git a/plugins/style/recompute_STYLE_N.sh b/plugins/style/recompute_STYLE_N.sh new file mode 100755 index 0000000..906aad8 --- /dev/null +++ b/plugins/style/recompute_STYLE_N.sh @@ -0,0 +1,8 @@ +#!/bin/bash +function sedr(){ +  find ./ -type f -exec sed -i -e "$1" {} \; +} ## e.g., sedr "s/target/replacement/g" + +STYLE_N=$(wc -c style.js | cut -d " " -f 1) +sedr "s/^#define STYLE_N .*/#define STYLE_N $STYLE_N + 1/g" + diff --git a/plugins/style/style.c b/plugins/style/style.c new file mode 100644 index 0000000..dc2da8a --- /dev/null +++ b/plugins/style/style.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#define STYLE_N 794 + 1 + +void read_style_js(char* string){ +  FILE *fp=fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rose-bud-personal/plugins/style/style.js", "r"); +  if (!fp) { // fp is NULL, fopen failed +    fprintf(stderr, "Failed to open file\n"); +    string=NULL; +    return; +  } +  int i=0; +  int c; +  while ((c = fgetc(fp)) != EOF){ +     string[i++] = c; +  } +  string[i]='\0'; +  fclose(fp); +} + +/* +int main(){ +    char* readability_js = malloc(STYLE_N+1); +    read_readability_js(readability_js); +    printf("%s", readability_js); +    free(readability_js); +} +*/ diff --git a/plugins/style/style.h b/plugins/style/style.h new file mode 100644 index 0000000..20a684b --- /dev/null +++ b/plugins/style/style.h @@ -0,0 +1,8 @@ +#ifndef STYLE +#define STYLE + +#define STYLE_N 794 + 1 + +void read_style_js(char* string); + +#endif diff --git a/plugins/style/style.js b/plugins/style/style.js new file mode 100644 index 0000000..01524d0 --- /dev/null +++ b/plugins/style/style.js @@ -0,0 +1,26 @@ +// Replicates the Stylus app: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/> + +if (document.domain == "forum.effectivealtruism.org"){ +	var styles = ` +	    .Layout-main { +                margin-left: 100px; +	    } +            .SingleColumnSection-root { +                width: 1000px !important; +                max-width: 1400px !important; +                padding-left: 100px !important; +            } +            .NavigationStandalone-sidebar { +                display: none; +            } +            .intercom-lightweight-app{ +                display: none; +            } +  ` +	  var styleSheet = document.createElement('style') +	  styleSheet.innerText = styles +	  document.head.appendChild(styleSheet) +	  console.log('Style changed') +} + +document.body.style.visibility = "visible" | 
