AO3: Reorder Tags with Drag & Drop

drag & drop tags into the order you'd like before posting

作者
escctrl
日安装量
0
总安装量
288
评分
2 0 0
版本
2.3
创建于
2023-09-03
更新于
2025-04-13
大小
15.3 KB
许可证
MIT
适用于

💖 What it does

On AO3, the order you're adding tags (fandoms, characters, relationships, additional tags) to your work determines the order they show up on your work once you save it. If you think of a tag late and want this to be the first tag, you'd have to delete and re-add all tags. No more!

With this script, each new tag becomes draggable: Once you have added all tags, you can just drag & drop them into the order you want.

an animated GIF showing an example of a New Work form. A relationship tag and two character tags show as fixed, without a handle and a lightly striped background. Two more character tags are 'draggable' and have an icon of three stacked horizontal lines. A mouse pointer grabs onto the icon of the first tag, and drags it across the screen, causing it to reorder behind the second draggable tag.

That is, until you saved your work/draft...

🪴 How to use it

Draggable Tags

Before you save the work or the draft, the tags you enter are "draggable". By default, they'll have an icon of three stacked horizontal lines ≡ as a handle.

Click and hold the icon. The tag will follow your mouse (or finger on mobile) and will slot between the other draggable tags. Drag & drop the tag into the spot you want it to be.

If the configuration is set to not add a handle, you can drag & drop tags by grabbing on anywhere in the tag. However it's pretty easy to accidentally cause the tag to drop back into the input textfield, so I strongly recommend using the handle.

You can preview your work - but if you want to go back to continue changing tags, please use the  ⇦  back button in your browser. Unfortunately AO3 does some weird things that I can't really work around, which means that using the "Edit" button on the Preview page stops the script from working.

Ordering Fixed Tags

Tags which were already saved in a particular order (if you posted your work or saved your draft previously) are fixed in place by AO3 and cannot be re-ordered. Such tags are shown with a striped background, and a mouse-over text tells you that this tag isn't sortable. The only way to re-order fixed tags is to delete them, save the work, and re-add them. While re-adding, you can use the drag & drop feature of this script.

To help with that task, the script adds Copy and Delete buttons to the labels.

  1. Select the Copy button.
  2. A comma-separated list of these tags is now in your clipboard. Paste them in a notepad application somewhere for later.
  3. Select the Delete button to remove all tags under this label.
  4. Repeat steps 1-3 for any label where you need to re-order fixed tags.
  5. "Post" the work/draft. (Post, not Preview!)
  6. Go back to editing the work/draft.
  7. Copy the comma-seperated lists of tags from your notepad into the proper tags textboxes, and press the Enter key.
  8. Now the tags are sortable. Drag & drop them into the order you want.
  9. Post the work/draft again.

🎨 How to configure it

This script does not have a configuration GUI. There are some options within the code at the beginning of the script:

The script recognizes site skins such as Reversi, and adjusts its colors accordingly. But you can also set your own colors:

    /* ********* COLORS CONFIGURATION *************** */
    var fixed_stripe1 = "";
    var fixed_stripe2 = "";
    var sortable_border = "";
    var sortable_fill = "";

This part lets you set the background and border colors of the fixed and sortable tags. Between the quotes, enter a Hex or RGB color, e.g. "#4a1919".

To disable the three stacked horizontal lines ≡ handle (which I don't recommend, btw):

    // enabling the handle for sorting (workaround for touch devices)
    // configurable just in case someone wants to disable it to save space by removing the handle
    var mobile = true;

Switch the true word to false.

🐞 Known limitations

On mobile it is unfortunately a bit fiddly, especially when tags are long and screens are small, and you always have to drag the three stacked horizontal lines ≡ handle.

Using the "Edit" button on the Preview page stops the script from working! You can preview your work - but if you want to go back to continue changing tags, please use the  ⇦  back button in your browser.

🏛️ History

  • v2
    • mobile support
    • improvements to survive a page refresh
  • v1 - drag & drop on desktop browsers