SankakuAddon

Adds a few quality of life improvements on Sankaku Channel: Automatic image scaling, scrolling to image, thumbnail icons for loud/animated posts, muting/pausing videos, + - tag search buttons, a tag menu which allows for tagging by clicking, 'Choose/Set Parent' modes, easier duplicate tagging/flagging. Fully configurable through the Addon config.

< Feedback on SankakuAddon

Review: Good - script works

§
Posted: 2020-12-02

Please change window.open() to GM.openInTab. It doesn't need any special permissions to run. It is also more compatible with adblockers like uBlock Origin because scriptlets like window.open-defuser.js prevent opening new windows by window.open() when URL positively or negatively matches to specific string.

sanchanAuthor
§
Posted: 2020-12-03
Edited: 2020-12-03

Ah, that actually leaves a lot to talk about, so here's a quick history lesson/rambling:

Back then, over 4 years ago, I decided to keep the script 100% 'vanilla' because of compatibility reasons, I didn't even use GM_setValue/GM_getValue.
Since Greasemonkey was ported to web extensions (version 4.0 with a new security model I believe?), the script broke - so much for compatibility - and I recommended using Tampermonkey, having even less of a reason to use the GM API.

Very recently I tried porting SankakuAddon to Greasemonkey and I got 98% of it working, but the security model made two particular things either very inconvenient (PostModeMenu change and click events) or straight up impossible ('flag duplicate' using Ajax.Request).

What's more, using the GM API means using the old API (e.g. GM_openInTab) for Tampermonkey and the new API (GM.openInTab) for Greasemonkey, which I'm not particularly looking forward to.


So for now, I released a new version which uses GM_openInTab, not GM.openInTab, which'll work in Tampermonkey but not in Greasemonkey, which is broken anyways.

sanchanAuthor
§
Posted: 2020-12-03

Just pushed out a new SankakuAddon version with rudimentary Greasemonkey support.
I disabled the broken features (Choose/Set Parent Modes and Flag Duplicate) - everything else, including GM.openInTab, should work.

§
Posted: 2020-12-03

You could just use:

@require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js

This helper script bridges compatibility between Greasemonkey 3 and Greasemonkey 4 and for that matter all versions of Violentmonkey, Tampermonkey, and any other user script engine.

Your approach works too.

Rating changed from Ok to Good. Thanks for the update.

sanchanAuthor
§
Posted: 2020-12-04

Did some more testing and it looks like Tampermonkey does have basic support for GM. despite it not being documented.
Violentmonkey also supports GM., so it looks like the polyfill isn't actually needed.
I generified the compatibility tests a bit, the script should now work on all userscript managers (except Greasemonkey).

Post reply

Sign in to post a reply.