.bind -> .on, .unbind -> .off

This commit is contained in:
rolux 2012-05-28 16:06:22 +02:00
parent f45f993f42
commit 461a237880
22 changed files with 54 additions and 54 deletions

View file

@ -175,7 +175,7 @@ Ox.load(function() {
} else if (!url.page) {
app.$ui.logo
.css({cursor: 'pointer'})
.bind({
.on({
click: app.toggle
});
['label', 'menu', 'switch'].forEach(function(element) {
@ -201,7 +201,7 @@ Ox.load(function() {
.animate({opacity: 1}, 500, function() {
app.$ui.logo
.css({cursor: 'pointer'})
.bind({
.on({
click: app.toggle
});
});
@ -210,7 +210,7 @@ Ox.load(function() {
}, 500);
});
}
Ox.$window.bind({
Ox.$window.on({
hashchange: app.urlchange
});
app.state.loaded = true;
@ -241,7 +241,7 @@ Ox.load(function() {
callback();
}
});
Ox.$(window).bind({
Ox.$(window).on({
resize: app.resize
});
},
@ -407,7 +407,7 @@ Ox.load(function() {
paddingBottom: '4px',
borderRadius: '6px'
})
.bind({
.on({
click: app.toggle
});
},
@ -491,7 +491,7 @@ Ox.load(function() {
.css({
width: 224 - Ox.UI.SCROLLBAR_SIZE + 'px'
})
.bind({
.on({
click: function(e) {
if (!$(this).is('.selected')) {
selectItem(item.id);

View file

@ -105,7 +105,7 @@ Ox.load.UI = function(options, callback) {
width: '32px',
height: '32px'
}, css))
.bind({
.on({
mousedown: function(e) {
e.preventDefault();
}
@ -125,7 +125,7 @@ Ox.load.UI = function(options, callback) {
width: '32px',
height: '32px'
}, css))
.bind({
.on({
mousedown: function(e) {
e.preventDefault()
}
@ -191,7 +191,7 @@ Ox.load.UI = function(options, callback) {
border: 0,
cursor: 'pointer'
}, css))
.bind({
.on({
mousedown: function(e) {
e.preventDefault();
}
@ -269,7 +269,7 @@ Ox.load.UI = function(options, callback) {
Ox.$head = Ox.UI.$head = $('head');
Ox.$window = Ox.UI.$window = $(window);
// fixme: is this the right place to do this?
$.browser.mozilla && Ox.$document.bind('dragstart', function() {
$.browser.mozilla && Ox.$document.on('dragstart', function() {
return false;
});
callbacks.forEach(function(callback) {

View file

@ -47,8 +47,9 @@ Ox.Resizebar = function(options, self) {
.append($('<div>').addClass('OxSpace'));
if (self.options.tooltip) {
// FIXME: Use Ox.Element's tooltip
self.$tooltip = Ox.Tooltip({title: getTitle()});
that.bind({
that.on({
mouseenter: self.$tooltip.show,
mouseleave: self.$tooltip.hide
});

View file

@ -357,7 +357,7 @@ Ox.Calendar = function(options, self) {
top: (self.options.showToolbar * 24) + 16 + 'px',
bottom: (self.options.showZoombar * 16) + 16 + 'px'
})
.bind({
.on({
mouseleave: mouseleave,
mousemove: mousemove,
mousewheel: mousewheel

View file

@ -179,7 +179,7 @@ Ox.ExamplePage = function(options, self) {
!self.hasUI && self.$switchButton.options({disabled: true});
});
Ox.$window.bind({
Ox.$window.on({
resize: function() {
setSize();
}

View file

@ -23,7 +23,7 @@ Ox.Event = (function() {
that.bind = function() {
Ox.forEach(Ox.makeObject(arguments), function(callback, event) {
var foo = event;
self.$eventHandler.bind('ox_' + event, function(event, data) {
self.$eventHandler.on('ox_' + event, function(event, data) {
Ox.Log('Core', 'CALLBACK', foo, data.value);
callback(data.value);
});
@ -82,10 +82,10 @@ Ox.Event = (function() {
@*/
that.unbind = function() {
if (arguments.length == 0) {
self.$eventHandler.unbind();
self.$eventHandler.off();
} else {
Ox.toArray(arguments).forEach(function(event) {
self.$eventHandler.unbind('ox_' + event);
self.$eventHandler.off('ox_' + event);
});
}
return that;

View file

@ -80,7 +80,7 @@ Ox.ArrayInput = function(options, self) {
type: 'image'
})
.css({float: 'left', marginLeft: '8px'})
.bind({
.on({
click: function() {
var index = $(this).parent().data('index');
if (self.$input[index].value() !== '') {
@ -104,7 +104,7 @@ Ox.ArrayInput = function(options, self) {
type: 'image'
})
.css({float: 'left', marginLeft: '8px'})
.bind({
.on({
click: function() {
var index = $(this).parent().data('index');
addInput(index + 1, '', true);

View file

@ -35,7 +35,7 @@ Ox.Editable = function(options, self) {
})
.options(options || {})
.addClass('OxEditableElement' + (self.options.editable ? ' OxEditable' : ''))
.bind({
.on({
click: function() {
return false;
}

View file

@ -92,7 +92,7 @@ Ox.FileButton = function(options, self) {
marginLeft: -self.options.width + 'px',
opacity: 0
})
.bind({
.on({
change: selectFiles
})
.appendTo(that);

View file

@ -277,7 +277,7 @@ Ox.FileInput = function(options, self) {
margin: '-1px -7px 0 -16px',
opacity: 0
})
.bind({
.on({
change: addFiles
})
.appendTo(self.$bar);

View file

@ -596,7 +596,7 @@ Ox.Input = function(options, self) {
self.options.autovalidate && autovalidate(true);
self.options.placeholder && setPlaceholder();
self.options.validate && validate();
self.bindKeyboard && Ox.UI.$document.unbind('keydown', keydown);
self.bindKeyboard && Ox.UI.$document.off('keydown', keydown);
if (!self.cancelled && !self.submitted) {
that.triggerEvent('blur', {
value: self.options.value

View file

@ -77,7 +77,7 @@ Ox.ObjectArrayInput = function(options, self) {
width: self.buttonWidth
})
.css({float: 'left', margin: '8px 4px 0 0'})
.bind({
.on({
click: function() {
var index = $(this).parent().data('index');
if (self.$input.length > 1) {
@ -97,7 +97,7 @@ Ox.ObjectArrayInput = function(options, self) {
width: self.buttonWidth
})
.css({float: 'left', margin: '8px 0 0 4px'})
.bind({
.on({
click: function() {
var index = $(this).parent().data('index');
addInput(index + 1, getDefaultValue());

View file

@ -92,7 +92,7 @@ Ox.PlacePicker = function(options, self) {
}, self)
.bindEvent('show', showPicker);
that.$label.bind('click', clickLabel);
that.$label.on('click', clickLabel);
self.map = false;

View file

@ -868,7 +868,7 @@ Ox.TextList = function(options, self) {
value: column.unformat ? column.unformat(html) : html,
width: width
})
.bind({
.on({
mousedown: function(e) {
// keep mousedown from reaching list
e.stopPropagation();

View file

@ -49,7 +49,7 @@ Ox.Menu = function(options, self) {
'OxMenu Ox' + Ox.toTitleCase(self.options.side) +
' Ox' + Ox.toTitleCase(self.options.size)
)
.bind({
.on({
click: click,
mouseenter: mouseenter,
mouseleave: mouseleave,

View file

@ -29,7 +29,7 @@ Ox.BlockVideoTimeline = function(options, self) {
.css({
position: 'absolute'
})
.bind({
.on({
mousedown: mousedown,
mouseleave: mouseleave,
mousemove: mousemove

View file

@ -94,7 +94,7 @@ Ox.VideoElement = function(options, self) {
}
return $('<video>')
.css({position: 'absolute'})
.bind({
.on({
ended: function() {
if (i < item.parts - 1) {
setCurrentPart(self.currentPart + 1);

View file

@ -146,7 +146,7 @@ Ox.VideoPlayer = function(options, self) {
Ox.Log('VIDEO', 'VIDEO PLAYER OPTIONS', self.options)
Ox.UI.$window.bind({
Ox.UI.$window.on({
resize: function() {
self.options.fullscreen && setSizes();
}
@ -233,7 +233,7 @@ Ox.VideoPlayer = function(options, self) {
key_space: togglePaused
});
if (self.options.focus == 'mouseenter') {
that.bind({
that.on({
mouseenter: function() {
if (!self.inputHasFocus) {
that.gainFocus();
@ -244,7 +244,7 @@ Ox.VideoPlayer = function(options, self) {
}
});
} else {
that.bind({
that.on({
click: function() {
var focused = Ox.Focus.focused();
if (
@ -269,7 +269,7 @@ Ox.VideoPlayer = function(options, self) {
(self.options.controlsTop.length || self.options.controlsBottom.length)) ||
self.options.showIcon
) {
that.bind({
that.on({
mouseenter: function() {
showControls();
self.mouseHasLeft = false;
@ -338,7 +338,7 @@ Ox.VideoPlayer = function(options, self) {
} else {
self.options.enableMouse && self.$videoContainer.bind({
self.options.enableMouse && self.$videoContainer.on({
click: function(e) {
if (!$(e.target).is('.OxLogo')) {
goToPoint();
@ -671,7 +671,7 @@ Ox.VideoPlayer = function(options, self) {
width: self.positionWidth - 4 + 'px'
})
.html(formatPosition())
.bind({
.on({
click: function() {
if (self.options.enablePosition) {
if (self.options.type == 'play') {
@ -1149,7 +1149,7 @@ Ox.VideoPlayer = function(options, self) {
}
function enterFullscreen() {
that.bind({
that.on({
mousemove: function() {
showControls();
hideControls();
@ -1157,7 +1157,7 @@ Ox.VideoPlayer = function(options, self) {
});
showControls();
hideControls();
that.find('.OxControls').bind({
that.find('.OxControls').on({
mouseenter: function() {
self.mouseIsInControls = true;
},
@ -1585,9 +1585,9 @@ Ox.VideoPlayer = function(options, self) {
top: getCSS('logo').top,
opacity: 0.25
}, 250, function() {
self.options.logoLink && self.$logo.unbind('click');
self.options.logoLink && self.$logo.off('click');
self.options.logoTitle &&
self.$logo.unbind('mouseenter').unbind('mouseleave');
self.$logo.off('mouseenter mouseleave');
});
self.$subtitle && self.$subtitle.animate({
bottom: getCSS('subtitle').bottom
@ -1766,7 +1766,7 @@ Ox.VideoPlayer = function(options, self) {
function renderSettings() {
var $settings = $('<div>')
.addClass('OxControls OxSettings')
.bind({
.on({
click: function(e) {
var $target = $(e.target), resolution, title;
self.$settings.hide();
@ -1825,7 +1825,7 @@ Ox.VideoPlayer = function(options, self) {
if (item.title) {
$item = $('<div>')
.addClass('OxItem')
.bind({
.on({
mouseenter: function() {
$(this).addClass('OxSelected');
},
@ -2096,13 +2096,13 @@ Ox.VideoPlayer = function(options, self) {
opacity: 0.5
}, 250, function() {
self.options.logoLink && self.$logo
.bind({
.on({
click: function() {
document.location.href = self.options.logoLink;
}
});
self.options.logoTitle && self.$logo
.bind({
.on({
mouseenter: function(e) {
self.$logoTooltip.show(e);
},
@ -2213,11 +2213,10 @@ Ox.VideoPlayer = function(options, self) {
} else {
// exitFullscreen flag makes the animation end on absolute position
self.exitFullscreen = true;
that.unbind('mousemove');
that.off('mousemove');
that.find('.OxControls')
.trigger('mouseleave')
.unbind('mouseenter')
.unbind('mouseleave');
.off('mouseenter mouseleave');
clearTimeout(self.interfaceTimeout);
setSizes(true, function() {
self.exitFullscreen = false;

View file

@ -59,7 +59,7 @@ Ox.VideoPreview = function(options, self) {
}
})
.addClass('OxInterface')
.bind({
.on({
click: click,
mouseenter: startLoading,
mouseleave: function() {

View file

@ -119,7 +119,7 @@ Ox.VideoTimelinePlayer = function(options, self) {
self.$timelinePlayer = Ox.Element()
.css({overflowX: 'hidden', overflowY: 'auto'})
.bind({
.on({
mousedown: mousedown,
mouseleave: mouseleave,
mousemove: mousemove,
@ -206,7 +206,7 @@ Ox.VideoTimelinePlayer = function(options, self) {
width: self.positionWidth - 4 + 'px'
})
.html(formatPosition())
.bind({
.on({
click: function() {
if (!self.options.paused) {
self.playOnSubmit = true;

View file

@ -715,7 +715,7 @@ Ox.Dialog = function(options, self) {
self.$layer.show();
that.gainFocus();
}
Ox.UI.$window.bind({
Ox.UI.$window.on({
resize: function() {
var offset = that.offset();
setMinAndMax();

View file

@ -17,7 +17,7 @@ Ox.Layer = function(options, self) {
})
.options(options || {})
.addClass('OxLayer Ox' + Ox.toTitleCase(self.options.type) + 'Layer')
.bind(self.options.type == 'dialog' ? {
.on(self.options.type == 'dialog' ? {
mousedown: mousedown
} : {
click: click
@ -41,7 +41,7 @@ Ox.Layer = function(options, self) {
@*/
that.hide = function() {
if (self.options.type == 'dialog') {
Ox.UI.$window.unbind({mouseup: mouseup});
Ox.$window.off({mouseup: mouseup});
}
that.remove();
};
@ -52,9 +52,9 @@ Ox.Layer = function(options, self) {
@*/
that.show = function() {
if (self.options.type == 'dialog') {
Ox.UI.$window.bind({mouseup: mouseup});
Ox.$window.on({mouseup: mouseup});
}
that.appendTo(Ox.UI.$body);
that.appendTo(Ox.$body);
return that;
}