Gitlab CSE Unil

Commit 2a3e142c authored by M. Chardon's avatar M. Chardon
Browse files

bouton pause/play tjs visible

parent df74e390
define(["jquery"],function(a){function b(a,c){return this.controler=a,this.assignpart=c,b.clickAnnotation=0,this}b.controler=null,b.assignpart=-1,b.clickAnnotation=0,b.delayBeforeAnnotation=2,b.options=null,b.prototype.PLAYPAUSEBUTTON=".justwave_playpause",b.prototype.PLAYPAUSEBUTTONBEFORE=".justwave_playpause_before",b.prototype.CURRENTFOCUS=".justwave_curfocus",b.prototype.drawAnnotation=function(b,c,d){if(b&&b.duration){var e=c.timeposition/b.duration*100,f=a(b).next(),g=c.displayDiv(e,d);f.find(".audio_annotations").append(g)}},b.prototype.goBeforeAnnotation=function(a,d){a&&(a.currentTime=Math.max(d.timeposition-b.delayBeforeAnnotation,0),c(a),b.clickAnnotation=1)},b.prototype.getWaveOpts=function(c){var d={ajax:"justWave/justwave.ajax.php",width:900,height:100,wave_color:"#909296",prog_color:"#74cdd7",back_color:"#FFFFFF",buttoncolor:"#A47655",buttonsize:0,showname:1,namesize:15,showtimes:1,nowaves:0,nocache:!0};a.isPlainObject(b.options)&&a.extend(d,b.options),c.attr("width")&&(d.width=c.attr("width")),c.attr("height")&&(d.height=c.attr("height")),c.attr("poster")&&(d.poster=c.attr("poster"));var e=c.data();return Object.keys(e).map(function(a){return d[a]=e[a],d[a]}),d},b.prototype.init=function(h,i){var j=a("#player_markup > div.justwave_wrapper").clone(),k=a("audio");null!==this.assignpart&&(k=a(".justwave"+this.assignpart.assignpartid).find("audio")),"string"==typeof h&&(i=h),"string"==typeof i&&(k=k.filter("."+i));var l=this.controler,m=this.assignpart,n=this.getWaveOpts;k.each(function(){var h=this,i=a(this);h.opts=n(i),h.opts.chained&&i.addClass("justwave_chained"),i.after(j),a(h).on("canplay",function(b){var c=b.target,d=a(c).next();c.xduration=c.duration,c.opts.showtimes&&c.opts.showtimes>0?d.find(".justwave_duration, .justwave_curpos").show():d.find(".justwave_duration, .justwave_curpos").hide()}).on("playing",function(c){var d=c.target,e=a(d).next();e.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").addClass("fa-pause"),e.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").removeClass("fa-play"),d.opts.chained&&a("audio.justwave_chained").each(function(){this!==d&&this.pause()}),l.notify("playing","player",d)}).on("pause",function(c){var d=a(c.target).next();d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").addClass("fa-play"),d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").removeClass("fa-pause")}).on("error",function(c){var d=c.target,e=a(d).next();f(d),e.find(b.prototype.PLAYPAUSEBUTTON).prop("disabled",!0),e.find(b.prototype.PLAYPAUSEBUTTONBEFORE).prop("disabled",!0),e.find(".justwave_songname").text(a(d).attr("src").replace(/.+[\\\/]/,"")),e.find(".justwave_duration").text("00:00"),d.xduration=0,e.find(".justwave_duration, .justwave_curpos, "+b.prototype.CURRENTFOCUS).hide(),l.notify("error","player",d)}).on("timeupdate",function(){c(this)}).on("ended",function(){this.pause()}),f(h),g(h);var k=i.next();k.click(function(d){if(!b.clickAnnotation||0===b.clickAnnotation){d.preventDefault();var e=a(this).prev()[0],f=a(this).offset(),g=d.pageX-f.left;e.currentTime=g*e.xduration/this.offsetWidth,c(e),m.notify("click",e.currentTime)}b.clickAnnotation=0}).mousemove(function(c){var f=a(this).offset(),g=c.pageX-f.left,h=c.pageY-f.top,i=this,j=a(this).prev()[0];a(i).find(b.prototype.CURRENTFOCUS).text(d(g/this.offsetWidth*j.xduration)).css({top:h-5+"px",left:g+5+"px"}),j.opts.showname&&j.opts.showname>0&&e(a(i).find(".justwave_songname"))}).mouseleave(function(){a(this).find(b.prototype.CURRENTFOCUS).hide(),a(this).find(b.prototype.PLAYPAUSEBUTTON).fadeOut(1e3),a(this).find(b.prototype.PLAYPAUSEBUTTONBEFORE).fadeOut(1e3)}).mouseenter(function(){var c=a(this).prev()[0];a(this).find(b.prototype.PLAYPAUSEBUTTON).stop(!1,!0).fadeIn(500),a(this).find(b.prototype.PLAYPAUSEBUTTONBEFORE).stop(!1,!0).fadeIn(500),c.opts.showtimes&&c.opts.showtimes>0&&a(this).find(b.prototype.CURRENTFOCUS).show(),l.notify("mouseenter","player",c)}).dblclick(function(){l.isWriting()<=0&&l.getPairing()<=0||(b.clickAnnotation&&0!==b.clickAnnotation||(h.pause(),m.notify("dblclick")),b.clickAnnotation=0)}),k.find(b.prototype.PLAYPAUSEBUTTON).on("click touchstart",function(b){b.stopPropagation(),b.preventDefault();var c=a(this).parent(),d=c.prev()[0];d.ended&&(d.currentTime=0),d.paused?d.play():(d.pause(),m.notify("pause",d.currentTime)),l.notify("pause","player",d)}),k.find(b.prototype.PLAYPAUSEBUTTONBEFORE).on("click touchstart",function(d){d.stopPropagation(),d.preventDefault();var e=a(this).parent(),f=e.prev()[0];f.ended&&(f.currentTime=0),f.currentTime=Math.max(f.currentTime-b.delayBeforeAnnotation,0),c(f)}).on("dblclick",function(a){a.stopPropagation(),a.preventDefault()}),k.find(".justwave_playpause_btn").mouseenter(function(){a(this).siblings(b.prototype.CURRENTFOCUS).hide()}).mouseleave(function(){var c=a(this).parent().prev()[0];c.opts.showtimes&&c.opts.showtimes>0&&a(this).siblings(b.prototype.CURRENTFOCUS).show()});var o=k.parents('div[data-parent="#accordionAssignPart"]');o.attr("tabindex",0),o.on("keydown",function(a){l.isWriting()<=0&&l.getPairing()<=0||(32===a.which&&(a.preventDefault(),k.find("button"+b.prototype.PLAYPAUSEBUTTON).click()),66===a.which&&(a.preventDefault(),k.find("button"+b.prototype.PLAYPAUSEBUTTONBEFORE).click()),78===a.which&&(a.preventDefault(),h.pause(),m.notify("pause",h.currentTime),m.notify("dblclick")))}),l.notify("initeach","player",h)})};var c=function(b){var c=b.currentTime/b.xduration*100,e=a(b).next();c<=100.1&&e.find(".justwave_playhead").width(c+"%"),e.find(".justwave_curpos").text(d(b.currentTime))},d=function(a){var b=Math.floor(a/60),c=Math.floor(a%60);return isNaN(a)?"00:00":(b<10?"0":"")+b+":"+(c<10?"0":"")+c},e=function(a,b){b&&a.stop(!0,!0).hide(),a.is(":visible")||a.fadeIn(300,function(){a.fadeOut(7e3,"swing")})},f=function(b){var c=a(b).next();c.find(".justwave_wave").width(0).attr("src",""),c.find(".justwave_progress").width(0).attr("src",""),c.width(b.opts.width).height(b.opts.height).css("background",b.opts.wave_color),b.opts.poster&&c.css("background-image","url("+b.opts.poster+")"),c.find(".justwave_playhead").css("background",b.opts.prog_color)},g=function(c){var d=a(c).next();d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").addClass("fa-play"),d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").removeClass("fa-pause")};return b.prototype.drawWaveDisplay=function(b){var c=this.assignpart;b.opts=this.getWaveOpts(b);var h=new Audio;a(h).on("loadedmetadata",function(){var h=a(b).next();f(b),g(b),a(b).attr("src")?b.opts.audio=a(b).attr("src"):b.opts.audio=b.currentSrc;var i=h.find(".justwave_songname").css("font-size",b.opts.namesize+"px").text(decodeURIComponent(b.opts.audio.replace(/.+[\\\/]/,"")));b.opts.showname&&b.opts.showname>0&&e(i,!0),+b.opts.nowaves||a.ajax(b.opts.ajax,{dataType:"json",type:"POST",data:b.opts}).done(function(e){var f=a(b).next(),g=f.find(".justwave_wave"),h=f.find(".justwave_progress");"ok"===e.status&&(g.width(b.opts.width),h.width(b.opts.width),f.css("background",""),f.find(".justwave_playhead").css("background",""),b.opts.poster&&f.css("background-image","url("+b.opts.poster+")"),g.attr("src",e.waveurl),b.opts.wave_color===b.opts.prog_color?h.attr("src",e.waveurl):h.attr("src",e.progressurl)),b.xduration=parseFloat(e.duration),b.xduration||(b.xduration=b.duration),b.xduration&&!b.duration&&(b.duration=e.duration),f.find(".justwave_duration").text(d(b.xduration));var i=a(f).prev()[0];i.xduration=b.xduration,i.duration=b.duration,c&&c.notify("loadedmetadata",b)})}),h.src=a(b).attr("src")},b});
\ No newline at end of file
define(["jquery"],function(a){function b(a,c){return this.controler=a,this.assignpart=c,b.clickAnnotation=0,this}b.controler=null,b.assignpart=-1,b.clickAnnotation=0,b.delayBeforeAnnotation=2,b.options=null,b.prototype.PLAYPAUSEBUTTON=".justwave_playpause",b.prototype.PLAYPAUSEBUTTONBEFORE=".justwave_playpause_before",b.prototype.CURRENTFOCUS=".justwave_curfocus",b.prototype.drawAnnotation=function(b,c,d){if(b&&b.duration){var e=c.timeposition/b.duration*100,f=a(b).next(),g=c.displayDiv(e,d);f.find(".audio_annotations").append(g)}},b.prototype.goBeforeAnnotation=function(a,d){a&&(a.currentTime=Math.max(d.timeposition-b.delayBeforeAnnotation,0),c(a),b.clickAnnotation=1)},b.prototype.getWaveOpts=function(c){var d={ajax:"justWave/justwave.ajax.php",width:900,height:100,wave_color:"#909296",prog_color:"#74cdd7",back_color:"#FFFFFF",buttoncolor:"#A47655",buttonsize:0,showname:1,namesize:15,showtimes:1,nowaves:0,nocache:!0};a.isPlainObject(b.options)&&a.extend(d,b.options),c.attr("width")&&(d.width=c.attr("width")),c.attr("height")&&(d.height=c.attr("height")),c.attr("poster")&&(d.poster=c.attr("poster"));var e=c.data();return Object.keys(e).map(function(a){return d[a]=e[a],d[a]}),d},b.prototype.init=function(h,i){var j=a("#player_markup > div.justwave_wrapper").clone(),k=a("audio");null!==this.assignpart&&(k=a(".justwave"+this.assignpart.assignpartid).find("audio")),"string"==typeof h&&(i=h),"string"==typeof i&&(k=k.filter("."+i));var l=this.controler,m=this.assignpart,n=this.getWaveOpts;k.each(function(){var h=this,i=a(this);h.opts=n(i),h.opts.chained&&i.addClass("justwave_chained"),i.after(j),a(h).on("canplay",function(b){var c=b.target,d=a(c).next();c.xduration=c.duration,c.opts.showtimes&&c.opts.showtimes>0?d.find(".justwave_duration, .justwave_curpos").show():d.find(".justwave_duration, .justwave_curpos").hide()}).on("playing",function(c){var d=c.target,e=a(d).next();e.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").addClass("fa-pause"),e.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").removeClass("fa-play"),d.opts.chained&&a("audio.justwave_chained").each(function(){this!==d&&this.pause()}),l.notify("playing","player",d)}).on("pause",function(c){var d=a(c.target).next();d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").addClass("fa-play"),d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").removeClass("fa-pause")}).on("error",function(c){var d=c.target,e=a(d).next();f(d),e.find(b.prototype.PLAYPAUSEBUTTON).prop("disabled",!0),e.find(b.prototype.PLAYPAUSEBUTTONBEFORE).prop("disabled",!0),e.find(".justwave_songname").text(a(d).attr("src").replace(/.+[\\\/]/,"")),e.find(".justwave_duration").text("00:00"),d.xduration=0,e.find(".justwave_duration, .justwave_curpos, "+b.prototype.CURRENTFOCUS).hide(),l.notify("error","player",d)}).on("timeupdate",function(){c(this)}).on("ended",function(){this.pause()}),f(h),g(h);var k=i.next();k.click(function(d){if(!b.clickAnnotation||0===b.clickAnnotation){d.preventDefault();var e=a(this).prev()[0],f=a(this).offset(),g=d.pageX-f.left;e.currentTime=g*e.xduration/this.offsetWidth,c(e),m.notify("click",e.currentTime)}b.clickAnnotation=0}).mousemove(function(c){var f=a(this).offset(),g=c.pageX-f.left,h=c.pageY-f.top,i=this,j=a(this).prev()[0];a(i).find(b.prototype.CURRENTFOCUS).text(d(g/this.offsetWidth*j.xduration)).css({top:h-5+"px",left:g+5+"px"}),j.opts.showname&&j.opts.showname>0&&e(a(i).find(".justwave_songname"))}).mouseleave(function(){a(this).find(b.prototype.CURRENTFOCUS).hide()}).mouseenter(function(){var c=a(this).prev()[0];c.opts.showtimes&&c.opts.showtimes>0&&a(this).find(b.prototype.CURRENTFOCUS).show()}).dblclick(function(){l.isWriting()<=0&&l.getPairing()<=0||(b.clickAnnotation&&0!==b.clickAnnotation||(h.pause(),m.notify("dblclick")),b.clickAnnotation=0)}),k.find(b.prototype.PLAYPAUSEBUTTON).on("click touchstart",function(b){b.stopPropagation(),b.preventDefault();var c=a(this).parent(),d=c.prev()[0];d.ended&&(d.currentTime=0),d.paused?d.play():(d.pause(),m.notify("pause",d.currentTime)),l.notify("pause","player",d)}),k.find(b.prototype.PLAYPAUSEBUTTONBEFORE).on("click touchstart",function(d){d.stopPropagation(),d.preventDefault();var e=a(this).parent(),f=e.prev()[0];f.ended&&(f.currentTime=0),f.currentTime=Math.max(f.currentTime-b.delayBeforeAnnotation,0),c(f)}).on("dblclick",function(a){a.stopPropagation(),a.preventDefault()}),k.find(".justwave_playpause_btn").mouseenter(function(){a(this).siblings(b.prototype.CURRENTFOCUS).hide()}).mouseleave(function(){var c=a(this).parent().prev()[0];c.opts.showtimes&&c.opts.showtimes>0&&a(this).siblings(b.prototype.CURRENTFOCUS).show()});var o=k.parents('div[data-parent="#accordionAssignPart"]');o.attr("tabindex",0),o.on("keydown",function(a){l.isWriting()<=0&&l.getPairing()<=0||(32===a.which&&(a.preventDefault(),k.find("button"+b.prototype.PLAYPAUSEBUTTON).click()),66===a.which&&(a.preventDefault(),k.find("button"+b.prototype.PLAYPAUSEBUTTONBEFORE).click()),78===a.which&&(a.preventDefault(),h.pause(),m.notify("pause",h.currentTime),m.notify("dblclick")))}),l.notify("initeach","player",h)})};var c=function(b){var c=b.currentTime/b.xduration*100,e=a(b).next();c<=100.1&&e.find(".justwave_playhead").width(c+"%"),e.find(".justwave_curpos").text(d(b.currentTime))},d=function(a){var b=Math.floor(a/60),c=Math.floor(a%60);return isNaN(a)?"00:00":(b<10?"0":"")+b+":"+(c<10?"0":"")+c},e=function(a,b){b&&a.stop(!0,!0).hide(),a.is(":visible")||a.fadeIn(300,function(){a.fadeOut(7e3,"swing")})},f=function(b){var c=a(b).next();c.find(".justwave_wave").width(0).attr("src",""),c.find(".justwave_progress").width(0).attr("src",""),c.width(b.opts.width).height(b.opts.height).css("background",b.opts.wave_color),b.opts.poster&&c.css("background-image","url("+b.opts.poster+")"),c.find(".justwave_playhead").css("background",b.opts.prog_color)},g=function(c){var d=a(c).next();d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").addClass("fa-play"),d.find(b.prototype.PLAYPAUSEBUTTON+" i.fa").removeClass("fa-pause")};return b.prototype.drawWaveDisplay=function(b){var c=this.assignpart;b.opts=this.getWaveOpts(b);var h=new Audio;a(h).on("loadedmetadata",function(){var h=a(b).next();f(b),g(b),a(b).attr("src")?b.opts.audio=a(b).attr("src"):b.opts.audio=b.currentSrc;var i=h.find(".justwave_songname").css("font-size",b.opts.namesize+"px").text(decodeURIComponent(b.opts.audio.replace(/.+[\\\/]/,"")));b.opts.showname&&b.opts.showname>0&&e(i,!0),+b.opts.nowaves||a.ajax(b.opts.ajax,{dataType:"json",type:"POST",data:b.opts}).done(function(e){var f=a(b).next(),g=f.find(".justwave_wave"),h=f.find(".justwave_progress");"ok"===e.status&&(g.width(b.opts.width),h.width(b.opts.width),f.css("background",""),f.find(".justwave_playhead").css("background",""),b.opts.poster&&f.css("background-image","url("+b.opts.poster+")"),g.attr("src",e.waveurl),b.opts.wave_color===b.opts.prog_color?h.attr("src",e.waveurl):h.attr("src",e.progressurl)),b.xduration=parseFloat(e.duration),b.xduration||(b.xduration=b.duration),b.xduration&&!b.duration&&(b.duration=e.duration),f.find(".justwave_duration").text(d(b.xduration));var i=a(f).prev()[0];i.xduration=b.xduration,i.duration=b.duration,c&&c.notify("loadedmetadata",b)})}),h.src=a(b).attr("src")},b});
\ No newline at end of file
......@@ -340,16 +340,11 @@ define(['jquery'],
}
}).mouseleave(function () {
$(this).find(JustWave.prototype.CURRENTFOCUS).hide();
$(this).find(JustWave.prototype.PLAYPAUSEBUTTON).fadeOut(1000);
$(this).find(JustWave.prototype.PLAYPAUSEBUTTONBEFORE).fadeOut(1000);
}).mouseenter(function () {
var p = $(this).prev()[0];
$(this).find(JustWave.prototype.PLAYPAUSEBUTTON).stop(false, true).fadeIn(500);
$(this).find(JustWave.prototype.PLAYPAUSEBUTTONBEFORE).stop(false, true).fadeIn(500);
if (p.opts.showtimes && p.opts.showtimes > 0) {
$(this).find(JustWave.prototype.CURRENTFOCUS).show();
}
controlerNot.notify('mouseenter', "player", p);
}).dblclick(function () {
if (controlerNot.isWriting() <= 0 && controlerNot.getPairing() <= 0) {
return;
......
......@@ -155,7 +155,6 @@
bottom:2px;
border-radius:50%;
height:35px;
display: none;
}
.path-mod-audioannotation .justwave_wrapper button.justwave_playpause_btn:focus {
......@@ -167,11 +166,6 @@
opacity:.4;
}
.path-mod-audioannotation .justwave_wrapper button.justwave_playpause .justwave_pause,
.path-mod-audioannotation .justwave_wrapper button.justwave_playpause .justwave_play {
display: none;
}
.path-mod-audioannotation .record-header {
cursor: pointer;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment