I’ve always been someone who prefers the light theme over the dark theme, and a while ago I tried to change the theme of my Lemmy account to the “litely” theme but that theme blurs the NSFW preview of images, and If I remember correctly, the disableblur theme was a theme that @Wander@yiffit.net created because Lemmy itself doesn’t allow you to disable the blur on the preview of NSFW images.

Is there something I can do to disable that blur or it’s necessary to create a new theme with that blur disabled?

  • Eagle0600@yiffit.net
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    11 months ago

    Our goal is to inject the following CSS into Lemmy: /* Anti-blur */ .img-blur { filter: none !important; }

    What browser are you using? Depending on your browser, there is likely at least one add-on similar to Greasemonkey which allows you to run custom javascript on web pages of your choice. You might also find an add-on that injects CSS directly, in which case you can just copy the above CSS into that and call it a day.

    However, in the case where we have to use javascript, here’s some code that will do that:

    const CSS = `
    /* Anti-blur */
    .img-blur {
    	filter: none !important;
    }`;
    function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }
    addGlobalStyle(CSS);
    

    And here’s a full script including the header that selects the correct website:

    // ==UserScript==
    // @name     Lemmy antiblur
    // @namespace   Eagle0600
    // @include     https://yiffit.net/*
    // @version  1
    // @grant    none
    // ==/UserScript==
    
    const CSS = `
    /* Anti-blur */
    .img-blur {
    	filter: none !important;
    }`;
    
    function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }
    
    addGlobalStyle(CSS);
    
    • MrMorgana@yiffit.netOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      11 months ago

      Oops, sorry for the late reply!

      I am currently using Firefox and actually I use ViolentMonkey. I just tried to create a script with the code you gave me and it works perfectly, thanks!

      I wonder if it will be possible to create a custom filter in uBlock Origin for the same purpose.