getSpan gets type now
This commit is contained in:
parent
d6861f9171
commit
f8830119e0
1 changed files with 39 additions and 32 deletions
|
@ -690,6 +690,9 @@ pandora.getItemByIdOrTitle = function(type, str, callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (type == 'text') {
|
||||||
|
// /number is page for pdf or percent for html
|
||||||
|
callback(str.replace(/\/\d+$/, ''));
|
||||||
} else {
|
} else {
|
||||||
callback(str);
|
callback(str);
|
||||||
}
|
}
|
||||||
|
@ -793,42 +796,46 @@ pandora.getListData = function(list) {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.getMetadataByIdOrName = function(item, view, str, callback) {
|
pandora.getMetadataByIdOrName = function(type, item, view, str, callback) {
|
||||||
// For a given item (or none) and a given view (or any), this takes a string
|
// For a given item (or none) and a given view (or any), this takes a string
|
||||||
// and checks if it's an annotation/event/place id or an event/place name,
|
// and checks if it's an annotation/event/place id or an event/place name,
|
||||||
// and returns the id (or none) and the view (or none)
|
// and returns the id (or none) and the view (or none)
|
||||||
// fixme: "subtitles:23" is still missing
|
// fixme: "subtitles:23" is still missing
|
||||||
Ox.Log('URL', 'getMetadataByIdOrName', item, view, str);
|
if (type == pandora.site.itemName.plural.toLowerCase()) {
|
||||||
var isName = str[0] == '@',
|
var isName = str[0] == '@',
|
||||||
canBeAnnotation = (
|
canBeAnnotation = (
|
||||||
!view || Ox.contains(['player', 'editor', 'timeline'], view)
|
!view || Ox.contains(['player', 'editor', 'timeline'], view)
|
||||||
) && item && !isName,
|
) && item && !isName,
|
||||||
canBeEvent = !view || view == 'calendar',
|
canBeEvent = !view || view == 'calendar',
|
||||||
canBePlace = !view || view == 'map';
|
canBePlace = !view || view == 'map';
|
||||||
str = isName ? str.slice(1) : str;
|
str = isName ? str.slice(1) : str;
|
||||||
getId(canBeAnnotation ? 'annotation' : '', function(id) {
|
getId(canBeAnnotation ? 'annotation' : '', function(id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
Ox.Log('URL', 'id?', id)
|
Ox.Log('URL', 'id?', id)
|
||||||
callback(id, pandora.user.ui.videoView);
|
callback(id, pandora.user.ui.videoView);
|
||||||
} else {
|
} else {
|
||||||
getId(canBePlace ? 'place' : '', function(id) {
|
getId(canBePlace ? 'place' : '', function(id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
Ox.Log('', 'found place id', id)
|
Ox.Log('', 'found place id', id)
|
||||||
callback(id, 'map');
|
callback(id, 'map');
|
||||||
} else {
|
} else {
|
||||||
getId(canBeEvent ? 'event' : '', function(id) {
|
getId(canBeEvent ? 'event' : '', function(id) {
|
||||||
if (id) {
|
if (id) {
|
||||||
callback(id, 'calendar');
|
callback(id, 'calendar');
|
||||||
} else if (canBePlace && isName) {
|
} else if (canBePlace && isName) {
|
||||||
callback('@' + str, 'map');
|
callback('@' + str, 'map');
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (type == 'text') {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
|
||||||
function getId(type, callback) {
|
function getId(type, callback) {
|
||||||
if (type) {
|
if (type) {
|
||||||
pandora.api['find' + Ox.toTitleCase(type + 's')](Ox.extend({
|
pandora.api['find' + Ox.toTitleCase(type + 's')](Ox.extend({
|
||||||
|
|
Loading…
Reference in a new issue