4 changed files with 139 additions and 0 deletions
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,49 @@ |
|||||
|
var PlayControl = function (parent, id) { |
||||
|
this.Self = $(id); |
||||
|
this.Parent = parent; |
||||
|
|
||||
|
this.PlayTimer = null; |
||||
|
this.CurrentTimeList = null; |
||||
|
|
||||
|
this.PrevButton = this.Self.find('.prev-btn:first'); |
||||
|
this.NextButton = this.Self.find('.next-btn:first'); |
||||
|
this.PlayButton = this.Self.find('.play-btn:first'); |
||||
|
this.PauseButton = this.Self.find('.pause-btn:first'); |
||||
|
|
||||
|
this.Startup = function () { |
||||
|
this.PrevButton.on('click', this.OnPreButtonClick.bind(this)); |
||||
|
this.NextButton.on('click', this.OnNextButtonClick.bind(this)); |
||||
|
this.PlayButton.on('click', this.OnPlayButtonClick.bind(this)); |
||||
|
this.PauseButton.on('click', this.OnPauseButtonClick.bind(this)); |
||||
|
}; |
||||
|
|
||||
|
this.OnPreButtonClick = function () { |
||||
|
var active = this.CurrentTimeList.find('.active:first'); |
||||
|
var prev = active.prev(); |
||||
|
if (prev.length === 0) |
||||
|
prev = this.CurrentTimeList.find('li:last'); |
||||
|
|
||||
|
prev.trigger('click'); |
||||
|
}; |
||||
|
|
||||
|
this.OnNextButtonClick = function () { |
||||
|
var active = this.CurrentTimeList.find('.active:first'); |
||||
|
var next = active.next(); |
||||
|
if (next.length === 0) |
||||
|
next = this.CurrentTimeList.find('li:first'); |
||||
|
|
||||
|
next.trigger('click'); |
||||
|
}; |
||||
|
|
||||
|
this.OnPlayButtonClick = function () { |
||||
|
this.PlayTimer = setInterval(this.OnNextButtonClick.bind(this), 1500); |
||||
|
this.PauseButton.parent('.pause').show(); |
||||
|
this.PlayButton.parent('.play').hide(); |
||||
|
}; |
||||
|
|
||||
|
this.OnPauseButtonClick = function () { |
||||
|
clearInterval(this.PlayTimer); |
||||
|
this.PauseButton.parent('.pause').hide(); |
||||
|
this.PlayButton.parent('.play').show(); |
||||
|
}; |
||||
|
}; |
@ -0,0 +1,49 @@ |
|||||
|
var PlayControl = function (parent, id) { |
||||
|
this.Self = $(id); |
||||
|
this.Parent = parent; |
||||
|
|
||||
|
this.PlayTimer = null; |
||||
|
this.CurrentTimeList = null; |
||||
|
|
||||
|
this.PrevButton = this.Self.find('.prev-btn:first'); |
||||
|
this.NextButton = this.Self.find('.next-btn:first'); |
||||
|
this.PlayButton = this.Self.find('.play-btn:first'); |
||||
|
this.PauseButton = this.Self.find('.pause-btn:first'); |
||||
|
|
||||
|
this.Startup = function () { |
||||
|
this.PrevButton.on('click', this.OnPreButtonClick.bind(this)); |
||||
|
this.NextButton.on('click', this.OnNextButtonClick.bind(this)); |
||||
|
this.PlayButton.on('click', this.OnPlayButtonClick.bind(this)); |
||||
|
this.PauseButton.on('click', this.OnPauseButtonClick.bind(this)); |
||||
|
}; |
||||
|
|
||||
|
this.OnPreButtonClick = function () { |
||||
|
var active = this.CurrentTimeList.find('.active:first'); |
||||
|
var prev = active.prev(); |
||||
|
if (prev.length === 0) |
||||
|
prev = this.CurrentTimeList.find('li:last'); |
||||
|
|
||||
|
prev.trigger('click'); |
||||
|
}; |
||||
|
|
||||
|
this.OnNextButtonClick = function () { |
||||
|
var active = this.CurrentTimeList.find('.active:first'); |
||||
|
var next = active.next(); |
||||
|
if (next.length === 0) |
||||
|
next = this.CurrentTimeList.find('li:first'); |
||||
|
|
||||
|
next.trigger('click'); |
||||
|
}; |
||||
|
|
||||
|
this.OnPlayButtonClick = function () { |
||||
|
this.PlayTimer = setInterval(this.OnNextButtonClick.bind(this), 1500); |
||||
|
this.PauseButton.parent('.pause').show(); |
||||
|
this.PlayButton.parent('.play').hide(); |
||||
|
}; |
||||
|
|
||||
|
this.OnPauseButtonClick = function () { |
||||
|
clearInterval(this.PlayTimer); |
||||
|
this.PauseButton.parent('.pause').hide(); |
||||
|
this.PlayButton.parent('.play').show(); |
||||
|
}; |
||||
|
}; |
@ -0,0 +1,41 @@ |
|||||
|
var PlayControl = function (parent) { |
||||
|
this.Parent = parent; |
||||
|
this.Timer = null; |
||||
|
|
||||
|
this.Startup = function () { |
||||
|
$('#prev').on('click', this.ActivePrevImage.bind(this)); |
||||
|
$('#next').on('click', this.ActiveNextImage.bind(this)); |
||||
|
$('#play').on('click', this.OnPlayButtonClick.bind(this)); |
||||
|
$('#pause').on('click', this.OnPauseButtonClick.bind(this)); |
||||
|
}; |
||||
|
|
||||
|
this.ActivePrevImage = function () { |
||||
|
var index = parseInt($(".calc-list").attr("index")); |
||||
|
var count = parseInt($(".calc-list").attr("count")); |
||||
|
var prevIndex = index > 0 ? index - 1 : count - 1; |
||||
|
this.Parent.SetActiveImage(prevIndex); |
||||
|
}; |
||||
|
|
||||
|
this.ActiveNextImage = function () { |
||||
|
var index = parseInt($(".calc-list").attr("index")); |
||||
|
var count = parseInt($(".calc-list").attr("count")); |
||||
|
var nextIndex = index < count - 1 ? index + 1 : 0; |
||||
|
this.Parent.SetActiveImage(nextIndex); |
||||
|
}; |
||||
|
|
||||
|
this.AutoPlay = function () { |
||||
|
this.Timer = setInterval(this.ActiveNextImage.bind(this), 1500); |
||||
|
}; |
||||
|
|
||||
|
this.OnPlayButtonClick = function () { |
||||
|
this.AutoPlay(); |
||||
|
$('.btn-group div.pause').show(); |
||||
|
$('.btn-group div.play').hide(); |
||||
|
}; |
||||
|
|
||||
|
this.OnPauseButtonClick = function () { |
||||
|
clearInterval(this.Timer); |
||||
|
$('.btn-group div.pause').hide(); |
||||
|
$('.btn-group div.play').show(); |
||||
|
}; |
||||
|
}; |
Loading…
Reference in new issue