From 461a23788073183d0b42c78520182e4953640a1c Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 28 May 2012 16:06:22 +0200 Subject: [PATCH] .bind -> .on, .unbind -> .off --- index.js | 12 +++---- source/Ox.UI/Ox.UI.js | 8 ++--- source/Ox.UI/js/Bar/Ox.Resizebar.js | 3 +- source/Ox.UI/js/Calendar/Ox.Calendar.js | 2 +- source/Ox.UI/js/Code/Ox.ExamplePage.js | 2 +- source/Ox.UI/js/Core/Ox.Event.js | 6 ++-- source/Ox.UI/js/Form/Ox.ArrayInput.js | 4 +-- source/Ox.UI/js/Form/Ox.Editable.js | 2 +- source/Ox.UI/js/Form/Ox.FileButton.js | 2 +- source/Ox.UI/js/Form/Ox.FileInput.js | 2 +- source/Ox.UI/js/Form/Ox.Input.js | 2 +- source/Ox.UI/js/Form/Ox.ObjectArrayInput.js | 4 +-- source/Ox.UI/js/Form/Ox.PlacePicker.js | 2 +- source/Ox.UI/js/List/Ox.TextList.js | 2 +- source/Ox.UI/js/Menu/Ox.Menu.js | 2 +- .../Ox.UI/js/Video/Ox.BlockVideoTimeline.js | 2 +- source/Ox.UI/js/Video/Ox.VideoElement.js | 2 +- source/Ox.UI/js/Video/Ox.VideoPlayer.js | 33 +++++++++---------- source/Ox.UI/js/Video/Ox.VideoPreview.js | 2 +- .../Ox.UI/js/Video/Ox.VideoTimelinePlayer.js | 4 +-- source/Ox.UI/js/Window/Ox.Dialog.js | 2 +- source/Ox.UI/js/Window/Ox.Layer.js | 8 ++--- 22 files changed, 54 insertions(+), 54 deletions(-) diff --git a/index.js b/index.js index f03f1e57..cbe4b504 100644 --- a/index.js +++ b/index.js @@ -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); diff --git a/source/Ox.UI/Ox.UI.js b/source/Ox.UI/Ox.UI.js index 273f34c7..4f52355f 100644 --- a/source/Ox.UI/Ox.UI.js +++ b/source/Ox.UI/Ox.UI.js @@ -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) { diff --git a/source/Ox.UI/js/Bar/Ox.Resizebar.js b/source/Ox.UI/js/Bar/Ox.Resizebar.js index 4c650d23..7548576e 100644 --- a/source/Ox.UI/js/Bar/Ox.Resizebar.js +++ b/source/Ox.UI/js/Bar/Ox.Resizebar.js @@ -47,8 +47,9 @@ Ox.Resizebar = function(options, self) { .append($('
').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 }); diff --git a/source/Ox.UI/js/Calendar/Ox.Calendar.js b/source/Ox.UI/js/Calendar/Ox.Calendar.js index c9382f60..b50bfdff 100644 --- a/source/Ox.UI/js/Calendar/Ox.Calendar.js +++ b/source/Ox.UI/js/Calendar/Ox.Calendar.js @@ -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 diff --git a/source/Ox.UI/js/Code/Ox.ExamplePage.js b/source/Ox.UI/js/Code/Ox.ExamplePage.js index 2b9d24c5..2ec87cf6 100644 --- a/source/Ox.UI/js/Code/Ox.ExamplePage.js +++ b/source/Ox.UI/js/Code/Ox.ExamplePage.js @@ -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(); } diff --git a/source/Ox.UI/js/Core/Ox.Event.js b/source/Ox.UI/js/Core/Ox.Event.js index a7ed921e..89e02c1c 100644 --- a/source/Ox.UI/js/Core/Ox.Event.js +++ b/source/Ox.UI/js/Core/Ox.Event.js @@ -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; diff --git a/source/Ox.UI/js/Form/Ox.ArrayInput.js b/source/Ox.UI/js/Form/Ox.ArrayInput.js index b93482f9..9a6d5b0e 100644 --- a/source/Ox.UI/js/Form/Ox.ArrayInput.js +++ b/source/Ox.UI/js/Form/Ox.ArrayInput.js @@ -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); diff --git a/source/Ox.UI/js/Form/Ox.Editable.js b/source/Ox.UI/js/Form/Ox.Editable.js index 07656d0a..a38a6085 100644 --- a/source/Ox.UI/js/Form/Ox.Editable.js +++ b/source/Ox.UI/js/Form/Ox.Editable.js @@ -35,7 +35,7 @@ Ox.Editable = function(options, self) { }) .options(options || {}) .addClass('OxEditableElement' + (self.options.editable ? ' OxEditable' : '')) - .bind({ + .on({ click: function() { return false; } diff --git a/source/Ox.UI/js/Form/Ox.FileButton.js b/source/Ox.UI/js/Form/Ox.FileButton.js index e9fa80be..e5868262 100644 --- a/source/Ox.UI/js/Form/Ox.FileButton.js +++ b/source/Ox.UI/js/Form/Ox.FileButton.js @@ -92,7 +92,7 @@ Ox.FileButton = function(options, self) { marginLeft: -self.options.width + 'px', opacity: 0 }) - .bind({ + .on({ change: selectFiles }) .appendTo(that); diff --git a/source/Ox.UI/js/Form/Ox.FileInput.js b/source/Ox.UI/js/Form/Ox.FileInput.js index ceb79600..86ef7152 100644 --- a/source/Ox.UI/js/Form/Ox.FileInput.js +++ b/source/Ox.UI/js/Form/Ox.FileInput.js @@ -277,7 +277,7 @@ Ox.FileInput = function(options, self) { margin: '-1px -7px 0 -16px', opacity: 0 }) - .bind({ + .on({ change: addFiles }) .appendTo(self.$bar); diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js index 9cfa7e79..c578550e 100644 --- a/source/Ox.UI/js/Form/Ox.Input.js +++ b/source/Ox.UI/js/Form/Ox.Input.js @@ -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 diff --git a/source/Ox.UI/js/Form/Ox.ObjectArrayInput.js b/source/Ox.UI/js/Form/Ox.ObjectArrayInput.js index dc80bdbf..5553c6b3 100644 --- a/source/Ox.UI/js/Form/Ox.ObjectArrayInput.js +++ b/source/Ox.UI/js/Form/Ox.ObjectArrayInput.js @@ -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()); diff --git a/source/Ox.UI/js/Form/Ox.PlacePicker.js b/source/Ox.UI/js/Form/Ox.PlacePicker.js index f204c2ec..7916a9b1 100644 --- a/source/Ox.UI/js/Form/Ox.PlacePicker.js +++ b/source/Ox.UI/js/Form/Ox.PlacePicker.js @@ -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; diff --git a/source/Ox.UI/js/List/Ox.TextList.js b/source/Ox.UI/js/List/Ox.TextList.js index d729fefe..eab27f15 100644 --- a/source/Ox.UI/js/List/Ox.TextList.js +++ b/source/Ox.UI/js/List/Ox.TextList.js @@ -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(); diff --git a/source/Ox.UI/js/Menu/Ox.Menu.js b/source/Ox.UI/js/Menu/Ox.Menu.js index 4532276c..6107be32 100644 --- a/source/Ox.UI/js/Menu/Ox.Menu.js +++ b/source/Ox.UI/js/Menu/Ox.Menu.js @@ -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, diff --git a/source/Ox.UI/js/Video/Ox.BlockVideoTimeline.js b/source/Ox.UI/js/Video/Ox.BlockVideoTimeline.js index 1c9ad15d..ad8f21e3 100644 --- a/source/Ox.UI/js/Video/Ox.BlockVideoTimeline.js +++ b/source/Ox.UI/js/Video/Ox.BlockVideoTimeline.js @@ -29,7 +29,7 @@ Ox.BlockVideoTimeline = function(options, self) { .css({ position: 'absolute' }) - .bind({ + .on({ mousedown: mousedown, mouseleave: mouseleave, mousemove: mousemove diff --git a/source/Ox.UI/js/Video/Ox.VideoElement.js b/source/Ox.UI/js/Video/Ox.VideoElement.js index 098d9679..4b7f07db 100644 --- a/source/Ox.UI/js/Video/Ox.VideoElement.js +++ b/source/Ox.UI/js/Video/Ox.VideoElement.js @@ -94,7 +94,7 @@ Ox.VideoElement = function(options, self) { } return $('