1
0
Fork 0
forked from 0x2620/oxjs

update Ox.URL

This commit is contained in:
rlx 2012-01-06 17:28:53 +05:30
commit dc4a8bf464
3 changed files with 38 additions and 41 deletions

View file

@ -125,9 +125,12 @@ example.com/2001/2001 -> example.com/0062622/video/00:33:21
example.com/2002/2002 -> example.com/calendar/2002/2002
2002 is a valid duration, but no list view supports durations. Then it is
read as a year, and we get calendar view with find *=2002
example.com/@paris/london -> example.com/map/@paris/london
paris matches place ABC (case-insensitive), but (assuming) find *=london
does not match place ABC, "paris" becomes the map query
example.com/@paris/paris -> example.com/map/ABC/paris
paris matches a place name (case-insensitive), so we get map view, zoomed to
Paris, with find *=paris
paris matches place ABC (case-insensitive), so we get map view, zoomed to
ABC/Paris, which is selected, with find *=paris
example.com/@renaissance/renaissance -> example.com/calendar/ABC/renaissance
renaissaince matches an event name (case-insensitive), so we get calendar
view, zoomed to the Renaissance, with find *=renaissance
@ -200,13 +203,9 @@ Ox.URL = function(options) {
function constructFind(find) {
return find.conditions.map(function(condition) {
var ret;
if (condition.conditions) {
ret = '(' + constructFind(condition) + ')';
} else {
ret = constructCondition(condition);
}
return ret;
return condition.conditions
? '(' + constructFind(condition) + ')'
: constructCondition(condition);
}).join(find.operator);
}
@ -275,10 +274,7 @@ Ox.URL = function(options) {
type = Ox.isArray(findKey.type) ? findKey.type[0] : findKey.type,
value = str,
values = findKey.values;
if (type == 'enum') {
return values[value];
}
return value;
return type == 'enum' ? values[value] : value;
}
function decodeValue(str) {
@ -531,6 +527,7 @@ Ox.URL = function(options) {
if (!state.span && /^[A-Z@]/.test(parts[0])) {
// test for span id or name
self.options.getSpan(state.item, state.view, parts[0].replace(/%20/g, ' '), function(span, view) {
Ox.Log('Core', 'span/view', span, view)
if (span) {
if (!state.view) {
// set list or item view