Skip to content

Instantly share code, notes, and snippets.

@inwardmovement
Last active February 21, 2020 13:55
Show Gist options
  • Save inwardmovement/899b4a41ced9becbc5c47641056a6394 to your computer and use it in GitHub Desktop.
Save inwardmovement/899b4a41ced9becbc5c47641056a6394 to your computer and use it in GitHub Desktop.
Add external links icon (using JS)
// EXTERNAL LINKS
var links = $(document.links).filter(function() {
return this.hostname !== location.hostname
&& !this.classList.contains('no-external-icon');
});
for (var i = 0; i < links.length; i++) {
links[i].innerHTML += " <svg class=\"bi bi-box-arrow-up-right\" width=\"1em\" height=\"1em\" viewBox=\"0 0 20 20\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" d=\"M3.5 15A1.5 1.5 0 005 16.5h8a1.5 1.5 0 001.5-1.5v-4a.5.5 0 00-1 0v4a.5.5 0 01-.5.5H5a.5.5 0 01-.5-.5V7a.5.5 0 01.5-.5h4a.5.5 0 000-1H5A1.5 1.5 0 003.5 7v8zm7-11a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v5a.5.5 0 01-1 0V4.5H11a.5.5 0 01-.5-.5z\" clip-rule=\"evenodd\"/><path fill-rule=\"evenodd\" d=\"M16.354 3.646a.5.5 0 010 .708l-8 8a.5.5 0 01-.708-.708l8-8a.5.5 0 01.708 0z\" clip-rule=\"evenodd\"/></svg>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment