forked from 0x2620/pandora
Ox.getPositionById() -> Ox.getIndexById()
This commit is contained in:
parent
e1989eed57
commit
2e4d6fd9d9
9 changed files with 19 additions and 19 deletions
|
@ -15,7 +15,7 @@ Ox.load('UI', {
|
||||||
user: data.user.level == 'guest' ? Ox.clone(data.site.user) : data.user,
|
user: data.user.level == 'guest' ? Ox.clone(data.site.user) : data.user,
|
||||||
ui: {},
|
ui: {},
|
||||||
clip: function(item, inPoint, outPoint) {
|
clip: function(item, inPoint, outPoint) {
|
||||||
Ox.print('!@#!@#!@#', inPoint, outPoint);
|
//Ox.print('!@#!@#!@#', inPoint, outPoint);
|
||||||
var that = Ox.Element();
|
var that = Ox.Element();
|
||||||
pandora.api.get({id: item, keys: []}, function(result) {
|
pandora.api.get({id: item, keys: []}, function(result) {
|
||||||
var video = {};
|
var video = {};
|
||||||
|
|
|
@ -51,7 +51,7 @@ pandora.ui.appPanel = function() {
|
||||||
!pandora.$ui.appPanel ? 'showScreen' : 'fadeInScreen'
|
!pandora.$ui.appPanel ? 'showScreen' : 'fadeInScreen'
|
||||||
]();
|
]();
|
||||||
} else if (
|
} else if (
|
||||||
Ox.getPositionById(pandora.site.sitePages, page) > -1
|
Ox.getIndexById(pandora.site.sitePages, page) > -1
|
||||||
|| page == 'software'
|
|| page == 'software'
|
||||||
) {
|
) {
|
||||||
if (pandora.$ui.siteDialog && pandora.$ui.siteDialog.is(':visible')) {
|
if (pandora.$ui.siteDialog && pandora.$ui.siteDialog.is(':visible')) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ pandora.ui.clipList = function(videoRatio) {
|
||||||
// if the item query contains a layer condition,
|
// if the item query contains a layer condition,
|
||||||
// then this condition is added to the clip query
|
// then this condition is added to the clip query
|
||||||
itemsQuery.conditions.forEach(function(condition) {
|
itemsQuery.conditions.forEach(function(condition) {
|
||||||
if (Ox.getPositionById(pandora.site.layers, condition.key) > -1) {
|
if (Ox.getIndexById(pandora.site.layers, condition.key) > -1) {
|
||||||
query.conditions.push(condition);
|
query.conditions.push(condition);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
'use strict';
|
'use strict';
|
||||||
pandora.ui.filter = function(id) {
|
pandora.ui.filter = function(id) {
|
||||||
var i = Ox.getPositionById(pandora.user.ui.filters, id),
|
var i = Ox.getIndexById(pandora.user.ui.filters, id),
|
||||||
filter = Ox.getObjectById(pandora.site.filters, id),
|
filter = Ox.getObjectById(pandora.site.filters, id),
|
||||||
panelWidth = pandora.$ui.document.width() - (pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize) - 1,
|
panelWidth = pandora.$ui.document.width() - (pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize) - 1,
|
||||||
title = Ox.getObjectById(pandora.site.filters, id).title,
|
title = Ox.getObjectById(pandora.site.filters, id).title,
|
||||||
|
@ -167,7 +167,7 @@ pandora.ui.filter = function(id) {
|
||||||
var filters = Ox.clone(pandora.user.ui.filters),
|
var filters = Ox.clone(pandora.user.ui.filters),
|
||||||
find,
|
find,
|
||||||
id_ = data.value,
|
id_ = data.value,
|
||||||
i_ = Ox.getPositionById(pandora.user.ui.filters, id_);
|
i_ = Ox.getIndexById(pandora.user.ui.filters, id_);
|
||||||
if (i_ == -1) {
|
if (i_ == -1) {
|
||||||
// new filter was not part of old filter set
|
// new filter was not part of old filter set
|
||||||
if (pandora.user.ui._filterState[i].selected.length) {
|
if (pandora.user.ui._filterState[i].selected.length) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ pandora.ui.folderBrowserList = function(id) {
|
||||||
// fixme: user and name are set to the same width here,
|
// fixme: user and name are set to the same width here,
|
||||||
// but resizeFolders will set them to different widths
|
// but resizeFolders will set them to different widths
|
||||||
var columnWidth = (pandora.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 96) / 2,
|
var columnWidth = (pandora.user.ui.sidebarSize - Ox.UI.SCROLLBAR_SIZE - 96) / 2,
|
||||||
i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
|
i = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id),
|
||||||
that = Ox.TextList({
|
that = Ox.TextList({
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
pandora.ui.folderList = function(id) {
|
pandora.ui.folderList = function(id) {
|
||||||
// FIXME: use canEditFeaturedLists capability, not 'admin'
|
// FIXME: use canEditFeaturedLists capability, not 'admin'
|
||||||
var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
|
var i = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id),
|
||||||
that;
|
that;
|
||||||
if (pandora.user.ui.section == 'items') {
|
if (pandora.user.ui.section == 'items') {
|
||||||
var columns, items;
|
var columns, items;
|
||||||
|
|
|
@ -88,7 +88,7 @@ pandora.ui.mainMenu = function() {
|
||||||
{ id: 'filters', title: 'Filters', items: [
|
{ id: 'filters', title: 'Filters', items: [
|
||||||
{ group: 'filters', min: 5, max: 5, items: pandora.site.filters.map(function(filter) {
|
{ group: 'filters', min: 5, max: 5, items: pandora.site.filters.map(function(filter) {
|
||||||
return Ox.extend({
|
return Ox.extend({
|
||||||
checked: Ox.getPositionById(ui.filters, filter.id) > -1
|
checked: Ox.getIndexById(ui.filters, filter.id) > -1
|
||||||
}, filter);
|
}, filter);
|
||||||
}) },
|
}) },
|
||||||
{},
|
{},
|
||||||
|
@ -168,13 +168,13 @@ pandora.ui.mainMenu = function() {
|
||||||
} else if (Ox.startsWith(data.id, 'orderfilter')) {
|
} else if (Ox.startsWith(data.id, 'orderfilter')) {
|
||||||
var filters = Ox.clone(pandora.user.ui.filters),
|
var filters = Ox.clone(pandora.user.ui.filters),
|
||||||
id = data.id.replace('orderfilter', ''),
|
id = data.id.replace('orderfilter', ''),
|
||||||
position = Ox.getPositionById(filters, id),
|
index = Ox.getIndexById(filters, id),
|
||||||
key = filters[position].sort[0].key,
|
key = filters[index].sort[0].key,
|
||||||
operator = value == 'ascending' ? '+' : '-';
|
operator = value == 'ascending' ? '+' : '-';
|
||||||
pandora.$ui.filters[position].options({
|
pandora.$ui.filters[index].options({
|
||||||
sort: [{key: key, operator: operator}]
|
sort: [{key: key, operator: operator}]
|
||||||
});
|
});
|
||||||
filters[position].sort[0].operator = operator;
|
filters[index].sort[0].operator = operator;
|
||||||
pandora.UI.set({filters: filters});
|
pandora.UI.set({filters: filters});
|
||||||
} else if (data.id == 'ordermovies') {
|
} else if (data.id == 'ordermovies') {
|
||||||
var key = pandora.user.ui.listSort[0].key,
|
var key = pandora.user.ui.listSort[0].key,
|
||||||
|
@ -188,7 +188,7 @@ pandora.ui.mainMenu = function() {
|
||||||
} else if (Ox.startsWith(data.id, 'sortfilter')) {
|
} else if (Ox.startsWith(data.id, 'sortfilter')) {
|
||||||
var filters = Ox.clone(ui.filters),
|
var filters = Ox.clone(ui.filters),
|
||||||
id = data.id.replace('sortfilter', ''),
|
id = data.id.replace('sortfilter', ''),
|
||||||
position = Ox.getPositionById(filters, id),
|
index = Ox.getIndexById(filters, id),
|
||||||
type = Ox.getObjectById(pandora.site.filters, id).type,
|
type = Ox.getObjectById(pandora.site.filters, id).type,
|
||||||
key = value,
|
key = value,
|
||||||
operator = key == 'name' && type == 'string' ? '+' : '-';
|
operator = key == 'name' && type == 'string' ? '+' : '-';
|
||||||
|
@ -196,10 +196,10 @@ pandora.ui.mainMenu = function() {
|
||||||
'sortMenu_orderfilters_orderfilter' + id + '_'
|
'sortMenu_orderfilters_orderfilter' + id + '_'
|
||||||
+ (operator == '+' ? 'ascending' : 'descending')
|
+ (operator == '+' ? 'ascending' : 'descending')
|
||||||
);
|
);
|
||||||
pandora.$ui.filters[position].options({
|
pandora.$ui.filters[index].options({
|
||||||
sort: [{key: key, operator: operator}]
|
sort: [{key: key, operator: operator}]
|
||||||
});
|
});
|
||||||
filters[position].sort[0].key = key;
|
filters[index].sort[0].key = key;
|
||||||
pandora.UI.set({filters: filters});
|
pandora.UI.set({filters: filters});
|
||||||
} else if (data.id == 'sortmovies') {
|
} else if (data.id == 'sortmovies') {
|
||||||
pandora.UI.set({listSort: [{key: value, operator: ''}]});
|
pandora.UI.set({listSort: [{key: value, operator: ''}]});
|
||||||
|
|
|
@ -18,7 +18,7 @@ pandora.ui.sortSelect = function(isNavigationView) {
|
||||||
}
|
}
|
||||||
if (!pandora.user.ui.item) {
|
if (!pandora.user.ui.item) {
|
||||||
items = Ox.merge(items, Ox.map(pandora.site.sortKeys, function(key) {
|
items = Ox.merge(items, Ox.map(pandora.site.sortKeys, function(key) {
|
||||||
return Ox.getPositionById(items, key.id) == -1
|
return Ox.getIndexById(items, key.id) == -1
|
||||||
? Ox.extend(Ox.clone(key), {
|
? Ox.extend(Ox.clone(key), {
|
||||||
title: 'Sort by ' + key.title
|
title: 'Sort by ' + key.title
|
||||||
})
|
})
|
||||||
|
|
|
@ -480,7 +480,7 @@ pandora.getClipsQuery = function() {
|
||||||
if (condition.conditions) {
|
if (condition.conditions) {
|
||||||
addClipsConditions(condition.conditions);
|
addClipsConditions(condition.conditions);
|
||||||
} else if (
|
} else if (
|
||||||
Ox.getPositionById(pandora.site.layers, condition.key) > -1
|
Ox.getIndexById(pandora.site.layers, condition.key) > -1
|
||||||
&& condition.operator == '='
|
&& condition.operator == '='
|
||||||
) {
|
) {
|
||||||
clipsQuery.conditions.push(condition);
|
clipsQuery.conditions.push(condition);
|
||||||
|
@ -824,7 +824,7 @@ pandora.isClipView = function(view, item) {
|
||||||
|
|
||||||
pandora.isItemFind = function(find) {
|
pandora.isItemFind = function(find) {
|
||||||
return find.conditions.length == 1
|
return find.conditions.length == 1
|
||||||
&& Ox.getPositionById(pandora.site.layers, find.conditions[0].key) > -1
|
&& Ox.getIndexById(pandora.site.layers, find.conditions[0].key) > -1
|
||||||
&& find.conditions[0].operator == '=';
|
&& find.conditions[0].operator == '=';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -914,7 +914,7 @@ pandora.resizeFolders = function() {
|
||||||
Ox.Log('', 'RESIZE FOLDERS', width);
|
Ox.Log('', 'RESIZE FOLDERS', width);
|
||||||
pandora.$ui.allItems.resizeElement(width - 104);
|
pandora.$ui.allItems.resizeElement(width - 104);
|
||||||
Ox.forEach(pandora.$ui.folderList, function($list, id) {
|
Ox.forEach(pandora.$ui.folderList, function($list, id) {
|
||||||
var pos = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id);
|
var pos = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id);
|
||||||
pandora.$ui.folder[pos].css({width: width + 'px'});
|
pandora.$ui.folder[pos].css({width: width + 'px'});
|
||||||
$list.css({width: width + 'px'});
|
$list.css({width: width + 'px'});
|
||||||
if (pandora.user.ui.section == 'items') {
|
if (pandora.user.ui.section == 'items') {
|
||||||
|
|
Loading…
Reference in a new issue