combine data from previous season
[sc2-widget] / widget.html
index 64f35a252f067397445d576128b16e10c74b478a..26bdd168836cf38547ac14f277a68e7bf195658e 100644 (file)
@@ -13,8 +13,7 @@
 <p id="clan">No clan data</p>
 <script>
        let request = this.location.pathname.split('/')
-       request.splice(2, 1) // strip page name
-       fetch(request.join('/') + '.json')
+       fetch('/schtarr/data/' + request.pop() + '.json')
        .then(res => {
                if (res.status != 200) {
                        console.log('got %o', res)
@@ -25,7 +24,7 @@
        .then(clan => {
                let tiernum = (rank) => rank <= 8 ? 1 : rank <= 25 ? 2 : rank <= 50 ? 3 : 4;
                document.getElementById('clan').outerHTML = `
-                       <h1>${clan.tag}</h1>
+                       <h1>${clan.tag || clan.members[0].name}</h1>
                        <ul class=ladders>
                        ${clan.ladders.map(ladder => `
                                <li class="rank ${ladder.league} tier${tiernum(ladder.rank)}"