You forgot ); at the end of your code, hence the error.
Something like this could work (don’t mind the URI parsing, there’s many ways to do it):
api.onPageChange((url) => {
if (location.pathname.split('/')[1] == "review") {
api.replaceIcon('check', 'full-circle-icon');
}
});
But be aware that onPageChange doesn’t trigger on the first page load. If you open directly yourforum/reviews in your browser, then onPageChange won’t trigger and the icon won’t be replaced.
I don’t know how to trigger the icon change on both the first page load and on a page change though. Maybe there’s an API method for that, but I didn’t find it. ![]()
Plus, once the icon is changed, it will remain changed on other pages as you navigate, so you should revert the icon change if the URL isn’t /review.
In short… I think it requires a bit more work to be fully functional. Note that I’m not exactly an expert in Discourse code or javascript. Maybe someone with more knowledge will be able to help further.
edit: the code doesn’t work when you go to /review the first time, I suppose this is because the page is loaded and the icon isn’t dynamically changed. So, we should find another way to do that. Sorry that I can’t help more with this. ![]()