-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
83 lines (74 loc) · 2.61 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
<!DOCTYPE html>
<html lang="nl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Sportlink CSV naar Mailchimp CSV</title>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/sportlink-to-mailchimp-converter.umd.js"></script>
<script>
const converter = new SportlinkToMailchimpConverter.SportlinkToMailchimpConverter({
nonAthleticsMembershipTypes: ['Gastlid', 'Recreanten', 'Overigen'],
athleticsMembershipTypes: ['Atletiek'],
});
function handleFileSelect(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const contents = e.target.result;
const lines = contents.split('\n').slice(0, 6);
document.getElementById('file-preview').textContent = lines.join('\n');
// Convert the selected file
converter.convertFileToOutput(file).then(output => {
const outputLines = output.split('\n').slice(0, 6);
document.getElementById('converted-preview').textContent = outputLines.join('\n');
});
};
reader.readAsText(file);
}
}
</script>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 800px;
margin: 0 auto;
background-color: #f9f9f9;
padding: 20px;
}
h1 {
color: #2e004f;
margin: 20px 0;
}
button {
background-color: #2e004f;
color: white;
border-radius: 5px;
padding: 10px 20px;
border: none;
cursor: pointer;
}
pre {
border: 1px solid lightgray;
border-radius: 5px;
margin: 10px 0;
padding: 10px;
}
</style>
</head>
<body>
<div class="container">
<h1>Sportlink CSV naar Mailchimp CSV</h1>
<input type="file" id="file-input" accept=".csv">
<pre id="file-preview"></pre>
<pre id="converted-preview"></pre>
<script>
document.getElementById('file-input').addEventListener('change', handleFileSelect);
</script>
</div>
</body>
</html>