parent
731cd8373b
commit
668906f0a2
|
@ -1,3 +0,0 @@
|
|||
const lilaGulp = require('@build/tsProject');
|
||||
|
||||
lilaGulp('LichessCli', 'lichess.cli', __dirname);
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue