-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
125 lines (112 loc) · 3.43 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JIRA Standup Order</title>
<style>
body {
font-family: sans-serif;
}
</style>
</head>
<body>
<div style="padding: 20px 0">
<div id="app"></div>
</div>
<script type="module" src="/src/main.ts"></script>
<!-- Testing tools -->
<hr />
<div style="font-style: italic">
<p>Testing tools:</p>
<button onclick="clearLocalStorage()">Clear local storage</button>
<button onclick="setValidLocalStorage()">Set sample local storage</button>
<button onclick="setLegacyLocalStorageV1()">
Set legacy local storage (v1)
</button>
<p>Current local storage:</p>
<pre id="currentLocalStorage"></pre>
<p>Current config:</p>
<pre id="currentConfig"></pre>
</div>
<script>
if (window.location.pathname === "/") {
navigation.navigate("/TEST/boards/123");
}
const prefix = "jiraStandupOrder";
const id = "9af6f43c-08f3-5a42-bdeb-a863b5c42247";
const key = `${prefix}-${id}`;
function clearLocalStorage() {
localStorage.removeItem(key);
window.location.reload();
}
function setValidLocalStorage() {
localStorage.setItem(
key,
JSON.stringify({
attendees: [
{
id: "2e0486e9-8dab-4d5f-b1cc-e4c798123abb",
name: "Bert",
isSkipped: false,
},
{
id: "e27c0bd2-6ff1-4285-983c-d16a6633abb0",
name: "Ernie",
isSkipped: false,
},
{
id: "af85ee36-ca33-4b44-a26b-8ba5e9651abe",
name: "Big Bird",
isSkipped: false,
},
{
id: "12a1fc7b-159d-4dac-8edd-b0e5c7d3c4f6",
name: "Elmo",
isSkipped: false,
},
],
})
);
window.location.reload();
}
function setLegacyLocalStorageV1() {
localStorage.setItem(
key,
JSON.stringify({
attendees: ["Bert", "Ernie", "Big Bird", "Elmo"],
shuffled: ["Ernie", "Big Bird", "Elmo", "Bert"],
})
);
window.location.reload();
}
function getLocalStorage() {
const currentLocalStorage = localStorage.getItem(key);
return currentLocalStorage;
}
function getConfig() {
return localStorage.getItem(`${prefix}-config`);
}
let localStorageCache = "";
let configCache = "";
setInterval(() => {
const currentLocalStorage = getLocalStorage();
const currentConfig = getConfig();
if (currentLocalStorage !== localStorageCache) {
document.getElementById("currentLocalStorage").innerText =
JSON.stringify(JSON.parse(currentLocalStorage), null, 2);
localStorageCache = currentLocalStorage;
}
if (currentConfig !== configCache) {
document.getElementById("currentConfig").innerText = JSON.stringify(
JSON.parse(currentConfig),
null,
2
);
configCache = currentConfig;
}
}, 200);
</script>
</body>
</html>