From 3f5ba250342c57b0334c1e8dcfd499d8a75926a9 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 9 Nov 2017 10:03:10 -0800 Subject: [PATCH] Update the site to use Salmon Run schedule data from SplatNet --- src/css/main.scss | 10 ------ src/img/salmon-run-random-weapon.png | Bin 0 -> 1470 bytes src/js/components/App.vue | 30 +++++++++--------- .../screenshots/ScreenshotHelper.vue | 13 +++----- .../screenshots/salmonrun/SalmonRun.vue | 19 +++++------ src/js/components/splatoon/SalmonRunBox.vue | 25 +++++---------- .../splatoon/SalmonRunDetailsBar.vue | 3 +- src/js/splatoonStages.js | 17 ---------- src/updater/twitter/SalmonRunTweet.js | 17 ++++------ 9 files changed, 47 insertions(+), 87 deletions(-) create mode 100644 src/img/salmon-run-random-weapon.png diff --git a/src/css/main.scss b/src/css/main.scss index ca231bd..57955b9 100644 --- a/src/css/main.scss +++ b/src/css/main.scss @@ -198,16 +198,6 @@ body.has-modal #main { transform: scale(1.2); } } - - .calendar-attribution { - background: rgba(0,0,0,0.5); - font-family: $family-sans-serif; - font-size: 0.7rem; - padding: 2px 20px; - a { - color: mix($green, $white-ter, 25%); - } - } } .splatfest { diff --git a/src/img/salmon-run-random-weapon.png b/src/img/salmon-run-random-weapon.png new file mode 100644 index 0000000000000000000000000000000000000000..04eee67de3bb87a136268eb643f521fe018acabe GIT binary patch literal 1470 zcmYLI2~bm46n%*p5exu#{kvDXVkZRic5};$YBkEu=)A4^6G&|ECVR^#9?f{6U1aKh~mi$+Bl?GPL17|~E z_5l|nYHSi~3hL|+$Rj)#t32u=q9b0YMoAi$ILG+-3| zuT~pvPy7oggGm6zJmi7CctFO3vLLX^4HBXQLX3q+Q2}xWh*|`?d2nmC_l5C9V6aE@ zBG}j20o><+seQ1co&!(zZvuCtr{%#yyH4mNPU|$GEl_#(xzMbb42<^KQD)TAC_u-B zN+@`^ZKFd}u7w!q4d&s1F%Ih2^FWp#_}mR%$o;74Yq@|99t&^aNi5I_K~)I2fdKkK z;5i$hY9HHW&%#0~bR4v`DGrW_-moDWavJ&Y)u0SU9+YH=fim<__L2GVBa<7@!kSzG zR|sT#Ykxh;SJqXZJ2JF0UzJ>0lbNDQ)NFXt*f^-!vynY?dtk;p$wiIkeTUw{34DyZ zM`}G8wfgCadd%Uiqr>BrpZ?-`g)QCNRr~IFOW$n^!pYsw9=`YXS{OaRwDYR1?#5f} z9f5-Ix(>7OSUhViqayTWjmyZxvZD5s9(+U#*P(E1M`x2rPV2p;csJ>7sV0(azrX0X z`SHX0>(nx*Vf1^&UW{Z$#BJ>x(@S!U3<7R*h`eQ&$6#$&R~M%Wny(}^Ys`<6k~_8K zO2%kUlQK`1#q$o^L;rKMDkbSmCW&1cC@%Fj8%EYGJvGv1wKa{>Z1-wZw`}ximqxEP z16in!siv;5_zK*1Rc0xBe^ESmP1x5#c(lH#fcUES`<0#bJ)ev%`JshW{pjP0+s?8H z&$*f<{n`aO&H0Kcb#JSGXwZ1^H&NOX$&-b(0{(D2vEi8da9K84{@q*xkR4)INlP#% zODFcvkn38ni3@Y*<2pPn1q4T0=NNB}{M2GfNI3=Ep^7QyzMt{qZ)84s7?)V>;!EFt zsk%}Vqe$nvYG)NinJ2a}@Bgb*cR{zF~3eUQC4nG3SJRU{P4!7y>2y@F{ec< zHc|&Z=vv+KDylSZ)4|H8Qi9`9bZK}=$OEyJ$$GXyrTQYjZ9aP$z5LKIN^QPoKyPq; z-nk=nZTJ#JIkRuERUP51R*785=+ YcbmK1U(@4y9{!P$EH1NQ&E|uD1I^$vYybcN literal 0 HcmV?d00001 diff --git a/src/js/components/App.vue b/src/js/components/App.vue index c6e55f3..a4edd58 100644 --- a/src/js/components/App.vue +++ b/src/js/components/App.vue @@ -88,10 +88,10 @@ -
+
- +
@@ -177,11 +177,11 @@ export default { now: null, splatnet: { schedules: null, + coopSchedules: null, timeline: null, merchandises: null, festivals: null, }, - salmonruncalendar: null, aboutOpen: false, splatNetGearOpen: false, }; @@ -229,11 +229,11 @@ export default { if (this.splatnet.timeline && this.splatnet.timeline.coop && this.splatnet.timeline.coop.schedule.end_time > this.now) return this.splatnet.timeline.coop; }, - coopCalendar() { - if (this.salmonruncalendar) { - let schedules = this.salmonruncalendar.schedules.filter(this.filterEndTime); - if (schedules.length > 0) - return schedules; + coopSchedules() { + if (this.splatnet.coopSchedules) { + let details = this.splatnet.coopSchedules.details.filter(this.filterEndTime); + let schedules = this.splatnet.coopSchedules.schedules.filter(this.filterEndTime); + return { details, schedules }; } }, @@ -257,7 +257,7 @@ export default { // Other bottomRowHasThreeColumns() { - return this.selectedFestival && !this.isSelectedFestivalActive && (this.coop || this.coopCalendar) && this.newWeapons; + return this.selectedFestival && !this.isSelectedFestivalActive && (this.coop || this.coopSchedules) && this.newWeapons; }, }, created() { @@ -306,7 +306,12 @@ export default { .then(response => this.splatnet.schedules = response.data) .catch(e => console.error(e)); - // Co-op (Salmon Run) data + // Co-op schedules + axios.get('/data/coop-schedules.json') + .then(response => this.splatnet.coopSchedules = response.data) + .catch(e => console.error(e)); + + // Timeline data (Salmon Run weapon of the month and new weapon availability) axios.get('/data/timeline.json') .then(response => this.splatnet.timeline = response.data) .catch(e => console.error(e)); @@ -320,11 +325,6 @@ export default { axios.get('/data/merchandises.json') .then(response => this.splatnet.merchandises = response.data) .catch(e => console.error(e)); - - // Salmon Run calendar data (upcoming Salmon Run schedules) - axios.get('/data/salmonruncalendar.json') - .then(response => this.salmonruncalendar = response.data) - .catch(e => console.error(e)); }, updateNow() { this.now = Math.trunc((new Date).getTime() / 1000); diff --git a/src/js/components/screenshots/ScreenshotHelper.vue b/src/js/components/screenshots/ScreenshotHelper.vue index 461fd20..7fe0d16 100644 --- a/src/js/components/screenshots/ScreenshotHelper.vue +++ b/src/js/components/screenshots/ScreenshotHelper.vue @@ -57,9 +57,9 @@ export default { data() { return { schedules: null, + coopSchedules: null, merchandises: null, timeline: null, - salmonruncalendar: null, festivals: null, }; }, @@ -79,11 +79,8 @@ export default { return this.merchandises[this.merchandises.length - 1]; }, latestSalmonRun() { - if (this.salmonruncalendar) - return this.salmonruncalendar.schedules[0]; - - if (this.timeline && this.timeline.coop) - return this.timeline.coop; + if (this.coopSchedules) + return this.coopSchedules.details[0]; }, newWeaponAvailability() { if (this.timeline && this.timeline.weapon_availability && this.timeline.weapon_availability.availabilities) { @@ -108,12 +105,12 @@ export default { created() { axios.get('data/schedules.json') .then(response => this.schedules = response.data); + axios.get('data/coop-schedules.json') + .then(response => this.coopSchedules = response.data); axios.get('data/merchandises.json') .then(response => this.merchandises = response.data.merchandises); axios.get('data/timeline.json') .then(response => this.timeline = response.data); - axios.get('data/salmonruncalendar.json') - .then(response => this.salmonruncalendar = response.data); axios.get('data/festivals.json') .then(response => this.festivals = response.data); }, diff --git a/src/js/components/screenshots/salmonrun/SalmonRun.vue b/src/js/components/screenshots/salmonrun/SalmonRun.vue index f7ff34f..89028a5 100644 --- a/src/js/components/screenshots/salmonrun/SalmonRun.vue +++ b/src/js/components/screenshots/salmonrun/SalmonRun.vue @@ -3,8 +3,9 @@
@@ -23,8 +24,8 @@ export default { props: ['startTime'], data() { return { + coopSchedules: null, timeline: null, - salmonruncalendar: null, }; }, computed: { @@ -35,19 +36,19 @@ export default { if (this.timeline && this.timeline.coop && this.timeline.coop.schedule.end_time > this.now) return this.timeline.coop; }, - coopCalendar() { - if (this.salmonruncalendar) { - let schedules = this.salmonruncalendar.schedules.filter(s => s.start_time == this.now); - if (schedules.length > 0) - return schedules; + coopSchedules() { + if (this.coopSchedules) { + let details = this.splatnet.coopSchedules.details.filter(s => s.start_time == this.now); + let schedules = this.splatnet.coopSchedules.schedules.filter(s => s.start_time == this.now); + return { details, schedules }; } }, }, created() { + axios.get('data/coop-schedules.json') + .then(response => this.coopSchedules = response.data) axios.get('data/timeline.json') .then(response => this.timeline = response.data) - axios.get('data/salmonruncalendar.json') - .then(response => this.salmonruncalendar = response.data) }, } diff --git a/src/js/components/splatoon/SalmonRunBox.vue b/src/js/components/splatoon/SalmonRunBox.vue index 892911d..fa46eab 100644 --- a/src/js/components/splatoon/SalmonRunBox.vue +++ b/src/js/components/splatoon/SalmonRunBox.vue @@ -90,11 +90,6 @@
- -
- Salmon Run schedule courtesy of - thejellydude -
@@ -112,7 +107,7 @@ import SalmonRunGearDialog from './SalmonRunGearDialog.vue'; export default { components: { SalmonRunDetailsBar, SalmonRunGearDialog }, - props: ['coop', 'coopCalendar', 'now', 'screenshotMode'], + props: ['coop', 'coopSchedules', 'now', 'screenshotMode'], data() { return { gearDialogOpen: false, @@ -120,17 +115,16 @@ export default { }, computed: { allSchedules() { + // Combine the "schedules" and "details" sections into one list of schedules let results = {}; - // "Official" schedule from SplatNet - if (this.coop && this.coop.schedule.end_time > this.now) - results[this.coop.schedule.start_time] = this.coop.schedule; + // Add the less-detailed schedules in first + for (let schedule of this.coopSchedules.schedules) + results[schedule.start_time] = schedule; - // Other schedules - if (this.coopCalendar) { - for (let schedule of this.coopCalendar) - results[schedule.start_time] = schedule; - } + // Add/replace the schedules that have map/weapon details + for (let schedule of this.coopSchedules.details) + results[schedule.start_time] = schedule; return Object.values(results).sort((a, b) => { return a.start_time - b.start_time }); }, @@ -139,9 +133,6 @@ export default { if (this.allSchedules.length > 0 && this.allSchedules[0].start_time <= this.now) return this.allSchedules[0]; }, - showSourceBar() { - return this.upcomingSchedules && this.upcomingSchedules.find(s => s.source == 'thejellydude'); - }, }, } diff --git a/src/js/components/splatoon/SalmonRunDetailsBar.vue b/src/js/components/splatoon/SalmonRunDetailsBar.vue index 6666dad..4a405cb 100644 --- a/src/js/components/splatoon/SalmonRunDetailsBar.vue +++ b/src/js/components/splatoon/SalmonRunDetailsBar.vue @@ -15,7 +15,8 @@
- + +
diff --git a/src/js/splatoonStages.js b/src/js/splatoonStages.js index 40c0335..aaffd90 100644 --- a/src/js/splatoonStages.js +++ b/src/js/splatoonStages.js @@ -47,21 +47,4 @@ export default [ image: '/images/stage/96fd8c0492331a30e60a217c94fd1d4c73a966cc.png', largeImage: require('@/img/stages/turf-wars-stage-8_2x.jpg'), }, - - // Salmon Run stages with fake IDs for tracking purposes - { - id: '999901', - name: 'Spawning Grounds', - image: require('@/img/stages/turf-wars-stage-5_2x.jpg'), - }, - { - id: '999902', - name: 'Marooner\'s Bay', - image: require('@/img/stages/marooners-bay.jpg'), - }, - { - id: '999903', - name: 'Lost Outpost', - image: require('@/img/stages/lost-outpost.jpg'), - }, ] diff --git a/src/updater/twitter/SalmonRunTweet.js b/src/updater/twitter/SalmonRunTweet.js index ef3d02d..861d2f5 100644 --- a/src/updater/twitter/SalmonRunTweet.js +++ b/src/updater/twitter/SalmonRunTweet.js @@ -7,19 +7,16 @@ class SalmonRunTweet extends TwitterPostBase { getName() { return 'Salmon Run'; } getSalmonRunSchedules() { - let schedules = {}; + let results = {}; + let coopSchedules = readData('coop-schedules.json'); - let timeline = readData('timeline.json').coop; - if (timeline) - schedules[timeline.start_time] = timeline; + for (let schedule of coopSchedules.schedules) + results[schedule.start_time] = schedule; - let calendar = readData('salmonruncalendar.json').schedules; - if (calendar) { - for (let schedule of calendar) - schedules[schedule.start_time] = schedule; - } + for (let schedule of coopSchedules.details) + results[schedule.start_time] = schedule; - return Object.values(schedules); + return Object.values(results); } getData() {