app/assets/javascripts/your_platform/links_to_external_sites.js.coffee
$(document).on 'click', "a:not(.has_popover):not(.gallery-item)", ->
if this.href? && this.href != "" && !this.href.startsWith("mailto") && !this.href.startsWith("tel")
link_host = this.href.split("/")[2]
document_host = document.location.href.split("/")[2]
unless link_host is document_host
window.open @href
false