Skip to content

Instantly share code, notes, and snippets.

@nathanaelnsmith
Created January 11, 2013 00:35
Show Gist options
  • Save nathanaelnsmith/4507017 to your computer and use it in GitHub Desktop.
Save nathanaelnsmith/4507017 to your computer and use it in GitHub Desktop.
External Link Speedbump
// external link speedbump
$.expr[":"].external = function (a) {
// DO NOT INCLUDE THE FOLLOWING MATCHES: EMAIL LINKS, TELEPHONE LINKS, HOSTNAME
return !a.href.match(/^mailto\:/) && !a.href.match(/^tel\:/) && a.hostname != location.hostname
};
$('a:external').click(function(e){
e.preventDefault();
href = $(this).attr('href');
$.colorbox({
href: '/_diffs/templates/portal_pop_up-speedbump.html',
fixed: false,
// left: '575px',
top: '350px',
width: '600px',
initialHeight: '295px',
overlayClose: false,
onComplete: function() {
$('button[type=submit]').click(function(){
window.open(href);
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment