AO3: [Wrangling] Wrangling Navigation Menu

Add a "Wrangling" dropdown menu to the navigation bar

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        AO3: [Wrangling] Wrangling Navigation Menu
// @version     1.0.1
// @description Add a "Wrangling" dropdown menu to the navigation bar
// @author      Rhine
// @namespace   https://github.com/RhineCloud
// @match       https://*.archiveofourown.org/*
// @grant       none
// @license     GPL-3.0 <https://www.gnu.org/licenses/gpl.html>
// ==/UserScript==

(function($) {
    const username = document.getElementById("greeting").querySelector("a").href.split("/").pop();
    const navbar = document.querySelector("ul.primary.navigation.actions li.search");
    
    /* use // at the beginning of each line to toggle whether to include each item or not */
    const wranglingMenuItems = [
        {name: "Wrangling Home", path: `/tag_wranglers/${username}`},
        {name: "Wrangling Tools", path: "/tag_wranglings"},
        {name: "Wranglers", path: "/tag_wranglers"},
        {name: "Search Tags", path: "/tags/search"},
        {name: "New Tag", path: "/tags/new"},
        
        // {name: "Fandoms bin", path: "/tag_wranglings?show=fandoms"},
        {name: "Characters bin", path: "/tag_wranglings?show=characters"},
        {name: "Relationships bin", path: "/tag_wranglings?show=relationships"},
        // {name: "Freeforms bin", path: "/tag_wranglings?show=freeforms"},
        // {name: "Unsorted Tags bin", path: "/unsorted_tags"},

        // {name: "My Inbox", path: `/users/${username}/inbox`}
    ];
    
    const wranglingMenu = document.createElement("li");
    wranglingMenu.className = "dropdown";
    wranglingMenu.innerHTML = `<a class="dropdown-toggle" href="/tag_wranglers/${username}" data-toggle="dropdown" data-target="#">Wrangling</a>
    <ul class="menu dropdown-menu" role="menu">
        ${wranglingMenuItems.map((item) => `<li role="menu-item"><a href="${item.path}">${item.name}</a></li>`).join("")}
    </ul>`;
    
    navbar.before(wranglingMenu);
})();