| author | veltr |
| Fri, 27 Jul 2012 19:22:54 +0200 | |
| branch | new-model |
| changeset 930 | 165f236e42f2 |
| parent 929 | a39ff507b050 |
| child 931 | 0fdce6e14748 |
| child 933 | 8604bc7b4712 |
--- a/src/js/defaults.js Fri Jul 27 19:22:25 2012 +0200 +++ b/src/js/defaults.js Fri Jul 27 19:22:54 2012 +0200 @@ -19,12 +19,17 @@ zeroClipboardSwf: "ZeroClipboard.swf" }, locations : { - // use to define locations outside defautl_dir + // use to define locations outside default_dir }, cdn : { - jQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js", + jQuery : "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js", + jQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.min.js", swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", - cssjQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css" + cssjQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/themes/ui-lightness/jquery-ui.css", + underscore : "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js", + Mustache : "http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.5.0-dev/mustache.min.js", + raphael : "http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js", + json : "http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js" }, useCdn : false }
--- a/src/js/model.js Fri Jul 27 19:22:25 2012 +0200 +++ b/src/js/model.js Fri Jul 27 19:22:54 2012 +0200 @@ -94,12 +94,8 @@ IriSP.Model.List.prototype = new Array(); -IriSP.Model.List.prototype.getElement = function(_id) { - return this[_id]; -} - IriSP.Model.List.prototype.hasId = function(_id) { - return (IriSP._(this.idIndex).indexOf(_id) !== -1); + return IriSP._(this.idIndex).include(_id); } /* On recent browsers, forEach and map are defined and do what we want.
--- a/src/widgets/AnnotationsList.js Fri Jul 27 19:22:25 2012 +0200 +++ b/src/widgets/AnnotationsList.js Fri Jul 27 19:22:54 2012 +0200 @@ -47,7 +47,7 @@ '<div class="Ldt-AnnotationsListWidget">' + '<ul class="Ldt-AnnotationsList-ul">' + '{{#annotations}}' - + '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}" style="{{specific_style}}">' + + '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">' + '<div class="Ldt-AnnotationsList-ThumbContainer">' + '<a href="{{url}}">' + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />' @@ -206,6 +206,7 @@ }); var _res = { id : _annotation.id, + media_id : _annotation.getMedia().id, title : _title, description : _description, begin : _annotation.begin.toString(),
--- a/src/widgets/Polemic.js Fri Jul 27 19:22:25 2012 +0200 +++ b/src/widgets/Polemic.js Fri Jul 27 19:22:54 2012 +0200 @@ -25,18 +25,22 @@ foundcolor : "#fc00ff", polemics : [ { + "name" : "OK", "keywords" : [ "++" ], "color" : "#1D973D" }, { + "name" : "KO", "keywords" : [ "--" ], "color" : "#CE0A15" }, { + "name" : "REF", "keywords" : [ "==", "http://" ], "color" : "#C5A62D" }, { + "name" : "Q", "keywords" : [ "?" ], "color" : "#036AAE" } @@ -144,12 +148,14 @@ var _x = 0, _html = ''; - function displayElement(_x, _y, _color, _id, _title) { + function displayElement(_x, _y, _color, _id, _title, _polemic) { _html += Mustache.to_html( - '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}" annotation-id="{{id}}" tweet-title="{{title}}" pos-x="{{posx}}" pos-y="{{top}}" polemic-color="{{color}}"' + '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id={{media_id}}, polemic={{polemic}}" annotation-id="{{id}}" tweet-title="{{title}}" pos-x="{{posx}}" pos-y="{{top}}" polemic-color="{{color}}"' + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>', { id: _id, + media_id: _this.source.currentMedia.id, + polemic: _polemic, title: _title, posx: Math.floor(_x + (_this.element_width - 1) / 2), left: _x, @@ -164,13 +170,14 @@ var _y = _this.height; _slice.annotations.forEach(function(_annotation) { _y -= _this.element_height; - displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title); + displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title, "none"); }); IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { - var _color = _this.polemics[_j].color; + var _color = _this.polemics[_j].color, + _polemic = _this.polemics[_j].name; _annotations.forEach(function(_annotation) { _y -= _this.element_height; - displayElement(_x, _y, _color, _annotation.id, _annotation.title); + displayElement(_x, _y, _color, _annotation.id, _annotation.title, _polemic); }); }); _x += _this.element_width; @@ -215,13 +222,15 @@ _html = '', _scale = this.max_elements * this.element_height / _max; - function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end) { + function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end, _polemic) { _html += Mustache.to_html( - '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-block,time:{{begin}}" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"' + '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-block, media-id={{media_id}}, polemic={{polemic}}, time:{{begin}}" pos-x="{{posx}}" pos-y="{{top}}" annotation-counts="{{nums}}" begin-time="{{begin}}" end-time="{{end}}"' + ' style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>', { nums: _nums, posx: Math.floor(_x + (_this.element_width - 1) / 2), + media_id: _this.source.currentMedia.id, + polemic: _polemic, left: _x, top: _y, color: _color, @@ -240,14 +249,15 @@ if (_slice.annotations.length) { var _h = Math.ceil(_scale * _slice.annotations.length); _y -= _h; - displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end); + displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end, "none"); } IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { if (_annotations.length) { var _color = _this.polemics[_j].color, + _polemic = _this.polemics[_j].name, _h = Math.ceil(_scale * _annotations.length); _y -= _h; - displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end); + displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end, _polemic); } }); _x += _this.element_width;
--- a/src/widgets/Segments.js Fri Jul 27 19:22:25 2012 +0200 +++ b/src/widgets/Segments.js Fri Jul 27 19:22:54 2012 +0200 @@ -14,7 +14,7 @@ IriSP.Widgets.Segments.prototype.template = '<div class="Ldt-Segments-List">{{#segments}}' - + '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}" segment-id="{{id}}" segment-text="{{text}}" segment-color="{{color}}" center-pos="{{center}}" begin-seconds="{{beginseconds}}"' + + '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}" segment-id="{{id}}" segment-text="{{text}}" segment-color="{{color}}" center-pos="{{center}}" begin-seconds="{{beginseconds}}"' + 'style="left:{{left}}px; width:{{width}}px; background:{{color}}"></div>' + '{{/segments}}</div>' + '<div class="Ldt-Segments-Position"></div>' @@ -47,7 +47,8 @@ left : Math.floor( _left ), width : Math.floor( _width ), center : Math.floor( _center ), - id : _annotation.id + id : _annotation.id, + media_id : _annotation.getMedia().id } }) }));
--- a/src/widgets/Trace.js Fri Jul 27 19:22:25 2012 +0200 +++ b/src/widgets/Trace.js Fri Jul 27 19:22:54 2012 +0200 @@ -85,7 +85,7 @@ _traceInfo = _target.attr("trace-info"), _lastTarget = _name + (_id && _id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class && _class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : ''); _data.target = _lastTarget - if (typeof _traceInfo == "string" && _traceInfo.length && _traceInfo.length < 140) { + if (typeof _traceInfo == "string" && _traceInfo.length) { _data.traceInfo = _traceInfo; _lastTarget += ( ";" + _traceInfo ); } @@ -150,7 +150,7 @@ IriSP._(_arg).extend(this.extend); } this.tracer.trace(_traceName, _arg); - if (this.js_console) { + if (this.js_console && typeof window.console !== "undefined" && typeof console.log !== "undefined") { console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");"); } }