Reddit++

A lot of enhancements for new design of reddit.com like unwrapped feed buttons, bigger fonts, view images without redirect and many more...

< Feedback on Reddit++

Review: OK - script works, but has bugs

§
Posted: 07. 09. 2024

Works beautifully with Tempermonkey in Chrome/Firefox, but doesn't work in Safari with Userscripts. Please consider Userscripts for Mac.

lnm95Author
§
Posted: 08. 09. 2024

As I see safary uses custom GM, so it may be point of the trouble. But I haven't a mac device to debug it. So I doubt to making some fixes without understanding that it's actually fix the trouble.

§
Posted: 16. 09. 2024
Edited: 16. 09. 2024

I tried to tinker around with this and got to the point that I know the problem is that userscripts doesn't define "GM_getValue" or any of the "GM_" functions (Only GM_getValue and GM_setValue are used in RedditPlusPlus) but they rely on GM.getValue and GM.setValue instead. And the catch is that they are async functions, I started writing a wrapper for the storage but this ended up requiring changes in A LOT of places. I will create a draft PR later but basically this should be the starting point to support both TM and GM:

export class GMStorage {
    getValue(key: string, defaultValue: any) {
        if (typeof GM_getValue === 'function') {
            return Promise.resolve(GM_getValue(key, defaultValue));
        } else {
            return GM.getValue(key, defaultValue);
        }
    }

    setValue(key: string, value: any) {
        if (typeof GM_setValue === 'function') {
            return Promise.resolve(GM_setValue(key, value));
        } else {
            return GM.setValue(key, value);
        }
    }
}

Post reply

Sign in to post a reply.