2011-10-30 16:00:21 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
|
|
|
|
2011-11-05 17:04:10 +00:00
|
|
|
'use strict';
|
|
|
|
|
2011-10-30 15:36:14 +00:00
|
|
|
pandora.ui.clipsView = function(videoRatio) {
|
|
|
|
|
2012-03-21 03:09:24 +00:00
|
|
|
var $status = $('<div>')
|
|
|
|
.css({
|
|
|
|
width: '100%',
|
|
|
|
marginTop: '2px',
|
|
|
|
fontSize: '9px',
|
|
|
|
textAlign: 'center'
|
2012-03-21 03:12:29 +00:00
|
|
|
})
|
|
|
|
.html('Loading...'),
|
2012-03-21 03:09:24 +00:00
|
|
|
|
|
|
|
that = Ox.SplitPanel({
|
2011-10-30 15:36:14 +00:00
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
element: Ox.Bar({size: 24})
|
|
|
|
.append(
|
|
|
|
pandora.$ui.sortSelect = pandora.ui.sortSelect()
|
|
|
|
)
|
|
|
|
.append(
|
|
|
|
pandora.$ui.orderButton = pandora.ui.orderButton()
|
|
|
|
)
|
2011-10-30 16:00:21 +00:00
|
|
|
.append(
|
|
|
|
Ox.Input({
|
|
|
|
clear: true,
|
|
|
|
placeholder: 'Find Clips',
|
2012-02-01 12:01:39 +00:00
|
|
|
value: pandora.user.ui.itemFind,
|
2011-10-30 16:00:21 +00:00
|
|
|
width: 192
|
|
|
|
})
|
|
|
|
.css({float: 'right', margin: '4px'})
|
|
|
|
.bindEvent({
|
|
|
|
submit: function(data) {
|
2012-03-21 03:12:29 +00:00
|
|
|
$status.html('Loading...');
|
2012-02-01 12:01:39 +00:00
|
|
|
pandora.UI.set('itemFind', data.value);
|
2011-10-30 16:00:21 +00:00
|
|
|
// since this is the only way itemFind can change,
|
|
|
|
// there's no need for an event handler
|
|
|
|
that.replaceElement(1,
|
2012-03-21 03:09:24 +00:00
|
|
|
pandora.$ui.clipList = getClipList()
|
2011-10-30 16:00:21 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
),
|
|
|
|
size: 24
|
2011-10-30 15:36:14 +00:00
|
|
|
},
|
|
|
|
{
|
2012-03-21 03:09:24 +00:00
|
|
|
element: pandora.$ui.clipList = getClipList()
|
|
|
|
},
|
|
|
|
{
|
|
|
|
element: Ox.Bar({size: 16})
|
|
|
|
.append($status)
|
2011-10-30 15:36:14 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
orientation: 'vertical'
|
|
|
|
});
|
|
|
|
|
2012-03-21 03:09:24 +00:00
|
|
|
function getClipList() {
|
|
|
|
return pandora.ui.clipList(videoRatio)
|
|
|
|
.bindEvent({
|
|
|
|
init: function(data) {
|
|
|
|
var items = data.items;
|
|
|
|
$status.html(
|
|
|
|
(items ? Ox.formatNumber(items) : 'No')
|
2012-03-21 04:58:02 +00:00
|
|
|
+ ' Clip' + (items == 1 ? '' : 's')
|
2012-03-21 03:09:24 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-10-30 15:36:14 +00:00
|
|
|
return that;
|
|
|
|
|
2012-01-05 12:31:56 +00:00
|
|
|
};
|