From 2387542efc2ea4efc77f8428f0a869369cd9f527 Mon Sep 17 00:00:00 2001 From: neauoire Date: Wed, 25 Mar 2020 10:02:22 +0900 Subject: [PATCH] Improved builder --- .gitignore | 1 + icon.svg | 6 ------ index.html | 3 ++- scripts/lib/acels.js | 5 ++++- scripts/lib/build.js | 12 ++++-------- 5 files changed, 11 insertions(+), 16 deletions(-) delete mode 100644 icon.svg diff --git a/.gitignore b/.gitignore index 5e380f1..032286e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ builds/ .DS_Store */.DS_Store +debug.* \ No newline at end of file diff --git a/icon.svg b/icon.svg deleted file mode 100644 index ae2f668..0000000 --- a/icon.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/index.html b/index.html index 706a828..7b8d709 100644 --- a/index.html +++ b/index.html @@ -59,7 +59,7 @@ function Acels (client) { return h } this.convert = (event) => { - const accelerator = event.key === ' ' ? 'Space' : event.key.substr(0, 1).toUpperCase() + event.key.substr(1) + const accelerator = event.key === ' ' ? 'Space' : capitalize(event.key.replace('Arrow', '')) if ((event.ctrlKey || event.metaKey) && event.shiftKey) { return `CmdOrCtrl+Shift+${accelerator}` } @@ -113,6 +113,7 @@ function Acels (client) { this.toggle = () => { this.el.className = this.el.className === 'hidden' ? '' : 'hidden' } + function capitalize (s) { return s.substr(0, 1).toUpperCase() + s.substr(1) } } 'use strict' function Lisp (lib = {}) { diff --git a/scripts/lib/acels.js b/scripts/lib/acels.js index c02832f..740b2e7 100644 --- a/scripts/lib/acels.js +++ b/scripts/lib/acels.js @@ -58,7 +58,7 @@ function Acels (client) { } this.convert = (event) => { - const accelerator = event.key === ' ' ? 'Space' : event.key.substr(0, 1).toUpperCase() + event.key.substr(1) + const accelerator = event.key === ' ' ? 'Space' : capitalize(event.key.replace('Arrow', '')) if ((event.ctrlKey || event.metaKey) && event.shiftKey) { return `CmdOrCtrl+Shift+${accelerator}` } @@ -81,6 +81,7 @@ function Acels (client) { this.onKeyDown = (e) => { const target = this.get(this.convert(e)) if (!target || !target.downfn) { return this.pipe ? this.pipe.onKeyDown(e) : null } + target.downfn() e.preventDefault() } @@ -118,4 +119,6 @@ function Acels (client) { this.toggle = () => { this.el.className = this.el.className === 'hidden' ? '' : 'hidden' } + + function capitalize (s) { return s.substr(0, 1).toUpperCase() + s.substr(1) } } diff --git a/scripts/lib/build.js b/scripts/lib/build.js index 5d70266..c77eec6 100644 --- a/scripts/lib/build.js +++ b/scripts/lib/build.js @@ -20,7 +20,7 @@ function cleanup (txt) { // Create release -const release_body = ` +fs.writeFileSync('index.html', cleanup(` @@ -43,13 +43,11 @@ const release_body = ` ${styles.reduce((acc, item) => { return `${acc}/* Including Style ${item} */ \n\n${fs.readFileSync('./links/' + item, 'utf8')}\n` }, '')} -` - -fs.writeFileSync('index.html', cleanup(release_body)) +`)) // Create debug -const debug_body = ` +fs.writeFileSync('debug.html', ` @@ -70,8 +68,6 @@ const debug_body = ` }) -` - -fs.writeFileSync('debug.html', debug_body) +`) console.log(`Built ${id}`)