init.js (910B)
1 /* Set up the environment before loading the rest of the files into Zotero */ 2 var $rdf = { 3 Util: { 4 ArrayIndexOf: function (arr, item, i) { 5 //supported in all browsers except IE<9 6 return arr.indexOf(item, i); 7 }, 8 RDFArrayRemove: function (a, x) { //removes all statements equal to x from a 9 for (var i = 0; i < a.length; i++) { 10 //TODO: This used to be the following, which didnt always work..why 11 //if(a[i] == x) 12 if (a[i].subject.sameTerm(x.subject) && a[i].predicate.sameTerm(x.predicate) && a[i].object.sameTerm(x.object) && a[i].why.sameTerm(x.why)) { 13 a.splice(i, 1); 14 return; 15 } 16 } 17 throw "RDFArrayRemove: Array did not contain " + x; 18 } 19 }, 20 log: { 21 debug: Zotero.debug, 22 warn: Zotero.debug, 23 error: Zotero.debug 24 } 25 }; 26 27 if(Zotero.RDF) { 28 Zotero.RDF.AJAW = $rdf; 29 } else { 30 Zotero.RDF = {AJAW:$rdf}; 31 } 32 33 var tabulator = {log: $rdf.log}; 34 var alert = $rdf.log.warn;