Skip to content

Commit 3399374

Browse files
authored
refactor: Remove jQuery dependency. Use vanilla JS. (#73)
* Remove jQuery dependency. Use vanilla JS. * Remove jQuery from all templates. Also popper.js, which was unused.
1 parent 1cbde0a commit 3399374

File tree

3 files changed

+99
-94
lines changed

3 files changed

+99
-94
lines changed

resources/html/error.html

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
{{define "base"}}
2-
<html>
2+
<html lang="en">
33
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
46
<title>{{ .ErrorCode }} {{ .ErrorMessage }}</title>
7+
<meta name="robots" content="noindex, nofollow">
58
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
6-
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
7-
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
8-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
99
<style>
1010
/*
11-
* Globals
12-
*/
13-
/* Custom default button */
11+
* Globals
12+
*/
1413
.btn-secondary,
1514
.btn-secondary:hover,
1615
.btn-secondary:focus {
17-
color: #333;
18-
text-shadow: none; /* Prevent inheritance from `body` */
16+
color: #333;
17+
text-shadow: none; /* Prevent inheritance from `body` */
1918
}
2019
/*
21-
* Base structure
22-
*/
20+
* Base structure
21+
*/
2322
body {
24-
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, 0.05);
25-
box-shadow: inset 0 0 25rem rgba(0, 0, 0, .5);
23+
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, 0.05);
24+
box-shadow: inset 0 0 25rem rgba(0, 0, 0, .5);
25+
font-size: larger;
2626
}
2727
.cover-container {
28-
max-width: 42em;
28+
max-width: 60em;
2929
}
3030
/*
31-
* Header
32-
*/
31+
* Header
32+
*/
3333
.nav-masthead .nav-link {
34-
padding: .25rem 0;
35-
font-weight: 700;
36-
color: rgba(255, 255, 255, .5);
37-
background-color: transparent;
38-
border-bottom: .25rem solid transparent;
34+
padding: .25rem 0;
35+
font-weight: 700;
36+
color: rgba(255, 255, 255, .5);
37+
background-color: transparent;
38+
border-bottom: .25rem solid transparent;
3939
}
4040
.nav-masthead .nav-link:hover,
4141
.nav-masthead .nav-link:focus {
42-
border-bottom-color: rgba(255, 255, 255, .25);
42+
border-bottom-color: rgba(255, 255, 255, .25);
4343
}
4444
.nav-masthead .nav-link + .nav-link {
45-
margin-left: 1rem;
45+
margin-left: 1rem;
4646
}
4747
.nav-masthead .active {
48-
color: #fff;
49-
border-bottom-color: #fff;
48+
color: #fff;
49+
border-bottom-color: #fff;
5050
}
5151
</style>
5252
</head>

resources/html/forced.html

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,60 @@
11
{{define "base"}}
2-
<html>
2+
<html lang="en">
33
<head>
4-
<!-- refresh the page -->
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
56
<title>Scaled | Lagoon</title>
7+
<meta name="robots" content="noindex, nofollow">
68
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
7-
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
8-
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
9-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
109
<style>
1110
/*
12-
* Globals
13-
*/
14-
/* Custom default button */
11+
* Globals
12+
*/
1513
.btn-secondary,
1614
.btn-secondary:hover,
1715
.btn-secondary:focus {
18-
color: #333;
19-
text-shadow: none; /* Prevent inheritance from `body` */
16+
color: #333;
17+
text-shadow: none; /* Prevent inheritance from `body` */
2018
}
2119
/*
22-
* Base structure
23-
*/
20+
* Base structure
21+
*/
2422
body {
25-
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, 0.05);
26-
box-shadow: inset 0 0 25rem rgba(0, 0, 0, .5);
27-
font-size: larger;
23+
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, 0.05);
24+
box-shadow: inset 0 0 25rem rgba(0, 0, 0, .5);
25+
font-size: larger;
2826
}
2927
.cover-container {
30-
max-width: 60em;
28+
max-width: 60em;
3129
}
3230
/*
33-
* Header
34-
*/
31+
* Header
32+
*/
3533
.nav-masthead .nav-link {
36-
padding: .25rem 0;
37-
font-weight: 700;
38-
color: rgba(255, 255, 255, .5);
39-
background-color: transparent;
40-
border-bottom: .25rem solid transparent;
34+
padding: .25rem 0;
35+
font-weight: 700;
36+
color: rgba(255, 255, 255, .5);
37+
background-color: transparent;
38+
border-bottom: .25rem solid transparent;
4139
}
4240
.nav-masthead .nav-link:hover,
4341
.nav-masthead .nav-link:focus {
44-
border-bottom-color: rgba(255, 255, 255, .25);
42+
border-bottom-color: rgba(255, 255, 255, .25);
4543
}
4644
.nav-masthead .nav-link + .nav-link {
47-
margin-left: 1rem;
45+
margin-left: 1rem;
4846
}
4947
.nav-masthead .active {
50-
color: #fff;
51-
border-bottom-color: #fff;
48+
color: #fff;
49+
border-bottom-color: #fff;
5250
}
5351
</style>
5452
</head>
5553
<body class="d-flex h-100 text-center text-black bg-light">
5654
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
5755
<header class="mb-auto">
5856
<div>
59-
<h3 class="float-md-start mb-0">This environment has been forcibly scaled. To restore this environment trigger a deployment.</h3>
57+
<h3 class="float-md-start mb-0">This environment has been forcibly scaled. To restore this environment, trigger a new deployment.</h3>
6058
</div>
6159
</header>
6260
<main class="px-3">

resources/html/unidle.html

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,53 @@
11
{{define "base"}}
2-
<html>
2+
<html lang="en">
33
<head>
4-
<!-- refresh the page -->
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
56
<title>Preparing your environment | Lagoon</title>
67
<meta http-equiv="refresh" content="{{ .RefreshInterval }}">
8+
<meta name="robots" content="noindex, nofollow">
79
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
8-
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" crossorigin="anonymous"></script>
9-
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
10-
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
1110
<style>
1211
/*
13-
* Globals
14-
*/
15-
/* Custom default button */
12+
* Globals
13+
*/
1614
.btn-secondary,
1715
.btn-secondary:hover,
1816
.btn-secondary:focus {
19-
color: #333;
20-
text-shadow: none; /* Prevent inheritance from `body` */
17+
color: #333;
18+
text-shadow: none; /* Prevent inheritance from `body` */
2119
}
2220
/*
23-
* Base structure
24-
*/
21+
* Base structure
22+
*/
2523
body {
26-
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, 0.05);
27-
box-shadow: inset 0 0 25rem rgba(0, 0, 0, .5);
28-
font-size: larger;
24+
text-shadow: 0 .05rem .1rem rgba(0, 0, 0, 0.05);
25+
box-shadow: inset 0 0 25rem rgba(0, 0, 0, .5);
26+
font-size: larger;
2927
}
3028
.cover-container {
31-
max-width: 60em;
29+
max-width: 60em;
3230
}
3331
/*
34-
* Header
35-
*/
32+
* Header
33+
*/
3634
.nav-masthead .nav-link {
37-
padding: .25rem 0;
38-
font-weight: 700;
39-
color: rgba(255, 255, 255, .5);
40-
background-color: transparent;
41-
border-bottom: .25rem solid transparent;
35+
padding: .25rem 0;
36+
font-weight: 700;
37+
color: rgba(255, 255, 255, .5);
38+
background-color: transparent;
39+
border-bottom: .25rem solid transparent;
4240
}
4341
.nav-masthead .nav-link:hover,
4442
.nav-masthead .nav-link:focus {
45-
border-bottom-color: rgba(255, 255, 255, .25);
43+
border-bottom-color: rgba(255, 255, 255, .25);
4644
}
4745
.nav-masthead .nav-link + .nav-link {
48-
margin-left: 1rem;
46+
margin-left: 1rem;
4947
}
5048
.nav-masthead .active {
51-
color: #fff;
52-
border-bottom-color: #fff;
49+
color: #fff;
50+
border-bottom-color: #fff;
5351
}
5452
</style>
5553
</head>
@@ -84,25 +82,34 @@ <h3 class="float-md-start mb-0">Preparing your environment</h3>
8482
</p>
8583
</main>
8684
<footer class="mt-auto text-dark">
87-
<p>Refreshing in <span id="countdowntimer">{{ .RefreshInterval }} </span> Seconds</p>
85+
<p>Refreshing in <span id="countdowntimer">{{ .RefreshInterval }}</span> Seconds</p>
8886
<small class="text-muted">If this page persists, contact your Lagoon administrator to check for issues unidling</small>
8987
</footer>
9088
</div>
91-
<script type="text/javascript">
92-
var timeleft = {{ .RefreshInterval }};
93-
var downloadTimer = setInterval(function(){
94-
timeleft--;
95-
document.getElementById("countdowntimer").textContent = timeleft;
96-
if(timeleft <= 0)
97-
clearInterval(downloadTimer);
98-
},1000);
89+
<script>
90+
var timeleft = {{ .RefreshInterval }};
91+
var downloadTimer = setInterval(function() {
92+
timeleft--;
93+
var countdownElement = document.getElementById('countdowntimer');
94+
if (countdownElement) {
95+
countdownElement.textContent = timeleft;
96+
}
97+
if (timeleft <= 0) {
98+
clearInterval(downloadTimer);
99+
}
100+
}, 1000);
101+
</script>
99102
{{if ne .Verifier ""}}
100-
var host = window.location.origin;
101-
jQuery(document).ready(function(){
102-
jQuery.get(host+"?verifier={{ .Verifier }}", () => {});
103-
});
104-
{{ end }}
103+
<script>
104+
const host = window.location.origin;
105+
document.addEventListener('DOMContentLoaded', () => {
106+
fetch(
107+
host + '?verifier={{ .Verifier }}',
108+
{ method: 'GET' }
109+
);
110+
});
105111
</script>
112+
{{ end }}
106113
</body>
107114
</html>
108115
{{end}}

0 commit comments

Comments
 (0)