-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
85 lines (79 loc) · 4.08 KB
/
index.html
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="https://www.google.dk/imgres?imgurl=http%3A%2F%2Fwww.wpclipart.com%2Frecreation%2Ffitness%2Ffitness_2%2Fexercise_fitness_icon.png&imgrefurl=http%3A%2F%2Fwww.wpclipart.com%2Frecreation%2Ffitness%2Ffitness_2%2Fexercise_fitness_icon.png.html&docid=HO25zAsbvDETCM&tbnid=X6E-KzZ0-1ytoM%3A&vet=1&w=256&h=256&safe=off&bih=887&biw=1750&ved=0ahUKEwj_nYDu6KHQAhVIhywKHXKmDT4QMwhRKCswKw&iact=mrc&uact=8">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script> </head>
<body ng-app="Workout" ng-controller="main">
<!--<div ng-show="!runningTask">
<md-button class="md-raised md-primary" ng-repeat="task in tasks" ng-click="startTask(task)">
{{task.name}} {{task.duration}}
</md-button>
</div>-->
<md-list flex ng-show="!runningTask">
<md-list-item class="md-3-line " ng-repeat="task in tasks" ng-click="startTask(task)" >
<img ng-src="http://previews.123rf.com/images/rastudio/rastudio1606/rastudio160600983/57760172-Man-doing-abdominal-crunches-vector-sketch-icon-isolated-on-background-Hand-drawn-Man-doing-abdomina-Stock-Vector.jpg"
class="md-avatar" />
<div class="md-list-item-text" layout="column">
<h3>{{ task.name }}</h3>
<h4>{{ task.duration }} </h4>
<p ng-show="task.completed">Flot!!</p>
</div>
<md-divider ng-if="!$last"></md-divider>
</md-list-item>
</md-list>
<div ng-show="runningTask">
<md-progress-linear md-mode="determinate" value="{{progress}}"></md-progress-linear>
<md-content layout-padding >
<div layout-align="center center" layout="column">
<h1>{{runningTask.remaining}}</h1>
<h3>seconds left</h3>
<md-button class="md-raised" ng-click="stopTask(runningTask)">Stop</md-button>
<!--<md-progress-circular md-mode="determinate" value={{progress}} />-->
</div>
</md-content>
<md-progress-linear md-mode="determinate" value="{{progress}}"></md-progress-linear>
</div>
<script>
var app = angular.module('Workout', ['ngMaterial'])
.config(function($mdThemingProvider) {
$mdThemingProvider.theme('default');
});
app.controller('main', function($scope, $interval, $timeout) {
$scope.tasks = [
{name:'mavebøjninger',duration:30},
{name:'armbøjninger',duration:30},
{name:'pushups',duration:5}
];
$scope.startTask = function(task){
$scope.progress = 0;
if(task.running === true) return;
$scope.runningTask = task;
task.remaining = task.duration;
task.value = task.duration;
task.running = true;
task.interval = $interval(function() {
if(task.remaining <= 0){
$scope.stopTask(task);
task.completed = true;
}
task.value = task.value - 0.1;
$scope.progress = 100 - (task.value/task.duration) * 100;
task.remaining = Math.ceil(task.value);
}, 100);
};
$scope.stopTask = function(task){
task.running = false;
$interval.cancel(task.interval);
$scope.runningTask = undefined;
};
});
</script>
</body>
</html>