mirror of
https://github.com/misenhower/splatoon2.ink.git
synced 2026-09-12 20:45:25 -05:00
Add automatic region detection
This commit is contained in:
@@ -126,6 +126,7 @@ export default {
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.detectRegion();
|
||||
this.updateNow();
|
||||
this.timer = setInterval(() => {
|
||||
this.updateNow();
|
||||
@@ -141,6 +142,16 @@ export default {
|
||||
axios.get('/data/timeline.json').then(response => this.splatnet.timeline = response.data);
|
||||
axios.get('/data/festivals-na.json').then(response => this.splatnet.festivals.na = response.data);
|
||||
},
|
||||
detectRegion() {
|
||||
if (window.navigator && window.navigator.language) {
|
||||
switch (window.navigator.language) {
|
||||
case 'en-US':
|
||||
case 'en-CA':
|
||||
case 'es-MX':
|
||||
this.selectedRegionKey = 'na';
|
||||
}
|
||||
}
|
||||
},
|
||||
updateNow() {
|
||||
this.now = Math.trunc((new Date).getTime() / 1000);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user