From 55c4d73251b94624bc28b8337fe7496fe3c9bc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Andreas=20Nilsen?= Date: Wed, 26 Mar 2025 14:37:52 +0100 Subject: [PATCH] added diri de-blur --- diri.user.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 diri.user.js diff --git a/diri.user.js b/diri.user.js new file mode 100644 index 0000000..98f693f --- /dev/null +++ b/diri.user.js @@ -0,0 +1,57 @@ +// ==UserScript== +// @name Diri.ai Patch +// @namespace https://git.ntnu.no/M365-Drift/MonkeyMagic +// @version 0.1 +// @description Sets --blur-xs to 0px instead of 4px for diri.ai +// @author Øyvind Nilsen +// @match https://diri.ai/* +// @icon https://www.google.com/s2/favicons?sz=64&domain=diri.ai +// @grant none +// @run-at document-start +// @updateURL https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/diri.user.js +// @downloadURL https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/diri.user.js +// ==/UserScript== + +(function() { + 'use strict'; + + // Method 1: Create a style element and add it to the head + const styleElement = document.createElement('style'); + styleElement.textContent = ` + :host, :root { + --blur-xs: 0px !important; + } + `; + + // Add the style element as soon as the document head is available + const addStyle = () => { + if (document.head) { + document.head.appendChild(styleElement); + } else { + // If document.head isn't available yet, try again shortly + setTimeout(addStyle, 10); + } + }; + + addStyle(); + + // Method 2: Observe and update any dynamically added stylesheets + // This handles cases where styles are added dynamically after page load + document.addEventListener('DOMContentLoaded', () => { + // Update the CSS variable in the computed styles + document.documentElement.style.setProperty('--blur-xs', '0px'); + + // Set up a MutationObserver to watch for style changes + const observer = new MutationObserver((mutations) => { + document.documentElement.style.setProperty('--blur-xs', '0px'); + }); + + // Start observing the document with the configured parameters + observer.observe(document.documentElement, { + childList: true, + subtree: true, + attributes: true, + attributeFilter: ['style', 'class'] + }); + }); +})(); \ No newline at end of file