Greasy Fork is available in English.

Slickdeals+

Various enhancements, such as ad-block, price difference and more.

< Feedback on Slickdeals+

Review: Good - script works

§
Posted: 2024.06.02.
Edited: 2024.06.02.

Does the script need to be updated? Doesn't seem to work for me on Safari as of this week :( The menu doesn't attach to the header anymore

vanowmAuthor
§
Posted: 2024.06.03.

I'm unable test it on Safari, however it seems SD is pushing new style, I occasionally get different design tiles, which changes on each refresh.
So, when they finalize the change, I'll update the script.

§
Posted: 2024.06.03.
Edited: 2024.06.03.

Cheers, will keep a lookout for an update. Is the mobile layout different from desktop div wise? I was testing on desktop mostly

§
Posted: 2024.07.03.

Figured out these were mostly Safari and UserScript extension related errors, works fine in Firefox with Tampermonkey. Here's their repo if you want to see how they are parsing things.

Added /*. jshint esversion: •11.*/ under line 12 to get rid of the Safari UserScripts error on line 21 'Optional chaining' is only available in ES11 (use 'esversion: 11'). I suspect that is an extension specific bug with jshint but maybe you can add that in for better compat. Likely keeping just GM_info.script.version on that line would work too but I see your comment on external editors there.

Line 182 has a strange error Unexpected '6' maybe regex related?

vanowmAuthor
§
Posted: 2024.07.03.

I'm using eslint with this config

{
    "env": {
        "browser": true,
        "es6": true,
        "es2020": true,
        "es2021": true,
        "greasemonkey": true
    },
    "extends": [
        "plugin:userscripts/recommended",
        "eslint:recommended",
        "plugin:sonarjs/recommended",
        "plugin:eslint-comments/recommended",
        "plugin:promise/recommended",
        "plugin:unicorn/recommended",
        "plugin:import/errors",
        "plugin:import/warnings"
    ],
    "plugins": [
        "eslint-comments",
        "promise",
        "sonarjs",
        "unicorn",
        "userscripts"
    ],
    "rules": {
        "arrow-body-style": [
            "error",
            "as-needed",
            {
                "requireReturnForObjectLiteral": true
            }
        ],
        "arrow-parens": [
            "error",
            "as-needed"
        ],
        "arrow-spacing": "error",
        "brace-style": [
            "error",
            "allman",
            {
                "allowSingleLine": true
            }
        ],
        "eqeqeq": "error",
        "indent": [
            "error",
            "tab",
            {
                "SwitchCase": 1,
                "ignoreComments": true,
                "outerIIFEBody": 0
            }
        ],
        "max-statements-per-line": [
            "error",
            {
                "max": 1
            }
        ],
        "no-array-constructor": "error",
        "no-catch-shadow": "error",
        "no-compare-neg-zero": "error",
        "no-cond-assign": "warn",
        "no-confusing-arrow": "error",
        "no-const-assign": "error",
        "no-constant-condition": [
            "error",
            {
                "checkLoops": false
            }
        ],
        "no-dupe-args": "error",
        "no-dupe-class-members": "error",
        "no-dupe-keys": "error",
        "no-duplicate-case": "error",
        "no-else-return": "error",
        "no-empty": [
            "error",
            {
                "allowEmptyCatch": true
            }
        ],
        "no-empty-character-class": "error",
        "no-empty-pattern": "error",
        "no-eq-null": "error",
        "no-extra-bind": "error",
        "no-extra-boolean-cast": "error",
        "no-extra-label": "error",
        "no-extra-semi": "error",
        "no-inner-declarations": "error",
        "no-invalid-regexp": "error",
        "no-irregular-whitespace": "error",
        "no-lonely-if": "error",
        "no-mixed-spaces-and-tabs": "error",
        "no-multi-assign": "error",
        "no-multi-spaces": "error",
        "no-multi-str": "error",
        "no-multiple-empty-lines": [
            "error",
            {
                "max": 1
            }
        ],
        "no-negated-condition": "error",
        "no-nested-ternary": "error",
        "no-prototype-builtins": "error",
        "no-redeclare": "error",
        "no-return-assign": "error",
        "no-self-compare": "error",
        "no-shadow": [
            "error",
            {
                "allow": [
                    "i",
                    "evt"
                ]
            }
        ],
        "no-spaced-func": "error",
        "no-sparse-arrays": "error",
        "no-throw-literal": "error",
        "no-trailing-spaces": "error",
        "no-undef": "error",
        "no-unexpected-multiline": "error",
        "no-unreachable": "warn",
        "no-unused-expressions": [
            "warn",
            {
                "allowShortCircuit": true
            }
        ],
        "no-unused-vars": "warn",
        "no-useless-computed-key": "error",
        "no-useless-concat": "error",
        "no-useless-constructor": "error",
        "no-useless-escape": "error",
        "no-useless-rename": "error",
        "no-useless-return": "error",
        "no-var": "error",
        "no-whitespace-before-property": "error",
        "one-var": [
            "error",
            "never"
        ],
        "prefer-arrow-callback": "error",
        "prefer-const": "error",
        "quotes": [
            "error",
            "double",
            {
                "allowTemplateLiterals": true,
                "avoidEscape": true
            }
        ],
        "semi": "error",
        "space-before-function-paren": "error",
        "space-infix-ops": "error",
        "userscripts/better-use-match": "off",
        "userscripts/filename-user": "off"
    }
}

There are no errors in my VSCode editor and quite frankly, I care less what errors shown in TM editor (which doesn't support ES11).

So, do you see any errors in dev tools in safari?

Also, I should note, that lately TM become temperamental, like it would show that it's running NN number of scripts on a page, but it actually doesn't.

vanowmAuthor
§
Posted: 2024.07.07.

I found if page was fully loaded before SD+ is executed the menu would not be created (which never happens while dev tools is opened). It should be fixed in v24.7.7

§
Posted: 2024.07.07.

Works better in Firefox and Safari now, great changes! For Safari, I found the issue preventing the userscript from loading, seems to be a regex pattern issue in Safari. If I remove the highlighted section and leave just GM_info.script.version; the userscript runs great. I need to run some regex tests to see which pattern it's having an issue with in Safari, no issues in Firefox. Might be related to lookaround regex which Safari used to have problems with

vanowmAuthor
§
Posted: 2024.07.07.

Perhaps it's not the regex, but optional chaining ?. ? is if this would work:

const VERSION = (document.currentScript && document.currentScript.textContent.match(/^\/\/ @version\s+(.+)$/m)[1]) || GM_info.script.version;
§
Posted: 2024.07.07.

These are both versions of the errors I'm seeing on the console. The new line seems to satisfy the editor at least, no warning for optional chaining and es versions

vanowmAuthor
§
Posted: 2024.07.07.
Edited: 2024.07.07.

Oh, I see. this should do the trick then:

const VERSION = (document.currentScript?.textContent.match(/^\/\/ @version\s+(.+)$/m) || [])[1] || GM_info.script.version;

But I'm curious now why this fails in safary, can you add this line and see what it shows in console?

console.log(document.currentScript?.textContent);

Will it show the actual userscript with metadata, with line // @version 24.7.7 ?

§
Posted: 2024.07.07.
Edited: 2024.07.07.

That fixed it! Safari seems to be good to go now. This is what I see in the console output for that line and saved to a txt. Is this expected? I see that escape chars are appearing in the log like \n.

https://gist.github.com/stevenya97/07b779be8d871293aeb3307e5ec154ed

vanowmAuthor
§
Posted: 2024.07.07.

oh, what extension do you use to run userscripts in safari? Tampermonkey on Chrome/edge doesn't strip metadata. I've been using this technique to get proper userscript version for a while now, but it seems not 100% proof.

I'll just abandon this practice and fix VERSION constant via my bundler that updates .user.js file upon committing.

§
Posted: 2024.07.08.

I am using this. Wonder if it's an intentional implementation or a bug.

https://github.com/quoid/userscripts?tab=readme-ov-file

§
Posted: 2024.07.08.
Edited: 2024.07.08.

It does seem like it only supports a smaller list of metadata tags compared to Tampermonkey looking at the readme, likely they do some tag stripping. I see that @author tag has been stripped from all my imported userscripts. @version is supported

§
Posted: 2024.07.08.

Scratch that, I do see the tags so not sure what's happening with the metadata. Some of my userscripts had that tag omitted.

vanowmAuthor
§
Posted: 2024.07.08.

Are you seeing some metadata printed in the console after adding console.log line from previous message or in the editor?

§
Posted: 2024.07.08.

I think it was a different issue with one of my other scripts, so I think everything is good here. If I add the console line it shows the metadata the same as before

Post reply

Sign in to post a reply.