Skip to content

Commit e559fdb

Browse files
Fix team scoping bug and add object picker to matches/group-standings
Revert flag emojis — Regional Indicator Symbol pairs render as letter codes (HR, GH, PA) rather than flag images in SquaredUp's table tile. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7b0873d commit e559fdb

6 files changed

Lines changed: 7 additions & 99 deletions

File tree

plugins/WorldCup2026/v1/dataStreams/scripts/group-standings.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
var games = data.games || [];
22
var teamFilter = context.objects[0] ? [].concat(context.objects[0].teamName)[0] || '' : '';
33

4-
var FLAG = {
5-
'Algeria': '🇩🇿', 'Argentina': '🇦🇷', 'Australia': '🇦🇺', 'Austria': '🇦🇹',
6-
'Belgium': '🇧🇪', 'Bosnia and Herzegovina': '🇧🇦', 'Brazil': '🇧🇷',
7-
'Canada': '🇨🇦', 'Cape Verde': '🇨🇻', 'Colombia': '🇨🇴', 'Croatia': '🇭🇷',
8-
'Curaçao': '🇨🇼', 'Czech Republic': '🇨🇿', 'Democratic Republic of the Congo': '🇨🇩',
9-
'Ecuador': '🇪🇨', 'Egypt': '🇪🇬', 'England': '🏴󠁧󠁢󠁥󠁮󠁧󠁿', 'France': '🇫🇷',
10-
'Germany': '🇩🇪', 'Ghana': '🇬🇭', 'Haiti': '🇭🇹', 'Iran': '🇮🇷', 'Iraq': '🇮🇶',
11-
'Ivory Coast': '🇨🇮', 'Japan': '🇯🇵', 'Jordan': '🇯🇴', 'Mexico': '🇲🇽',
12-
'Morocco': '🇲🇦', 'Netherlands': '🇳🇱', 'New Zealand': '🇳🇿', 'Norway': '🇳🇴',
13-
'Panama': '🇵🇦', 'Paraguay': '🇵🇾', 'Portugal': '🇵🇹', 'Qatar': '🇶🇦',
14-
'Saudi Arabia': '🇸🇦', 'Scotland': '🏴󠁧󠁢󠁳󠁣󠁴󠁿', 'Senegal': '🇸🇳',
15-
'South Africa': '🇿🇦', 'South Korea': '🇰🇷', 'Spain': '🇪🇸', 'Sweden': '🇸🇪',
16-
'Switzerland': '🇨🇭', 'Tunisia': '🇹🇳', 'Turkey': '🇹🇷',
17-
'United States': '🇺🇸', 'Uruguay': '🇺🇾', 'Uzbekistan': '🇺🇿'
18-
};
19-
204
var groupGames = games.filter(function(g) { return g.type === 'group'; });
215

226
var standings = {};
@@ -53,9 +37,8 @@ groupGames.forEach(function(g) {
5337

5438
var rows = Object.keys(standings).map(function(k) {
5539
var s = standings[k];
56-
var flag = FLAG[k] || '';
5740
return {
58-
team: flag ? flag + ' ' + k : k,
41+
team: k,
5942
group: s.group,
6043
mp: s.mp,
6144
w: s.w,

plugins/WorldCup2026/v1/dataStreams/scripts/last-match.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
var games = data.games || [];
22
var teamId = context.objects[0] ? String(context.objects[0].teamId) : '';
33

4-
var FLAG = {
5-
'Algeria': '🇩🇿', 'Argentina': '🇦🇷', 'Australia': '🇦🇺', 'Austria': '🇦🇹',
6-
'Belgium': '🇧🇪', 'Bosnia and Herzegovina': '🇧🇦', 'Brazil': '🇧🇷',
7-
'Canada': '🇨🇦', 'Cape Verde': '🇨🇻', 'Colombia': '🇨🇴', 'Croatia': '🇭🇷',
8-
'Curaçao': '🇨🇼', 'Czech Republic': '🇨🇿', 'Democratic Republic of the Congo': '🇨🇩',
9-
'Ecuador': '🇪🇨', 'Egypt': '🇪🇬', 'England': '🏴󠁧󠁢󠁥󠁮󠁧󠁿', 'France': '🇫🇷',
10-
'Germany': '🇩🇪', 'Ghana': '🇬🇭', 'Haiti': '🇭🇹', 'Iran': '🇮🇷', 'Iraq': '🇮🇶',
11-
'Ivory Coast': '🇨🇮', 'Japan': '🇯🇵', 'Jordan': '🇯🇴', 'Mexico': '🇲🇽',
12-
'Morocco': '🇲🇦', 'Netherlands': '🇳🇱', 'New Zealand': '🇳🇿', 'Norway': '🇳🇴',
13-
'Panama': '🇵🇦', 'Paraguay': '🇵🇾', 'Portugal': '🇵🇹', 'Qatar': '🇶🇦',
14-
'Saudi Arabia': '🇸🇦', 'Scotland': '🏴󠁧󠁢󠁳󠁣󠁴󠁿', 'Senegal': '🇸🇳',
15-
'South Africa': '🇿🇦', 'South Korea': '🇰🇷', 'Spain': '🇪🇸', 'Sweden': '🇸🇪',
16-
'Switzerland': '🇨🇭', 'Tunisia': '🇹🇳', 'Turkey': '🇹🇷',
17-
'United States': '🇺🇸', 'Uruguay': '🇺🇾', 'Uzbekistan': '🇺🇿'
18-
};
19-
204
var stageMap = {
215
group: 'Group Stage',
226
r32: 'Round of 32',
@@ -54,12 +38,11 @@ if (played.length === 0) {
5438
var oppScore = parseInt(isHome ? last.away_score : last.home_score, 10);
5539
var scoreStr = isHome ? last.home_score + '-' + last.away_score : last.away_score + '-' + last.home_score;
5640
var matchResult = myScore > oppScore ? 'Win' : myScore < oppScore ? 'Loss' : 'Draw';
57-
var opFlag = FLAG[opponent] || '';
5841

5942
result = [{
6043
date: last.local_date,
6144
home_away: isHome ? 'Home' : 'Away',
62-
opponent: opFlag ? opFlag + ' ' + opponent : opponent,
45+
opponent: opponent,
6346
score: scoreStr,
6447
result: matchResult,
6548
stage: stageMap[last.type] || last.type,

plugins/WorldCup2026/v1/dataStreams/scripts/matches.js

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
var games = data.games || [];
22
var teamId = context.objects[0] ? String(context.objects[0].teamId) : '';
33

4-
var FLAG = {
5-
'Algeria': '🇩🇿', 'Argentina': '🇦🇷', 'Australia': '🇦🇺', 'Austria': '🇦🇹',
6-
'Belgium': '🇧🇪', 'Bosnia and Herzegovina': '🇧🇦', 'Brazil': '🇧🇷',
7-
'Canada': '🇨🇦', 'Cape Verde': '🇨🇻', 'Colombia': '🇨🇴', 'Croatia': '🇭🇷',
8-
'Curaçao': '🇨🇼', 'Czech Republic': '🇨🇿', 'Democratic Republic of the Congo': '🇨🇩',
9-
'Ecuador': '🇪🇨', 'Egypt': '🇪🇬', 'England': '🏴󠁧󠁢󠁥󠁮󠁧󠁿', 'France': '🇫🇷',
10-
'Germany': '🇩🇪', 'Ghana': '🇬🇭', 'Haiti': '🇭🇹', 'Iran': '🇮🇷', 'Iraq': '🇮🇶',
11-
'Ivory Coast': '🇨🇮', 'Japan': '🇯🇵', 'Jordan': '🇯🇴', 'Mexico': '🇲🇽',
12-
'Morocco': '🇲🇦', 'Netherlands': '🇳🇱', 'New Zealand': '🇳🇿', 'Norway': '🇳🇴',
13-
'Panama': '🇵🇦', 'Paraguay': '🇵🇾', 'Portugal': '🇵🇹', 'Qatar': '🇶🇦',
14-
'Saudi Arabia': '🇸🇦', 'Scotland': '🏴󠁧󠁢󠁳󠁣󠁴󠁿', 'Senegal': '🇸🇳',
15-
'South Africa': '🇿🇦', 'South Korea': '🇰🇷', 'Spain': '🇪🇸', 'Sweden': '🇸🇪',
16-
'Switzerland': '🇨🇭', 'Tunisia': '🇹🇳', 'Turkey': '🇹🇷',
17-
'United States': '🇺🇸', 'Uruguay': '🇺🇾', 'Uzbekistan': '🇺🇿'
18-
};
19-
204
var stageMap = {
215
group: 'Group Stage',
226
r32: 'Round of 32',
@@ -33,20 +17,11 @@ function parseDate(d) {
3317
return new Date(dateParts[2] + '-' + dateParts[0] + '-' + dateParts[1] + 'T' + parts[1] + ':00');
3418
}
3519

36-
function withFlag(name) {
37-
if (!name) return name;
38-
var flag = FLAG[name];
39-
return flag ? flag + ' ' + name : name;
40-
}
41-
4220
function getTeamName(game, side) {
43-
var name;
4421
if (side === 'home') {
45-
name = game.home_team_id !== '0' ? game.home_team_name_en : (game.home_team_label || 'TBD');
46-
} else {
47-
name = game.away_team_id !== '0' ? game.away_team_name_en : (game.away_team_label || 'TBD');
22+
return game.home_team_id !== '0' ? game.home_team_name_en : (game.home_team_label || 'TBD');
4823
}
49-
return withFlag(name);
24+
return game.away_team_id !== '0' ? game.away_team_name_en : (game.away_team_label || 'TBD');
5025
}
5126

5227
var filtered = games.filter(function(g) {

plugins/WorldCup2026/v1/dataStreams/scripts/next-match.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
var games = data.games || [];
22
var teamId = context.objects[0] ? String(context.objects[0].teamId) : '';
33

4-
var FLAG = {
5-
'Algeria': '🇩🇿', 'Argentina': '🇦🇷', 'Australia': '🇦🇺', 'Austria': '🇦🇹',
6-
'Belgium': '🇧🇪', 'Bosnia and Herzegovina': '🇧🇦', 'Brazil': '🇧🇷',
7-
'Canada': '🇨🇦', 'Cape Verde': '🇨🇻', 'Colombia': '🇨🇴', 'Croatia': '🇭🇷',
8-
'Curaçao': '🇨🇼', 'Czech Republic': '🇨🇿', 'Democratic Republic of the Congo': '🇨🇩',
9-
'Ecuador': '🇪🇨', 'Egypt': '🇪🇬', 'England': '🏴󠁧󠁢󠁥󠁮󠁧󠁿', 'France': '🇫🇷',
10-
'Germany': '🇩🇪', 'Ghana': '🇬🇭', 'Haiti': '🇭🇹', 'Iran': '🇮🇷', 'Iraq': '🇮🇶',
11-
'Ivory Coast': '🇨🇮', 'Japan': '🇯🇵', 'Jordan': '🇯🇴', 'Mexico': '🇲🇽',
12-
'Morocco': '🇲🇦', 'Netherlands': '🇳🇱', 'New Zealand': '🇳🇿', 'Norway': '🇳🇴',
13-
'Panama': '🇵🇦', 'Paraguay': '🇵🇾', 'Portugal': '🇵🇹', 'Qatar': '🇶🇦',
14-
'Saudi Arabia': '🇸🇦', 'Scotland': '🏴󠁧󠁢󠁳󠁣󠁴󠁿', 'Senegal': '🇸🇳',
15-
'South Africa': '🇿🇦', 'South Korea': '🇰🇷', 'Spain': '🇪🇸', 'Sweden': '🇸🇪',
16-
'Switzerland': '🇨🇭', 'Tunisia': '🇹🇳', 'Turkey': '🇹🇷',
17-
'United States': '🇺🇸', 'Uruguay': '🇺🇾', 'Uzbekistan': '🇺🇿'
18-
};
19-
204
var stageMap = {
215
group: 'Group Stage',
226
r32: 'Round of 32',
@@ -56,11 +40,10 @@ if (upcoming.length === 0) {
5640
if (!opponent || opponent === 'undefined') {
5741
opponent = isHome ? (next.away_team_label || 'TBD') : (next.home_team_label || 'TBD');
5842
}
59-
var opFlag = FLAG[opponent] || '';
6043
result = [{
6144
date: next.local_date,
6245
home_away: isHome ? 'Home' : 'Away',
63-
opponent: opFlag ? opFlag + ' ' + opponent : opponent,
46+
opponent: opponent,
6447
stage: stageMap[next.type] || next.type,
6548
group: next.type === 'group' ? 'Group ' + next.group : '',
6649
sourceId: sourceId
Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
11
var games = data.games || [];
22
var teamId = context.objects[0] ? String([].concat(context.objects[0].teamId)[0] || '') : '';
33
var teamName = context.objects[0] ? [].concat(context.objects[0].teamName)[0] || '' : '';
4-
var iso2Raw = context.objects[0] ? [].concat(context.objects[0].iso2)[0] || '' : '';
54
var group = context.objects[0] ? [].concat(context.objects[0].group)[0] || '' : '';
65

7-
function flagFromIso2(code) {
8-
if (!code) return '';
9-
if (code === 'ENG') return '🏴󠁧󠁢󠁥󠁮󠁧󠁿';
10-
if (code === 'SCO') return '🏴󠁧󠁢󠁳󠁣󠁴󠁿';
11-
if (code.length === 2) {
12-
return code.toUpperCase().split('').map(function(c) {
13-
return String.fromCodePoint(c.charCodeAt(0) + 127397);
14-
}).join('');
15-
}
16-
return '';
17-
}
18-
19-
var flag = flagFromIso2(iso2Raw);
20-
var country = flag ? flag + ' ' + teamName : teamName;
21-
226
var groupGames = games.filter(function(g) {
237
return g.type === 'group' &&
248
(g.home_team_id === teamId || g.away_team_id === teamId);
@@ -43,4 +27,4 @@ var pts = (w * 3) + d;
4327
var gd = gf - ga;
4428

4529
var sourceId = context.objects[0] ? context.objects[0].sourceId : '';
46-
result = [{ country: country, group: group, mp: mp, w: w, d: d, l: l, pts: pts, gf: gf, ga: ga, gd: gd, sourceId: sourceId }];
30+
result = [{ country: teamName, group: group, mp: mp, w: w, d: d, l: l, pts: pts, gf: gf, ga: ga, gd: gd, sourceId: sourceId }];

plugins/WorldCup2026/v1/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "worldcup2026",
33
"displayName": "FIFA World Cup 2026",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"author": {
66
"name": "@TimWheeler-SQUP",
77
"type": "community"

0 commit comments

Comments
 (0)