1296 }; |
1296 }; |
1297 |
1297 |
1298 IriSP.PopcornReplacement.roundTime = function() { |
1298 IriSP.PopcornReplacement.roundTime = function() { |
1299 var currentTime = IriSP.PopcornReplacement.currentTime(); |
1299 var currentTime = IriSP.PopcornReplacement.currentTime(); |
1300 return Math.round(currentTime); |
1300 return Math.round(currentTime); |
1301 };/* utils.js - various utils that don't belong anywhere else */ |
1301 }; |
|
1302 /* utils.js - various utils that don't belong anywhere else */ |
1302 |
1303 |
1303 /* trace function, for debugging */ |
1304 /* trace function, for debugging */ |
1304 |
1305 |
1305 IriSP.traceNum = 0; |
1306 IriSP.traceNum = 0; |
1306 IriSP.trace = function( msg, value ) { |
1307 IriSP.trace = function( msg, value ) { |
4636 IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) { |
4637 IriSP.JSONSerializer.prototype.searchTweets = function(title, description, keyword) { |
4637 /* we can have many types of annotations. We want search to only look for regular segments */ |
4638 /* we can have many types of annotations. We want search to only look for regular segments */ |
4638 /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either |
4639 /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either |
4639 null or undefined. |
4640 null or undefined. |
4640 */ |
4641 */ |
4641 var view; |
4642 |
4642 |
4643 var searchViewType = this.getTweets(); |
4643 if (typeof(this._data.views) !== "undefined" && this._data.views !== null) |
4644 if (typeof(searchViewType) === "undefined") { |
4644 view = this._data.views[0]; |
4645 var view; |
4645 |
4646 |
4646 var searchViewType = ""; |
4647 if (typeof(this._data.views) !== "undefined" && this._data.views !== null) |
4647 |
4648 view = this._data.views[0]; |
4648 if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
4649 |
4649 searchViewType = view.annotation_types[0]; |
4650 if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) { |
|
4651 searchViewType = view.annotation_types[0]; |
|
4652 } |
4650 } |
4653 } |
4651 |
|
4652 var filterfn = function(annotation) { |
4654 var filterfn = function(annotation) { |
4653 if( searchViewType != "" && |
4655 if( searchViewType != "" && |
4654 typeof(annotation.meta) !== "undefined" && |
4656 typeof(annotation.meta) !== "undefined" && |
4655 typeof(annotation.meta["id-ref"]) !== "undefined" && |
4657 typeof(annotation.meta["id-ref"]) !== "undefined" && |
4656 annotation.meta["id-ref"] !== searchViewType) { |
4658 annotation.meta["id-ref"] === searchViewType) { |
4657 return false; // pass |
4659 return false; // pass |
4658 } else { |
4660 } else { |
4659 return true; |
4661 return true; |
4660 } |
4662 } |
4661 }; |
4663 }; |