diff -r ac66e2240e1e -r 8da49ff273e0 test/integration/allocine_dossier_independant/js/LdtPlayer-release.js
--- a/test/integration/allocine_dossier_independant/js/LdtPlayer-release.js Fri Mar 30 18:00:26 2012 +0200
+++ b/test/integration/allocine_dossier_independant/js/LdtPlayer-release.js Tue Apr 03 20:30:12 2012 +0200
@@ -1091,10 +1091,11 @@
IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}
";
IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}";
IriSP.arrowWidget_template = "
";
-IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}";
+IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}";
IriSP.createAnnotation_errorMessage_template = " {{l10n.empty_annotation}}
";
+IriSP.loading_template = "{{l10n.loading_wait}}
";
IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}
";
-IriSP.player_template = "{{! template for the radio player }}
{{^disable_annotate_btn}}
{{/disable_annotate_btn}} {{^disable_search_btn}}
{{/disable_search_btn}}
";
+IriSP.player_template = "{{! template for the radio player }}
{{^disable_annotate_btn}}
{{/disable_annotate_btn}} {{^disable_search_btn}}
{{/disable_search_btn}}
";
IriSP.search_template = "{{! template for the search container }}
";
IriSP.share_template = "{{! social network sharing template }} ";
IriSP.sliceWidget_template = "{{! template for the slice widget }}";
@@ -1216,7 +1217,7 @@
/* shortcut to have global variables in templates */
IriSP.templToHTML = function(template, values) {
- var params = IriSP.jQuery.extend(
+ var params = IriSP.underscore.extend(
{ "defaults" : IriSP.default_templates_vars,
"l10n" : IriSP.i18n.getMessages()
},
@@ -1423,11 +1424,11 @@
};
IriSP.PopcornReplacement.player.prototype.pause = function() {
- if ( !this.media.paused ) {
+// if ( !this.media.paused ) {
this.media.paused = true;
this.trigger( "pause" );
this.playerFns.pause();
- }
+// }
};
IriSP.PopcornReplacement.player.prototype.muted = function(val) {
@@ -1451,6 +1452,22 @@
}
};
+IriSP.PopcornReplacement.player.prototype.volume = function(val) {
+ if (typeof this.playerFns.getVolume == "undefined" || typeof this.playerFns.setVolume == "undefined") {
+ return false;
+ }
+ var _vol = this.playerFns.getVolume();
+ if (typeof(val) !== "undefined" && parseFloat(val) !== NaN) {
+ val = Math.max(0, Math.min(1, val));
+ if (parseFloat(val) != parseFloat(_vol)) {
+ this.playerFns.setVolume(val);
+ this.trigger("volumechange");
+ _vol = this.playerFns.getVolume();
+ }
+ }
+ return _vol;
+};
+
IriSP.PopcornReplacement.player.prototype.mute = IriSP.PopcornReplacement.player.prototype.muted;
IriSP.PopcornReplacement.player.prototype.code = function(options) {
@@ -1918,7 +1935,10 @@
/* this is a shortcut */
this.selector = IriSP.jQuery("#" + this._div);
- this.selector.css("width", this._width);
+ this.selector.css({
+ "width": this._width,
+ "clear": "both"
+ });
if (this._height !== undefined)
this.selector.css("height", this._height);
@@ -1948,7 +1968,7 @@
var spacerDiv = IriSP.guid("LdtPlayer_spacer_");
this._widgets.push([widgetName, newDiv]);
- var divTempl = "
1) {
+ IriSP.jQuery(_jq[Math.floor(_jq.length*Math.random())]).show();
+ } else {
+ _jq.show();
+ break;
+ }
+ }
+ if (this.selector.find(".Ldt-createAnnotation-keywords li:hidden").length == 0) {
+ this.selector.find('.Ldt-createAnnotation-moar-keywordz').hide();
+ }
+}
+
/* Handles adding keywords and polemics */
IriSP.createAnnotationWidget.prototype.addKeyword = function(_keyword) {
var _field = this.selector.find(".Ldt-createAnnotation-Description"),
@@ -3389,7 +3463,7 @@
? _contents.replace(_rx,"").replace(" "," ").trim()
: _contents.trim() + " " + _keyword
);
- _field.val(_contents);
+ _field.val(_contents.trim());
_field.trigger("js_mod");
}
@@ -3451,7 +3525,7 @@
/** watch for changes in the textfield and change the buttons accordingly */
IriSP.createAnnotationWidget.prototype.handleTextChanges = function(event) {
var contents = this.selector.find(".Ldt-createAnnotation-Description").val();
- if (this.cinecast_version && !this._Popcorn.media.paused) {
+ if (this.cinecast_version) {
this._Popcorn.pause();
}
this.selector.find(".Ldt-createAnnotation-btnblock button").each(function() {
@@ -3626,7 +3700,17 @@
meta.created = Date().toString();
// All #hashtags are added to tags
- annotation.tags = contents.match(/#[^#\s]+\b/gim) || [];
+ var _tags = contents.toLowerCase().match(/#[^#\s]+\b/gim) || [];
+ this.selector.find('.Ldt-createAnnotation-keyword-button').each(function() {
+ var _tx = IriSP.jQuery(this).text(),
+ _rx = IriSP.regexpFromText(_tx);
+ if (_rx.test(contents)) {
+ _tags.push(_tx.toLowerCase())
+ }
+ });
+
+ annotation.tags = IriSP.underscore.uniq(_tags);
+
var jsonString = JSON.stringify(apiJson);
var project_id = this._serializer._data.meta.id;
@@ -3643,9 +3727,9 @@
//dataType: 'json',
success: IriSP.wrap(this, function(json, textStatus, XMLHttpRequest) {
/* add the annotation to the annotation and tell the world */
- if (this.cinecast_version) {
- var annotation = json.annotations[0];
- } else {
+ var annotation = json.annotations[0];
+
+ if (!this.cinecast_version) {
/* if the media doesn't have a contributions line, we need to add one */
if (typeof(this._serializer.getContributions()) === "undefined") {
/* set up a basic view */
@@ -3664,8 +3748,10 @@
annotation.meta = meta;
annotation.meta["id-ref"] = json.annotations[0]["type"];
+ } else {
+ annotation.type = "cinecast:UserAnnotation";
}
-
+ annotation.is_new = true;
// everything is shared so there's no need to propagate the change
_this._serializer._data.annotations.push(annotation);
@@ -3708,7 +3794,9 @@
"annotate": "Annotate",
"search": "Search",
"elapsed_time": "Elapsed time",
- "total_time": "Total time"
+ "total_time": "Total time",
+ "volume": "Volume",
+ "volume_control": "Volume control"
},
"fr": {
"play_pause": "Lecture/Pause",
@@ -3720,7 +3808,9 @@
"annotate": "Annoter",
"search": "Rechercher",
"elapsed_time": "Durée écoulée",
- "total_time": "Durée totale"
+ "total_time": "Durée totale",
+ "volume": "Niveau sonore",
+ "volume_control": "Réglage du niveau sonore"
}
}
);
@@ -3750,7 +3840,7 @@
this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater));
this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater));
- this._Popcorn.listen("volumechange", IriSP.wrap(this, this.muteButtonUpdater));
+ this._Popcorn.listen("volumechange", IriSP.wrap(this, this.volumeUpdater));
this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater));
// update the time display for the first time.
@@ -3766,7 +3856,20 @@
{ self._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); });
this.selector.find(".Ldt-CtrlSearch").click(function() { self.searchButtonHandler.call(self); });
- this.selector.find('.Ldt-CtrlSound').click(function() { self.muteHandler.call(self); } );
+ var _volctrl = this.selector.find(".Ldt-Ctrl-Volume-Control");
+ this.selector.find('.Ldt-CtrlSound')
+ .click(function() { self.muteHandler.call(self); } )
+ .mouseover(function() {
+ _volctrl.show();
+ })
+ .mouseout(function() {
+ _volctrl.hide();
+ });
+ _volctrl.mouseover(function() {
+ _volctrl.show();
+ }).mouseout(function() {
+ _volctrl.hide();
+ });
/*
var searchButtonPos = this.selector.find(".Ldt-CtrlSearch").position();
@@ -3777,8 +3880,19 @@
// trigger an IriSP.PlayerWidget.MouseOver to the widgets that are interested (i.e : sliderWidget)
this.selector.hover(function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOver"); },
function() { self._Popcorn.trigger("IriSP.PlayerWidget.MouseOut"); });
+ this.selector.find(".Ldt-Ctrl-Volume-Cursor").draggable({
+ axis: "x",
+ drag: function(event, ui) {
+ var _vol = Math.max(0, Math.min( 1, ui.position.left / (ui.helper.parent().width() - ui.helper.outerWidth())));
+ ui.helper.attr("title",IriSP.i18n.getMessage('volume')+': ' + Math.floor(100*_vol) + '%');
+ self._Popcorn.volume(_vol);
+ },
+ containment: "parent"
+ });
- this.muteButtonUpdater(); /* some player - jwplayer notable - save the state of the mute button between sessions */
+ setTimeout(function() {
+ self.volumeUpdater();
+ }, 1000); /* some player - jwplayer notable - save the state of the mute button between sessions */
};
/* Update the elasped time div */
@@ -3835,25 +3949,28 @@
};
IriSP.PlayerWidget.prototype.muteHandler = function() {
- if (!this._Popcorn.muted()) {
- this._Popcorn.mute(true);
- } else {
- this._Popcorn.mute(false);
+ this._Popcorn.mute(!this._Popcorn.muted());
+};
+
+IriSP.PlayerWidget.prototype.volumeUpdater = function() {
+ var _muted = this._Popcorn.muted(),
+ _vol = this._Popcorn.volume();
+ if (_vol === false) {
+ _vol = .5;
}
-};
-
-IriSP.PlayerWidget.prototype.muteButtonUpdater = function() {
- var status = this._Popcorn.media.muted;
-
- if ( status == true ){
- this.selector.find(".Ldt-CtrlSound").attr("title", IriSP.i18n.getMessage('unmute'));
- this.selector.find(".Ldt-CtrlSound").removeClass("Ldt-CtrlSound-MuteState").addClass("Ldt-CtrlSound-SoundState");
- } else {
- this.selector.find(".Ldt-CtrlSound").attr("title", IriSP.i18n.getMessage('mute'));
- this.selector.find(".Ldt-CtrlSound").removeClass("Ldt-CtrlSound-SoundState").addClass("Ldt-CtrlSound-MuteState");
- }
-
- return;
+ var _soundCtl = this.selector.find(".Ldt-CtrlSound");
+ _soundCtl.removeClass("Ldt-CtrlSound-Mute Ldt-CtrlSound-Half Ldt-CtrlSound-Full");
+ if (_muted) {
+ _soundCtl.attr("title", IriSP.i18n.getMessage('unmute'))
+ .addClass("Ldt-CtrlSound-Mute");
+ } else {
+ _soundCtl.attr("title", IriSP.i18n.getMessage('mute'))
+ .addClass(_vol < .5 ? "Ldt-CtrlSound-Half" : "Ldt-CtrlSound-Full" )
+ }
+ var _cursor = this.selector.find(".Ldt-Ctrl-Volume-Cursor");
+ _cursor.css({
+ "left": ( _muted ? 0 : Math.floor(_vol * (_cursor.parent().width() - _cursor.outerWidth())) ) + "px"
+ })
};
IriSP.PlayerWidget.prototype.showSearchBlock = function() {
@@ -4956,7 +5073,6 @@
this.selector.css("background", this._config.background);
}
this.checkOption('cinecast_version');
- console.log('Cinecast', this.cinecast_version);
};
@@ -4988,7 +5104,7 @@
// If we've found the correct view, feed the directly the data from the view
// to jquery sparkline. Otherwise, compute it ourselves.
if (!IriSP.null_or_undefined(stat_view)) {
- console.log("sparklinewidget : using stats embedded in the json");
+ //console.log("sparklinewidget : using stats embedded in the json");
var _results = stat_view.meta.stat.split(",");
} else {
var _annotations = this._serializer._data.annotations,
@@ -5588,8 +5704,9 @@
}
this.lastEvent = _traceName;
this.tracer.trace(_traceName, _arg);
- console.log("trace('" + _traceName + "', " + JSON.stringify(_arg) + ");");
-
+ if (this._config.js_console) {
+ console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");");
+ }
}
/* a widget that displays tweet - used in conjunction with the polemicWidget */