-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSettingsForm.html
74 lines (57 loc) · 3.53 KB
/
SettingsForm.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
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<form id="settings" class="d-grid gap-2" onsubmit="event.preventDefault(); google.script.run.processSettingsForm(this)" method="POST">
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_CLIENT_ID" name="SPOTIFY_CLIENT_ID" placeholder="SPOTIFY_CLIENT_ID" value="<?= SPOTIFY_CLIENT_ID ?>">
<label for="SPOTIFY_CLIENT_ID">SPOTIFY_CLIENT_ID</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_CLIENT_SECRET" name="SPOTIFY_CLIENT_SECRET" placeholder="SPOTIFY_CLIENT_SECRET" value="<?= SPOTIFY_CLIENT_SECRET ?>">
<label for="SPOTIFY_CLIENT_SECRET">SPOTIFY_CLIENT_SECRET</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_SAVED_SONGS_PLAYLIST_ID" name="SPOTIFY_SAVED_SONGS_PLAYLIST_ID" placeholder="SPOTIFY_SAVED_SONGS_PLAYLIST_ID" value="<?= SPOTIFY_SAVED_SONGS_PLAYLIST_ID ?>">
<label for="SPOTIFY_SAVED_SONGS_PLAYLIST_ID">SPOTIFY_SAVED_SONGS_PLAYLIST_ID</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_SAVED_ARCHIVE_PLAYLIST_ID" name="SPOTIFY_SAVED_ARCHIVE_PLAYLIST_ID" placeholder="SPOTIFY_SAVED_ARCHIVE_PLAYLIST_ID" value="<?= SPOTIFY_SAVED_ARCHIVE_PLAYLIST_ID ?>">
<label for="SPOTIFY_SAVED_ARCHIVE_PLAYLIST_ID">SPOTIFY_SAVED_ARCHIVE_PLAYLIST_ID</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_RELEASE_RADAR_PLAYLIST_ID" name="SPOTIFY_RELEASE_RADAR_PLAYLIST_ID" placeholder="SPOTIFY_RELEASE_RADAR_PLAYLIST_ID" value="<?= SPOTIFY_RELEASE_RADAR_PLAYLIST_ID ?>">
<label for="SPOTIFY_RELEASE_RADAR_PLAYLIST_ID">SPOTIFY_RELEASE_RADAR_PLAYLIST_ID</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_DISCOVER_WEEKLY_PLAYLIST_ID" name="SPOTIFY_DISCOVER_WEEKLY_PLAYLIST_ID" placeholder="SPOTIFY_DISCOVER_WEEKLY_PLAYLIST_ID" value="<?= SPOTIFY_DISCOVER_WEEKLY_PLAYLIST_ID ?>">
<label for="SPOTIFY_DISCOVER_WEEKLY_PLAYLIST_ID">SPOTIFY_DISCOVER_WEEKLY_PLAYLIST_ID</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_RELEASE_RADAR_BACKUP_PLAYLIST_ID" name="SPOTIFY_RELEASE_RADAR_BACKUP_PLAYLIST_ID" placeholder="SPOTIFY_RELEASE_RADAR_BACKUP_PLAYLIST_ID" value="<?= SPOTIFY_RELEASE_RADAR_BACKUP_PLAYLIST_ID ?>">
<label for="SPOTIFY_RELEASE_RADAR_BACKUP_PLAYLIST_ID">SPOTIFY_RELEASE_RADAR_BACKUP_PLAYLIST_ID</label>
</div>
<div class="form-floating">
<input type="text" class="form-control" id="SPOTIFY_DISCOVER_WEEKLY_BACKUP_PLAYLIST_ID" name="SPOTIFY_DISCOVER_WEEKLY_BACKUP_PLAYLIST_ID" placeholder="SPOTIFY_DISCOVER_WEEKLY_BACKUP_PLAYLIST_ID" value="<?= SPOTIFY_DISCOVER_WEEKLY_BACKUP_PLAYLIST_ID ?>">
<label for="SPOTIFY_DISCOVER_WEEKLY_BACKUP_PLAYLIST_ID">SPOTIFY_DISCOVER_WEEKLY_BACKUP_PLAYLIST_ID</label>
</div>
<button class="btn btn-primary" id="submit" type="submit">Save</button>
</form>
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js"></script>
<script type="application/javascript">
$(document).ready(function() {
$('input').change(validate);
validate();
});
function validate() {
let errors = false;
$('input').each(function() {
const me = $(this);
if (!me.val()) {
me.addClass('is-invalid');
errors = true;
}
else {
me.removeClass('is-invalid');
}
});
$('#submit').prop('disabled', errors);
}
</script>