Skip to content

Instantly share code, notes, and snippets.

@hellysmile
Created October 29, 2011 20:45
Show Gist options
  • Save hellysmile/1325073 to your computer and use it in GitHub Desktop.
Save hellysmile/1325073 to your computer and use it in GitHub Desktop.
if((e.which == 2) && (e.target.tagName.toLowerCase() == 'a' || $(e.target).parent()[0].nodeName.toLowerCase() == 'a')) {
var bIE=$.browser.msie,w=window,$o=$(e.target),oe=$o.data('events'),b=true,f=function(){};
if(typeof oe == 'object' && oe['click']) {
f=function() {
$o.trigger('click');
}
}
else {
b=(typeof $o[0].href == 'string' && ($o[0].target == undefined || $o[0].target == '' || $o[0].target == '_self'));
if( b ) {
f=function(){
window.location.href=$o[0].href;
};
}
}
if(!b) {
return;
}
e.stopImmediatePropagation();
e.stopPropagation();
e.preventDefault();
e.returnValue = false;
if(bIE) {
if( !w.__swcp__) {
w.__swcp__= $('<div style="position:fixed;top:0px;left:0px;width:100%;height:100%;background:#000;display:block;z-index:9999;opacity:0.01;filter:alpha(opacity:1);" />').appendTo('body');
}
w.__swcp__.show();
}
setTimeout(f, 50);
if(bIE) {
setTimeout( function() { w.__swcp__.hide(); }, 1000 );
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment