-
Notifications
You must be signed in to change notification settings - Fork 1
/
loop_patches.html
200 lines (170 loc) · 5.77 KB
/
loop_patches.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Customize Loop</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
padding: 20px;
}
h1 {
color: #333;
}
div {
margin-bottom: 20px;
}
label {
display: block;
margin: 0px 0;
padding: 6px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
button {
display: block;
margin-top: 20px;
padding: 10px 20px;
font-size: 18px;
color: #fff;
background-color: #007BFF;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
textarea {
width: 100%;
height: 500px;
margin-top: 20px;
padding: 10px;
box-sizing: border-box;
border: none;
background-color: #fff;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<h1>Customize Loop</h1>
<div>
<label><input type="checkbox" id="option1"> Manual bolus threshold</label><br>
<label><input type="checkbox" id="option2"> Omnipod Dash Site Change</label><br>
<label><input type="checkbox" id="option3"> Dexcom G6+G7 - Sensor Change</label><br>
<label><input type="checkbox" id="option4"> Dexcom G6+G7 - Upload Readings</label><br>
<label><input type="checkbox" id="option5"> View PreMeal in Nightscout</label><br>
<label><input type="checkbox" id="option6"> Future carbs 90 minutes</label><br>
<label><input type="checkbox" id="option7"> Required carbs</label><br>
<label><input type="checkbox" id="option8"> Dash Fast Forward</label><br>
<label><input type="checkbox" id="option9"> Basic I:C Bolus Calculation</label><br>
<label><input type="checkbox" id="option10"> 2 hours Lolipop</label><br>
</div>
<button id="copyButton">Copy to Clipboard</button>
<textarea id="output" readonly></textarea>
<script>
let options = [
];
function indent(level) {
return ' '.repeat(level * 2);
}
function addOption(id, comment, url, directory = '') {
let command = `curl ${url} | git apply`;
if (directory) {
command += ` --directory=${directory}`;
}
let text = `
${indent(5)}# ${comment}
${indent(5)}${command}
`;
options.push({
id: id,
text: text
});
}
addOption(
'option1',
'Loop: Manual bolus threshold',
'https://raw.githubusercontent.com/bjorkert/patches/master/manualBolusThreshold.patch',
'Loop'
);
addOption(
'option2',
'OmniBLE: Omnipod Dash Site Change',
'https://raw.githubusercontent.com/bjorkert/patches/master/siteChange.patch',
'OmniBLE'
);
addOption(
'option3',
'CGMBLEKit: Dexcom G6+G7 - Sensor Change',
'https://raw.githubusercontent.com/bjorkert/patches/master/g6g7_sage.patch'
);
addOption(
'option4',
'CGMBLEKit: Dexcom G6+G7 - Upload Readings',
'https://raw.githubusercontent.com/bjorkert/patches/master/g6g7_upload_readings.patch'
);
addOption(
'option5',
'Loop: View PreMeal in Nightscout',
'https://raw.githubusercontent.com/bjorkert/patches/master/preMeal.patch',
'Loop'
);
addOption(
'option6',
'Loop: Future carbs 90 minutes',
'https://raw.githubusercontent.com/bjorkert/patches/master/90m.patch',
'Loop'
);
addOption(
'option7',
'Required carbs',
'https://raw.githubusercontent.com/bjorkert/patches/master/updateRequiredCarbs.patch'
);
addOption(
'option8',
'Dash Fast Forward',
'https://raw.githubusercontent.com/bjorkert/patches/master/fast_forward.patch'
);
addOption(
'option9',
'Basic I:C Bolus Calculation',
'https://raw.githubusercontent.com/bjorkert/patches/master/basicICBolusCalc.patch'
);
addOption(
'option10',
'2 hours Lolipop',
'https://raw.githubusercontent.com/bjorkert/patches/master/2hlollipop.patch'
);
const initialText = indent(3) + `# Customize Loop: Download and apply patches
${indent(3)}- name: Customize Loop
${indent(4)}run: |`;
const output = document.getElementById('output');
const copyButton = document.getElementById('copyButton');
function updateOutput() {
let text = initialText;
options.forEach(option => {
const checkbox = document.getElementById(option.id);
if (checkbox.checked) {
text += option.text;
}
});
output.value = text;
}
options.forEach(option => {
const checkbox = document.getElementById(option.id);
checkbox.addEventListener('change', updateOutput);
});
copyButton.addEventListener('click', () => {
output.select();
document.execCommand('copy');
alert('Text copied to clipboard!');
});
updateOutput();
</script>
</body>
</html>