Updated Metadataplayer
authorveltr
Tue, 01 Oct 2013 15:59:22 +0200
changeset 87 017f45c5209f
parent 86 88017f00714b
child 88 7961b6f56445
Updated Metadataplayer
player/js/ldt-serializer.js
player/js/metadataplayer-core.js
--- a/player/js/ldt-serializer.js	Wed Jul 10 11:14:06 2013 +0200
+++ b/player/js/ldt-serializer.js	Tue Oct 01 15:59:22 2013 +0200
@@ -44,7 +44,7 @@
                         "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
                         "dc:duration" : _data.duration.milliseconds
                     }
-                }
+                };
                 _dest.medias.push(_res);
                 var _list = {
                     id: IriSP.Model.getUID(),
@@ -77,16 +77,15 @@
                     }).map(function(_at) {
                         return {
                             "id-ref": _at.id
-                        }
+                        };
                     })
-                }
+                };
                 _dest.lists.push(_list);
                 _dest.views[0].contents.push(_data.id);
             }
         },
         tag : {
             serialized_name : "tags",
-            model_name : "tag",
             deserializer : function(_data, _source) {
                 var _res = new IriSP.Model.Tag(_data.id, _source);
                 _res.title = _data.meta["dc:title"];
@@ -106,7 +105,7 @@
                         "dc:creator" : _data.creator || _source.creator,
                         "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
                     }
-                }
+                };
                 _dest.tags.push(_res);
             }
         },
@@ -127,7 +126,7 @@
                     "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified),
                     "dc:creator" : _data.creator || _source.creator,
                     "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
-                }
+                };
                 _dest["annotation-types"].push(_res);
                 _dest.views[0].annotation_types.push(_data.id);
             }
@@ -177,11 +176,11 @@
                         {
                             title : _data.title,
                             description : _data.description,
-                            audio : _data.audio,
-                            img: {
-                                src: _data.thumbnail
-                            }
-                        },
+                        audio : _data.audio,
+                        img: {
+                            src: _data.thumbnail
+                        }
+                    },
                         _data.content,
                         {
                             title: "",
@@ -198,18 +197,18 @@
                         "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator,
 //                        project : _source.projectId
                     }
-                }
+                };
                 if (_source.regenerateTags) {
                     _res.tags = IriSP._(_data.keywords).map(function(_kw) {
                         return {
                             "id-ref": _source.__keywords[_kw.toLowerCase()].id
-                        } 
+                        };
                     });
                 } else {
                     _res.tags = IriSP._(_data.tag.id).map(function(_id) {
                        return {
                            "id-ref" : _id
-                       } 
+                       };
                     });
                 }
                 _res.content.title = _data.title || _res.content.title || "";
@@ -244,7 +243,7 @@
                         return _annotation.annotation.id;
                     }),
                     id: _data.id
-                }
+                };
                 _dest.lists.push(_res);
             }
         }
@@ -284,13 +283,13 @@
                             id: IriSP.Model.getUID(),
                             title: kw,
                             regenerated: true
-                        }
+                        };
                     }
                 });
             });
             IriSP._(_source.__keywords).each(function(kw) {
                 _this.types.tag.serializer(kw, _source, _res);
-            })
+            });
         }
         _source.forEach(function(_list, _typename) {
             if (typeof _this.types[_typename] !== "undefined") {
--- a/player/js/metadataplayer-core.js	Wed Jul 10 11:14:06 2013 +0200
+++ b/player/js/metadataplayer-core.js	Tue Oct 01 15:59:22 2013 +0200
@@ -99,10 +99,10 @@
     }
     
     addToList(/(https?:\/\/)?[\w\d\-]+\.[\w\d\-]+\S+/gm, function(matches) {
-        return '<a href="' + (matches[1] ? '' : 'http://') + matches[0] + '" target="_blank">'
+        return '<a href="' + (matches[1] ? '' : 'http://') + matches[0] + '" target="_blank">';
     }, '</a>');
     addToList(/@([\d\w]{1,15})/gm, function(matches) {
-        return '<a href="http://twitter.com/' + matches[1] + '" target="_blank">'
+        return '<a href="http://twitter.com/' + matches[1] + '" target="_blank">';
     }, '</a>');
     addToList(/\*[^*]+\*/gm, '<b>', '</b>');
     addToList(/[\n\r]+/gm, '', '<br />');
@@ -114,7 +114,7 @@
     positions = IriSP._(positions)
         .chain()
         .uniq()
-        .sortBy(function(p) { return parseInt(p) })
+        .sortBy(function(p) { return parseInt(p); })
         .value();
     
     var res = "", lastIndex = 0;
@@ -168,9 +168,9 @@
     var _this = this,
         noop = (function() {});
     IriSP._(properties).each(function(p) {
-        _this[p] = noop
+        _this[p] = noop;
     });
-}
+};
 
 /* js is where data is stored in a standard form, whatever the serializer */
 
@@ -227,7 +227,7 @@
     isLocalURL = Model.isLocalURL = function(url) {
         var matches = url.match(/^(\w+:)\/\/([^/]+)/);
         if (matches) {
-            return(matches[1] === document.location.protocol && matches[2] === document.location.host)
+            return(matches[1] === document.location.protocol && matches[2] === document.location.host);
         }
         return true;
     },
@@ -254,7 +254,7 @@
     fullTextRegexps = Model.fullTextRegexps = function(_text) {
         var remsrc = "[\\" + removeChars.join("\\") + "]",
             remrx = new RegExp(remsrc,"gm"),
-            txt = _text.toLowerCase().replace(remrx,"")
+            txt = _text.toLowerCase().replace(remrx,""),
             res = [],
             charsrx = ns._(charsub).map(function(c) {
                 return new RegExp(c);
@@ -304,7 +304,7 @@
             + pad(2, d.getUTCDate())+'T'  
             + pad(2, d.getUTCHours())+':'  
             + pad(2, d.getUTCMinutes())+':'  
-            + pad(2, d.getUTCSeconds())+'Z'  
+            + pad(2, d.getUTCSeconds())+'Z'  ;
     };
 
 /*
@@ -327,7 +327,7 @@
             _element.found = undefined;
         });
         _this.trigger("search-cleared");
-    })
+    });
 };
 
 List.prototype = new Array();
@@ -345,7 +345,7 @@
         ns._(this).forEach(function(_value, _key) {
             _callback(_value, _key, _this);
         });
-    }
+    };
 };
 
 if (typeof Array.prototype.map === "undefined") {
@@ -354,7 +354,7 @@
         return ns._(this).map(function(_value, _key) {
             return _callback(_value, _key, _this);
         });
-    }
+    };
 };
 
 List.prototype.pluck = function(_key) {
@@ -434,9 +434,9 @@
     }
     this.searching = true;
     this.trigger("search", _text);
-    var rxsource = fullTextRegexps(_text)
-        rgxp = new RegExp(rxsource,"im"),
-        this.regexp = new RegExp(rxsource,"gim");
+    var rxsource = fullTextRegexps(_text),
+        rgxp = new RegExp(rxsource,"im");
+    this.regexp = new RegExp(rxsource,"gim");
     var res = this.filter(function(_element, _k) {
         var titlematch = rgxp.test(_element.title),
             descmatch = rgxp.test(_element.description),
@@ -456,7 +456,7 @@
 };
 
 List.prototype.addId = function(_id) {
-    var _el = this.directory.getElement(_id)
+    var _el = this.directory.getElement(_id);
     if (!this.hasId(_id) && typeof _el !== "undefined") {
         this.idIndex.push(_id);
         Array.prototype.push.call(this, _el);
@@ -589,7 +589,7 @@
         minutes : (Math.floor(_totalSeconds / 60) % 60),
         seconds : _totalSeconds % 60,
         milliseconds: this.milliseconds % 1000
-    } 
+    };
 };
 
 Time.prototype.add = function(_milliseconds) {
@@ -604,11 +604,11 @@
     var _hms = this.getHMS(),
         _res = '';
     if (_hms.hours) {
-        _res += _hms.hours + ':'
+        _res += _hms.hours + ':';
     }
     _res += pad(2, _hms.minutes) + ':' + pad(2, _hms.seconds);
     if (showCs) {
-        _res += "." + Math.floor(_hms.milliseconds / 100)
+        _res += "." + Math.floor(_hms.milliseconds / 100);
     }
     return _res;
 };
@@ -646,7 +646,7 @@
 
 Reference.prototype.isOrHasId = function(_idRef) {
     if (this.isList) {
-        return (ns._(this.id).indexOf(_idRef) !== -1)
+        return (ns._(this.id).indexOf(_idRef) !== -1);
     } else {
         return (this.id == _idRef);
     }
@@ -658,7 +658,7 @@
     this.elementType = 'element';
     this.title = "";
     this.description = "";
-    this.__events = {}
+    this.__events = {};
     if (typeof _source === "undefined") {
         return;
     }
@@ -740,14 +740,14 @@
     this.on("timeupdate", function(_time) {
         _this.currentTime = _time;
         _this.getAnnotations().filter(function(_a) {
-            return (_a.end <= _time || _a.begin > _time) && _a.playing
+            return (_a.end <= _time || _a.begin > _time) && _a.playing;
         }).forEach(function(_a) {
             _a.playing = false;
             _a.trigger("leave");
             _this.trigger("leave-annotation",_a);
         });
         _this.getAnnotations().filter(function(_a) {
-            return _a.begin <= _time && _a.end > _time && !_a.playing
+            return _a.begin <= _time && _a.end > _time && !_a.playing;
         }).forEach(function(_a) {
             _a.playing = true;
             _a.trigger("enter");
@@ -830,7 +830,7 @@
             return ns._(_annTypes).indexOf(_annotation.getAnnotationType().id) !== -1;
         });
     } else {
-        return new List(this.source.directory)
+        return new List(this.source.directory);
     }
 };
 
@@ -926,7 +926,7 @@
 };
 
 Annotation.prototype.getDuration = function() {
-    return new Time(this.end.milliseconds - this.begin.milliseconds)
+    return new Time(this.end.milliseconds - this.begin.milliseconds);
 };
 
 /* */
@@ -993,7 +993,7 @@
     this._updateTimes = function() {
         _this.updateTimes();
         _this.trigger("change");
-    }
+    };
     this.on("add", this._updateTimes);
     this.on("remove", this._updateTimes);
 };
@@ -1082,19 +1082,19 @@
 
 Mashup.prototype.hasAnnotation = function(_annotation) {
     return !!ns._(this.segments).find(function(_s) {
-        return _s.annotation === _annotation
+        return _s.annotation === _annotation;
     });
 };
 
 Mashup.prototype.getAnnotation = function(_annotation) {
     return ns._(this.segments).find(function(_s) {
-        return _s.annotation === _annotation
+        return _s.annotation === _annotation;
     });
 };
 
 Mashup.prototype.getAnnotationById = function(_id) {
     return ns._(this.segments).find(function(_s) {
-        return _s.annotation.id === _id
+        return _s.annotation.id === _id;
     });
 };
 
@@ -1113,8 +1113,8 @@
 Mashup.prototype.getMedias = function() {
     var medias = new List(this.source.directory);
     this.segments.forEach(function(_annotation) {
-        medias.push(_annotation.getMedia())
-    })
+        medias.push(_annotation.getMedia());
+    });
     return medias;
 };
 
@@ -1125,7 +1125,7 @@
             return ns._(_annTypes).indexOf(_annotation.getAnnotationType().id) !== -1;
         });
     } else {
-        return new List(this.source.directory)
+        return new List(this.source.directory);
     }
 };
 
@@ -1159,7 +1159,7 @@
         var _this = this;
         ns._(_config).forEach(function(_v, _k) {
             _this[_k] = _v;
-        })
+        });
         this.callbackQueue = [];
         this.contents = {};
         this.get();
@@ -1183,7 +1183,7 @@
         });
     } else {
         if (typeof this.contents[_listId] === "undefined") {
-            this.contents[_listId] = new IriSP.List(this.directory);
+            this.contents[_listId] = new List(this.directory);
         }
         return this.contents[_listId];
     }
@@ -1193,7 +1193,7 @@
     var _this = this;
     ns._(this.contents).forEach(function(_value, _key) {
         _callback.call(_this, _value, _key);
-    })
+    });
 };
 
 Source.prototype.getElement = function(_elId) {
@@ -1266,7 +1266,7 @@
         _annTypes = this.getAnnotationTypes(_global).searchByTitle(_title);
     _annTypes.forEach(function(_annType) {
         _res.addElements(_annType.getAnnotations(_global));
-    })
+    });
     return _res;
 };
 
@@ -1462,7 +1462,7 @@
         getVolume();
         media.trigger("loadedmetadata");
         media.trigger("volumechange");
-    })
+    });
     
     videoEl.on("timeupdate", function() {
         media.trigger("timeupdate", new IriSP.Model.Time(1000*mediaEl.currentTime));
@@ -1471,7 +1471,7 @@
     videoEl.on("volumechange", function() {
         getVolume();
         media.trigger("volumechange");
-    })
+    });
     
     videoEl.on("play", function() {
         media.trigger("play");