Greasy Fork

Greasy Fork is available in English.

아프리카TV - 참여 통계 리캡

참여 통계에 스트리머 별 총 시간을 표시합니다

当前为 2024-06-11 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         아프리카TV - 참여 통계 리캡
// @namespace    https://www.afreecatv.com/
// @version      1.0.0
// @description  참여 통계에 스트리머 별 총 시간을 표시합니다
// @author       Jebibot
// @match        *://broadstatistic.afreecatv.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=afreecatv.com
// @grant        unsafeWindow
// @license      MIT
// ==/UserScript==

(function () {
  "use strict";

  const container = document.createElement("div");
  container.id = "recap";
  container.style.height = "100%";
  const chart = document.getElementById("containchart");
  if (chart == null) {
    return;
  }
  chart.parentNode.appendChild(container);

  const oPage = unsafeWindow.oPage;
  const setMultipleChart = oPage.setMultipleChart.bind(oPage);
  oPage.setMultipleChart = (data) => {
    setMultipleChart(data);

    new unsafeWindow.Highcharts.Chart({
      chart: {
        renderTo: "recap",
        width: 900,
        height: Math.max(300, data.data_stack.length * 40),
        zoomType: "xy",
      },
      title: {
        text: null,
      },
      legend: {
        enabled: false,
      },
      xAxis: {
        type: "category",
      },
      yAxis: {
        opposite: true,
        title: {
          text: null,
        },
      },
      plotOptions: {
        series: {
          type: "bar",
          colorByPoint: true,
        },
      },
      tooltip: {
        valueDecimals: 1,
      },
      series: [
        {
          type: "bar",
          name: "시간",
          data: data.data_stack
            .map((t) => [t.bj_nick, t.data.reduce((a, b) => a + b, 0) / 3600])
            .sort((a, b) => {
              if (a[0] === "기타") {
                return 1;
              } else if (b[0] === "기타") {
                return -1;
              } else {
                return b[1] - a[1];
              }
            }),
        },
      ],
    });
  };
})();