integration/js/ldt-serializer.js
changeset 96 7cbaa8d0a7a6
parent 92 14b9fc4a4a3d
child 187 38ce0eace032
equal deleted inserted replaced
95:5f42ac58d262 96:7cbaa8d0a7a6
    56                         "dc:creator" : _data.creator || _source.creator,
    56                         "dc:creator" : _data.creator || _source.creator,
    57                         "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
    57                         "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
    58                         "id-ref": _data.id
    58                         "id-ref": _data.id
    59                     },
    59                     },
    60                     items: _source.getAnnotationTypes().filter(function(_at) {
    60                     items: _source.getAnnotationTypes().filter(function(_at) {
    61                         return _at.media === _data;
    61                         switch (typeof _at.media) {
       
    62                             case "object":
       
    63                                 return (_at.media === _data);
       
    64                             case "string":
       
    65                                 return (_at.media === _data.id);
       
    66                             default:
       
    67                                 var _ann = _at.getAnnotations();
       
    68                                 if (_ann) {
       
    69                                     for (var i = 0; i < _ann.length; i++) {
       
    70                                         if (_ann[i].getMedia() === _data) {
       
    71                                             return true;
       
    72                                         }
       
    73                                     }
       
    74                                 }
       
    75                         }
       
    76                         return false;
    62                     }).map(function(_at) {
    77                     }).map(function(_at) {
    63                         return {
    78                         return {
    64                             "id-ref": _at.id
    79                             "id-ref": _at.id
    65                         }
    80                         }
    66                     })
    81                     })