Only send websocket message to update team FTA notes if notes changed.

This commit is contained in:
Patrick Fairbank
2020-04-04 14:23:08 -07:00
parent b49afaa363
commit 636d2c0927

View File

@@ -128,14 +128,16 @@ var handleEventStatus = function(data) {
// Makes the team notes section editable and handles saving edits to the server.
var editFtaNotes = function(element) {
var teamNotesElement = $(element);
var teamNotesTextElement = $(element);
var textArea = $("<textarea />");
textArea.val(teamNotesElement.text());
teamNotesElement.replaceWith(textArea);
textArea.val(teamNotesTextElement.text());
teamNotesTextElement.replaceWith(textArea);
textArea.focus();
textArea.blur(function() {
textArea.replaceWith(teamNotesElement);
websocket.send("updateTeamNotes", { station: teamNotesElement.attr("data-station"), notes: textArea.val()});
textArea.replaceWith(teamNotesTextElement);
if (textArea.val() !== teamNotesTextElement.text()) {
websocket.send("updateTeamNotes", { station: teamNotesTextElement.attr("data-station"), notes: textArea.val()});
}
});
};