user ox.ui events for pandora ui events

This commit is contained in:
rolux 2011-09-28 01:30:13 +02:00
parent 1f2bfe2f76
commit 76442b5f34
14 changed files with 119 additions and 145 deletions

View file

@ -5,15 +5,12 @@ pandora.UI = (function() {
self.previousUI = {};
that.bind = function() {
Ox.Event.bind.apply(null, arguments);
};
that.encode = function(val) {
return val.replace(/\./g, '\\.');
};
that.getPrevious = function(key) {
// fixme: probably unneeded by now
return !key ? self.previousUI : self.previousUI[key];
};
@ -93,11 +90,6 @@ pandora.UI = (function() {
});
});
Ox.len(set) && pandora.api.setUI(set);
Ox.forEach(trigger, function(val, key) {
// fixme: send previousVal as second parameter
Ox.Event.trigger(key, val);
});
Ox.forEach(trigger, function(val, key) {
Ox.forEach(pandora.$ui, function(element) {
// fixme: send previousVal as second parameter
@ -107,6 +99,7 @@ pandora.UI = (function() {
});
});
});
Ox.len(trigger) && Ox.URL.push();
};
return that;

View file

@ -436,12 +436,6 @@ pandora.URL = (function() {
views: views
});
['find', 'item', 'itemSort', 'itemView', 'list', 'listSort', 'listView'].forEach(function(event) {
pandora.UI.bind(event, function() {
that.push();
});
});
return that;
};

View file

@ -90,20 +90,18 @@ pandora.ui.browser = function() {
pandora.$ui.editor.gainFocus();
}
}
}
});
pandora.enableDragAndDrop(that, false);
pandora.UI.bind({
icons: function(value) {
},
pandora_icons: function(data) {
that.options({
borderRadius: value == 'posters' ? 0 : 8,
defaultRatio: value == 'posters' ? 5/8 : 1
borderRadius: data.value == 'posters' ? 0 : 8,
defaultRatio: data.value == 'posters' ? 5/8 : 1
}).reloadList(true);
},
showSitePoster: function() {
pandora_showsiteposter: function() {
pandora.user.ui.icons == 'poster' && that.reloadList(true);
}
});
pandora.enableDragAndDrop(that, false);
}
return that;
};

View file

@ -27,17 +27,17 @@ pandora.ui.contentPanel = function() {
}
],
orientation: 'vertical'
});
pandora.UI.bind({
listView: function() {
})
.bindEvent({
pandora_listview: function() {
that.replaceElement(1, pandora.$ui.list = pandora.ui.list());
},
item: function(value) {
if (value && pandora.UI.getPrevious('item')) {
pandora_item: function(data) {
if (data.value && data.previousValue) {
that.replaceElement(1, pandora.$ui.item = pandora.ui.item());
}
},
itemView: function() {
pandora_itemview: function() {
that.replaceElement(1, pandora.$ui.item = pandora.ui.item());
}
});

View file

@ -235,7 +235,7 @@ pandora.ui.folders = function() {
that.append($folder);
});
pandora.resizeFolders();
pandora.selectList(); //fixme: doesn't work
//pandora.selectList();
}
}
})

View file

@ -515,9 +515,9 @@ pandora.ui.infoView = function(data) {
$data.css({height: height + 'px'});
};
pandora.UI.bind({
icons: that.reload,
showSitePoster: function() {
that.bindEvent({
pandora_icons: that.reload,
pandora_showsiteposter: function() {
pandora.user.ui.icons == 'poster' && that.reload();
}
});

View file

@ -250,13 +250,11 @@ pandora.ui.item = function() {
} else {
$('.OxSelectedVideo').removeClass('OxSelectedVideo');
}
},
pandora_itemsort: function(data) {
pandora.$ui.clips.options({sort: data.value});
}
}));
pandora.UI.bind({
itemSort: function(value) {
pandora.$ui.clips.options({sort: value});
}
});
} else if (pandora.user.ui.itemView == 'video') {
// fixme: duplicated

View file

@ -675,20 +675,20 @@ pandora.ui.list = function() {
}
pandora.UI.bind({
listSort: function(value) {
that.options({sort: value});
that.bindEvent({
pandora_listsort: function(data) {
that.options({sort: data.value});
}
});
if (pandora.user.ui.listView == 'grid') {
pandora.UI.bind({
icons: function(value) {
that.bindEvent({
pandora_icons: function(data) {
that.options({
borderRadius: value == 'posters' ? 0 : 16,
defaultRatio: value == 'posters' ? 5/8 : 1
borderRadius: data.value == 'posters' ? 0 : 16,
defaultRatio: data.value == 'posters' ? 5/8 : 1
}).reloadList(true);
},
showSitePoster: function() {
pandora_showsiteposter: function() {
pandora.user.ui.icons == 'poster' && that.reloadList(true);
}
});

View file

@ -16,9 +16,9 @@ pandora.ui.mainPanel = function() {
}
],
orientation: 'horizontal'
});
pandora.UI.bind({
find: function() {
})
.bindEvent({
pandora_find: function() {
var previousUI = pandora.UI.getPrevious();
if (pandora.user.ui._list == previousUI._list) {
pandora.$ui.list.reloadList();
@ -34,8 +34,8 @@ pandora.ui.mainPanel = function() {
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
}
},
item: function(value) {
if (!value || !pandora.UI.getPrevious('item')) {
pandora_item: function(data) {
if (!data.value || !data.previousValue) {
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
}
}

View file

@ -229,6 +229,11 @@ pandora.ui.mainMenu = function() {
} else if (data.id == 'clearcache') {
Ox.Request.clearCache();
}
},
pandora_listView: function(data) {
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
that.replaceMenu('sortMenu', getSortMenu());
}
}
});
@ -350,14 +355,6 @@ pandora.ui.mainMenu = function() {
});
});
pandora.UI.bind({
listView: function(value) {
if (pandora.isClipView() != pandora.isClipView(pandora.UI.getPrevious('listView'))) {
that.replaceMenu('sortMenu', getSortMenu());
}
}
});
return that;
};

View file

@ -20,15 +20,13 @@ pandora.ui.orderButton = function() {
}]
});
that.options({title: getTitle()});
},
pandora_listsort: function() {
that.options({title: getTitle()});
}
});
function getTitle() {
return pandora.user.ui.listSort[0].operator == '+' ? 'up' : 'down';
}
pandora.UI.bind({
listSort: function() {
that.options({title: getTitle()});
}
});
return that;
}

View file

@ -54,16 +54,14 @@ pandora.ui.rightPanel = function() {
pandora.$ui.editor.options({width: data.size});
}
}
}
});
}
pandora.UI.bind({
itemView: function(value) {
if (pandora.isClipView() != pandora.isClipView(pandora.UI.getPrevious('itemView'))) {
},
pandora_itemview: function(data) {
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
that.replaceElement(0, pandora.$ui.toolbar = pandora.ui.toolbar());
}
}
})
});
}
return that;
};

View file

@ -25,9 +25,9 @@ pandora.ui.toolbar = function() {
that.append(
pandora.$ui.findElement = pandora.ui.findElement()
);
pandora.UI.bind({
listView: function(value) {
if (pandora.isClipView() != pandora.isClipView(pandora.UI.getPrevious('listView'))) {
that.bindEvent({
pandora_listview: function(data) {
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
pandora.$ui.sortSelect.replaceWith(
pandora.$ui.sortSelect = pandora.ui.sortSelect()
);

View file

@ -19,14 +19,12 @@ pandora.ui.viewSelect = function() {
.bindEvent({
change: function(data) {
pandora.UI.set(viewKey, data.selected[0].id);
}
});
pandora.UI.bind({
listView: function(value) {
that.selectItem(value);
},
itemView: function(value) {
that.selectItem(value);
pandora_listview: function(data) {
that.selectItem(data.value);
},
pandora_itemview: function(data) {
that.selectItem(data.value);
}
});
return that;