Tag Reorder
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. This makes reordering existing/new tags tedious. This script solves theissue 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.)
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 can 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.
If the work has no pre-existing tags (e.g. it's a new work) there is no difference between the standard buttons and the script's buttons.
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