pandora/static/js/clipsView.js

76 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2011-11-05 17:04:10 +00:00
'use strict';
2011-10-30 15:36:14 +00:00
pandora.ui.clipsView = function(videoRatio) {
var $status = $('<div>')
.css({
width: '100%',
marginTop: '2px',
fontSize: '9px',
textAlign: 'center'
})
2013-05-09 10:13:58 +00:00
.html(Ox._('Loading...')),
that = Ox.SplitPanel({
2011-10-30 15:36:14 +00:00
elements: [
{
element: Ox.Bar({size: 24})
.bindEvent({
doubleclick: function(e) {
if ($(e.target).is('.OxBar')) {
pandora.$ui.clipList.animate({scrollTop: 0}, 250);
}
}
})
2011-10-30 15:36:14 +00:00
.append(
pandora.$ui.sortElement = pandora.ui.sortElement()
2011-10-30 15:36:14 +00:00
)
2011-10-30 16:00:21 +00:00
.append(
Ox.Input({
clear: true,
2013-05-09 10:13:58 +00:00
placeholder: Ox._('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) {
2013-05-09 10:13:58 +00:00
$status.html(Ox._('Loading...'));
2013-07-14 15:36:49 +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,
pandora.$ui.clipList = getClipList()
2011-10-30 16:00:21 +00:00
);
}
})
),
size: 24
2011-10-30 15:36:14 +00:00
},
{
element: pandora.$ui.clipList = getClipList()
},
{
2012-06-30 22:12:04 +00:00
element: Ox.Bar({size: 16}).append($status),
size: 16
2011-10-30 15:36:14 +00:00
}
],
orientation: 'vertical'
});
function getClipList() {
return pandora.ui.clipList(videoRatio)
.bindEvent({
init: function(data) {
var items = data.items;
$status.html(
Ox.toTitleCase(Ox.formatCount(items, 'clip'))
);
}
});
}
2011-10-30 15:36:14 +00:00
return that;
};