Update plyr.scss - Make it work

There were some things that needed to be changed for the sass preprocessor to work. There were some variables declared as @ that need to be declared with the right syntax: $. Also sass evaluation is eager, while less evaluation is _lazy_ that means in sass, mixins should be declared before they are use. I hope you can accept this change as it's currently not working. Thanks!
This commit is contained in:
khrizpv 2015-07-27 13:04:02 -03:00
parent fe1989dea1
commit 04cf5dfda1

View File

@ -7,51 +7,69 @@
// ------------------------------- // -------------------------------
// Colors // Colors
$blue: #3498DB !default; $blue: #3498DB;
$gray-dark: #343F4A !default; $gray-dark: #343F4A;
$gray: #565D64 !default; $gray: #565D64;
$gray-light: #6B7D86 !default; $gray-light: #6B7D86;
$gray-lighter: #CBD0D3 !default; $gray-lighter: #CBD0D3;
$off-white: #D6DADD !default; $off-white: #D6DADD;
// Font sizes // Font sizes
$font-size-small: 14px !default; $font-size-small: 14px;
$font-size-base: 16px !default; $font-size-base: 16px;
$font-size-large: ceil(($font-size-base * 1.5)) !default; $font-size-large: ceil(($font-size-base * 1.5));
// Controls // Controls
$control-spacing: 10px !default; $control-spacing: 10px;
$controls-bg: #fff !default; $controls-bg: #fff;
$control-bg-hover: @blue !default; $control-bg-hover: $blue;
.contrast-control-color($controls-bg);
.contrast-control-color-hover($control-bg-hover); // Contrast
@mixin contrast-control-color($color: "") {
$control-color: null !global;
@if lightness($color) >= 65% {
$control-color: $gray-light;
} @else if(lightness($color) < 65%) {
$control-color: $gray-lighter;
}
}
@mixin contrast-control-color-hover($color: "") {
$control-color-hover: null !global;
@if lightness($color) >= 65% {
$control-color-hover: $gray;
} @else if lightness($color) < 65% {
$control-color-hover: #fff;
}
}
@include contrast-control-color($controls-bg);
@include contrast-control-color-hover($control-bg-hover);
// Tooltips // Tooltips
$tooltip-bg: $controls-bg !default; $tooltip-bg: $controls-bg;
$tooltip-border-color: $off-white !default; $tooltip-color: $control-color;
$tooltip-color: $control-color !default; $tooltip-padding: $control-spacing;
$tooltip-padding: $control-spacing !default; $tooltip-arrow-size: 5px;
$tooltip-arrow-size: 5px !default; $tooltip-radius: 3px;
$tooltip-radius: 3px !default;
// Progress // Progress
$progress-bg: rgba(red($gray), green($gray), blue($gray), .2) !default; $progress-bg: rgba(red($gray), green($gray), blue($gray), .2);
$progress-playing-bg: $blue !default; $progress-playing-bg: $blue;
$progress-buffered-bg: rgba(red($gray), green($gray), blue($gray), .25) !default; $progress-buffered-bg: rgba(red($gray), green($gray), blue($gray), .25);
$progress-loading-size: 40px !default; $progress-loading-size: 40px;
$progress-loading-bg: rgba(0,0,0, .15) !default; $progress-loading-bg: rgba(0,0,0, .15);
// Volume // Volume
$volume-track-height: 6px !default; $volume-track-height: 6px;
$volume-track-bg: darken($controls-bg, 10%) !default; $volume-track-bg: darken($controls-bg, 10%);
$volume-thumb-height: ($volume-track-height * 2) !default; $volume-thumb-height: ($volume-track-height * 2);
$volume-thumb-width: ($volume-track-height * 2) !default; $volume-thumb-width: ($volume-track-height * 2);
$volume-thumb-bg: $control-color !default; $volume-thumb-bg: $control-color;
$volume-thumb-bg-focus: $control-bg-hover !default; $volume-thumb-bg-focus: $control-bg-hover;
// Breakpoints // Breakpoints
$bp-control-split: 560px !default; // When controls split into left/right $bp-control-split: 560px; // When controls split into left/right
$bp-captions-large: 768px !default; // When captions jump to the larger font size $bp-captions-large: 768px; // When captions jump to the larger font size
// Animation // Animation
// --------------------------------------- // ---------------------------------------
@ -60,27 +78,6 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
to { background-position: $progress-loading-size 0; } to { background-position: $progress-loading-size 0; }
} }
// Mixins
// -------------------------------
// Contrast
@mixin contrast-control-color($color: "") {
@if (lightness($color) >= 65%) {
$control-color: $gray-light;
}
@else if(lightness(@color) < 65%) {
$control-color: $gray-lighter;
}
}
@mixin contrast-control-color-hover($color: "") {
@if (lightness($color) >= 65%) {
$control-color-hover: $gray;
}
@else if (lightness($color) < 65%) {
$control-color-hover: #fff;
}
}
// Font smoothing // Font smoothing
@mixin font-smoothing($mode: on) @mixin font-smoothing($mode: on)
{ {
@ -109,7 +106,7 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
outline-offset: 0; outline-offset: 0;
} }
// Range mixins // <input type="range"> styling
@mixin volume-thumb() @mixin volume-thumb()
{ {
height: $volume-thumb-height; height: $volume-thumb-height;
@ -180,6 +177,21 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
vertical-align: middle; vertical-align: middle;
} }
// For embeds
&-video-embed {
padding-bottom: 56.25%; /* 16:9 */
height: 0;
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
}
// Captions // Captions
&-captions { &-captions {
display: none; display: none;
@ -241,7 +253,7 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
margin: 0 2px; margin: 0 2px;
padding: ($control-spacing / 2) $control-spacing; padding: ($control-spacing / 2) $control-spacing;
background .3s ease, color .3s ease, opacity .3s ease; transition: background .3s ease, color .3s ease, opacity .3s ease;
border-radius: 3px; border-radius: 3px;
cursor: pointer; cursor: pointer;
@ -324,7 +336,6 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
opacity: 0; opacity: 0;
background: $tooltip-bg; background: $tooltip-bg;
border: 1px solid $tooltip-border-color;
border-radius: $tooltip-radius; border-radius: $tooltip-radius;
color: $tooltip-color; color: $tooltip-color;
font-size: $font-size-small; font-size: $font-size-small;
@ -335,26 +346,25 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
transform-origin: 50% 100%; transform-origin: 50% 100%;
transition: transform .2s .1s ease, opacity .2s .1s ease; transition: transform .2s .1s ease, opacity .2s .1s ease;
// Arrow
&::after { &::after {
content: ""; content: "";
position: absolute;
z-index: 1;
top: 100%;
left: 50%;
display: block; display: block;
width: 10px; position: absolute;
height: 10px; left: 50%;
background: $tooltip-bg; bottom: -$tooltip-arrow-size;
transform: translate(-50%, -50%) rotate(45deg) translateY(2px); margin-left: -$tooltip-arrow-size;
border: 1px solid $tooltip-border-color; width: 0;
border-width: 0 1px 1px 0; height: 0;
transition: inherit;
border-style: solid;
border-width: $tooltip-arrow-size $tooltip-arrow-size 0 $tooltip-arrow-size;
border-color: $controls-bg transparent transparent;
} }
} }
label:hover .player-tooltip, label:hover .player-tooltip,
input.tab-focus:focus + label .player-tooltip, input:focus + label .player-tooltip,
button:hover .player-tooltip, button:hover .player-tooltip,
button.tab-focus:focus .player-tooltip { button:focus .player-tooltip {
visibility: visible; visibility: visible;
opacity: 1; opacity: 1;
transform: translate(-50%, 0) scale(1); transform: translate(-50%, 0) scale(1);
@ -492,7 +502,7 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
// Volume control // Volume control
// <input[type='range']> element // <input[type='range']> element
// Specificity is for bootstrap compatibility // Specificity is for bootstrap compatibility
&-volume[type="range"] { &-volume[type=range] {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
-webkit-appearance: none; -webkit-appearance: none;
@ -597,6 +607,15 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
.player-video-wrapper { .player-video-wrapper {
height: 100%; height: 100%;
width: 100%; width: 100%;
.player-captions {
top: auto;
bottom: 90px;
@media (min-width: $bp-control-split) {
bottom: 60px;
}
}
} }
.player-controls { .player-controls {
position: absolute; position: absolute;
@ -606,29 +625,13 @@ $bp-captions-large: 768px !default; // When captions jump to the larger fo
} }
// Hide controls when playing in full screen // Hide controls when playing in full screen
&.fullscreen-hide-controls.playing { &.fullscreen-hide-controls.playing .player-controls {
.player-controls {
transform: translateY(100%) translateY($control-spacing / 2); transform: translateY(100%) translateY($control-spacing / 2);
transition: transform .3s .2s ease; transition: transform .3s .2s ease;
}
&.player-hover .player-controls { &.hover {
transform: translateY(0); transform: translateY(0);
} }
.player-captions {
bottom: (@control-spacing / 2);
transition: bottom .3s .2s ease;
}
}
// Captions
.player-captions,
&.fullscreen-hide-controls.playing.player-hover .player-captions {
top: auto;
bottom: 90px;
@media (min-width: $bp-control-split) {
bottom: 60px;
}
} }
} }