If I use this: api.replaceIcon('check', 'full-circle-icon');
all the checks of the forum will be replaced by the full-circle…
But I don’t want to replace the icon in the other pages.
How can I modify do that? Thank you for your answer
Not 100% sure it would work because I haven’t tried it, but you can try to get the current page with javascript, check if it’s a review page, then change the icon with your line of code.
I believe there was a JS example somewhere on meta using the API to get the current page we’re on, but I couldn’t find it again.
Or maybe you can just return the current URL to check if you’re on /review.
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.