From 119f85d76e7f2478c1a1ab959e3b5d1f1d27956f Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 8 Nov 2013 17:28:35 +0000 Subject: [PATCH] parse text spans --- static/js/utils.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/static/js/utils.js b/static/js/utils.js index 8779d87c..dc347e4b 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1462,6 +1462,7 @@ pandora.getSpan = function(state, val, callback) { // event/place name (string), and in that case sets state.span, and may // modify state.view. // fixme: "subtitles:23" is still missing + Ox.print('GET SPAN', state, val) if (state.type == pandora.site.itemName.plural.toLowerCase()) { var isArray = Ox.isArray(val), isName, isVideoView, canBeAnnotation, canBeEvent, canBePlace; @@ -1527,8 +1528,18 @@ pandora.getSpan = function(state, val, callback) { }); } } else if (state.type == 'texts') { - state.span = val; - callback(); + pandora.api.getText({id: state.item}, function(result) { + if (isArray) { + if (result.data.type == 'html') { + state.span = Ox.limit(val[0], 0, 100); + } else { + state.span = Math.floor(Ox.limit(val[0], 1, result.data.pages)); + } + } else if (result.data.type == 'html' && Ox.contains(result.data.names, val)) { + state.span = val; + } + callback(); + }); } function getId(type, callback) {