# HG changeset patch # User durandn # Date 1435931344 -7200 # Node ID 5eecb7d31547e5dc964a3ae0d4b7f482e0fbc130 # Parent 2c75b482088b6f50a002aa1476a1024637486341 Tweaks to hide/show elements for several widgets to adjust for remie scenarii + More work on new widgets diff -r 2c75b482088b -r 5eecb7d31547 src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.css --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.css Fri Jul 03 15:47:35 2015 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.css Fri Jul 03 15:49:04 2015 +0200 @@ -1,7 +1,7 @@ .Ldt-AnnotationsController{ background: url(img/pinstripe.png); - width: 537px; + width: 535px; max-height: 280px; margin: 0px; margin-top: 4px; diff -r 2c75b482088b -r 5eecb7d31547 src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.js --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.js Fri Jul 03 15:47:35 2015 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.js Fri Jul 03 15:49:04 2015 +0200 @@ -13,6 +13,9 @@ IriSP.Widgets.AnnotationsController.prototype.defaults = { // If true, displaying AnnotationList will hide CreateAnnotation and vice versa. display_or_write: false, + starts_hidden: false, + hide_without_segment: false, + segments_annotation_type: "chap" }; IriSP.Widgets.AnnotationsController.prototype.template = @@ -37,20 +40,70 @@ IriSP.Widgets.AnnotationsController.prototype.draw = function() { this.renderTemplate(); var _this = this; + this.element_$ = this.$.find(".Ldt-AnnotationsController") - this.$displayButton = this.$.find(".Ldt-AnnotationsController-ShowAnnotationsListButton"); - this.$writeButton = this.$.find(".Ldt-AnnotationsController-ShowCreateAnnotationButton"); + this.displayButton_$ = this.$.find(".Ldt-AnnotationsController-ShowAnnotationsListButton"); + this.writeButton_$ = this.$.find(".Ldt-AnnotationsController-ShowCreateAnnotationButton"); - this.$writeButton.click(function(){ + this.writeButton_$.click(function(){ _this.player.trigger("CreateAnnotation.toggle"); if (_this.display_or_write){ _this.player.trigger("AnnotationsList.hide"); } }); - this.$displayButton.click(function(){ + this.displayButton_$.click(function(){ _this.player.trigger("AnnotationsList.toggle"); if (_this.display_or_write){ _this.player.trigger("CreateAnnotation.hide"); } }) + this.onMediaEvent("timeupdate", "onTimeUpdate") + + if (this.starts_hidden) { + this.visible = true + this.hide(); + } + else{ + this.visible = false + this.show(); + } + }; + +IriSP.Widgets.AnnotationsController.prototype.onTimeUpdate = function(){ + if (this.hide_without_segment){ + _currentTime = this.media.getCurrentTime() + _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type) + _currentSegments = _segmentsAnnotations.filter(function(_segment){ + return (_currentTime >= _segment.begin && _currentTime <= _segment.end) + }); + if (_currentSegments.length == 0){ + if (this.visible){ + this.hide(); + _this.player.trigger("CreateAnnotation.hide"); + _this.player.trigger("AnnotationsList.hide"); + } + } + else { + if (!this.visible){ + this.show(); + _this.player.trigger("CreateAnnotation.hide"); + _this.player.trigger("AnnotationsList.hide"); + } + } + } +} + +IriSP.Widgets.AnnotationsController.prototype.hide = function() { + if (this.visible){ + this.visible = false; + this.element_$.hide() + } +} + +IriSP.Widgets.AnnotationsController.prototype.show = function() { + if(!this.visible){ + this.visible = true; + this.element_$.show() + } +} diff -r 2c75b482088b -r 5eecb7d31547 src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css Fri Jul 03 15:47:35 2015 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css Fri Jul 03 15:49:04 2015 +0200 @@ -13,6 +13,33 @@ width: 1px; height: 1px; } +.Ldt-AnnotationsList-Filters { + display: table-cell; + width: 100%; + height: 30px; + vertical-align: middle; + text-align: center; + +} + +.Ldt-AnnotationsList-filter-text { + text-align: left; + display: inline; + margin: 4px 2px; +} + +.Ldt-AnnotationsList-filter-dropdown { + text-align: center; + display: inline; + margin: 4px 2px; +} + +.Ldt-AnnotationsList-filter-checkbox { + text-align: center; + display: inline; + margin: 4px 2px; +} + ul.Ldt-AnnotationsList-ul { list-style: none; padding: 2px; diff -r 2c75b482088b -r 5eecb7d31547 src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Fri Jul 03 15:47:35 2015 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Fri Jul 03 15:49:04 2015 +0200 @@ -35,8 +35,10 @@ newest_first : false, always_visible : false, start_visible: true, - show_audio: true, - show_creation_date: false, + show_audio : true, + show_filters : false, + show_creation_date : false, + show_timecode : true, /* * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget. */ @@ -50,7 +52,7 @@ * Show a text field that filter annotations by username */ filter_by_user: false, - + tags : true, polemics : [{ keyword: "++", background_color: "#c9ecc6" @@ -79,6 +81,13 @@ IriSP.Widgets.AnnotationsList.prototype.template = '