update per ox.js changes

This commit is contained in:
rolux 2011-04-20 18:52:15 +00:00
parent 24cf7e5625
commit a15a0d119c

View file

@ -107,7 +107,7 @@
}, },
accountDialogOptions: function(action, value) { accountDialogOptions: function(action, value) {
//Ox.print('ACTION', action) //Ox.print('ACTION', action)
app.$ui.accountForm && app.$ui.accountForm.remove(); app.$ui.accountForm && app.$ui.accountForm.removeElement();
var buttons = { var buttons = {
login: ['register', 'reset'], login: ['register', 'reset'],
register: ['login'], register: ['login'],
@ -191,7 +191,7 @@
//Ox.Event.unbind('usernameOrEmailInput') //Ox.Event.unbind('usernameOrEmailInput')
} }
//Ox.print('REMOVING ITEM', item.options('id')); //Ox.print('REMOVING ITEM', item.options('id'));
item.remove(); item.removeElement();
}); });
} }
var items = { var items = {
@ -491,13 +491,14 @@
orientation: 'vertical' orientation: 'vertical'
}); });
that.display = function() { that.display = function() {
// fixme: move animation into Ox.App
app.$ui.body.css({opacity: 0}); app.$ui.body.css({opacity: 0});
that.appendTo(app.$ui.body); that.appendTo(app.$ui.body);
app.$ui.body.animate({opacity: 1}, 1000); app.$ui.body.animate({opacity: 1}, 1000);
return that; return that;
} }
that.reload = function() { that.reload = function() {
app.$ui.appPanel.remove(); app.$ui.appPanel.removeElement();
app.$ui.appPanel = ui.appPanel().appendTo(app.$ui.body); app.$ui.appPanel = ui.appPanel().appendTo(app.$ui.body);
return that; return that;
} }
@ -1409,14 +1410,14 @@
UI.set(['lists', id].join('|'), app.config.user.ui.lists['']); // fixme: necessary? UI.set(['lists', id].join('|'), app.config.user.ui.lists['']); // fixme: necessary?
URL.set('?find=list:' + id) URL.set('?find=list:' + id)
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList().bindEvent({load: load}); $list.reloadList().bindEventOnce({
function load(event, data) { load: function(event, data) {
$list.gainFocus() $list.gainFocus()
.options({selected: [id]}) .options({selected: [id]})
.editCell(id, 'name'); .editCell(id, 'name');
$list.unbindEvent({load: load}) // fixme: need bindEventOnce
} }
}); });
});
} }
} }
})]; })];
@ -1489,14 +1490,14 @@
id = result.data.id; id = result.data.id;
URL.set('?find=list:' + id) URL.set('?find=list:' + id)
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
$list.reloadList().bindEvent({load: load}); $list.reloadList().bindEventOnce({
function load(event, data) { load: function(event, data) {
$list.gainFocus() $list.gainFocus()
.options({selected: [id]}) .options({selected: [id]})
.editCell(id, 'name'); .editCell(id, 'name');
$list.unbindEvent({load: load}) // fixme: need bindEventOnce
} }
}); });
});
} else if (data.id == 'browse') { } else if (data.id == 'browse') {
alert('??') alert('??')
/* /*
@ -1513,9 +1514,8 @@
}); });
//$sections.push(app.$ui.section[i]); //$sections.push(app.$ui.section[i]);
app.$ui.folderList[folder.id] = ui.folderList(folder.id) app.$ui.folderList[folder.id] = ui.folderList(folder.id)
.bindEvent({init: init}) .bindEventOnce({
.appendTo(app.$ui.folder[i].$content); init: function(event, data) {
function init(event, data) {
Ox.print('init', i, counter) Ox.print('init', i, counter)
if (++counter == 3) { if (++counter == 3) {
app.$ui.folder.forEach(function($folder) { app.$ui.folder.forEach(function($folder) {
@ -1524,8 +1524,9 @@
resizeFolders(); resizeFolders();
selectList(); //fixme: doesn't work selectList(); //fixme: doesn't work
} }
app.$ui.folderList[folder.id].unbindEvent({init: init}); // fixme: need bindEventOnce
} }
})
.appendTo(app.$ui.folder[i].$content);
}); });
} }
that.toggle = function() { that.toggle = function() {
@ -1730,7 +1731,7 @@
app.ui.infoRatio = result.data.item.stream.aspectRatio; app.ui.infoRatio = result.data.item.stream.aspectRatio;
var width = that.width() || 256, var width = that.width() || 256,
height = width / app.ui.infoRatio + 16; height = width / app.ui.infoRatio + 16;
app.$ui.infoStill.remove(); app.$ui.infoStill.removeElement();
app.$ui.infoStill = ui.flipbook(app.user.ui.item) app.$ui.infoStill = ui.flipbook(app.user.ui.item)
.appendTo(that.$element); .appendTo(that.$element);
app.$ui.infoStill.css({ app.$ui.infoStill.css({
@ -1963,11 +1964,11 @@
var infoSize = Math.round(data / app.ui.infoRatio) + 16; var infoSize = Math.round(data / app.ui.infoRatio) + 16;
app.user.ui.sidebarSize = data; app.user.ui.sidebarSize = data;
if (data < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) { if (data < app.ui.sectionButtonsWidth && app.$ui.sectionButtons) {
app.$ui.sectionButtons.remove(); app.$ui.sectionButtons.removeElement();
delete app.$ui.sectionButtons; delete app.$ui.sectionButtons;
app.$ui.sectionbar.append(app.$ui.sectionSelect = ui.sectionSelect()); app.$ui.sectionbar.append(app.$ui.sectionSelect = ui.sectionSelect());
} else if (data >= app.ui.sectionButtonsWidth && app.$ui.sectionSelect) { } else if (data >= app.ui.sectionButtonsWidth && app.$ui.sectionSelect) {
app.$ui.sectionSelect.remove(); app.$ui.sectionSelect.removeElement();
delete app.$ui.sectionSelect; delete app.$ui.sectionSelect;
app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons()); app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons());
} }
@ -2361,7 +2362,7 @@
pandora.api.getItem(data.ids[0], function(result) { pandora.api.getItem(data.ids[0], function(result) {
app.ui.infoRatio = result.data.item.stream.aspectRatio; app.ui.infoRatio = result.data.item.stream.aspectRatio;
var height = app.$ui.info.width() / app.ui.infoRatio + 16; var height = app.$ui.info.width() / app.ui.infoRatio + 16;
app.$ui.infoStill.remove(); app.$ui.infoStill.removeElement();
app.$ui.infoStill = ui.flipbook(data.ids[0]) app.$ui.infoStill = ui.flipbook(data.ids[0])
.appendTo(app.$ui.info.$element); .appendTo(app.$ui.info.$element);
app.$ui.infoStill.css({ app.$ui.infoStill.css({
@ -3000,16 +3001,14 @@
Ox.print('AAAAA') Ox.print('AAAAA')
app.$ui.placesElement app.$ui.placesElement
.reloadList() .reloadList()
.bindEvent({loadlist: load}); .bindEventOnce({
Ox.print('BBBBB') loadlist: function() {
function load(event, data) {
Ox.print('LOAD')
app.$ui.placesElement app.$ui.placesElement
.focusList() .focusList()
.options({selected: [id]}) .options({selected: [id]});
.unbindEvent({loadlist: load}); // fixme: need bindEventOnce
} }
}); });
});
}, },
removeplace: function(event, data) { removeplace: function(event, data) {
pandora.api.removePlace(data.id, function(result) { pandora.api.removePlace(data.id, function(result) {
@ -3017,13 +3016,13 @@
Ox.Request.clearCache(); // fixme: remove Ox.Request.clearCache(); // fixme: remove
app.$ui.placesElement app.$ui.placesElement
.reloadList() .reloadList()
.bindEvent({loadlist: load}); .bindEventOnce({
function load(event, data) { loadlist: function(event, data) {
app.$ui.placesElement app.$ui.placesElement
.focusList() .focusList();
.unbindEvent({loadlist: load}); // fixme: need bindEventOnce
} }
}); });
});
} }
}), }),
height: height, height: height,
@ -3478,14 +3477,14 @@
init: function(event, data) { init: function(event, data) {
app.$ui.folderList[listData.status] app.$ui.folderList[listData.status]
.value(listData.id, 'items', data.items); .value(listData.id, 'items', data.items);
}, }
load: load })
.bindEventOnce({
load: function(event, data) {
app.$ui.list.gainFocus().options({selected: [data.items]});
}
}) })
.reloadList(); .reloadList();
function load(event, data) {
app.$ui.list.gainFocus().options({selected: [data.items]});
app.$ui.list.unbindEvent({load: load}); // fixme: need bindEventOnce
}
} }
function resizeGroups(width) { function resizeGroups(width) {
@ -3808,7 +3807,7 @@
delete obj[key]; delete obj[key];
} }
}); });
Ox.length(obj) && pandora.api.setUI(obj); Ox.len(obj) && pandora.api.setUI(obj);
//alert('set ' + JSON.stringify(obj)) //alert('set ' + JSON.stringify(obj))
} }
} }