arca.live 채널 구독자순 정렬

아카라이브 채널 페이지 자동 구독자순 정렬

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name         arca.live 채널 구독자순 정렬
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  아카라이브 채널 페이지 자동 구독자순 정렬
// @author       Miug
// @match        https://arca.live/channels
// @icon         https://www.google.com/s2/favicons?sz=64&domain=arca.live
// @grant        none
// @license      MIT
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// ==/UserScript==

/* globals jQuery, $ */

(function() {
    'use strict';

    const getItemSubscribers = (item) => {
        const infoBoxText = $(item).find('.info').text();
        return parseInt(infoBoxText.match(/(\d+)/)[0]);
    };

    const main = () => {
        const boardItems = $('.board-list > .board-item').toArray()
            .sort((a, b) => getItemSubscribers(b) - getItemSubscribers(a));
        $('.board-list').empty();
        $('.board-list').append(boardItems);
    };

    main();
})();