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-10

[Firefox] It doesn't let me left click a picture to open it in the home page, or a search results page. Nothing happens, but only with ublock origin installed, even if diabled for the site. If I disable the extension entirely then I can click pictures fine. I think this happened in the last week.
Thanks btw, addon is great otherwize.

§
Posted: 2020-12-10

Or so I thought, but now I can't replicate it again. Ublock changes nothing. Any idea?

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

Hm.. I'm using Firefox and uBlock myself and didn't run in this issue.
It's probably related to the postmode stuff that I recently changed ("fix post mode resetting for good"), no idea as to why yet.
It's also possible it's unrelated to uBlock and just random.

If it happens again, can you first check if there's any error message in the web console? (Ctrl + Shift + K)
If there is none, can you check what the "Mode" to the left says? By default it should show "View posts".
It would be also useful to know what the cookies look like, in the dev tools under web storage (Shift + F9) there should be a cookie named "mode" that should have the value "view". There should also be an "addon_mode" cookie with the same value.

...

Aha! I was just able to reproduce it when I'm not logged in, were you also not logged in?
In any case, I've got a lead:

ERROR: Execution of script 'SankakuAddon' failed! unsafeWindow.Cookie is undefined

Shouldn't be too hard to fix.

edit Maybe not so easy, Cookie does eventually load.

sanchanAuthor
§
Posted: 2020-12-10

So the good news, I fixed a logic error which affects clicking while not being logged in.

The bad news... the errors I'm getting look like a fundamental issue where the sitescript hasn't yet fully executed, so any unsafeWindow.* variables may not yet exist.
I even had a Uncaught TypeError: $(...) is null, which could only have happened inside unsafeWindow.PostMode.change() !

This sucks, to say the least.
As far as I know, there is no easy way to wait for the sitescript, I've read that not even setting the scripts @​run-at to document-idle is guaranteed to work.

I'll try to make it more robust in the mean time and may retort to spinning until unsafeWindow.PostMode, Cookie and $ exist later (maybe I'll also just reimplement Cookie...).

§
Posted: 2020-12-10

Thanks for getting back so quick!!
So... no error message in console after I click the unreactive posts.
It's view mode. Switched to [add to fav] and it also does nothing on click.
Cookie mode=view. Can't find any cookie named "addon_mode" with the same method.
I'm definitely logged in.
Don't know about anything after that.

Is tamper monkey the problem? I realized you might use something else
Before this I tested by installing a portable firefox, ublock origin and tampermonkey with your addon, still happened that's what made me think it wasn't me.

sanchanAuthor
§
Posted: 2020-12-10

I just released a new version which adresses the fundamental issues and hopefully fixes the click event as well, but I'm not 100% on that after reading what you wrote (being logged in and all).

Btw, I'm using Tampermonkey as well, that's where I test everything, so it's still odd that I've not run into this issue before.
It may (have been?) a timing issue; until recently there was an issue where the main script just did not run when the code was injected too late, which I replicated on bare Chrome after turning ads back on in my profile, stuff's funny isn't it?

§
Posted: 2020-12-11

Still had the bug, then I refreshed the sankaku page after installing 0.99.18 and it once again clicks as normal. Whatever it was must have had ties to what you found, funny how fickle it can be.
Thanks so much for the help, you're a cool person!

sanchanAuthor
§
Posted: 2020-12-11

So it's working, thank god.

One last worry I have: Do the Choose/Set Parent modes always show up for you?
Because if they don't, that'd explain why the clicks didn't work.

Can you try selecting Choose Parent and Ctrl+F5 a bunch of times to see if it it keeps being selected?
And if it's not selected, can you check if the option is missing from the list?

§
Posted: 2020-12-12

Okay, so I didn't know what you meant at first. I only ever had 8 options in the mode list. None were *** parent.
Just then messing around I found them in the "visually similar search. Is that intended?
https://i.imgur.com/duutNO5.png

Stays selected through f5 refreshes and closing firefox.

sanchanAuthor
§
Posted: 2020-12-12

No, that is not intended, the Choose/Set Parent modes should always be added by SankakuAddon - that is actually the reason why the click events get overwritten in the first place.

(I just lost what I wrote, so here we go again)
I was finally able to replicate and debug the issue by adding some alert()s - which apparently stopped script execution and changed the timings.

The issue is really weird.
The observer which looks for the earliest point in time the mode dropdown is 'finished' (that is, after 'Apply tag script' was added), looks at the parent of that just added <option> (which should be the dropdown, aka the <select>) and for some inexplicable reason, that parent can be undefined - okay - or it can be the <div> above the <select>...?

Anyways, the fix seems to be to just use getElementById(), let's hope that this is final and I don't need to add any more spinning code.
v0.99.19 is up, give it a try

sanchanAuthor
§
Posted: 2020-12-12

And now I can't reproduce it anymore, it's like waking up from a dream, was it even real?

§
Posted: 2020-12-12

I must be dreaming because nothing has changed for me, those modes aren't on most pages. Why would I be different?

sanchanAuthor
§
Posted: 2020-12-13

I put together a debug build that should shed at least some light into what's happening:
https://hastebin.com/raw/isiqemusan.user.js

Please install it, go to the post index, open the console (Ctrl+Shift+K) and on the top right, filter by Debug.
Select all messages (rightclick select all) and copy-paste it here (either with https://hastebin.com/ or as a <blockquote>).

It should look something like this:

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

Oh, apparently I'm an idiot, just looked at your image again, you don't have 'Edit/Apply tag script' options in the first place, probably because you don't have the rights to use them and since 'Choose/Set Parent' modes use tag scripts, it's actually good that they don't appear for you.

It's still very odd that they do appear on the visually similar pages though, this might be a site bug.
You could try using a tag script (choose edit tag script, enter 'test', click a post and check if the post now has a 'test' tag) - if that doesn't work, it's definitely a user permission thing.

edit Just created a test account and it's the same on that, the post index doesn't have tag script modes, but the visually similar page does.
I can't test if they actually work because the account needs to be a day old at least.

If they do work, that might actually be a terrible flaw in the system that needs to be reported.

§
Posted: 2020-12-13
Edited: 2020-12-13

Okay so I guess I'll disregard the debugger. Shame about that lol.
I used the tagger script fine and added 'test' with a click, I can see why that would be an effective griefing tool.

Don't really know where I'm going with this after fixing the click to view, but I'm happy to help with this since I've probably used the addon a fair bit now. Also the sankaku site is nice.
PM'd you about a spare account.

sanchanAuthor
§
Posted: 2020-12-13
I used the tagger script fine and added 'test' with a click

Okay, I just tried with your spare account. Once the account has an avatar set (that's one of the requirements to be able to edit tags), the tag script actually works on the visually similar page.
That in itself isn't so bad (maybe even intentional), what could be bad however is that tag scripts can be run anywhere on the site and with any post ids you want, so it can be abused easily.
Though it's also not hard to abuse the system the 'normal' way by sending custom POST forms on edit pages.

It's probably no big issue since there's surely ways of mass-undoing griefing and on the griefing side, creating new accounts which are able to edit tags requires manual actions like mail verification.

I'll still report it just to be safe.

Don't really know where I'm going with this after fixing the click to view, but I'm happy to help with this since I've probably used the addon a fair bit now. Also the sankaku site is nice.

Yeah, I guess there's nothing left to help with anymore, the click events are fixed, I even fixed an unrelated bug with post modes not always appearing and the rest is a possible site issue which I'll report.

So thanks for the help!

§
Posted: 2020-12-14

Well I had an email linked to that account, but never clicked verify because it took to long to pop up in the inbox. Could still edit tags, just a small detail.

Overall, been fun. Maybe I'll start a thread with a feature suggestion.

Post reply

Sign in to post a reply.