-
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.
It is bound correctly and styled. Ready for review.
- Loading branch information
Showing
8 changed files
with
265 additions
and
88 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,125 @@ | ||
//noinspection CssInvalidHtmlTagReference | ||
volume-control { | ||
|
||
width: 150px; | ||
|
||
#volumeControl-mute { | ||
|
||
span { | ||
@extend .glyphicon; | ||
|
||
&:before { | ||
@extend .glyphicon-volume-up:before; | ||
} | ||
|
||
} | ||
|
||
&.muted { | ||
span { | ||
&:before { | ||
@extend .glyphicon-volume-off:before; | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
#volumeControl-slider { | ||
|
||
-webkit-appearance: none; | ||
|
||
// track | ||
$track-height : 2px; | ||
$thumb-size: 10px; | ||
@mixin track { | ||
background-color: $btn-default-color; | ||
border: none; | ||
height: $track-height; | ||
|
||
} | ||
|
||
&::-ms-track { | ||
|
||
color: transparent; | ||
border: none; | ||
@include track; | ||
} | ||
&::-moz-range-track { | ||
@include track; | ||
} | ||
&::-webkit-slider-runnable-track { | ||
@include track; | ||
} | ||
|
||
|
||
// thumb | ||
@mixin thumb { | ||
background: none ; | ||
//background-color: blue; | ||
background-color: $btn-default-bg; | ||
width: $thumb-size; | ||
height: $thumb-size; | ||
border: solid $btn-default-color 1px; | ||
@include rounded-corners(50%); | ||
@include vendor-prefix(box-sizing, border-box); | ||
} | ||
|
||
&::-ms-thumb { | ||
@include thumb; | ||
} | ||
&::-moz-range-thumb { | ||
@include thumb; | ||
} | ||
&::-webkit-slider-thumb { | ||
-webkit-appearance: none; | ||
margin-top: - ($thumb-size / 2 ) + ($track-height/2); | ||
@include thumb; | ||
|
||
} | ||
|
||
// before | ||
&::-ms-fill-lower { | ||
border: none; | ||
background:none; | ||
} | ||
|
||
&::-ms-ticks-before { | ||
display: none; | ||
border: none; | ||
background:none; | ||
} | ||
|
||
// after | ||
&::-ms-fill-upper { | ||
border: none; | ||
background:none; | ||
|
||
} | ||
|
||
&::-ms-ticks-after { | ||
display: none; | ||
border: none; | ||
background:none; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
/* | ||
glyphicon glyphicon-volume-down | ||
glyphicon glyphicon-volume-off | ||
glyphicon glyphicon-volume-up | ||
.decipher-tags-taglist .icon-remove { | ||
@extend .glyphicon; | ||
&:before { | ||
@extend .glyphicon-remove:before; | ||
} | ||
} | ||
*/ |
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,39 +1,53 @@ | ||
var acds = acds || angular.module('audio-control', []); | ||
var acds = acds || angular.module("audio-control", []); | ||
|
||
/** | ||
* A directive for binding the volume of an audio element to some DOM. | ||
* | ||
*/ | ||
bawds.directive('volumeControl', ['$parse', function ($parse) { | ||
acds.directive("volumeControl", ["$parse", function ($parse) { | ||
return { | ||
restrict: "E", | ||
scope: { | ||
ngAudio: "=" | ||
model: "=" | ||
}, | ||
templateUrl: "audioControl/volumeControl.tpl.html", | ||
link: function(scope, element, attrs, controller, transcludeFunc) { | ||
link: function(scope, $element, attrs, controller, transcludeFunc) { | ||
|
||
// get instances of the mute button and the slider | ||
var muteButton = null, | ||
slider = null; | ||
var element = $element[0], | ||
muteButton = element.querySelector("#volumeControl-mute"), | ||
slider = element.querySelector("#volumeControl-slider") | ||
; | ||
|
||
// set up binding | ||
scope.$watch("expression", function volumeChanged(newValue, oldValue) { | ||
|
||
// volume | ||
scope.$watch(function(){ | ||
return scope.model ? scope.model.volume : null; | ||
}, function volumeChanged(newValue, oldValue) { | ||
scope.volume = newValue ? newValue * 100 : null; | ||
}); | ||
|
||
scope.$watch("expression", function mutedChanged(newValue, oldValue) { | ||
|
||
// muted | ||
scope.$watch(function(){ | ||
return scope.model ? scope.model.muted : null; | ||
}, function mutedChanged(newValue, oldValue) { | ||
scope.muted = newValue; | ||
}); | ||
|
||
// bind from the inputs to the model | ||
muteButton.click = function() { | ||
|
||
}; | ||
|
||
slider.click(function() { | ||
|
||
muteButton.addEventListener('click', function() { | ||
scope.$apply(function() { | ||
scope.model.muted = !scope.model.muted; | ||
}); | ||
}); | ||
|
||
function sliderChanged() { | ||
scope.$apply(function() { | ||
scope.model.volume = parseFloat(slider.value) / 100; | ||
}); | ||
} | ||
slider.addEventListener('input', sliderChanged); | ||
//slider.click(); | ||
} | ||
} | ||
}; | ||
}]); |
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,8 +1,13 @@ | ||
<div id="volumeControl-mute"> | ||
<input type="button"> | ||
<div class="input-group-btn"> | ||
<button id="volumeControl-mute" | ||
class="btn btn-default" | ||
ng-class="{muted: muted}" title="{{muted && 'Unmute' || 'Mute'}}"> | ||
<span></span> | ||
</button> | ||
</div> | ||
<div id="volumeControl-slider"> | ||
<input type="range" value="50" max="100" min="0" title="Volume"> | ||
|
||
</input> | ||
</div> | ||
<input id="volumeControl-slider" | ||
class="form-control" | ||
type="range" value="{{volume}}" | ||
max="100" min="0" | ||
ng-disabled="muted" | ||
title="{{ 'Volume ' + (volume | number:0) }}"> |
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.