Skip to content

Commit

Permalink
[FIX] Improve chrome & opera experience
Browse files Browse the repository at this point in the history
* [FIX] Improve chrome & opera experience
* [FIX] svg style
* [FEATURE] keyboard shortcuts
  • Loading branch information
Ronan authored and m4dz committed Apr 7, 2016
1 parent 396c834 commit 81b20f5
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 66 deletions.
3 changes: 3 additions & 0 deletions app/styles/app.styl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ div[role='application']
width: 100%
display: flex

path
fill: inherit

:focus
outline:none
::-moz-focus-inner
Expand Down
5 changes: 1 addition & 4 deletions app/styles/header.styl
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ div[role='contentinfo']
left: 9px
width: 20px
top: 6px

path
fill: $svg
stroke: 2px
fill: $svg

button:active
padding-top: 1px
4 changes: 1 addition & 3 deletions app/styles/notification.styl
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ div[role='toolbar']
padding-left: 14px
width: 40px
height: 40px

path
fill: $white
fill: $white

.notify
animation-timing-function: ease;
Expand Down
20 changes: 5 additions & 15 deletions app/styles/player.styl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1)
padding: 0px
background-color: white

path
svg
padding-left: 7px
fill: $blue

svg
Expand All @@ -40,9 +40,7 @@
padding-top: 7px
padding-bottom: 7px
padding-left: 28px

path
fill: $svg
fill: $svg

.timeline
margin-left: 32px
Expand Down Expand Up @@ -113,20 +111,12 @@
height: 20px
margin-top: 26px
margin-right: 10px
fill: $text
display: inline-block

path
fill: $text

.active
path
fill: $svg-red

#repeat-one-sm
path
svg
fill: $svg-red

#broadcast
margin-left: 100px
path
fill: $svg-red
8 changes: 2 additions & 6 deletions app/styles/playlists.styl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ div[role='toolbar']
position: relative
left: 16px
top: 4px

path
fill: $text
fill: $text

.input
border: solid 1px $blue
Expand All @@ -43,9 +41,7 @@ div[role='toolbar']
width: 16px
top: 8px
left: 15px

path
fill: $blue
fill: $blue

input[type='text']
color: #788195
Expand Down
15 changes: 11 additions & 4 deletions app/styles/popup-menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,34 @@
.small
width: 14px
height: 14px
top: 11px
opacity: 0.3
position: absolute
right: 14px
svg
path
fill: $svg
fill: $svg
ul
li
font-size: 16px
padding: 0px 20px
height: 36px
line-height: 2.3
box-shadow: none
color: $text-dark
align-items: center

a
width: 100%
height: 100%
text-decoration: none
display: block
color: $text-dark

svg
height: 20px
width: 20px
padding-right: 14px
path
fill: $svg
fill: $svg

li:hover
background-color: $background-dark;
Expand Down
13 changes: 4 additions & 9 deletions app/styles/toolbar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ div[role='toolbar']
height: 20px
width: 20px
top: 6px

path
fill: $white
fill: $white

p
position: relative
Expand Down Expand Up @@ -86,9 +84,7 @@ div[role='toolbar']
width: 20px
top: 8px
left: 15px

path
fill: $grey
fill: $grey

input[type='text']
color: #788195
Expand All @@ -100,11 +96,10 @@ div[role='toolbar']

.input-focused
border: solid 1px $blue
font-family: 'Source Sans Pro'
font-style: normal

svg
path
fill: $blue
fill: $blue

@keyframes notify {
0% {opacity: 0; visibility: visible}
Expand Down
11 changes: 4 additions & 7 deletions app/styles/track-actions.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@
top: 0px

.active
path
svg
fill: $svg-red

button:hover:not(.active)
svg
fill: $text-dark
.help
visibility: visibile
path
fill: $text-dark

button
height: 100%
width: 22px
svg
height: 20px
width: 20px
path
fill: $svg
-webkit-transition: fill 0.2s; /* Safari */
transition: fill 0.2s;
fill: $svg

.all
#delete-from-upnext
Expand Down
3 changes: 1 addition & 2 deletions app/styles/tracks.styl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
display: none
width: 18px
height: 18px
path
fill: $red
fill: $red

.song-column-cell
flex-grow: 1
Expand Down
34 changes: 20 additions & 14 deletions app/views/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,31 @@ const Player = Mn.LayoutView.extend({
}
});
$(document).keyup((e) => {
e.preventDefault();
switch (e.key) {
case ' ':
e.preventDefault();
let audio = this.ui.player.get(0);
let volume;
switch (e.which) {
case 32: // 'Space'
this.toggle();
break;
case 'ArrowRight':
case 39: // ArrowRight
this.next();
break;
case 'ArrowLeft':
case 37: // ArrowLeft
this.prev();
break;
case 'ArrowUp':
// increaseVol
case 38: // ArrowUp
volume = audio.volume + 0.1 > 1 ? 1 : audio.volume + 0.1;
audio.volume = volume;
application.appState.set('currentVolume', volume);
break;
case 'ArrowDown':
// decreaseVol
case 40: // ArrowDown
volume = audio.volume - 0.1 < 0 ? 0 : audio.volume - 0.1;
audio.volume = volume;
application.appState.set('currentVolume', volume);
break;
case 'm':
// mute
case 77: // m
this.toggleVolume();
break;
}
});
Expand Down Expand Up @@ -178,15 +184,15 @@ const Player = Mn.LayoutView.extend({
toggleShuffle() {
let shuffle = application.appState.get('shuffle');
application.appState.set('shuffle', !shuffle);
$('#shuffle-sm').toggleClass('active', !shuffle);
this.ui.shuffle.toggleClass('active', !shuffle);
},

toggleRepeat() {
let repeat = application.appState.get('repeat');
switch (repeat) {
case 'false':
application.appState.set('repeat', 'track');
$('#repeat-sm').toggleClass('active', true);
this.ui.repeat.toggleClass('active', true);
this.ui.repeat.find('use').attr(
'xlink:href',
require('../assets/icons/repeat-one-sm.svg')
Expand All @@ -201,7 +207,7 @@ const Player = Mn.LayoutView.extend({
break;
case 'playlist':
application.appState.set('repeat', 'false');
$('#repeat-sm').toggleClass('active', false);
this.ui.repeat.toggleClass('active', false);
break;
}
},
Expand Down
4 changes: 2 additions & 2 deletions app/views/templates/player.jst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<% if (false) { %>
<img class="album" src="album"></img>
<% } else { %>
<button>
<svg class="album">
<button class="album">
<svg>
<use xlink:href="<%= require('../../assets/icons/music-lg.svg') %>"/>
</svg>
</button>
Expand Down

0 comments on commit 81b20f5

Please sign in to comment.