Skip to content

Instantly share code, notes, and snippets.

@eai04191
Forked from owatan/feelcycle-diff-sheet.js
Last active May 14, 2021 12:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eai04191/1a3e406ec343fe876d88627a2ad897d1 to your computer and use it in GitHub Desktop.
Save eai04191/1a3e406ec343fe876d88627a2ad897d1 to your computer and use it in GitHub Desktop.
FEELCYCLE の予約ページで難易度を表示する userscript
// ==UserScript==
// @name feelcycle-diff-sheet.js
// @namespace http://tampermonkey.net/
// @version 0.1
// @description FEELCYCLE の予約ページで難易度を表示する userscript
// @author owatan
// @match https://m.feelcycle.com/reserve
// @icon https://m.feelcycle.com/favicon.png
// @grant none
// @run-at document-idle
// ==/UserScript==
(async function () {
"use strict";
// 1秒待つ
await new Promise((res) => setTimeout(res, 1000));
const ranks = [
{ rank: "rankE", regex: /BB1 10s 1/ },
{ rank: "rankE", regex: /BB1 Hit 11/ },
{ rank: "rankE", regex: /BB1 Comp[24]/ },
{ rank: "rankE", regex: /BB1 Hit [59]/ },
{ rank: "master", regex: /BB3 Regg 1/ },
];
document.querySelectorAll("div.seat-available").forEach((seat) => {
const lessonName = seat
.querySelector("div.lesson_name")
.textContent.trim();
const status = seat.querySelector("div.status");
status.style.visibility = "visible";
const rank = ranks.find((o) => o.regex.test(lessonName))?.rank;
if (!rank) {
console.log("rank not found:", lessonName);
return;
}
const style = (() => {
switch (rank) {
case "rankE":
return { color: "purple", text: "rankE" };
case "master":
return { color: "gold", bg: "black", text: "master" };
default:
return;
}
})();
if (!style) return;
status.textContent = style.text;
status.style.color = style.color;
if ("bg" in style) status.style.backgroundColor = style.bg;
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment