hanayo/static/js/beatmaps.faace68d.chunk.js

2 lines
7.4 KiB
JavaScript
Raw Normal View History

2019-02-23 20:44:28 +00:00
(window.webpackJsonp = window.webpackJsonp || []).push([[0], { 13: function (e, t, a) { e.exports = a(26) }, 18: function (e, t, a) { }, 21: function (e, t, a) { }, 26: function (e, t, a) { "use strict"; a.r(t); var s = a(0), n = a.n(s), i = a(5), r = a.n(i), c = (a(18), a(6)), l = a(7), o = a(11), u = a(8), m = a(12), d = a(1), h = a(9), f = function (e) { if (e.status >= 200 && e.status < 300) return e; var t = new Error("HTTP Error ".concat(e.statusText)); throw t.status = e.statusText, t.response = e, console.log(t), t }, k = function (e) { return e.json() }, p = { api_beatmaps_request: function (e, t) { return fetch("https://cg.mxr.lol/api/".concat(e), { method: "get", cache: "default" }).then(f).then(k).then(t) } }, b = (a(21), a(10)), v = a.n(b), E = function (e) { function t(e) { var a; return Object(c.a)(this, t), (a = Object(o.a)(this, Object(u.a)(t).call(this, e))).renderDummyData = function () { var e = a.state.beatmaps.map(function (e, t) { var s = e.ChildrenBeatmaps.map(function (e, t) { return n.a.createElement("div", { key: e.BeatmapID, className: "diff2" }, n.a.createElement("div", { className: "faa fal fa-extra-mode-" + a.getGameMode(e.Mode), style: { color: a.getDiffColor(e.DifficultyRating) } })) }); return n.a.createElement("div", { className: "eight wide column", key: e.SetID }, n.a.createElement("div", { className: "map" }, n.a.createElement("div", { className: "map-header" }, n.a.createElement("a", { href: "/b/" + e.ChildrenBeatmaps[e.ChildrenBeatmaps.length - 1].BeatmapID }, n.a.createElement("img", { src: "https://assets.ppy.sh/beatmaps/" + e.ChildrenBeatmaps[0].ParentSetID + "/covers/card.jpg", alt: "" }))), n.a.createElement("div", { className: "status" }, a.getRankStatus(e.RankedStatus)), n.a.createElement("div", { className: "name" }, e.Title.substring(0, 35)), n.a.createElement("div", { className: "artist" }, e.Artist.substring(0, 35)), n.a.createElement("div", { className: "creator" }, "by ", e.Creator), n.a.createElement("a", { title: "Download beatmap", href: "https://storage.yozora.pw/d/" + e.ChildrenBeatmaps[e.ChildrenBeatmaps.length - 1].ParentSetID, className: "download" }, n.a.createElement("i", { className: "download disk icon" })), n.a.createElement("div", { id: "alldiff" }, s))) }); return n.a.createElement("div", { className: "ui stackable two grid", onScrollCapture: a.scrollListener }, e, n.a.createElement(v.a, { onBottom: a.scrollListener })) }, a.state = { offset: 100, count: 22, query: "", mode: 0, loading: !0, status: 1 }, a.renderDummyData.bind(Object(d.a)(Object(d.a)(a))), a.scrollListener = a.scrollListener.bind(Object(d.a)(Object(d.a)(a))), a.reCallApi = a.reCallApi.bind(Object(d.a)(Object(d.a)(a))), a.queryNew = a.queryNew.bind(Object(d.a)(Object(d.a)(a))), a } return Object(m.a)(t, e), Object(l.a)(t, [{ key: "componentDidMount", value: function () { var e = this; p.api_beatmaps_request("search?offset=" + this.state.offset + "&amount=" + this.state.count + "&mode=" + this.state.mode + "&status=" + this.state.status + "&query=" + this.state.query, function (t) { e.setState({ loading: !1, beatmaps: t }) }) } }, { key: "reCallApi", value: function () { var e = this; this.setState({ loading: !0 }), p.api_beatmaps_request("search?offset=" + this.state.offset + "&amount=" + this.state.count + "&mode=" + this.state.mode + "&status=" + this.state.status + "&query=" + this.state.query, function (t) { e.setState({ loading: !1, beatmaps: t }) }) } }, { key: "getDiffColor", value: function (e) { return e <= 1.5 ? "#8AAE17" : e > 1.5 && e <= 2.25 ? "#9AD4DF" : e > 2.25 && e <= 3.75 ? "#DEB32A" : e > 3.75 && e <= 5.25 ? "#EB69A4" : e > 5.25 && e <= 6.75 ? "#7264B5" : "#050505" } }, { key: "getRankStatus", value: function (e) { switch (e) { case 0: return "PENDING"; case 1: return "RANKED"; case 3: return "APPROVED"; case 4: return "Loved"; default: return "UNKNOWN" } } }, { key: "getGameMode", value: function (e) { switch (e) { case 0: return "osu"; case 1: return "taiko"; case 2: return "fruits"; case 3: return "mania"; default: return "osu" } } }, { key: "scrollListener", value:
2019-02-23 20:27:37 +00:00
//# sourceMappingURL=main.faace68d.chunk.js.map