After an extensive debugging session on the KG discord, it turns out that the version of the D3 library this script uses is fatally incompatible with strict mode. If strict mode is enabled (for example, by having Tampermonkey's experimental setting for strict mode set to Always) the D3 library throws an exception when trying to read this.document where this is undefined. If strict mode is not enabled (set to Disabled or Default in the TM settings) the script functions normally.
After an extensive debugging session on the KG discord, it turns out that the version of the D3 library this script uses is fatally incompatible with strict mode. If strict mode is enabled (for example, by having Tampermonkey's experimental setting for strict mode set to
Always) the D3 library throws an exception when trying to readthis.documentwherethisis undefined. If strict mode is not enabled (set toDisabledorDefaultin the TM settings) the script functions normally.