Merge branch 'master' into tourneyMithril
* master: explicitely prevent caching of XHR GET requests Conflicts: public/javascripts/big.js
This commit is contained in:
commit
0867ca922a
|
@ -623,6 +623,7 @@ lichess.storage = {
|
|||
$('#message_notifications_tag').on('click', function() {
|
||||
$.ajax({
|
||||
url: $(this).data('href'),
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
$('#message_notifications_display').html(html)
|
||||
.find('a.mark_as_read').click(function() {
|
||||
|
@ -681,6 +682,7 @@ lichess.storage = {
|
|||
var $themepicker = $('#themepicker');
|
||||
$.ajax({
|
||||
url: $(this).data('url'),
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
$themepicker.append(html);
|
||||
var $body = $('body');
|
||||
|
@ -903,6 +905,7 @@ lichess.storage = {
|
|||
langs = acceptLanguages.split(',');
|
||||
$.ajax({
|
||||
url: $links.data('url'),
|
||||
cache: false,
|
||||
success: function(list) {
|
||||
$links.prepend(list.map(function(lang) {
|
||||
var klass = $.fp.contains(langs, lang[0]) ? 'class="accepted"' : '';
|
||||
|
@ -1103,10 +1106,14 @@ lichess.storage = {
|
|||
},
|
||||
end: function() {
|
||||
var url = (data.tv ? cfg.routes.Tv.side : cfg.routes.Round.sideWatcher)(data.game.id, data.player.color).url;
|
||||
$.get(url, function(html) {
|
||||
$('#site_header div.side').replaceWith(html);
|
||||
$('body').trigger('lichess.content_loaded');
|
||||
startTournamentClock();
|
||||
$.ajax({
|
||||
url: url,
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
$('#site_header div.side').replaceWith(html);
|
||||
$('body').trigger('lichess.content_loaded');
|
||||
startTournamentClock();
|
||||
}
|
||||
});
|
||||
},
|
||||
checkCount: function(e) {
|
||||
|
@ -1529,6 +1536,7 @@ lichess.storage = {
|
|||
reload_timeline: function() {
|
||||
$.ajax({
|
||||
url: $("#timeline").data('href'),
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
$('#timeline').html(html);
|
||||
$('body').trigger('lichess.content_loaded');
|
||||
|
@ -1552,7 +1560,9 @@ lichess.storage = {
|
|||
},
|
||||
reload_forum: function() {
|
||||
setTimeout(function() {
|
||||
$.ajax($newposts.data('url'), {
|
||||
$.ajax({
|
||||
url: $newposts.data('url'),
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
$newposts.find('ol').html(data).end().scrollTop(0);
|
||||
$('body').trigger('lichess.content_loaded');
|
||||
|
@ -1842,6 +1852,7 @@ lichess.storage = {
|
|||
$('.lichess_overboard').remove();
|
||||
$.ajax({
|
||||
url: $(this).attr('href'),
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
$('.lichess_overboard').remove();
|
||||
$('#hooks_wrap').prepend(html);
|
||||
|
|
|
@ -70,10 +70,14 @@ module.exports = {
|
|||
return m('div.hook_filter', {
|
||||
config: function(el, isUpdate, ctx) {
|
||||
if (ctx.loaded) return;
|
||||
$.get('/setup/filter', function(html) {
|
||||
el.innerHTML = html;
|
||||
ctx.loaded = true;
|
||||
initialize(ctrl, el);
|
||||
$.ajax({
|
||||
url: '/setup/filter',
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
el.innerHTML = html;
|
||||
ctx.loaded = true;
|
||||
initialize(ctrl, el);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,18 +5,22 @@ var xhrConfig = function(xhr) {
|
|||
xhr.setRequestHeader('Accept', 'application/vnd.lichess.v1+json');
|
||||
}
|
||||
|
||||
function uncache(url) {
|
||||
return url + '?_=' + new Date().getTime();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
seeks: function() {
|
||||
return m.request({
|
||||
method: 'GET',
|
||||
url: '/lobby/seeks',
|
||||
url: uncache('/lobby/seeks'),
|
||||
config: xhrConfig
|
||||
});
|
||||
},
|
||||
nowPlaying: function() {
|
||||
return m.request({
|
||||
method: 'GET',
|
||||
url: '/lobby/playing',
|
||||
url: uncache('/lobby/playing'),
|
||||
config: xhrConfig
|
||||
});
|
||||
}
|
||||
|
|
|
@ -273,8 +273,12 @@ function renderHistory(ctrl) {
|
|||
var hash = ctrl.data.user.history.join('');
|
||||
if (hash == context.hash) return;
|
||||
context.hash = hash;
|
||||
$.get('/training/history', function(html) {
|
||||
el.innerHTML = html;
|
||||
$.ajax({
|
||||
url: '/training/history',
|
||||
cache: false,
|
||||
success: function(html) {
|
||||
el.innerHTML = html;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,6 +10,10 @@ function showLoading(ctrl) {
|
|||
m.redraw();
|
||||
}
|
||||
|
||||
function uncache(url) {
|
||||
return url + '?_=' + new Date().getTime();
|
||||
}
|
||||
|
||||
function attempt(ctrl, win) {
|
||||
showLoading(ctrl);
|
||||
m.request({
|
||||
|
@ -44,7 +48,7 @@ function retry(ctrl) {
|
|||
showLoading(ctrl);
|
||||
m.request({
|
||||
method: 'GET',
|
||||
url: ctrl.router.Puzzle.load(ctrl.data.puzzle.id).url,
|
||||
url: uncache(ctrl.router.Puzzle.load(ctrl.data.puzzle.id).url),
|
||||
config: xhrConfig
|
||||
}).then(ctrl.reload);
|
||||
}
|
||||
|
@ -65,7 +69,7 @@ function newPuzzle(ctrl) {
|
|||
showLoading(ctrl);
|
||||
m.request({
|
||||
method: 'GET',
|
||||
url: '/training/new',
|
||||
url: uncache('/training/new'),
|
||||
config: xhrConfig
|
||||
}).then(ctrl.reload);
|
||||
}
|
||||
|
|
|
@ -5,12 +5,16 @@ var xhrConfig = function(xhr) {
|
|||
xhr.setRequestHeader('Accept', 'application/vnd.lichess.v1+json');
|
||||
}
|
||||
|
||||
function uncache(url) {
|
||||
return url + '?_=' + new Date().getTime();
|
||||
}
|
||||
|
||||
function reload(ctrl) {
|
||||
ctrl.vm.reloading = true;
|
||||
m.redraw();
|
||||
var req = m.request({
|
||||
method: 'GET',
|
||||
url: ctrl.data.url.round,
|
||||
url: uncache(ctrl.data.url.round),
|
||||
config: xhrConfig
|
||||
});
|
||||
req.then(function() {
|
||||
|
@ -24,7 +28,7 @@ function reload(ctrl) {
|
|||
function next(ctrl) {
|
||||
return m.request({
|
||||
method: 'GET',
|
||||
url: ctrl.router.Round.next(ctrl.data.game.id).url,
|
||||
url: uncache(ctrl.router.Round.next(ctrl.data.game.id).url),
|
||||
config: xhrConfig
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue