Blame view

sources/apps/files_videoviewer/mediaelement/src/js/mep-feature-loop.js 820 Bytes
03e52840d   Kload   Init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  (function($) {
  	// loop toggle
  	$.extend(MediaElementPlayer.prototype, {
  		buildloop: function(player, controls, layers, media) {
  			var 
  				t = this,
  				// create the loop button
  				loop = 
  				$('<div class="mejs-button mejs-loop-button ' + ((player.options.loop) ? 'mejs-loop-on' : 'mejs-loop-off') + '">' +
  					'<button type="button" aria-controls="' + t.id + '" title="Toggle Loop" aria-label="Toggle Loop"></button>' +
  				'</div>')
  				// append it to the toolbar
  				.appendTo(controls)
  				// add a click toggle event
  				.click(function() {
  					player.options.loop = !player.options.loop;
  					if (player.options.loop) {
  						loop.removeClass('mejs-loop-off').addClass('mejs-loop-on');
  					} else {
  						loop.removeClass('mejs-loop-on').addClass('mejs-loop-off');
  					}
  				});
  		}
  	});
  	
  })(mejs.$);