forked from 0x2620/pandora
refactoring (intermediate state)
This commit is contained in:
parent
000362c05c
commit
ce8656ef53
11 changed files with 46 additions and 38 deletions
|
@ -109,6 +109,7 @@ Ox.load({
|
|||
pandora.site.listSettings[key] = key[4].toLowerCase() + key.substr(5);
|
||||
}
|
||||
});
|
||||
/*
|
||||
if (Ox.isEmpty(pandora.user.ui.lists)) {
|
||||
var listSettings = {};
|
||||
Ox.forEach(pandora.site.listSettings, function(listSetting, setting) {
|
||||
|
@ -116,6 +117,7 @@ Ox.load({
|
|||
});
|
||||
pandora.UI.set('lists.', listSettings);
|
||||
}
|
||||
*/
|
||||
|
||||
Ox.extend(pandora.user, {
|
||||
sectionElement: 'buttons',
|
||||
|
@ -192,7 +194,7 @@ Ox.load({
|
|||
//Ox.print('pandora.$ui.window.resize');
|
||||
pandora.$ui.browser.scrollToSelection();
|
||||
pandora.user.ui.itemView == 'info' && pandora.$ui.item.resize();
|
||||
pandora.user.ui.itemView == 'player' && pandora.$ui.player.options({
|
||||
pandora.user.ui.itemView == 'video' && pandora.$ui.player.options({
|
||||
// fixme: duplicated
|
||||
height: pandora.$ui.contentPanel.size(1),
|
||||
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
||||
|
|
|
@ -57,16 +57,23 @@ pandora.UI = (function() {
|
|||
// when switching to an item, update list selection
|
||||
add['listSelection'] = [val];
|
||||
add['lists.' + that.encode(pandora.user.ui._list || '') + '.selection'] = [val];
|
||||
} else if (
|
||||
}
|
||||
if ((
|
||||
key == 'item'
|
||||
&& ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1
|
||||
&& !pandora.user.ui.videoPoints[val]
|
||||
) || (
|
||||
key == 'itemView'
|
||||
&& ['video', 'timeline'].indexOf(val) > -1
|
||||
&& !pandora.user.ui.videoPoints[pandora.user.ui.item]
|
||||
) {
|
||||
)) {
|
||||
// add default videoPoints
|
||||
add['videoPoints.' + pandora.user.ui.item] = {'in': 0, out: 0, position: 0};
|
||||
add['videoPoints.' + (
|
||||
key == 'item' ? val : pandora.user.ui.item
|
||||
)] = {'in': 0, out: 0, position: 0};
|
||||
}
|
||||
});
|
||||
[args, add].forEach(function(obj, isAdd) {
|
||||
[add, args].forEach(function(obj, isArg) {
|
||||
Ox.forEach(obj, function(val, key) {
|
||||
var keys = key.replace(/([^\\])\./g, '$1\n').split('\n'),
|
||||
ui = pandora.user.ui;
|
||||
|
@ -79,11 +86,8 @@ pandora.UI = (function() {
|
|||
} else {
|
||||
ui[keys[0]] = val;
|
||||
}
|
||||
// don't save or trigger events for private keys
|
||||
//if (key[0] != '_') {
|
||||
//}
|
||||
set[key] = val;
|
||||
if (!isAdd) {
|
||||
if (isArg) {
|
||||
trigger[key] = val;
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +103,7 @@ pandora.UI = (function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
Ox.len(trigger) && Ox.URL.push();
|
||||
Ox.len(trigger) && pandora.URL.push();
|
||||
};
|
||||
|
||||
return that;
|
||||
|
|
|
@ -121,9 +121,9 @@ pandora.URL = (function() {
|
|||
if (pandora.user.ui.showHome) {
|
||||
pandora.$ui.home = pandora.ui.home().showScreen();
|
||||
/*
|
||||
Ox.print('LIST', pandora.user.ui.list)
|
||||
pandora.user.ui.list && pandora.Query.fromString(
|
||||
'find=list:' + pandora.user.ui.list
|
||||
Ox.print('LIST', pandora.user.ui._list)
|
||||
pandora.user.ui._list && pandora.Query.fromString(
|
||||
'find=list:' + pandora.user.ui._list
|
||||
);
|
||||
*/
|
||||
} else {
|
||||
|
|
|
@ -116,7 +116,7 @@ pandora.enableDragAndDrop = function($list, canMove) {
|
|||
)) {
|
||||
if (drag.action == 'move') {
|
||||
pandora.api.removeListItems({
|
||||
list: pandora.user.ui.list,
|
||||
list: pandora.user.ui._list,
|
||||
items: data.ids
|
||||
}, pandora.reloadList);
|
||||
}
|
||||
|
@ -572,8 +572,6 @@ pandora.selectList = function() {
|
|||
pandora.$ui.folderList[folder]
|
||||
.options('selected', [pandora.user.ui._list])
|
||||
.gainFocus();
|
||||
} else {
|
||||
pandora.user.ui.list = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ pandora.ui.browser = function() {
|
|||
}).reloadList(true);
|
||||
},
|
||||
pandora_showsiteposter: function() {
|
||||
pandora.user.ui.icons == 'poster' && that.reloadList(true);
|
||||
pandora.user.ui.icons == 'posters' && that.reloadList(true);
|
||||
}
|
||||
});
|
||||
pandora.enableDragAndDrop(that, false);
|
||||
|
|
|
@ -4,7 +4,7 @@ pandora.ui.findElement = function() {
|
|||
findKey = pandora.user.ui._findState.key,
|
||||
findValue = pandora.user.ui._findState.value;
|
||||
var that = Ox.FormElementGroup({
|
||||
elements: Ox.merge(pandora.user.ui.list ? [
|
||||
elements: Ox.merge(pandora.user.ui._list ? [
|
||||
pandora.$ui.findListSelect = Ox.Select({
|
||||
items: [
|
||||
{id: 'all', title: 'Find: All ' + pandora.site.itemName.plural},
|
||||
|
@ -74,7 +74,7 @@ pandora.ui.findElement = function() {
|
|||
}
|
||||
},
|
||||
submit: function(data) {
|
||||
var findInList = pandora.user.ui.list
|
||||
var findInList = pandora.user.ui._list
|
||||
&& pandora.$ui.findListSelect.value() == 'list',
|
||||
key = pandora.$ui.findSelect.value(),
|
||||
conditions = data.value ? [{
|
||||
|
@ -86,7 +86,7 @@ pandora.ui.findElement = function() {
|
|||
pandora.UI.set('find', {
|
||||
conditions: Ox.merge([{
|
||||
key: 'list',
|
||||
value: pandora.user.ui.list,
|
||||
value: pandora.user.ui._list,
|
||||
operator: '=='
|
||||
}], conditions),
|
||||
operator: '&'
|
||||
|
@ -94,7 +94,7 @@ pandora.ui.findElement = function() {
|
|||
// fixme: what was this?
|
||||
// data.value && findIndex == 0 && pandora.user.ui.find.conditions.reverse();
|
||||
} else {
|
||||
if (pandora.user.ui.list) {
|
||||
if (pandora.user.ui._list) {
|
||||
Ox.forEach(pandora.$ui.folderList, function($list) {
|
||||
$list.options({selected: []});
|
||||
});
|
||||
|
@ -117,7 +117,7 @@ pandora.ui.findElement = function() {
|
|||
function autocompleteFunction() {
|
||||
return pandora.user.ui.find.conditions.length ? function(value, callback) {
|
||||
var elementValue = that.value(),
|
||||
key = elementValue[pandora.user.ui.list ? 1 : 0],
|
||||
key = elementValue[pandora.user.ui._list ? 1 : 0],
|
||||
findKey = Ox.getObjectById(pandora.site.findKeys, key);
|
||||
value === '' && Ox.print('Warning: autocomplete function should never be called with empty value');
|
||||
if (findKey.autocomplete) {
|
||||
|
@ -125,7 +125,7 @@ pandora.ui.findElement = function() {
|
|||
key: key,
|
||||
query: {
|
||||
conditions: pandora.$ui.findListSelect.value() == 'list'
|
||||
? [{key: 'list', value: pandora.user.ui.list, operator: '=='}] : [],
|
||||
? [{key: 'list', value: pandora.user.ui._list, operator: '=='}] : [],
|
||||
operator: '&'
|
||||
},
|
||||
range: [0, 20],
|
||||
|
|
|
@ -130,7 +130,7 @@ pandora.ui.folderBrowserList = function(id) {
|
|||
// not-featured list may be in the user's favorites folder
|
||||
keys: id == 'featured' ? ['subscribed'] : [],
|
||||
pageLength: 1000,
|
||||
selected: pandora.getListData().folder == id ? [pandora.user.ui.list] : [],
|
||||
selected: pandora.getListData().folder == id ? [pandora.user.ui._list] : [],
|
||||
sort: [
|
||||
{key: 'name', operator: '+'}
|
||||
]
|
||||
|
@ -181,16 +181,20 @@ pandora.ui.folderBrowserList = function(id) {
|
|||
},
|
||||
select: function(data) {
|
||||
// fixme: duplicated
|
||||
if (data.ids.length) {
|
||||
var list = data.ids.length ? data.ids[0] : '';
|
||||
if (list) {
|
||||
Ox.forEach(pandora.$ui.folderList, function($list, id_) {
|
||||
id != id_ && $list.options('selected', []);
|
||||
});
|
||||
//pandora.UI.set({list: data.ids[0]});
|
||||
pandora.URL.set('?find=list:' + data.ids[0]);
|
||||
} else {
|
||||
//pandora.UI.set({list: ''});
|
||||
pandora.URL.set('');
|
||||
}
|
||||
pandora.UI.set({
|
||||
find: {
|
||||
conditions: list ? [
|
||||
{key: 'list', value: data.ids[0], operator: '=='}
|
||||
] : [],
|
||||
operator: '&'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return that;
|
||||
|
|
|
@ -16,7 +16,7 @@ pandora.ui.info = function() {
|
|||
});
|
||||
Ox.print('INFO', view)
|
||||
if (view == 'list') {
|
||||
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo(pandora.user.ui.list));
|
||||
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo(pandora.user.ui._list));
|
||||
} else if (view == 'poster') {
|
||||
pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) {
|
||||
var ratio = result.data.posterRatio,
|
||||
|
@ -75,10 +75,10 @@ pandora.ui.info = function() {
|
|||
pandora.ui.listInfo = function(data) {
|
||||
var that = $('<div>').css({padding: '16px', textAlign: 'center'});
|
||||
var $icon = $('<img>')
|
||||
.attr({src: !pandora.user.ui.list ? '/static/png/icon256.png' : Ox.UI.getImageURL('symbolIcon')})
|
||||
.attr({src: !pandora.user.ui._list ? '/static/png/icon256.png' : Ox.UI.getImageURL('symbolIcon')})
|
||||
.css(getIconCSS())
|
||||
.appendTo(that);
|
||||
$('<div>').css({padding: '16px 0 16px 0', fontWeight: 'bold'}).html(!pandora.user.ui.list ? 'All Movies' : pandora.user.ui.list.replace(':', ': ')).appendTo(that);
|
||||
$('<div>').css({padding: '16px 0 16px 0', fontWeight: 'bold'}).html(!pandora.user.ui._list ? 'All Movies' : pandora.user.ui._list.replace(':', ': ')).appendTo(that);
|
||||
$('<div>').css({textAlign: 'left'}).html(Ox.repeat('This is the list info text. ', 10)).appendTo(that);
|
||||
function getIconCSS() {
|
||||
var size = Math.round(pandora.user.ui.sidebarSize / 2);
|
||||
|
|
|
@ -518,7 +518,7 @@ pandora.ui.infoView = function(data) {
|
|||
that.bindEvent({
|
||||
pandora_icons: that.reload,
|
||||
pandora_showsiteposter: function() {
|
||||
pandora.user.ui.icons == 'poster' && that.reload();
|
||||
pandora.user.ui.icons == 'posters' && that.reload();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -550,7 +550,7 @@ pandora.ui.list = function() {
|
|||
},
|
||||
'delete': function(data) {
|
||||
pandora.getListData().editable && pandora.api.removeListItems({
|
||||
list: pandora.user.ui.list,
|
||||
list: pandora.user.ui._list,
|
||||
items: data.ids
|
||||
}, pandora.reloadList);
|
||||
},
|
||||
|
@ -641,7 +641,7 @@ pandora.ui.list = function() {
|
|||
},
|
||||
paste: function(data) {
|
||||
data.items && pandora.getListData().editable && pandora.api.addListItems({
|
||||
list: pandora.user.ui.list,
|
||||
list: pandora.user.ui._list,
|
||||
items: data.items
|
||||
}, pandora.reloadList);
|
||||
},
|
||||
|
@ -689,7 +689,7 @@ pandora.ui.list = function() {
|
|||
}).reloadList(true);
|
||||
},
|
||||
pandora_showsiteposter: function() {
|
||||
pandora.user.ui.icons == 'poster' && that.reloadList(true);
|
||||
pandora.user.ui.icons == 'posters' && that.reloadList(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ pandora.ui.mainMenu = function() {
|
|||
return {
|
||||
id: 'viewlist' + list.id,
|
||||
title: (folder == 'favorite' ? list.user + ': ' : '') + list.name,
|
||||
checked: list.id == pandora.user.ui.list
|
||||
checked: list.id == pandora.user.ui._list
|
||||
};
|
||||
}) : [{id: 'loading', title: 'Loading...', disabled: true}]
|
||||
}]
|
||||
|
|
Loading…
Reference in a new issue