-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.html
98 lines (86 loc) · 4.33 KB
/
main.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
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Problem Solver</title>
<link rel="manifest" href="manifest.json" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<link rel="stylesheet" href="/style.css">
</head>
<body>
<script id="my-template" type="text/template">
<div>
<div class="row align-items-center" style="height: 100vh;">
<div class="mx-auto col-10 col-md-8 col-lg-6">
<!-- Form -->
<form class="form-example" action="" method="post">
<h1>{{ heading }}</h1>
<!-- Dropdown -->
{{#if enableDropdown}}
{{#each dropdownValues}}
<div class="form-group">
<label for="{{ this.dropdownName }}">{{ this.dropdownLabel }}</label>
<select class="form-control {{ this.dropdownName }}" id="{{ this.dropdownName }}" name="{{ this.dropdownName }}">
<option value="" selected disabled hidden>{{ this.dropdownPlaceholder }}</option>
{{#each this.dropdownOptions}}
<option value="{{ this }}">{{ this }}</option>
{{/each}}
</select>
</div>
{{/each}}
{{else}}
{{#each inputs}}
<!-- Input fields -->
<div class="form-group">
<label for="{{ this.name }}">{{ this.label }}</label>
<input type="{{ this.type }}" class="form-control {{ this.name }}" id="{{ this.name }}" placeholder="{{ this.placeholder }}" name="{{ this.name }}" />
</div>
{{/each}}
{{/if}}
<!-- Space between button and input field-->
<button type="button" class="btn btn-primary btn-customized mt-4" onclick="{{ calculateFunc }}">
{{ buttonName }}
</button>
</form>
<!-- Form end -->
<!-- Output box -->
<div class="card mt-3">
<div class="card-body">
<h3 class="card-title">{{ resultHeading }}</h3>
<!-- Desktop version -->
<p class="card-text d-sm-block" id="output">
{{#each results}}
{{ this.label }}: <span id="{{ this.name }}"></span>
{{/each}}
</p>
</div>
</div>
</div>
</div>
</div>
</script>
<div id="my-content"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"></script>
<!-- Add Bootstrap JS (requires jQuery and Popper.js) -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.1/dist/umd/popper.min.js"
integrity="sha384-KrNJ/xNQkLPZjK9nQ2mCJWYhYRJieTnZs0bdlpzzwZKd/hq3SKP0TjYiRynhX9dd"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"></script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('service_worker.js')
.then(registration => console.log('Service Worker registered'))
.catch(error => console.log('Error registering Service Worker', error));
});
}
</script>
<script src="app.js"></script>
</body>
</html>