remove $.ajax from standalone scripts

pull/7246/head
Thibault Duplessis 2020-09-06 18:32:34 +02:00
parent ebe0915f16
commit 833b06ed7f
2 changed files with 13 additions and 6 deletions

View File

@ -9,7 +9,12 @@ window.lichess.load.then(() => {
storage.set(hash);
const $i = $('#signup-fp-input');
if ($i.length) $i.val(hash);
else $.post('/auth/set-fp/' + hash + '/' + Math.round(performance.now() - t));
else fetch(
'/auth/set-fp/' + hash + '/' + Math.round(performance.now() - t), {
method: 'post',
credentials: 'same-origin',
}
);
};
if (storage.get()) send(storage.get());
else fipr.get(c => send(fipr.x64hash128(c.map(x => x.value).join(''), 31)));

View File

@ -1,10 +1,12 @@
$(function() {
window.lichess.load.then(() => {
lichess.refreshInsightForm = function() {
$('form.insight-refresh:not(.armed)').addClass('armed').submit(function() {
lichess.modal($(this).find('.crunching'));
$.post($(this).attr('action'), function() {
lichess.reload();
});
fetch(this.action, {
method: 'post',
credentials: 'same-origin',
}).then(lichess.reload);
if (lichess.modal) lichess.modal($(this).find('.crunching'));
else $(this).replaceWith($(this).find('.crunching').show());
return false;
});
};