[ai] new option on how to continue for mapping
This commit is contained in:
@@ -117,6 +117,14 @@
|
||||
<label for="song">Song:</label>
|
||||
<input type="text" id="song" name="song" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" name="mode">
|
||||
<option value="s">Single (play selected song / file)</option>
|
||||
<option value="f">Folder (play selected folder, then stop)</option>
|
||||
<option value="c">Continuous (continuous playback / loop folder)</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" class="action-btn" style="grid-column: 1 / -1;" onclick="editMapping()">Update Mapping</button>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -164,13 +164,17 @@ function playNamedSong(song) {
|
||||
function editMapping() {
|
||||
var rfid = document.getElementById('rfid').value;
|
||||
var song = document.getElementById('song').value;
|
||||
var modeEl = document.getElementById('mode');
|
||||
var mode = modeEl ? modeEl.value : 's';
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/edit_mapping", true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||
xhr.send("rfid=" + encodeURIComponent(rfid) + "&song=" + encodeURIComponent(song));
|
||||
xhr.send("rfid=" + encodeURIComponent(rfid) + "&song=" + encodeURIComponent(song) + "&mode=" + encodeURIComponent(mode));
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
alert("Mapping updated successfully!");
|
||||
} else if (xhr.readyState === 4) {
|
||||
alert("Failed to update mapping: " + (xhr.responseText || xhr.status));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user