rollup ui/cli

lichess.cli.min.js: 2407 -> 1616 bytes
pull/6909/head
Niklas Fiekas 2020-06-30 21:05:40 +02:00
parent 731cd8373b
commit 668906f0a2
3 changed files with 3 additions and 39 deletions

View File

@ -1,3 +0,0 @@
const lilaGulp = require('@build/tsProject');
lilaGulp('LichessCli', 'lichess.cli', __dirname);

View File

@ -6,12 +6,12 @@
"author": "Thibault Duplessis",
"license": "AGPL-3.0-or-later",
"devDependencies": {
"@build/tsProject": "2.0.0",
"@build/rollupProject": "2.0.0",
"@types/jquery": "^2.0",
"@types/lichess": "2.0.0"
},
"scripts": {
"dev": "gulp dev",
"prod": "gulp prod"
"dev": "rollup --config",
"prod": "rollup --config --config-prod"
}
}

View File

@ -1,33 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function app(wrap, toggle) {
var $wrap = $(wrap), $input = $wrap.find('input');
window.lichess.userAutocomplete($input, {
focus: 1,
friend: true,
onSelect: function (q) {
execute(q.name || q);
$input.val('');
}
}).done(function () {
$input.on('blur', function () { return wrap.classList.contains('shown') && toggle; });
});
}
exports.app = app;
function execute(q) {
if (!q)
return;
if (q[0] === '/')
command(q.slice(1));
else
location.href = '/@/' + q;
}
function command(q) {
var parts = q.split(' '), exec = parts[0];
if (exec === 'tv' || exec === 'follow')
location.href = '/@/' + parts[1] + '/tv';
else if (exec === 'play' || exec === 'challenge' || exec === 'match')
location.href = '/?user=' + parts[1] + '#friend';
else
alert('Unknown command: ' + q);
}