JS tweaks and fixes
parent
5c4137df71
commit
f6acd7b318
|
@ -139,7 +139,7 @@ object layout {
|
|||
|
||||
private def loadScripts(moreJs: Frag, chessground: Boolean)(implicit ctx: Context) =
|
||||
frag(
|
||||
chessground option jsAt("vendor/chessground.min.js"),
|
||||
chessground option chessgroundTag,
|
||||
ctx.requiresFingerprint option fingerprintTag,
|
||||
embedJsUnsafe(
|
||||
s"""lichess={load:new Promise(r=>{window.onload=r}),quantity:${lila.i18n
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
function challengeStart(opts) {
|
||||
var selector = '.challenge-page';
|
||||
var element = document.querySelector(selector);
|
||||
var challenge = opts.data.challenge;
|
||||
var accepting;
|
||||
|
||||
lichess.socket = new lichess.StrongSocket(
|
||||
opts.socketUrl,
|
||||
opts.data.socketVersion, {
|
||||
options: {
|
||||
name: "challenge"
|
||||
},
|
||||
events: {
|
||||
reload: function() {
|
||||
$.ajax({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
lichess.checkout = function (publicKey) {
|
||||
lichess.checkout = function(publicKey) {
|
||||
|
||||
var $checkout = $('div.plan_checkout');
|
||||
var lifetime = {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
var selector = '.auth-login form';
|
||||
const selector = '.auth-login form';
|
||||
|
||||
$(function() {
|
||||
load($(selector));
|
||||
});
|
||||
$(() => load($(selector)));
|
||||
|
||||
function load($f) {
|
||||
$f.submit(function() {
|
||||
|
|
|
@ -219,8 +219,9 @@ export default class StrongSocket {
|
|||
break;
|
||||
default:
|
||||
this.pubsub.emit('socket.in.' + m.t, m.d, m);
|
||||
const processed = this.settings.receive && this.settings.receive(m.t, m.d);
|
||||
if (!processed && this.settings.events[m.t]) this.settings.events[m.t](m.d || null, m);
|
||||
(this.settings.receive && this.settings.receive(m.t, m.d)) || (
|
||||
this.settings.events[m.t] && this.settings.events[m.t](m.d || null, m)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ window.lichess.load.then(() => {
|
|||
|
||||
requestIdleCallback(() => {
|
||||
|
||||
new OnlineFriends(document.getElementById('friend_box')!);
|
||||
const friendsEl = document.getElementById('friend_box');
|
||||
if (friendsEl) new OnlineFriends(friendsEl);
|
||||
|
||||
$('#main-wrap')
|
||||
.on('click', '.autoselect', function(this: HTMLElement) {
|
||||
|
|
Loading…
Reference in New Issue