Skip to content

Commit

Permalink
Merge pull request lichess-org#8438 from kraktus/inquiry
Browse files Browse the repository at this point in the history
Sync inquiry notes across tabs.
  • Loading branch information
ornicar authored Mar 21, 2021
2 parents 306356e + 750035a commit ec4f91e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion public/javascripts/inquiry.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
$(function () {
const noteStore = lichess.storage.make('inquiry-note');
const noteTextArea = $('#inquiry .notes').find('textarea')[0];

$('#inquiry .notes').on('mouseenter', function () {
$(this).find('textarea')[0].focus();
noteTextArea.focus();
noteTextArea.value = noteStore.get();
});

$('#inquiry .notes').on('keydown', function () {
setTimeout(function () {
noteStore.set(noteTextArea.value);
}, 5);
});

$('#inquiry .notes').on('submit', function () {
noteStore.remove();
});

$('#inquiry .costello').on('click', () => {
$('#inquiry').toggleClass('hidden');
$('body').toggleClass('no-inquiry');
Expand Down

0 comments on commit ec4f91e

Please sign in to comment.