AO3 Tag Reorder

Rearrange tag order when editing a work

作者
Ifky_
日安装量
0
总安装量
7
评分
0 0 0
版本
1.0.2
创建于
2025-01-26
更新于
2025-03-09
大小
10.5 KB
许可证
GPL-3.0-only
适用于

Known bugs

There might be an issue with new works being duplicated. I have been unable to replicate the bug after first spotting it. It seems to be related to making drafts. If you encounter this issue, please write me a message on how you encountered it.

Tag Reorder

Demo of reordering tags

About

This is a script meant to reorder a work's tags (Fandoms, Relationships, Characters, Additional/Freeform) for Archive of Our Own (aka AO3). To reorder the tags, just drag and drop a tag somewhere else in the list.

Normally, when removing and adding tags to change their order, existing tags will not be updated in the AO3 database. Only deleted tags will be removed and new tags will be appended at the end of the tag list. It does not care if the existing tags have changed order. This makes reordering existing/new tags tedious. This script solves the issue by sending two network requests: one with empty tags and one with the user's list of tags. (All empty with the exception of fandom, which will have a "-" (dash) placeholder fandom, which is used because the fandom category is a required field and cannot be completely empty. It is automatically replaced with the real fandom tags in the second request.) That way, in the second request, all tags are saved in the order they are in the list.

Note: This script is generally secure and stable, but due to the possibility of network issues or being rate limited by AO3, there is a potential risk of the first request being sent without the second. In that case, the work will be saved with no tags. Copy the tags beforehand to keep a backup.

Functionality

Copying Tags

The tags can be copied to the clipboard either by category or all tags at the same time. The recommended way is to copy all at the same time, so that no category is forgotten. Paste the comma separated list in a text file for safekeeping.

In the event that the reordering of tags fails, the tags will be be left empty. The tags can easily be pasted back in. AO3 will separate each tag by comma. This must be done separately for each category (fandom, relationship, character, additional/freeform).

Info Button

A button for opening an information modal has been provided, for easily available instructions in the UI itself.

Save Buttons

In order to reorder the tags, new buttons have been inserted at the bottom of the form. If reordering the tags is unnecessary, use AO3's standard buttons ("Save As Draft", "Preview", "Post", etc.) and it will function as normally (even if the tags have been reordered).

If reordering tags is wanted, use the buttons inserted by the script ("Save tags"). It's possible to save as draft (if the work can still be drafted) or post. The script has not added the functionality to reorder tags for preview. While it is possible to add preview of reordered tags, it was decided against due to lack of usefulness.

For works with no pre-existing tags (e.g. new works), the standard buttons and the script's buttons work the same. Due to this, the buttons have been removed on the "new work" page in order to avoid any complications of trying to udpate a work that technically does not exist yet.

Style

Elements have been styled minimally and with the intention that it should fit different site skins, but if it does not, here are the selectors to adjust them:

  • The "information" sections each have an ID, in the form of tag-copy-list-freeform where "freeform" can be replaced with the name of the other categories (fandom, relationship, character).
  • The buttons can be styled as button elements.
  • The tag handles ("hamburgers"/three lines) have selectors in the form of .freeform .added.tag::before where "freeform" can be replaced with the name of the other categories (fandom, relationship, character).

It's also possible to edit in the code, but any changes to the script risks being overridden if the script is updated.

Script Dependencies

  • Alpine.js v3.14.8

FAQ

  • Q: I'm using Greasemonkey. Why isn't it working? A: Try using the Tampermonkey extension instead.