Introduce data-doclink attribute for declaring documentation links
Background
Throughout our code there are a bunch of places where we do getDocLink("foo").then((link) => $("#foo").href = link)
. That is except for the first-run page where we are already using the "data-doclink" attribute (example) which is being resolved automatically at runtime (see convertDocLinks()
). Therefore we could simply reuse it for other UIs to avoid such redundant logic in our code.
What to change
Move convertDocLinks()
function from js/first-run.js to common.js in order to automatically resolve documentation links for links with the "data-doclink" attribute.
Hints for testers
- In particular the following links should continue to link to the correct URL, open the respective page in a new tab and look as intended:
- Desktop settings page:
- Contribute button in sidebar
- Learn more link in General tab below "Only allow ads without third-party tracking" option
- Learn more link in Whitelisted websites tab
- Learn more link in Advanced tab below title of Filter lists section
- Social media links in Help tab (including ones only shown to Chinese users)
- First-run page:
- All links
- Issue reporter:
- Link to privacy policy
- Mobile settings page:
- Learn more link next to Acceptable Ads option label
- Updates page:
- App store badges
- Desktop settings page:
- Other links should also be unaffected by this change.
- No error messages should be shown on any UI page.