forked from 0x2620/pandora
remove unused files
This commit is contained in:
parent
7f79228915
commit
758e7007d8
3 changed files with 0 additions and 241 deletions
|
@ -1,162 +0,0 @@
|
|||
// FIXME: unused
|
||||
|
||||
'use strict';
|
||||
|
||||
pandora.ui.posterView = function() {
|
||||
|
||||
var item = pandora.user.ui.item,
|
||||
view = pandora.user.ui.itemView,
|
||||
listWidth = 144 + Ox.UI.SCROLLBAR_SIZE,
|
||||
selectedImage = {};
|
||||
$preview = Ox.Element(),
|
||||
that = Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: Ox.Element(),
|
||||
size: listWidth
|
||||
},
|
||||
{
|
||||
element: $preview
|
||||
}
|
||||
],
|
||||
orientation: 'horizontal'
|
||||
});
|
||||
|
||||
that.resizeElement = function() {
|
||||
selectedImage.url && renderPreview();
|
||||
};
|
||||
|
||||
pandora.api.get({
|
||||
id: item,
|
||||
keys: [view]
|
||||
}, function(result) {
|
||||
var images = result.data[view];
|
||||
selectedImage = images.filter(function(image) {
|
||||
return image.selected;
|
||||
})[0];
|
||||
var $list = Ox.IconList({
|
||||
item: function(data, sort, size) {
|
||||
var ratio = data.width / data.height;
|
||||
size = size || 128;
|
||||
return {
|
||||
height: ratio <= 1 ? size : size / ratio,
|
||||
id: data['id'],
|
||||
info: data.width + ' x ' + data.height + ' px',
|
||||
title: view == 'frames' ? Ox.formatDuration(data.position) : data.source,
|
||||
url: data.url,
|
||||
width: ratio >= 1 ? size : size * ratio
|
||||
}
|
||||
},
|
||||
items: images,
|
||||
keys: view == 'frames'
|
||||
? ['index', 'position', 'width', 'height', 'url']
|
||||
: ['index', 'source', 'width', 'height', 'url'],
|
||||
max: 1,
|
||||
min: 1,
|
||||
orientation: 'vertical',
|
||||
selected: [selectedImage['index']],
|
||||
size: 128,
|
||||
sort: [{key: 'index', operator: '+'}],
|
||||
unique: 'index'
|
||||
})
|
||||
.css({background: 'rgb(16, 16, 16)'})
|
||||
.bindEvent({
|
||||
select: function(event) {
|
||||
var index = event.ids[0];
|
||||
selectedImage = images.filter(function(image) {
|
||||
return image.index == index;
|
||||
})[0];
|
||||
renderPreview(selectedImage);
|
||||
pandora.api[view == 'frames' ? 'setPosterFrame' : 'setPoster'](Ox.extend({
|
||||
id: item
|
||||
}, view == 'frames' ? {
|
||||
position: selectedImage.index // api slightly inconsistent
|
||||
} : {
|
||||
source: selectedImage.source
|
||||
}), function(result) {
|
||||
var imageRatio = selectedImage.width / selectedImage.height;
|
||||
$('img[src*="/' + item + '/poster"]').each(function() {
|
||||
var $this = $(this),
|
||||
size = Math.max($this.width(), $this.height()),
|
||||
src = $this.attr('src').split('?')[0] + '?' + Ox.uid();
|
||||
$('<img>')
|
||||
.attr({src: src})
|
||||
.load(function() {
|
||||
$this.attr({src: src});
|
||||
view == 'posters' && $this.css(imageRatio < 1 ? {
|
||||
width: Math.round(size * imageRatio) + 'px',
|
||||
height: size + 'px'
|
||||
} : {
|
||||
width: size + 'px',
|
||||
height: Math.round(size / imageRatio) + 'px'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
that.replaceElement(0, $list);
|
||||
renderPreview();
|
||||
});
|
||||
|
||||
function renderPreview() {
|
||||
var previewWidth = pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 - listWidth,
|
||||
previewHeight = pandora.$ui.contentPanel.size(1),
|
||||
previewRatio = previewWidth / previewHeight,
|
||||
imageRatio = selectedImage.width / selectedImage.height,
|
||||
imageWidth = imageRatio > previewRatio ? previewWidth : Math.round(previewHeight * imageRatio),
|
||||
imageHeight = imageRatio < previewRatio ? previewHeight : Math.round(previewWidth / imageRatio),
|
||||
imageLeft = Math.floor((previewWidth - imageWidth) / 2),
|
||||
imageTop = Math.floor((previewHeight - imageHeight) / 2);
|
||||
$preview.html(
|
||||
$('<img>')
|
||||
.attr({
|
||||
src: selectedImage.url
|
||||
})
|
||||
.css({
|
||||
position: 'absolute',
|
||||
left: imageLeft + 'px',
|
||||
top: imageTop + 'px',
|
||||
width: imageWidth + 'px',
|
||||
height: imageHeight + 'px'
|
||||
})
|
||||
);
|
||||
if (view == 'frames') {
|
||||
var left = Math.floor((imageWidth - imageHeight) / 2),
|
||||
right = Math.ceil((imageWidth - imageHeight) / 2);
|
||||
$('<div>')
|
||||
.addClass('OxPosterMarker OxPosterMarkerLeft')
|
||||
.css({
|
||||
display: 'block',
|
||||
left: imageLeft + 'px',
|
||||
top: imageTop + 'px',
|
||||
width: left + 'px',
|
||||
height: imageHeight + 'px'
|
||||
})
|
||||
.appendTo($preview.$element);
|
||||
$('<div>')
|
||||
.addClass('OxPosterMarker OxPosterMarkerCenter')
|
||||
.css({
|
||||
display: 'block',
|
||||
left: imageLeft + left + 'px',
|
||||
top: imageTop + 'px',
|
||||
width: imageHeight - 2 + 'px',
|
||||
height: imageHeight - 2 + 'px'
|
||||
})
|
||||
.appendTo($preview.$element);
|
||||
$('<div>')
|
||||
.addClass('OxPosterMarker OxPosterMarkerRight')
|
||||
.css({
|
||||
display: 'block',
|
||||
left: imageLeft + left + imageHeight + 'px',
|
||||
top: imageTop + 'px',
|
||||
width: right + 'px',
|
||||
height: imageHeight + 'px'
|
||||
})
|
||||
.appendTo($preview.$element);
|
||||
}
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
'use strict';
|
||||
pandora.ui.publicListsDialog = function() { // fixme: unused
|
||||
var that = Ox.Dialog({
|
||||
buttons: [
|
||||
Ox.Button({
|
||||
id: 'done',
|
||||
title: Ox._('Done')
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
that.close();
|
||||
}
|
||||
})
|
||||
],
|
||||
content: pandora.ui.publicListsList(),
|
||||
height: 320,
|
||||
keys: {enter: 'close', escape: 'close'},
|
||||
padding: 0,
|
||||
title: Ox._('Public Lists'),
|
||||
width: 420
|
||||
})
|
||||
.css({
|
||||
position: 'absolute'
|
||||
});
|
||||
return that;
|
||||
};
|
|
@ -1,53 +0,0 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
|
||||
'use strict';
|
||||
|
||||
pandora.ui.sortMenu = function() {
|
||||
|
||||
// FIXME: unused
|
||||
|
||||
var that = Ox.MenuButton({
|
||||
items: [].concat(
|
||||
pandora.site.clipKeys.map(function(key) {
|
||||
return Ox.extend(Ox.clone(key), {
|
||||
checked: key.id == pandora.user.ui.itemSort[0].key,
|
||||
id: key.id,
|
||||
title: Ox._('Sort by {0}', [key.title])
|
||||
});
|
||||
}),
|
||||
[
|
||||
{},
|
||||
{id: 'ascending', title: Ox._('Ascending'), checked: pandora.user.ui.itemSort[0].operator == '+'},
|
||||
{id: 'descending', title: Ox._('Descending'), checked: pandora.user.ui.itemSort[0].operator == '-'}
|
||||
]
|
||||
),
|
||||
tooltip: Ox._('Sort clips'),
|
||||
type: 'image'
|
||||
})
|
||||
.css({float: 'left', margin: '2px'})
|
||||
.bindEvent({
|
||||
click: function(data) {
|
||||
if (data.checked) {
|
||||
if (['ascending', 'descending'].indexOf(data.id) > -1) {
|
||||
pandora.UI.set({itemSort: [{
|
||||
key: pandora.user.ui.itemSort[0].key,
|
||||
operator: data.id == 'ascending' ? '+' : '-'
|
||||
}]});
|
||||
} else {
|
||||
pandora.UI.set({itemSort: [{
|
||||
key: data.id,
|
||||
operator: pandora.getSortOperator(data.id)
|
||||
}]});
|
||||
}
|
||||
}
|
||||
},
|
||||
pandora_itemsort: function() {
|
||||
pandora.$ui.sortMenu.replaceWith(
|
||||
pandora.$ui.sortMenu = pandora.ui.sortMenu()
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return that;
|
||||
|
||||
};
|
Loading…
Reference in a new issue