Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match-lineup-tweaks not adding faces/specialties for missing players #29

Open
unnecessarydave opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working classic Affects classic view only

Comments

@unnecessarydave
Copy link
Collaborator

Not to be confused with #27 that's a separate issue.

This isn't really so much a bug as a limitation/flaw in the existing code. I do not expect this to be fixed as such, but I am making an issue for it in case I ever have to go back to this topic.

This is relevant for classic pages and legacy live only.

In the lineup details page, match-lineup-tweaks does not display faces or specialties for players who are no longer in the team, but technically it is possible to do this (unless the player has been fired.)

The relevant function calls:

// add async stuff last
if (Foxtrick.Prefs.isModuleOptionEnabled(module, 'ShowSpecialties'))
module.runSpecialties(doc);
if (Foxtrick.Prefs.isModuleOptionEnabled(module, 'ShowFaces'))
module.runFaces(doc);
if (Foxtrick.Prefs.isModuleOptionEnabled(module, 'HighlightMissing'))
module.runMissing(doc);

runMissing functions as expected - if a player on the field is missing from the CHPP PlayerList a little 'missing' icon is added below the player.

runSpecialties actually has code to detect players missing from the CHPP PlayerList and make a CHPP call to get those player's individual data, but this never executes because of a flaw in Player.getPlayer.

Foxtrick.Pages.Player.getPlayer = function(doc, playerId, callback) {
if (Foxtrick.Pages.Player.wasFired(doc))
return;

Foxtrick.Pages.Player.wasFired = function(doc) {
var div = doc.getElementsByClassName('playerInfo')[0];
return typeof div === 'undefined';
};

wasFired only makes sense on a player or playerlist page. On the match or live view this will always return true. If the call to wasFired is removed from getPlayer the specialty icons do indeed appear for 'missing' players.

runFaces simply ignores 'missing' players, but it could be made to work. However CHPP makes this a little awkward as player avatars are retreived at a team level rather than from the individual player. For each missing player it would require two CHPP calls; one to playerdetails to determine the player's team, and then a second to avatars to retreive the player's face. This is a lot of CHPP for such a minor feature.

@unnecessarydave unnecessarydave added bug Something isn't working classic Affects classic view only labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working classic Affects classic view only
Projects
None yet
Development

No branches or pull requests

1 participant