search for ids in a case-insensitive way. popcorn-port
authorhamidouk
Fri, 13 Jan 2012 15:45:29 +0100
branchpopcorn-port
changeset 628 55282f5ef477
parent 627 13b9f14bf49a
child 629 b13bcfd2f9b1
search for ids in a case-insensitive way.
src/js/serializers/JSONSerializer.js
--- a/src/js/serializers/JSONSerializer.js	Fri Jan 13 14:18:21 2012 +0100
+++ b/src/js/serializers/JSONSerializer.js	Fri Jan 13 15:45:29 2012 +0100
@@ -314,10 +314,10 @@
   if (typeof(this._data.lists) === "undefined" || this._data.lists === null)
     return;
 
-  var e;
-  /* first get the list containing the tweets */
+  name = name.toUpperCase();
+  var e;  
   e = IriSP.underscore.find(this._data["annotation-types"], 
-                                  function(entry) { return (entry["dc:title"].indexOf(name) !== -1) });
+                                  function(entry) { return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) });
   
   if (typeof(e) === "undefined")
     return;
@@ -334,10 +334,20 @@
 
 /** return the id of the ligne de temps named "Tweets" */
 IriSP.JSONSerializer.prototype.getTweets = function() {
-  return this.getId("Tweets");
+  var val = this.getId("Tweets");
+  if (typeof(val) === "undefined")
+    val = this.getId("Tweet");
+  if (typeof(val) === "undefined")
+    val = this.getId("Twitter");
+  if (typeof(val) === "undefined")
+    val = this.getId("twit");
+  if (typeof(val) === "undefined")
+    val = this.getId("Polemic");
+  
+  return val;
 };
 
 /** return the id of the ligne de temps named "Contributions" */
 IriSP.JSONSerializer.prototype.getContributions = function() {
   return this.getId("Contributions");
-};
+};
\ No newline at end of file