From d5e85ccfebe4fc6e3519ffaa6e4476addb634b21 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Sun, 29 Oct 2023 12:36:38 +0300 Subject: [PATCH] [~] Refactor --- .gitignore | 1 + d2/book1/book.js | 5 +- d2/book1/index.html | 7 +- d2/book1/script.js | 29 +++++++- dotfiles/.local/bin/commands | 133 ++++++++++++++++++++++------------- dotfiles/.tmux.conf | 1 + dotfiles/.vimrc | 1 + 7 files changed, 125 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 86f8105..d326974 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tmp __pycache__ +d2/book1/books diff --git a/d2/book1/book.js b/d2/book1/book.js index afa9d92..f92928e 100644 --- a/d2/book1/book.js +++ b/d2/book1/book.js @@ -1,4 +1,4 @@ -$(window).on('load', () => { +(function() { window.context.books.push(` DEATH of a HERO @@ -4747,4 +4747,5 @@ $(window).on('load', () => { In an agony of helpless grief and pity. `); -}); + window.context.update_books(); +})(); diff --git a/d2/book1/index.html b/d2/book1/index.html index 07079a0..c406473 100644 --- a/d2/book1/index.html +++ b/d2/book1/index.html @@ -13,6 +13,10 @@ Speech synthesiser + @@ -50,7 +54,7 @@

Current Sentence: @@ -59,6 +63,7 @@
+ diff --git a/d2/book1/script.js b/d2/book1/script.js index 9c11a63..c5164d8 100644 --- a/d2/book1/script.js +++ b/d2/book1/script.js @@ -1,6 +1,4 @@ $(window).on('load', () => { - window.context = {}; - window.context.books = []; var synth = window.speechSynthesis; @@ -29,9 +27,20 @@ $(window).on('load', () => { $('.screen .widget input[name=total-sentences]'), read_aloud: $('.screen .widget input[name=read-aloud]'), + add_book: + $('.screen .widget input[name=add-book]'), debug: $('.screen .widget input[name=debug]'), }; + context.update_books = () => { + context.ui.books_select.empty(); + window.context.books.map( + (o, i) => $('