AO3: Jump to a Random Work

adds a "Random Work" button (top right corner) when viewing works in a tag/filter or your Marked For Later list

< Feedback on AO3: Jump to a Random Work

Review: OK - script works, but has bugs

§
Posted: 2022-11-10

This works nice for giving a random fic but it seems that if its on the filter button does not work anymore. it also does not appear in the marked for later screen (i dont use marked for later but i wanted to check so i added some fics to there and it still was not there). also i am new to scripts so there might be a way to turn it off apply my filters and then turn it back on to randomize a fic but that didn’t seem to work for me . but other than those two things it seems to work well so thank you for this script !

escctrlAuthor
§
Posted: 2022-11-11

Thank you for your feedback! May I ask, could you link me a page that doesn't work for you? I just tested it again on a tag page archiveofourown.org/tags/xxx/works as well as on a filter archiveofourown.org/works?commit=Sort+and+Filter&xxx, and both worked as expected. Maybe I'm missing something specific.

Same on the Marked For Later list. Could you elaborate what exactly doesn't work for you? Does the button not show up (see screenshot), or does it not redirect you for example?

Sometimes scripts fail due to incompatibilities between script managers. Are you using Greasemonkey, Tampermonkey, Violentmonkey, or something else? And on which browser?

Here are a couple more things that can help pinpoint where the problem is:

  • Some script managers (e.g. Tampermonkey) tell you which scripts they've applied on a page. Does the Random Work script show up in the list on the pages that you expected it to work?
  • When you right-click into the page where it was applied but doesn't work, and you select "Inspect" in the menu, a developer tool opens. In the top-right corner, there could be a red X icon that tells you about script errors on the page (see second screenshot). Do you see any of those?
§
Posted: 2022-11-13

i will try to explain this the best i can im not the best at this.

okay for the first part any tag i try it on doesnt work. i got it to work slightly for a second but after filtering the randomized button disappeared and stop appearing in my script manager (currently using userscripts for safari mobile) i forgot to take screenshots of the time it worked and haven’t gotten it start working again.
a common problem seem to be all of my links that have “#work-filters “ https://archiveofourown.org/tags/xxx/works#work-filters definitely wont work.
For the marked for later, the random button just doesn’t show up for me. I dont ever use marked for later so maybe I am just doing something wrong.
i switched to a different script manager (Stay - userscript extension) and it didn’t work at all for me. This might just be a user error.
i haven’t tested this anywhere except for on safari mobile on my iphone as this is the only place i use ao3.

escctrlAuthor
§
Posted: 2022-11-13

Okay, thanks for the hints. Most mobile browsers don't even have extensions and can't run userscripts. I'm surprised Safari can :)
I crosschecked the documentation, but see nothing in the code that Safari on iOS would not support. so I may have to find someone on an iPhone that can help me debug this in realtime. this could take a while, sorry!
If you test this on desktop browsers anywhere, let me know if that runs any better.

§
Posted: 2023-01-24

Hello, I will just add a few screenshots since I also use iOS and safari to browse AO3. Similarly, it did work for a single filtered tag (ex: a relationship), but did not if you added more than that (ex: relationship, pining). I turned it off to test the filter and was not able to get it to work again for some reason. The .js file shows up in the folder (which I accessed via the userscripts safari add on) but not in the available UserScripts menu of the same add on? So it seems like it can see it but not (or only selectively) use it. I've done my due diligence regarding turning it off and on again in various combinations but I wouldn't even know how to begin to debug this lol

escctrlAuthor
§
Posted: 2023-07-28

If the script is installed but the Userscript Manager doesn't think the script applies to the page you're viewing, then something is different about the way this Userscript Manager interprets the @match lines.

// @match        *://*.archiveofourown.org/tags/*/works*
// @match        *://*.archiveofourown.org/works?*
// @match        *://*.archiveofourown.org/users/*/readings*show=to-read*

really, any of the wildcards could be a problem.
it could be that the *:// at the beginning is not-so-liked, you could switch that out to https://
or it's the asterisk for the subdomain. if you're primarily viewing archiveofourown.org, you could try to remove the *. before it
if the "normal" works page is fine, but it stops working as soon as you add more filters, it could be the questionmark. try removing it.

Thank you for your investigations. I'm sorry I can't try these myself, and I haven't been able to find any articles that talk about differences in parsing the @match in this Userscript Manager. but if anyone has time to try a few iterations of these, maybe we can narrow it down.

Post reply

Sign in to post a reply.