Created
March 9, 2011 16:49
-
-
Save walterdavis/862521 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$$('a[rel^="new_window"]').invoke('observe','click',function(evt){ | |
evt.stop(); | |
var opts = this.rel.split(',').invoke('strip'); | |
opts.shift(); //get rid of new_window | |
var name = 'popup'; | |
opts.each(function(opt,idx){ | |
var pair = opt.split(':').invoke('strip'); | |
if (pair[0] == 'name'){ | |
name = pair[1]; | |
delete opts[idx]; | |
}else{ | |
opts[idx] = pair.join('='); | |
} | |
}); | |
return window.open(this.href,name,opts.join(',') ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment