Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #680 from jwplayer/feature/control-bar-compact-mode
JW7-815 - Control Compact Mode and Menu Drawer
- Loading branch information
Showing
10 changed files
with
200 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.jw-flag-compact-player { | ||
.jw-icon-playlist, | ||
.jw-icon-next, | ||
.jw-icon-prev, | ||
.jw-text-elapsed, | ||
.jw-text-duration { | ||
display: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
define([ | ||
'view/components/tooltip', | ||
'utils/helpers', | ||
'utils/underscore', | ||
'utils/ui' | ||
], function(Tooltip, utils, _, UI) { | ||
var Drawer = Tooltip.extend({ | ||
constructor: function(name) { | ||
Tooltip.call(this, name); | ||
|
||
this.container.className = 'jw-overlay-horizontal jw-reset'; | ||
this.openClass = 'jw-open-drawer'; | ||
}, | ||
setup : function (list, isCompactMode) { | ||
if(!this.iconUI){ | ||
this.iconUI = new UI(this.el); | ||
|
||
this.toggleOpenStateListener = this.toggleOpenState.bind(this); | ||
this.openTooltipListener = this.openTooltip.bind(this); | ||
this.closeTooltipListener = this.closeTooltip.bind(this); | ||
} | ||
|
||
this.reset(); | ||
|
||
list = _.isArray(list) ? list : []; | ||
|
||
var hasActiveContents = _.any(list, function (ele) { | ||
return ele.hasContent(); | ||
}); | ||
|
||
utils.toggleClass(this.el, 'jw-hidden', !isCompactMode || !hasActiveContents); | ||
|
||
if (isCompactMode && hasActiveContents) { | ||
utils.removeClass(this.el, 'jw-off'); | ||
|
||
this.iconUI.on('tap', function (evt) { | ||
if (evt.target === this.el) { | ||
this.isOpen = !this.isOpen; | ||
utils.toggleClass(this.el, this.openClass, this.isOpen); | ||
this.trigger('drawer-open', {'isOpen': this.isOpen}); | ||
} | ||
}, this); | ||
|
||
this.el.addEventListener('mouseover', this.openTooltipListener); | ||
this.el.addEventListener('mouseout', this.closeTooltipListener); | ||
|
||
_.each(list, function (menu) { | ||
this.container.appendChild(menu.el); | ||
}, this); | ||
} | ||
// else, spit the menus back out | ||
}, | ||
reset : function() { | ||
utils.addClass(this.el, 'jw-off'); | ||
this.iconUI.off(); | ||
if(this.contentUI) { | ||
this.contentUI.off().destroy(); | ||
} | ||
this.removeContent(); | ||
|
||
this.el.removeEventListener('mouseover', this.openTooltipListener); | ||
this.el.removeEventListener('mouseout', this.closeTooltipListener); | ||
} | ||
}); | ||
|
||
return Drawer; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.