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

Rework outbound links and file downloads #2208

Merged
merged 17 commits into from
Sep 29, 2022

Conversation

RobertJoonas
Copy link
Contributor

@RobertJoonas RobertJoonas commented Sep 12, 2022

Changes

  • Refactoring
    • Handlebars helper function to inject code for multiple script extensions at the same time
    • Extracted several functions and improved readability
  • Made the script not prevent default if it has been prevented by an external script (fixes outbound-links script causes media lightboxes to open in new tab #1941)
  • Used callbacks instead of waiting 150ms for the event request to be sent
  • Disallowed sending two events at the same time by only having one click handler
    • If using script.file-downloads.outbound-links.js and clicking an outbound download link, only outbound link click event is sent

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • Docs have been updated

Dark mode

  • This PR does not change the UI

@bundlemon
Copy link

bundlemon bot commented Sep 12, 2022

BundleMon

Unchanged files (7)
Status Path Size Limits
static/css/app.css
515.19KB -
static/js/dashboard.js
295.62KB -
static/js/app.js
12.13KB -
static/js/embed.host.js
5.58KB -
static/js/embed.content.js
5.06KB -
tracker/js/plausible.js
748B -
static/js/applyTheme.js
314B -

No change in files bundle size

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@RobertJoonas RobertJoonas requested review from ukutaht, vinibrsl and a team and removed request for ukutaht and vinibrsl September 12, 2022 11:48
Copy link
Contributor

@ukutaht ukutaht left a comment

Choose a reason for hiding this comment

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

Reviewing this commit-by-commit was a pleasure, good job @RobertJoonas!

The only change I would request is removing the typeof check and doing it with handlebars instead.

@RobertJoonas RobertJoonas force-pushed the rework-outbound-links-and-file-downloads branch from 6778e57 to 7d7eb9a Compare September 13, 2022 14:07
Copy link
Contributor

@vinibrsl vinibrsl left a comment

Choose a reason for hiding this comment

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

Nice work!

@RobertJoonas RobertJoonas force-pushed the rework-outbound-links-and-file-downloads branch from 4ca6c57 to 469d741 Compare September 13, 2022 15:00
@ukutaht ukutaht added the deploy-to-staging Special label that triggers a deploy to a staging environment label Sep 16, 2022
@ukutaht ukutaht merged commit f75d510 into master Sep 29, 2022
@vinibrsl vinibrsl deleted the rework-outbound-links-and-file-downloads branch December 26, 2022 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-to-staging Special label that triggers a deploy to a staging environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

outbound-links script causes media lightboxes to open in new tab
3 participants