(Backup Menu) ++ AO3: Kudosed and seen history

Added menu to export to .txt and import your backup

< 脚本(Backup Menu) ++ AO3: Kudosed and seen history的反馈

评价:好评 - 脚本运行良好

§
发表于:2025-03-15

Beautiful integration and very simple!
It just needs two smalls improvements in my opinion:

1. `localStorage.getItem` should happen on demand inside `exportToTxt()` instead of on page load:
- It is expensive since the data is read on every single page load.
- It is not interaction or multi-tab safe. This could be a big problem if you have many tabs and export from a very old one; it could save the state it remembers from hours, days, or weeks ago; with every change ignored until the page is reloaded.

2. I mostly use AO3 on mobile with a smaller phone, there, "Export/Import Data" is too long and wraps below the search bar. I would recommend using a shorter button name like "Data","Manage Data","Backup Data","Export Data" (anything smaller than "Export/Import" which doesn't fit sadly).

Great job though! I love how the files are dated too and stole it again :P

MAD90's作者
§
发表于:2025-03-22

Thanks! I've implemented the changes you suggested :)

Just out of curiosity, which browser do you use on your phone?

§
发表于:2025-03-22

Great to hear! I'm using Firefox Android with the ViolentMonkey add-on

Btw, on mobile, I just figured out why the button was pushed to the second line (and then to the third line, below the search bar, when it was too big): The button is appended after the search bar!
You definitely can't tell on desktop since search is on the right somehow... but this fix puts it all on the same line at last:
`// Line 88: $('ul.primary.navigation.actions').children().last().before(menu);`

Oh, and I also realized that `var kudos_history` wasn't technically needed, it can be used directly if you'd like to shorten the code a bit:
```
var export_lists = {
kudosed: localStorage.getItem('kudoshistory_kudosed') || ',',
seen: localStorage.getItem('kudoshistory_seen') || ',',
bookmarked: localStorage.getItem('kudoshistory_bookmarked') || ',',
skipped: localStorage.getItem('kudoshistory_skipped') || ',',
checked: localStorage.getItem('kudoshistory_checked') || ','
};
```

MAD90's作者
§
发表于:2025-03-26

Thanks Again! I modified the code and tested it on my phone, using Edge with Tampermonkey and Firefox with Violentmonkey.
I hope it fixes it for everyone because my phone has a big screen so it's not a good tester.

§
发表于:2025-03-26

Yup, it's perfect now, thanks!

发表回复

登录(不可用)以发表回复。

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址