-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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'] | ||
| }); | ||
| }); | ||
| })(); |