From fb3f8dda3f4791b9f0bedd7b0625e077ce0f4d60 Mon Sep 17 00:00:00 2001 From: jcass Date: Sun, 24 Jan 2016 21:29:32 +0200 Subject: [PATCH 01/11] Fix mute/unmute functionality: now also works if user unmutes by sliding volume manually. --- README.rst | 1 + .../static/images/icons/play_alt_12x12.png | Bin 0 -> 275 bytes .../static/images/icons/play_alt_16x16.png | Bin 0 -> 283 bytes mopidy_musicbox_webclient/static/index.html | 2 +- .../static/js/controls.js | 21 +++++++++++++----- mopidy_musicbox_webclient/static/mb.manifest | 4 +++- 6 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 mopidy_musicbox_webclient/static/images/icons/play_alt_12x12.png create mode 100644 mopidy_musicbox_webclient/static/images/icons/play_alt_16x16.png diff --git a/README.rst b/README.rst index 6a983b1..c7f1b14 100644 --- a/README.rst +++ b/README.rst @@ -63,6 +63,7 @@ v2.0.1 (UNRELEASED) - Increase volume slider handle by 30% to make it easier to grab on mobile devices - Add application cache manifest file for quicker loads and to allow client devices to detect when local caches should be invalidated. - Fix vertical alignment of playback control buttons in footer. +- Swop mute/unmute icons and apply fix to restore volume levels after unmute. v2.0.0 (26-3-2015) ------------------ diff --git a/mopidy_musicbox_webclient/static/images/icons/play_alt_12x12.png b/mopidy_musicbox_webclient/static/images/icons/play_alt_12x12.png new file mode 100644 index 0000000000000000000000000000000000000000..4d23adaf331802ba8fbdac4e68bc68290f1683b8 GIT binary patch literal 275 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&k$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWw1GTRmMILn>}1r8G2!W?$20SXrgO$B@Lh;sd+FJ%%H_iHeQ< z4op1(N7)>*>?b*uFkE`UaiyeDFzZvLP1i(INh8O(jKMXGDYhX(vJF?R7(3qOF=x%l zWu6drWT9aL=j`BySp}IQ2}ufq8yrd(-(ce55ZKSq@%iEtI|IkVlJ5)`Buxl@x0scU zCnuqCm!McATR@L?g!Ie>hA%plH7+W@V-z+Cad?=|afJJVNnJyiq|;Rc1{Mhhg+z-U U*#&B>Ko2l@y85}Sb4q9e0Ame6t3(I0e8UZa6b|8#1Y6Eok_)n~H^(x3{ajbP0l+XkKjuKZS literal 0 HcmV?d00001 diff --git a/mopidy_musicbox_webclient/static/index.html b/mopidy_musicbox_webclient/static/index.html index b2e64ea..0bb856f 100644 --- a/mopidy_musicbox_webclient/static/index.html +++ b/mopidy_musicbox_webclient/static/index.html @@ -117,7 +117,7 @@
  • - + diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index c0c279c..4106aa0 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -423,19 +423,28 @@ function doVolume(value) { } function triggerVolume() { - mopidy.playback.setVolume(parseInt(volumeChanging)); + if (volumeChanging > 0) { + $("#mutebt").attr('class', 'fa fa-volume-off'); + muteVolume = -1; + } else { + $("#mutebt").attr('class', 'fa fa-volume-up'); + muteVolume = currentVolume; + } + mopidy.playback.setVolume(parseInt(volumeChanging)).then(); + currentVolume = volumeChanging volumeChanging = 0; } function doMute() { //only emit the event, not the status if (muteVolume == -1) { - $("#mutebt").attr('src', 'images/icons/volume_mute_24x18.png'); - muteVolume = currentVolume; - mopidy.playback.setVolume(0).then(); + $("#mutebt").attr('class', 'fa fa-volume-up'); + volumeChanging = 0; + triggerVolume(); } else { - $("#mutebt").attr('src', 'images/icons/volume_24x18.png'); - mopidy.playback.setVolume(muteVolume).then(); + $("#mutebt").attr('class', 'fa fa-volume-off'); + volumeChanging = muteVolume; + triggerVolume(); muteVolume = -1; } diff --git a/mopidy_musicbox_webclient/static/mb.manifest b/mopidy_musicbox_webclient/static/mb.manifest index 7d2862d..144a601 100644 --- a/mopidy_musicbox_webclient/static/mb.manifest +++ b/mopidy_musicbox_webclient/static/mb.manifest @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2016-01-24:v1 +# 2016-01-24:v2 CACHE: index.html @@ -41,6 +41,8 @@ images/icons/musicbox32.png images/icons/musicbox57.png images/icons/musicbox72.png images/icons/musicbox114.png +images/icons/play_alt_12x12.png +images/icons/play_alt_16x16.png images/default_cover.png images/empty.png From 8cdc547d4e195e26f29c7e8d5978948f7e68cd22 Mon Sep 17 00:00:00 2001 From: jcass Date: Sun, 24 Jan 2016 21:44:46 +0200 Subject: [PATCH 02/11] Fix to store current volume on startup. --- mopidy_musicbox_webclient/static/js/controls.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index 4106aa0..300c25b 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -419,6 +419,8 @@ function doVolume(value) { volumeChanging = value; clearInterval(volumeTimer); volumeTimer = setTimeout(triggerVolume, 500); + } else { + currentVolume = value } } From 4bca4360009a303c150bd9e44c7fb5b20a946201 Mon Sep 17 00:00:00 2001 From: jcass Date: Mon, 25 Jan 2016 07:34:56 +0200 Subject: [PATCH 03/11] Refactor volume control and mute/unmute features. --- .../static/js/controls.js | 41 +++++++------------ mopidy_musicbox_webclient/static/mb.manifest | 2 +- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index 300c25b..6f4ba71 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -408,30 +408,23 @@ function setPosition(pos) { */ function setVolume(value) { - var oldval = initgui; - initgui = true; - $("#volumeslider").val(value).slider('refresh'); - initgui = oldval; + if (value != currentVolume) { + $("#volumeslider").val(value).slider('refresh'); + if (value > 0) { + $("#mutebt").attr('class', 'fa fa-volume-off'); + } else { + $("#mutebt").attr('class', 'fa fa-volume-up'); + } + } } function doVolume(value) { - if (!initgui) { - volumeChanging = value; - clearInterval(volumeTimer); - volumeTimer = setTimeout(triggerVolume, 500); - } else { - currentVolume = value - } + volumeChanging = value; + clearInterval(volumeTimer); + volumeTimer = setTimeout(triggerVolume, 500); } function triggerVolume() { - if (volumeChanging > 0) { - $("#mutebt").attr('class', 'fa fa-volume-off'); - muteVolume = -1; - } else { - $("#mutebt").attr('class', 'fa fa-volume-up'); - muteVolume = currentVolume; - } mopidy.playback.setVolume(parseInt(volumeChanging)).then(); currentVolume = volumeChanging volumeChanging = 0; @@ -439,17 +432,13 @@ function triggerVolume() { function doMute() { //only emit the event, not the status - if (muteVolume == -1) { - $("#mutebt").attr('class', 'fa fa-volume-up'); - volumeChanging = 0; - triggerVolume(); + if (currentVolume > 0) { + muteVolume = currentVolume + setVolume(0); } else { - $("#mutebt").attr('class', 'fa fa-volume-off'); - volumeChanging = muteVolume; - triggerVolume(); + setVolume(muteVolume); muteVolume = -1; } - } /******* diff --git a/mopidy_musicbox_webclient/static/mb.manifest b/mopidy_musicbox_webclient/static/mb.manifest index 144a601..f2c16ab 100644 --- a/mopidy_musicbox_webclient/static/mb.manifest +++ b/mopidy_musicbox_webclient/static/mb.manifest @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2016-01-24:v2 +# 2016-01-25:v1 CACHE: index.html From 1f45a7f4ace728fa4c506f2741beeb865ef8808b Mon Sep 17 00:00:00 2001 From: jcass Date: Mon, 25 Jan 2016 07:50:23 +0200 Subject: [PATCH 04/11] Add lable for mute/un-mute toggle. --- mopidy_musicbox_webclient/static/css/webclient.css | 2 +- mopidy_musicbox_webclient/static/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mopidy_musicbox_webclient/static/css/webclient.css b/mopidy_musicbox_webclient/static/css/webclient.css index 0a2297c..3b68652 100644 --- a/mopidy_musicbox_webclient/static/css/webclient.css +++ b/mopidy_musicbox_webclient/static/css/webclient.css @@ -551,7 +551,7 @@ a { max-height:90%; } .nowPlaying-artistInfo { - font-size: 12px; + font-size: 12px; } .nowPlaying-artistInfo h4{ margin: 0px; diff --git a/mopidy_musicbox_webclient/static/index.html b/mopidy_musicbox_webclient/static/index.html index 0bb856f..e81d231 100644 --- a/mopidy_musicbox_webclient/static/index.html +++ b/mopidy_musicbox_webclient/static/index.html @@ -117,7 +117,7 @@
  • - + From d4ed52ac32dde2c8f83765a69f25c50a9ed65178 Mon Sep 17 00:00:00 2001 From: jcass Date: Tue, 26 Jan 2016 16:29:56 +0200 Subject: [PATCH 05/11] Use standard mixer controls to mute / un-mute. --- .../static/js/controls.js | 20 ++++++++----------- mopidy_musicbox_webclient/static/mb.manifest | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index 6f4ba71..4db98f1 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -410,11 +410,6 @@ function setPosition(pos) { function setVolume(value) { if (value != currentVolume) { $("#volumeslider").val(value).slider('refresh'); - if (value > 0) { - $("#mutebt").attr('class', 'fa fa-volume-off'); - } else { - $("#mutebt").attr('class', 'fa fa-volume-up'); - } } } @@ -432,13 +427,14 @@ function triggerVolume() { function doMute() { //only emit the event, not the status - if (currentVolume > 0) { - muteVolume = currentVolume - setVolume(0); - } else { - setVolume(muteVolume); - muteVolume = -1; - } + mopidy.mixer.getMute().then(function(mute) { + mopidy.mixer.setMute(!mute).then(); + if (!mute) { + $("#mutebt").attr('class', 'fa fa-volume-up'); + } else { + $("#mutebt").attr('class', 'fa fa-volume-off'); + } + }); } /******* diff --git a/mopidy_musicbox_webclient/static/mb.manifest b/mopidy_musicbox_webclient/static/mb.manifest index f2c16ab..551f7f1 100644 --- a/mopidy_musicbox_webclient/static/mb.manifest +++ b/mopidy_musicbox_webclient/static/mb.manifest @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2016-01-25:v1 +# 2016-01-26:v1 CACHE: index.html From 14246cb7d17b541b96ba70367aa2d1f9bb39fbb9 Mon Sep 17 00:00:00 2001 From: jcass Date: Tue, 26 Jan 2016 16:33:27 +0200 Subject: [PATCH 06/11] Update changelog. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index c7f1b14..85a0fae 100644 --- a/README.rst +++ b/README.rst @@ -63,7 +63,7 @@ v2.0.1 (UNRELEASED) - Increase volume slider handle by 30% to make it easier to grab on mobile devices - Add application cache manifest file for quicker loads and to allow client devices to detect when local caches should be invalidated. - Fix vertical alignment of playback control buttons in footer. -- Swop mute/unmute icons and apply fix to restore volume levels after unmute. +- Swop icons and use standard Mopidy methods to mute / un-mute playback. v2.0.0 (26-3-2015) ------------------ From f18a80cc039e1b0ab477782f0390f2f73805a509 Mon Sep 17 00:00:00 2001 From: jcass Date: Tue, 26 Jan 2016 16:56:17 +0200 Subject: [PATCH 07/11] Get rid of local variables in checking current slider value. --- mopidy_musicbox_webclient/static/js/controls.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index 4db98f1..42dc5f9 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -408,7 +408,7 @@ function setPosition(pos) { */ function setVolume(value) { - if (value != currentVolume) { + if ($("#volumeslider").val() != value) { $("#volumeslider").val(value).slider('refresh'); } } @@ -421,12 +421,10 @@ function doVolume(value) { function triggerVolume() { mopidy.playback.setVolume(parseInt(volumeChanging)).then(); - currentVolume = volumeChanging volumeChanging = 0; } function doMute() { - //only emit the event, not the status mopidy.mixer.getMute().then(function(mute) { mopidy.mixer.setMute(!mute).then(); if (!mute) { From ac86e1918e5ce4bd286049882b11ee593ccbfd2e Mon Sep 17 00:00:00 2001 From: jcass Date: Tue, 26 Jan 2016 16:57:31 +0200 Subject: [PATCH 08/11] Update changelog. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 85a0fae..b98a932 100644 --- a/README.rst +++ b/README.rst @@ -63,7 +63,7 @@ v2.0.1 (UNRELEASED) - Increase volume slider handle by 30% to make it easier to grab on mobile devices - Add application cache manifest file for quicker loads and to allow client devices to detect when local caches should be invalidated. - Fix vertical alignment of playback control buttons in footer. -- Swop icons and use standard Mopidy methods to mute / un-mute playback. +- Swop icons and use standard Mopidy mixer methods to mute / un-mute playback. v2.0.0 (26-3-2015) ------------------ From b103d6a8a66bc421793c6aec61da57bcee7d13bd Mon Sep 17 00:00:00 2001 From: jcass Date: Tue, 26 Jan 2016 17:27:06 +0200 Subject: [PATCH 09/11] Rename function to toggle mute. Don't need promise to be returned on Mopidy calls. --- mopidy_musicbox_webclient/static/index.html | 2 +- mopidy_musicbox_webclient/static/js/controls.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mopidy_musicbox_webclient/static/index.html b/mopidy_musicbox_webclient/static/index.html index e81d231..593fb74 100644 --- a/mopidy_musicbox_webclient/static/index.html +++ b/mopidy_musicbox_webclient/static/index.html @@ -117,7 +117,7 @@
  • - + diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index 42dc5f9..d1b6c7b 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -420,13 +420,13 @@ function doVolume(value) { } function triggerVolume() { - mopidy.playback.setVolume(parseInt(volumeChanging)).then(); + mopidy.playback.setVolume(parseInt(volumeChanging)); volumeChanging = 0; } -function doMute() { +function toggleMute() { mopidy.mixer.getMute().then(function(mute) { - mopidy.mixer.setMute(!mute).then(); + mopidy.mixer.setMute(!mute); if (!mute) { $("#mutebt").attr('class', 'fa fa-volume-up'); } else { From c5cdc670efdd5d60aaddf2dcde5e5cf8f17c51de Mon Sep 17 00:00:00 2001 From: jcass Date: Tue, 26 Jan 2016 17:39:18 +0200 Subject: [PATCH 10/11] Set color of mute buttons to ensure that it is always visible. --- mopidy_musicbox_webclient/static/css/webclient.css | 1 + 1 file changed, 1 insertion(+) diff --git a/mopidy_musicbox_webclient/static/css/webclient.css b/mopidy_musicbox_webclient/static/css/webclient.css index 3b68652..4fd23f5 100644 --- a/mopidy_musicbox_webclient/static/css/webclient.css +++ b/mopidy_musicbox_webclient/static/css/webclient.css @@ -174,6 +174,7 @@ * Volume Slider ***********************/ #mutebt { + color: white; float: left; margin-left: 8px; margin-top: 8px; From eea716d8cdb6e5ce08497cddc258f02bae918983 Mon Sep 17 00:00:00 2001 From: jcass Date: Tue, 26 Jan 2016 17:42:31 +0200 Subject: [PATCH 11/11] Swop mute / un-mute icons back. --- README.rst | 2 +- mopidy_musicbox_webclient/static/index.html | 2 +- mopidy_musicbox_webclient/static/js/controls.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index b98a932..2772a60 100644 --- a/README.rst +++ b/README.rst @@ -63,7 +63,7 @@ v2.0.1 (UNRELEASED) - Increase volume slider handle by 30% to make it easier to grab on mobile devices - Add application cache manifest file for quicker loads and to allow client devices to detect when local caches should be invalidated. - Fix vertical alignment of playback control buttons in footer. -- Swop icons and use standard Mopidy mixer methods to mute / un-mute playback. +- Use standard Mopidy mixer methods to mute / un-mute playback. v2.0.0 (26-3-2015) ------------------ diff --git a/mopidy_musicbox_webclient/static/index.html b/mopidy_musicbox_webclient/static/index.html index 593fb74..27d3000 100644 --- a/mopidy_musicbox_webclient/static/index.html +++ b/mopidy_musicbox_webclient/static/index.html @@ -117,7 +117,7 @@
  • - + diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js index d1b6c7b..140157f 100644 --- a/mopidy_musicbox_webclient/static/js/controls.js +++ b/mopidy_musicbox_webclient/static/js/controls.js @@ -427,7 +427,7 @@ function triggerVolume() { function toggleMute() { mopidy.mixer.getMute().then(function(mute) { mopidy.mixer.setMute(!mute); - if (!mute) { + if (mute) { $("#mutebt").attr('class', 'fa fa-volume-up'); } else { $("#mutebt").attr('class', 'fa fa-volume-off');