Sebastian Berlin (WMSE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/300247

Change subject: Start and stop recitation with keyboard
......................................................................

Start and stop recitation with keyboard

Added a shortcut (initially ctrl + space) to start and stop the recitation.

Bug: T133676
Change-Id: I2a0615989056a08a84d965d14e6f03a82af7dbda
---
M modules/ext.wikispeech.js
1 file changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikispeech 
refs/changes/47/300247/1

diff --git a/modules/ext.wikispeech.js b/modules/ext.wikispeech.js
index f468880..0b819af 100644
--- a/modules/ext.wikispeech.js
+++ b/modules/ext.wikispeech.js
@@ -2,10 +2,10 @@
 
        /**
         * Adds button for starting and stopping recitation to the page.
-        * When no utterance is playing, clicking starts the first utterance.
-        * When an utterance is being played, clicking stops the playback.
-        * The button changes between play and stop symbols to reflect its
-        * current function.
+        * When no utterance is playing, the button starts the first utterance.
+        * When an utterance is being played, the button stops the playback. The
+        * button changes between play and stop symbols to reflect its current
+        * function.
         */
 
        function addPlayStopButton() {
@@ -34,6 +34,12 @@
                                } );
                        }
                } );
+               // Add keyboard shortcut.
+               $( document ).keydown( function ( event ) {
+                       if ( event.ctrlKey && event.key === ' ' ) {
+                               $playStopButton.click();
+                       }
+               } );
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/300247
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a0615989056a08a84d965d14e6f03a82af7dbda
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikispeech
Gerrit-Branch: master
Gerrit-Owner: Sebastian Berlin (WMSE) <sebastian.ber...@wikimedia.se>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to