Skip to content

Commit

Permalink
do not show controls if asked not to
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemurray committed Nov 18, 2016
1 parent 33b5ea5 commit c1ea9b9
Showing 1 changed file with 44 additions and 27 deletions.
71 changes: 44 additions & 27 deletions src/jquery.imgplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@
direction = 'forward';
drawFrame();

plugin.controls.play.addClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.pause.removeClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.forward.removeClass('active');
if (plugin.settings.controls) {
plugin.controls.play.addClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.pause.removeClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.forward.removeClass('active');
}
};

plugin.pause = function() {
Expand All @@ -89,22 +91,26 @@
clearTimeout(playTimer);
}

plugin.controls.pause.addClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.forward.removeClass('active');
if (plugin.settings.controls) {
plugin.controls.pause.addClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.forward.removeClass('active');
}
};

plugin.stop = function() {
playing = false;
index = 0;

plugin.controls.stop.addClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.pause.removeClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.forward.removeClass('active');
if (plugin.settings.controls) {
plugin.controls.stop.addClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.pause.removeClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.forward.removeClass('active');
}
};

plugin.rewind = function(frames) {
Expand All @@ -115,11 +121,13 @@
drawFrame();
}

plugin.controls.rewind.addClass('active');
plugin.controls.forward.removeClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.pause.removeClass('active');
if (plugin.settings.controls) {
plugin.controls.rewind.addClass('active');
plugin.controls.forward.removeClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.pause.removeClass('active');
}
};

plugin.forward = function(frames) {
Expand All @@ -130,11 +138,13 @@
drawFrame();
}

plugin.controls.forward.addClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.pause.removeClass('active');
if (plugin.settings.controls) {
plugin.controls.forward.addClass('active');
plugin.controls.rewind.removeClass('active');
plugin.controls.stop.removeClass('active');
plugin.controls.play.removeClass('active');
plugin.controls.pause.removeClass('active');
}
};

plugin.fastRewind = function(rate) {
Expand Down Expand Up @@ -196,7 +206,9 @@
} else if (el.webkitRequestFullscreen) {
el.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
plugin.controls.fullscreen.addClass('active');
if (plugin.settings.controls) {
plugin.controls.fullscreen.addClass('active');
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
Expand All @@ -207,7 +219,9 @@
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
plugin.controls.fullscreen.removeClass('active');
if (plugin.settings.controls) {
plugin.controls.fullscreen.removeClass('active');
}
}

setTimeout(function() {
Expand All @@ -216,6 +230,9 @@
};

var initControls = function() {
if (!plugin.settings.controls) {
return;
}
if($el.find('.imgplay-controls').length == 0) {
var controls = $('<div class="imgplay-controls"></div>');
var progress = $('<div class="imgplay-progress">');
Expand Down

0 comments on commit c1ea9b9

Please sign in to comment.