JavDB-lists-mod

修改Javdb的我的清单的打开方式

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         JavDB-lists-mod
// @namespace    zerobiubiu.top
// @description  修改Javdb的我的清单的打开方式
// @version      1.1
// @author       zerobiubiu
// @license      MIT
// @match        https://javdb.com/users/*lists
// @icon         https://javdb.com/favicon-32x32.png
// ==/UserScript==

(function () {
    'use strict';
    const last = location.pathname
        .split('/')
        .filter(Boolean)
        .at(-1)

    const ul = document.querySelector("#lists > ul")
    const lis = ul.children

    const isListsPage = last === 'lists'

    if (isListsPage) {
        lis[0].style.display = 'none'
    }

    for (let i = isListsPage ? 1 : 0; i < lis.length; i++) {
        const a = lis[i].querySelector("div.column.is-10 > a")
        a.target = "_blank"

        if (isListsPage) {
            const id = new URL(a.href).searchParams.get('id')
            a.href = `/lists/${id}`
        }
    }
})();