From 7a6d000e583d1f76fc39402024509b2821de4278 Mon Sep 17 00:00:00 2001
From: jcorporation <mail@jcgames.de>
Date: Mon, 1 Oct 2018 23:02:49 +0100
Subject: [PATCH] Fix: differentiate between lower and upper case keyboard
 shortcuts

---
 htdocs/js/mympd.js | 61 +++++++++++++++++++++++++++-------------------
 1 file changed, 36 insertions(+), 25 deletions(-)

diff --git a/htdocs/js/mympd.js b/htdocs/js/mympd.js
index 40a1a0d..15a8ae0 100644
--- a/htdocs/js/mympd.js
+++ b/htdocs/js/mympd.js
@@ -569,33 +569,44 @@ function appInit() {
     document.addEventListener('keydown', function(event) {
         if (event.target.tagName == 'INPUT' || event.target.tagName == 'SELECT')
             return;
-        switch (event.which) {
-            case 37: //left
-                clickPrev();
-                break;
-            case 39: //right
-                clickNext();
-                break;
-            case 32: //space
-                clickPlay();
-                break;
-            case 83: //s
-                clickStop();
-                break;
-            case 173: //-
-                chVolume(-5);
-                break;
-            case 171: //+
-                chVolume(5);
-                break;
-            case 67: //C c
-                if (event.shiftKey)
+        if (event.shiftKey) {
+            switch (event.which) {
+                case 83: //S
+                    sendAPI({"cmd": "MPD_API_QUEUE_SHUFFLE"});
+                    break;
+                case 67: //C
                     sendAPI({"cmd": "MPD_API_QUEUE_CROP"});
-                else
+                    break;
+                default:
+                    return;
+            }
+        }
+        else {
+            switch (event.which) {
+                case 37: //left
+                    clickPrev();
+                    break;
+                case 39: //right
+                    clickNext();
+                    break;
+                case 32: //space
+                    clickPlay();
+                    break;
+                case 83: //s
+                    clickStop();
+                    break;
+                case 173: //-
+                    chVolume(-5);
+                    break;
+                case 171: //+
+                    chVolume(5);
+                    break;
+                case 67: //c
                     sendAPI({"cmd": "MPD_API_QUEUE_CLEAR"});
-                break;
-            default:
-                return;
+                    break;
+                default:
+                    return;
+            }
         }
         event.preventDefault();
     }, false);