MyAnimeList Swap Peoples' Name Order

Swaps the name of people on MyAnimeList from the regular "Last Name, First Name" to "First Name Last Name"

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MyAnimeList Swap Peoples' Name Order
// @namespace    https://greasyfork.org/en/users/96096-purple-pinapples
// @version      1.3.0
// @description  Swaps the name of people on MyAnimeList from the regular "Last Name, First Name" to "First Name Last Name"
// @author       PurplePinapples
// @match        https://myanimelist.net/people.php?id=*
// @match        https://myanimelist.net/people/*
// @license      WTFPL
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    const css_selector = "h1 > strong"
    let name = $(css_selector).text();
    let commaIndex = name.indexOf(",");
    if (commaIndex != -1) {
        let swappedName = name.substring(commaIndex + 2) + " " + name.substring(0, commaIndex);
        $(css_selector).html(swappedName);
    }
})();