forked from 0x2620/pandora
utils: add isVideoView ('video' is a video view, not a clips view); don't throw when calling getListData on load
This commit is contained in:
parent
d677eb58b0
commit
22c0813a9b
1 changed files with 16 additions and 4 deletions
|
@ -986,7 +986,7 @@ pandora.getItemIdAndPosition = function() {
|
||||||
ret = getIdAndPositionByClipId(selected[0]);
|
ret = getIdAndPositionByClipId(selected[0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (['player', 'editor', 'timeline'].indexOf(ui.itemView) > -1) {
|
if (pandora.isVideoView()) {
|
||||||
ret = getIdAndPositionByItemId(ui.item);
|
ret = getIdAndPositionByItemId(ui.item);
|
||||||
} else if (
|
} else if (
|
||||||
['clips', 'map', 'calendar'].indexOf(ui.itemView) > -1
|
['clips', 'map', 'calendar'].indexOf(ui.itemView) > -1
|
||||||
|
@ -1074,7 +1074,7 @@ pandora.getListData = function(list) {
|
||||||
} else {
|
} else {
|
||||||
list = Ox.isUndefined(list) ? pandora.user.ui[pandora.user.ui.section.slice(0, -1)] : list;
|
list = Ox.isUndefined(list) ? pandora.user.ui[pandora.user.ui.section.slice(0, -1)] : list;
|
||||||
}
|
}
|
||||||
if (list) {
|
if (list && pandora.$ui.folderList) {
|
||||||
Ox.forEach(pandora.$ui.folderList, function($list, id) {
|
Ox.forEach(pandora.$ui.folderList, function($list, id) {
|
||||||
var ret = true;
|
var ret = true;
|
||||||
// for the current list, we have to check in which
|
// for the current list, we have to check in which
|
||||||
|
@ -1225,7 +1225,7 @@ pandora.getSpan = function(state, val, callback) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
isName = val[0] == '@';
|
isName = val[0] == '@';
|
||||||
isVideoView = Ox.contains(['player', 'editor', 'timeline'], state.view);
|
isVideoView = pandora.isVideoView(state.view);
|
||||||
canBeAnnotation = state.item && (!state.view || isVideoView) && !isName;
|
canBeAnnotation = state.item && (!state.view || isVideoView) && !isName;
|
||||||
canBeEvent = !state.view || state.view == 'calendar';
|
canBeEvent = !state.view || state.view == 'calendar';
|
||||||
canBePlace = !state.view || state.view == 'map';
|
canBePlace = !state.view || state.view == 'map';
|
||||||
|
@ -1481,7 +1481,7 @@ pandora.isClipView = function(view, item) {
|
||||||
item = pandora.user.ui.item;
|
item = pandora.user.ui.item;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
!item ? ['calendar', 'clip', 'map', 'video'] : ['calendar', 'clips', 'map']
|
!item ? ['calendar', 'clip', 'map'] : ['calendar', 'clips', 'map']
|
||||||
).indexOf(view) > -1;
|
).indexOf(view) > -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1497,6 +1497,18 @@ pandora.isPrintURL = function(url) {
|
||||||
return /^#print(\?.*?)?$/.test(hash);
|
return /^#print(\?.*?)?$/.test(hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.isVideoView = function(view, item) {
|
||||||
|
if (arguments.length == 0) {
|
||||||
|
item = pandora.user.ui.item;
|
||||||
|
view = !item ? pandora.user.ui.listView : pandora.user.ui.itemView;
|
||||||
|
} else if (arguments.length == 1) {
|
||||||
|
item = pandora.user.ui.item;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
!item ? ['video'] : ['player', 'editor', 'timeline']
|
||||||
|
).indexOf(view) > -1;
|
||||||
|
};
|
||||||
|
|
||||||
pandora.logEvent = function(data, event, element) {
|
pandora.logEvent = function(data, event, element) {
|
||||||
var element = this,
|
var element = this,
|
||||||
handlers = self.eventHandlers ? self.eventHandlers[event] : [];
|
handlers = self.eventHandlers ? self.eventHandlers[event] : [];
|
||||||
|
|
Loading…
Reference in a new issue