Skip to content

Instantly share code, notes, and snippets.

@kphrx
Forked from owatan/feelcycle-diff-sheet.js
Last active May 14, 2021 12:37
Show Gist options
  • Save kphrx/7021b1ac1367e91a062a1d10de18f552 to your computer and use it in GitHub Desktop.
Save kphrx/7021b1ac1367e91a062a1d10de18f552 to your computer and use it in GitHub Desktop.
FEELCYCLE の予約ページで難易度を表示する userscript
// ==UserScript==
// @name feelcycle-diff-sheet.js
// @namespace http://tampermonkey.net/
// @version 0.3
// @description FEELCYCLE の予約ページで難易度を表示する userscript
// @author owatan
// @match https://m.feelcycle.com/reserve
// @icon https://m.feelcycle.com/favicon.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
const ranks = {
rankF: { color: 'blue', regex: /^BB1 (90s|Comp 1|Hit (1|2|3|4|6|7|8|10))$/ },
rankE: { color: 'purple', regex: /^BB1 (10s 1|Comp(2|4)|Hit (5|9|11))$/ },
rankD: { color: 'deepskyblue', regex: [
/^BB1 (DVGT|Comp3|Hous 1|Queen)$/,
/^BB2 (Comp 4|HH 1|Hous 2|MLN 1|Soul 1|Hit (1|2|3|4|5|6|7|8|9|10|14)|3Y (1|2)|BRJ|MDNA 1|MJ 3|QOP 1)$/,
/^BSB Hit (1|2)$/,
/^BSL Hit (1|2|3)$/,
/^BSW Hit (1|2|3|5)$/,
]},
rankC: { color: 'lime', regex: [
/^BB2 (Comp (1|2|5)|Hous 1|Rock 1|Hit (13|17|20)|JUSTIN|MJ1|MTGX|PTX|RHNA|SUMR 1|Xmas (1|2)|BTLS (1|2))$/,
/^BSB (Comp 1|Hit (3|4))$/,
/^BSW (Soul 1|Hit 6)$/,
]},
rankB: { color: 'red', regex: [
/^BB2 (Comp 3|Avicii|BRMS|GRDY|MJ 2|JONAS|ZEDD|DEEP1|DEEP 2|Regg 1|HH 2|90s 2|Hit (12|15|19))$/,
/^BSB (Hous 1|Rock 1|Hit 7)$/,
/^BSL Hit (7|8)$/,
/^BSW (Comp 1|Regg 1|Rock 1|Hit (4|8))$/,
]},
rankA: { color: 'darkorange', regex: [
/^BB2 (2019|90s 2|HH 2|Hit (11|16|18)|MLN 2|DVGT|FLG|P!NK|QUEEN|Sigala|SUMR 2|Xmas 3|UPGD2|UPGD 1|Regg 2)$/,
/^BSB (DEEP 1|HH 1)$/,
/^BSL (HH 1|DEEP 1|Rock 1|Hit 4)$/,
/^BSWi (Hous2|METAL)$/,
]},
rankS: { color: 'gold', background: 'dark', regex: [
/^BB2 (JAZZ 1|Rock 2|2016|ARGD|BM1|EDM)$/,
/^BSB Hit (5|6)$/,
/^BSL (Hous 1|Hit (5|6))$/,
/^BSW Hit 7$/,
/^BSWi (HH 1|Hous1)$/,
]},
rankSS: { color: 'gold', background: 'dark', regex: [
/^BB2 (Hous 3|METAL 1|2017|2018)$/,
/^BB3 (Hous 2|Hit (2|6))$/,
/^SKRILLEX$/,
]},
rankSSS: { color: 'gold', background: 'dark', regex: [
/^BB3 (HH 1|Hous 1|Rock (1|2)|Hit (1|3|4|5))$/,
/^BSBi Hous 1$/,
]},
master: { color: 'gold', background: 'dark', regex: /^BB3 (HH 2|Hous 3|Regg 1|Soul 1|WORLD 1)$/ },
}
window.addEventListener('load', () => {
document.querySelectorAll('div.seat-available').forEach(function(e){
const status = e.querySelector('div.status');
const lessonName = e.querySelector('div.lesson_name').textContent.trim();
status.style.visibility = 'visible';
for (const [key, value] of Object.entries(ranks)) {
if (Array.isArray(value.regex) && value.regex.filter(regex => regex.test(lessonName)).length <= 0) {
continue;
}
if (!Array.isArray(value.regex) && !value.regex.test(lessonName)) {
continue;
}
status.textContent = key;
status.style.color = value.color;
if (value.background) {
status.style.background = value.background;
}
}
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment