Skip to content

Conversation

@dominiquelee
Copy link

  • Updated link from player page to point to that player page in Portal (this works even if the user does not own the player)
  • Added link to Hattrick's Players page (only for the current user team) to Portal's Your players page

Please note that:

  1. I haven't tested the changes because I'm not sure how to do so. In particular, playerslink does not yet appear in this file (but is referenced in links-players.js), and the ownteamid has very limited examples in this file,
  2. I'm not affiliated in any way to Hattrick Portal and there's AFAIK no ask from their side to do such a change.

- Updated link from player page to point to that player page in Portal (this works even if the user does not own the player)
- Added link to Hattrick's `Players` page (only for the current user team) to Portal's `Your players` page
@unnecessarydave
Copy link
Collaborator

There is a blocking issue for updates to links.json: #14

Once I have resolved that I will merge this PR and also your update to the French tracker that you submitted on minij's repo.

@unnecessarydave unnecessarydave added the blocked Another issue blocks this label Dec 21, 2024
@dominiquelee
Copy link
Author

Hattrick Portal migrated to https://hattrickportal.online this week.

@unnecessarydave unnecessarydave removed the blocked Another issue blocks this label May 22, 2025
Copy link
Collaborator

@unnecessarydave unnecessarydave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filters will only work with an associated filter range, e.g "teamidrange: [[1,100]]". The code in the suggestions should do what you intended, I think.

I appreciate you weren't able to test this, and there's no documentation that I could find for the format of links.json. I'll comment on the PR with some info on how I test links changes.

@unnecessarydave
Copy link
Collaborator

Ok, so it is possible to test links changes, even though Foxtrick pulls links.json fron the CDN rather than the module data files. The key is to 'test in place' rather than doing a build.

On chrome, you can simply 'load unpacked' from the extension manager and point it at the folder where you have your PR branch checked out. You need to click the little reload icon in the extension manager after any code changes.

On Firefox, you' need Mozilla's web-ext command line tool installed, and then 'web-ext run' from the folder where you have your PR branch checked out. The extension reloads automatically after any code changes (ususally).

In both cases, the branch is set to 'dev' and there's a conditional statement that checks for this and loads all CDN content locally rather than from the web.

@dominiquelee
Copy link
Author

Thanks for the review!
Ah, good catch, I see that the allow filters would be aligned with the hattrick-youthclub filters, so that sounds good. I'm not completely sure it needs to be in its own -ownteam section - if we want to ensure it still works for NT teams, we can add an OR filter using the same id logic as Foxtrick.util.id.isNTId.

I'm not that interested in setting up a local dev environment for now, so feel free to apply the changes by yourself. 😛

(and unrelated, very happy to see the PR to switch the CDN location!)

An unintended side effect of this is that the MyMonitor sideBox will appear
on the Players page for NT/U21 teams.
@unnecessarydave unnecessarydave added this to the 0.18.6 milestone Jun 18, 2025
@unnecessarydave
Copy link
Collaborator

Note for Dave of the Future:

Moving the NT players page to the 'national' category is a bit of a hack to get the tracker icon to have the National flag. Code like the following in links-players.js would be more correct, but you won't get the flag that way.

if (Foxtrick.Pages.Players.isNT(doc)) {
	// uses new HT players table so doesn't work on classic pages
	let playersTable = doc.querySelector('#playersTable');
	if (playersTable) {
		let leaguelink = playersTable.querySelector('a.flag');
		if (leaguelink)
			info['leagueId'] = leaguelink.href.match(/LeagueID=(\d+)/)[1];
	}
}

@unnecessarydave unnecessarydave added the approved Approved for release label Jun 30, 2025
@unnecessarydave unnecessarydave merged commit f274b5c into foxtrick-ng:master Jul 8, 2025
unnecessarydave added a commit to unnecessarydave/foxtrick that referenced this pull request Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved for release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants