delay inquiry JS

pull/4403/head
Thibault Duplessis 2018-06-08 13:24:35 +02:00
parent a1c0a72040
commit ad1eb4d7b5
1 changed files with 21 additions and 19 deletions

View File

@ -1,24 +1,26 @@
$(function() {
$('#inquiry .notes').on('mouseenter', function() {
$(this).find('textarea')[0].focus();
});
$('#inquiry .costello').click(function() {
$('#inquiry').toggleClass('hidden');
$('body').toggleClass('no-inquiry');
});
window.requestIdleCallback(function() {
$(function() {
$('#inquiry .notes').on('mouseenter', function() {
$(this).find('textarea')[0].focus();
});
$('#inquiry .costello').click(function() {
$('#inquiry').toggleClass('hidden');
$('body').toggleClass('no-inquiry');
});
var nextStore = lichess.storage.make('inquiry-auto-next');
var next = function() {
return nextStore.get() !== '';
};
var nextStore = lichess.storage.make('inquiry-auto-next');
var next = function() {
return nextStore.get() !== '';
};
if (!next()) {
$('#inquiry .switcher input').attr('checked', false);
$('#inquiry input.auto-next').val('0');
}
if (!next()) {
$('#inquiry .switcher input').attr('checked', false);
$('#inquiry input.auto-next').val('0');
}
$('#inquiry .switcher input').on('change', function() {
nextStore.set(next() ? '' : '1');
$('#inquiry input.auto-next').val(next() ? '1' : '0');
$('#inquiry .switcher input').on('change', function() {
nextStore.set(next() ? '' : '1');
$('#inquiry input.auto-next').val(next() ? '1' : '0');
});
});
});