forked from siddii/angular-timer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.js
More file actions
46 lines (41 loc) · 1.44 KB
/
docs.js
File metadata and controls
46 lines (41 loc) · 1.44 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function startTimer(sectionId) {
document.getElementById(sectionId).getElementsByTagName('timer')[0].start();
}
function stopTimer(sectionId) {
document.getElementById(sectionId).getElementsByTagName('timer')[0].stop();
}
function addCDSeconds(sectionId, extraTime) {
document.getElementById(sectionId).getElementsByTagName('timer')[0].addCDSeconds(extraTime);
}
function stopResumeTimer(sectionId, btn) {
if (btn.innerHTML === 'Start') {
document.getElementById(sectionId).getElementsByTagName('timer')[0].start();
btn.innerHTML = 'Stop';
}
else if (btn.innerHTML === 'Stop') {
document.getElementById(sectionId).getElementsByTagName('timer')[0].stop();
btn.innerHTML = 'Resume';
}
else {
document.getElementById(sectionId).getElementsByTagName('timer')[0].resume();
btn.innerHTML = 'Stop';
}
}
angular.module('timer-demo',['timer']).controller('TimerDemoController',['$scope', function ($scope) {
$scope.linkAnchors = function () {
$('ul.nav a').click(function (){
var path = $(this).attr('href');
if (path != '#') {
window.location = path;
}
});
};
$scope.callbackTimer={};
$scope.callbackTimer.status='Running';
$scope.callbackTimer.callbackCount=0;
$scope.callbackTimer.finished=function(){
$scope.callbackTimer.status='COMPLETE!!';
$scope.callbackTimer.callbackCount++;
$scope.$apply();
};
}]);