-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(audioControls): added audio download component
- Loading branch information
Showing
9 changed files
with
166 additions
and
30 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
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,66 @@ | ||
//noinspection CssInvalidHtmlTagReference | ||
download { | ||
|
||
.download-links-wrapper { | ||
|
||
position: relative; | ||
display: inline-block; | ||
|
||
.download-links { | ||
|
||
position: absolute; | ||
bottom: 30px; | ||
left:0px; | ||
background: #ffffff; | ||
z-index: 10000; | ||
padding: 10px; | ||
text-align: center; | ||
white-space: nowrap; | ||
border: solid #dddddd 1px; | ||
border-radius: 3px; | ||
|
||
&.show-links { | ||
|
||
transition-duration: 0.3s; | ||
transition-timing-function: ease-in; | ||
max-height: 1000px; | ||
padding-top: 10px; | ||
padding-bottom: 10px; | ||
overflow: hidden; | ||
|
||
} | ||
|
||
&.hide-links { | ||
|
||
overflow: hidden; | ||
max-height: 0; | ||
padding-top: 0; | ||
padding-bottom: 0; | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
border-top-width: 0px; | ||
border-bottom-width: 0px; | ||
transition-duration: 0.3s; | ||
transition-timing-function: cubic-bezier(0, 1, 0.5, 1); | ||
|
||
} | ||
|
||
a { | ||
display: block; | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
} | ||
|
||
|
||
|
||
} | ||
|
||
.btn-toolbar .download-links-wrapper { | ||
|
||
float: left; | ||
|
||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
angular.module("bawApp.audioControls",[ | ||
"bawApp.audioControls.volumeSlider", | ||
"bawApp.audioControls.previousPlayNext", | ||
"bawApp.audioControls.autoplayButton" | ||
"bawApp.audioControls.autoplayButton", | ||
"bawApp.audioControls.download" | ||
]); |
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,24 @@ | ||
angular.module("bawApp.audioControls.download", []) | ||
.component("download", { | ||
templateUrl: "audioControls/download.tpl.html", | ||
controller: [ | ||
"$scope", | ||
function ($scope) { | ||
|
||
$scope.downloadLinksShowing = false; | ||
|
||
$scope.toggleShowDownloadLinks = function () { | ||
$scope.downloadLinksShowing = !$scope.downloadLinksShowing; | ||
}; | ||
|
||
$scope.hideDownloadLinks = function () { | ||
$scope.downloadLinksShowing = false; | ||
}; | ||
|
||
}], | ||
bindings: { | ||
media: "=", | ||
otherLinks: "=" | ||
} | ||
}); | ||
|
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,34 @@ | ||
<div click-outside="hideDownloadLinks()" class="download-links-wrapper"> | ||
|
||
<button class="btn btn-default" | ||
ng-click="toggleShowDownloadLinks()" | ||
|
||
title="Download"> | ||
<span class="glyphicon glyphicon-download"></span> | ||
</button> | ||
<div ng-class="{'show-links': downloadLinksShowing, 'hide-links': !downloadLinksShowing}" | ||
class="download-links"> | ||
|
||
<div>Download:</div> | ||
|
||
<a target="_blank" | ||
ng-href="{{$ctrl.media.spectrogram.url}}" | ||
title="Download the spectrogram">Spectrogram</a> | ||
<a target="_blank" | ||
ng-class="{disabled: !$ctrl.media.available.audio['wav'].url}" | ||
ng-href="{{$ctrl.media.available.audio['wav'].url}}" | ||
title="{{ model.media.available.audio['wav'].url && 'Download the .wav file' || 'This file format is not available' }}" | ||
>Audio (WAV)</a> | ||
<a target="_blank" | ||
ng-class="{disabled: !$ctrl.media.available.audio['mp3'].url}" | ||
ng-href="{{$ctrl.media.available.audio['mp3'].url}}" | ||
title="{{ $ctrl.media.available.audio['mp3'].url && 'Download the .mp3 file' || 'This file format is not available' }}" | ||
>Audio (MP3)</a> | ||
<a ng-repeat="(key,link) in $ctrl.otherLinks" target="_blank" | ||
ng-class="{disabled: !link.url}" | ||
ng-href="{{link.url}}" | ||
title="{{link.text}}" | ||
>{{link.text}}</a> | ||
</div> | ||
|
||
</div> |
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,20 @@ | ||
angular | ||
.module("bawApp.directives.clickOutside", []) | ||
.directive("clickOutside", ["$document", function ($document) { | ||
return { | ||
link: function postLink(scope, element, attrs) { | ||
var onClick = function (event) { | ||
var isChild = element[0].contains(event.target); | ||
var isSelf = element[0] === event.target; | ||
var isInside = isChild || isSelf; | ||
if (!isInside) { | ||
console.log("is outside !!!!!!!"); | ||
scope.$apply(attrs.clickOutside); | ||
} | ||
}; | ||
|
||
$document.bind("click", onClick); | ||
|
||
} | ||
}; | ||
}]); |
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