Sha256: a396323dc694d2e9261eff70823b00575a752113630cceee6f1b944dd25a7589
Contents?: true
Size: 1.51 KB
Versions: 22
Compression:
Stored size: 1.51 KB
Contents
(function($) { $.widget('pageflow.linkmapAudioPlayersController', { _create: function() { var player = this.options.player; var element = this.element; this.delegatePlayerEvent('play', 'playing'); this.delegatePlayerEvent('pause ended', 'notPlaying'); this.delegatePlayerEvent('timeupdate', 'updateProgress'); player.on('play', function(options) { var playerElements = element.find('[data-target-type="audio_file"]'); playerElements.each(function() { var playerElement = $(this); if (playerElement.data('audioFile') !== options.audioFileId) { playerElement.linkmapAudioPlayerControls('cancelLoading'); } }); }); this.element.on('linkmapaudioplayercontrolsplay', function(event, options) { player.play(options.audioFileId); }); this.element.on('linkmapaudioplayercontrolspause', function(event, options) { player.pause(); }); this.element.on('linkmapaudioplayercontrolsseek', function(event, options) { player.seek(player.duration() * options.positionInPercent); }); }, delegatePlayerEvent: function (event, method) { var element = this.element; var player = this.options.player; player.on(event, function(options) { var selector = '[data-audio-file="' + options.audioFileId + '"]'; var playerElement = element.find(selector); playerElement.linkmapAudioPlayerControls(method, player); }); } }); }(jQuery));
Version data entries
22 entries across 22 versions & 1 rubygems