MDL-35836 Rewrite doctonewwindow handling to use delegation instead of individual events

This commit is contained in:
Andrew Robert Nicols
2012-10-07 09:55:08 +01:00
parent 7e8ae12a7a
commit afe3566cca
4 changed files with 44 additions and 34 deletions

View File

@@ -1403,6 +1403,42 @@ function hide_item(itemid) {
}
}
M.util.help_popups = {
setup : function(Y) {
Y.one('body').delegate('click', this.open_popup, 'a.helplinkpopup', this);
},
open_popup : function(e) {
// Prevent the default page action
e.preventDefault();
// Grab the anchor that was clicked
var anchor = e.target.ancestor('a', true);
var args = {
'name' : 'popup',
'url' : anchor.getAttribute('href'),
'options' : ''
};
var options = [
'height=600',
'width=800',
'top=0',
'left=0',
'menubar=0',
'location=0',
'scrollbars',
'resizable',
'toolbar',
'status',
'directories=0',
'fullscreen=0',
'dependent'
]
args.options = options.join(',');
openpopup(e, args);
}
}
M.util.help_icon = {
Y : null,
instance : null,