Created
March 21, 2011 14:03
-
-
Save walterdavis/879485 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'; | |
var defaults = $w('left=25 top=25 width=400 height=300'); | |
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('='); | |
} | |
}); | |
opts = defaults.concat(opts); | |
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