more xhr updates - WIP
parent
efd65cc196
commit
b555288b34
|
@ -2,9 +2,9 @@ function toBlurArray(player) {
|
|||
return player.blurs && player.blurs.bits ? player.blurs.bits.split('') : [];
|
||||
}
|
||||
lichess.advantageChart = function(data, trans, el) {
|
||||
lichess.loadScript('javascripts/chart/common.js').done(function() {
|
||||
lichess.loadScript('javascripts/chart/division.js').done(function() {
|
||||
lichess.chartCommon('highchart').done(function() {
|
||||
lichess.loadScript('javascripts/chart/common.js').then(function() {
|
||||
lichess.loadScript('javascripts/chart/division.js').then(function() {
|
||||
lichess.chartCommon('highchart').then(function() {
|
||||
|
||||
lichess.advantageChart.update = function(d) {
|
||||
$(el).highcharts().series[0].setData(makeSerieData(d));
|
||||
|
|
|
@ -2,7 +2,7 @@ lichess.highchartsPromise;
|
|||
lichess.chartCommon = function(type) {
|
||||
if (lichess.highchartsPromise) return lichess.highchartsPromise;
|
||||
var file = type === 'highstock' ? 'highstock.js' : 'highcharts.js';
|
||||
return lichess.highchartsPromise = lichess.loadScript('vendor/highcharts-4.2.5/' + file, { noVersion: true }).done(function() {
|
||||
return lichess.highchartsPromise = lichess.loadScript('vendor/highcharts-4.2.5/' + file, { noVersion: true }).then(function() {
|
||||
// Drop-in fix for Highcharts issue #8477 on older Highcharts versions. The
|
||||
// issue is fixed since Highcharts v6.1.1.
|
||||
Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function(proceed) {
|
||||
|
|
|
@ -3,9 +3,9 @@ function toBlurArray(player) {
|
|||
}
|
||||
lichess.movetimeChart = function(data, trans) {
|
||||
if (!data.game.moveCentis) return; // imported games
|
||||
lichess.loadScript('javascripts/chart/common.js').done(function() {
|
||||
lichess.loadScript('javascripts/chart/division.js').done(function() {
|
||||
lichess.chartCommon('highchart').done(function() {
|
||||
lichess.loadScript('javascripts/chart/common.js').then(function() {
|
||||
lichess.loadScript('javascripts/chart/division.js').then(function() {
|
||||
lichess.chartCommon('highchart').then(function() {
|
||||
lichess.movetimeChart.render = function() {
|
||||
$('#movetimes-chart:not(.rendered)').each(function() {
|
||||
var $this = $(this).addClass('rendered');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
lichess.ratingDistributionChart = function(data) {
|
||||
const trans = lichess.trans(data.i18n);
|
||||
lichess.loadScript('javascripts/chart/common.js').done(function() {
|
||||
lichess.chartCommon('highchart').done(function() {
|
||||
lichess.loadScript('javascripts/chart/common.js').then(function() {
|
||||
lichess.chartCommon('highchart').then(function() {
|
||||
var disabled = {
|
||||
enabled: false
|
||||
};
|
||||
|
|
|
@ -28,8 +28,8 @@ lichess.ratingHistoryChart = function(data, singlePerfName) {
|
|||
var indexFilter = function(_, i) {
|
||||
return !singlePerfName || i === singlePerfIndex;
|
||||
};
|
||||
lichess.loadScript('javascripts/chart/common.js').done(function() {
|
||||
lichess.chartCommon('highstock').done(function() {
|
||||
lichess.loadScript('javascripts/chart/common.js').then(function() {
|
||||
lichess.chartCommon('highstock').then(function() {
|
||||
// support: Fx when user bio overflows
|
||||
var disabled = {
|
||||
enabled: false
|
||||
|
|
|
@ -2,8 +2,8 @@ function loadShepherd(f) {
|
|||
var theme = 'shepherd-theme-' + ($('body').hasClass('dark') ? 'default' : 'dark');
|
||||
lichess.loadCss('vendor/shepherd/dist/css/' + theme + '.css');
|
||||
lichess.loadCss('stylesheets/shepherd.css');
|
||||
lichess.loadScript('vendor/shepherd/dist/js/tether.js', {noVersion:true}).done(function() {
|
||||
lichess.loadScript('vendor/shepherd/dist/js/shepherd.min.js', {noVersion:true}).done(function() {
|
||||
lichess.loadScript('vendor/shepherd/dist/js/tether.js', {noVersion:true}).then(function() {
|
||||
lichess.loadScript('vendor/shepherd/dist/js/shepherd.min.js', {noVersion:true}).then(function() {
|
||||
f(theme);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,8 +3,8 @@ function loadShepherd(f) {
|
|||
var theme = 'shepherd-theme-' + ($('body').hasClass('dark') ? 'default' : 'dark');
|
||||
lichess.loadCss('vendor/shepherd/dist/css/' + theme + '.css');
|
||||
lichess.loadCss('stylesheets/shepherd.css');
|
||||
lichess.loadScript('vendor/shepherd/dist/js/tether.js', {noVersion: true}).done(function () {
|
||||
lichess.loadScript('vendor/shepherd/dist/js/shepherd.min.js', {noVersion: true}).done(function () {
|
||||
lichess.loadScript('vendor/shepherd/dist/js/tether.js', {noVersion: true}).then(function () {
|
||||
lichess.loadScript('vendor/shepherd/dist/js/shepherd.min.js', {noVersion: true}).then(function () {
|
||||
f(theme);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ interface Lichess {
|
|||
jsModule(name: string): string;
|
||||
loadScript(url: string, opts?: AssetUrlOpts): Promise<void>;
|
||||
hopscotch: any;
|
||||
slider(): any;
|
||||
slider(): Promise<void>;
|
||||
makeChat(data: any): any;
|
||||
numberFormat(n: number): string;
|
||||
idleTimer(delay: number, onIdle: () => void, onWakeUp: () => void): void;
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
export const defined = <A>(v: A | undefined): v is A =>
|
||||
typeof v !== 'undefined';
|
||||
|
||||
export const notNull = <T>(value: T | null | undefined): value is T =>
|
||||
export const notNull = <T>(value: T | null | undefined): value is T =>
|
||||
value !== null && value !== undefined;
|
||||
|
||||
export const isEmpty = (a: any): boolean => !a || a.length === 0;
|
||||
|
||||
/* export const foreach = <A>(a: A | undefined, f: (a: A) => void): void => { */
|
||||
/* if (a) f(a); */
|
||||
/* } */
|
||||
|
||||
export interface Prop<T> {
|
||||
(): T
|
||||
(v: T): T
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import * as xhr from 'common/xhr';
|
||||
import once from "./component/once";
|
||||
import { hopscotch } from "./component/assets";
|
||||
import loadInfiniteScroll from "./component/infinite-scroll";
|
||||
|
@ -44,7 +45,7 @@ window.lichess.load.then(() => {
|
|||
$content = $('.angle-content'),
|
||||
browseTo = (path: string) => {
|
||||
$('.angle-content .infinitescroll').infinitescroll('destroy');
|
||||
$.get(path).then(html => {
|
||||
xhr.text(path).then(html => {
|
||||
$content.html(html);
|
||||
window.lichess.pubsub.emit('content_loaded');
|
||||
history.replaceState({}, '', path);
|
||||
|
|
Loading…
Reference in New Issue