Ox.getPositionById() -> Ox.getIndexById()

This commit is contained in:
rolux 2012-01-04 13:40:47 +05:30
parent e1989eed57
commit 2e4d6fd9d9
9 changed files with 19 additions and 19 deletions

View file

@ -15,7 +15,7 @@ Ox.load('UI', {
user: data.user.level == 'guest' ? Ox.clone(data.site.user) : data.user,
ui: {},
clip: function(item, inPoint, outPoint) {
Ox.print('!@#!@#!@#', inPoint, outPoint);
//Ox.print('!@#!@#!@#', inPoint, outPoint);
var that = Ox.Element();
pandora.api.get({id: item, keys: []}, function(result) {
var video = {};

View file

@ -51,7 +51,7 @@ pandora.ui.appPanel = function() {
!pandora.$ui.appPanel ? 'showScreen' : 'fadeInScreen'
]();
} else if (
Ox.getPositionById(pandora.site.sitePages, page) > -1
Ox.getIndexById(pandora.site.sitePages, page) > -1
|| page == 'software'
) {
if (pandora.$ui.siteDialog && pandora.$ui.siteDialog.is(':visible')) {

View file

@ -64,7 +64,7 @@ pandora.ui.clipList = function(videoRatio) {
// if the item query contains a layer condition,
// then this condition is added to the clip query
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);
}
});

View file

@ -1,7 +1,7 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
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),
panelWidth = pandora.$ui.document.width() - (pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize) - 1,
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),
find,
id_ = data.value,
i_ = Ox.getPositionById(pandora.user.ui.filters, id_);
i_ = Ox.getIndexById(pandora.user.ui.filters, id_);
if (i_ == -1) {
// new filter was not part of old filter set
if (pandora.user.ui._filterState[i].selected.length) {

View file

@ -4,7 +4,7 @@ pandora.ui.folderBrowserList = function(id) {
// fixme: user and name are set to the same width here,
// but resizeFolders will set them to different widths
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({
columns: [
{

View file

@ -2,7 +2,7 @@
'use strict';
pandora.ui.folderList = function(id) {
// 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;
if (pandora.user.ui.section == 'items') {
var columns, items;

View file

@ -88,7 +88,7 @@ pandora.ui.mainMenu = function() {
{ id: 'filters', title: 'Filters', items: [
{ group: 'filters', min: 5, max: 5, items: pandora.site.filters.map(function(filter) {
return Ox.extend({
checked: Ox.getPositionById(ui.filters, filter.id) > -1
checked: Ox.getIndexById(ui.filters, filter.id) > -1
}, filter);
}) },
{},
@ -168,13 +168,13 @@ pandora.ui.mainMenu = function() {
} else if (Ox.startsWith(data.id, 'orderfilter')) {
var filters = Ox.clone(pandora.user.ui.filters),
id = data.id.replace('orderfilter', ''),
position = Ox.getPositionById(filters, id),
key = filters[position].sort[0].key,
index = Ox.getIndexById(filters, id),
key = filters[index].sort[0].key,
operator = value == 'ascending' ? '+' : '-';
pandora.$ui.filters[position].options({
pandora.$ui.filters[index].options({
sort: [{key: key, operator: operator}]
});
filters[position].sort[0].operator = operator;
filters[index].sort[0].operator = operator;
pandora.UI.set({filters: filters});
} else if (data.id == 'ordermovies') {
var key = pandora.user.ui.listSort[0].key,
@ -188,7 +188,7 @@ pandora.ui.mainMenu = function() {
} else if (Ox.startsWith(data.id, 'sortfilter')) {
var filters = Ox.clone(ui.filters),
id = data.id.replace('sortfilter', ''),
position = Ox.getPositionById(filters, id),
index = Ox.getIndexById(filters, id),
type = Ox.getObjectById(pandora.site.filters, id).type,
key = value,
operator = key == 'name' && type == 'string' ? '+' : '-';
@ -196,10 +196,10 @@ pandora.ui.mainMenu = function() {
'sortMenu_orderfilters_orderfilter' + id + '_'
+ (operator == '+' ? 'ascending' : 'descending')
);
pandora.$ui.filters[position].options({
pandora.$ui.filters[index].options({
sort: [{key: key, operator: operator}]
});
filters[position].sort[0].key = key;
filters[index].sort[0].key = key;
pandora.UI.set({filters: filters});
} else if (data.id == 'sortmovies') {
pandora.UI.set({listSort: [{key: value, operator: ''}]});

View file

@ -18,7 +18,7 @@ pandora.ui.sortSelect = function(isNavigationView) {
}
if (!pandora.user.ui.item) {
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), {
title: 'Sort by ' + key.title
})

View file

@ -480,7 +480,7 @@ pandora.getClipsQuery = function() {
if (condition.conditions) {
addClipsConditions(condition.conditions);
} else if (
Ox.getPositionById(pandora.site.layers, condition.key) > -1
Ox.getIndexById(pandora.site.layers, condition.key) > -1
&& condition.operator == '='
) {
clipsQuery.conditions.push(condition);
@ -824,7 +824,7 @@ pandora.isClipView = function(view, item) {
pandora.isItemFind = function(find) {
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 == '=';
};
@ -914,7 +914,7 @@ pandora.resizeFolders = function() {
Ox.Log('', 'RESIZE FOLDERS', width);
pandora.$ui.allItems.resizeElement(width - 104);
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'});
$list.css({width: width + 'px'});
if (pandora.user.ui.section == 'items') {