Skip to content
Snippets Groups Projects
tty-player.css 5.61 KiB
Newer Older
  • Learn to ignore specific revisions
  • .terminal {
    	font-family: monospace, monospace;
    	cursor: text;
    	line-height: initial;
    }
    
    tty-player {
    	border: 2px solid #285577;
    	border-top: 1px solid #4c7899;
    }
    
    tty-player .title {
    	background: #285577;
    	border-bottom: 1px solid #4c7899;
    	color: #fff;
    	font-family: sans-serif;
    	font-weight: bold;
    	padding: 0.2em;
    	line-height: 1;
    	height: 1em;
    	cursor: default;
    }
    
    tty-player menu {
    	display: none;
    }
    
    tty-player {
    	display: inline-block;
    	position: relative;
    }
    
    tty-player:not([controls]) tty-player-controls {
    	display: none;
    }
    
    tty-player-poster {
    	/* XXX: <video> has an overlay with play button if [controls] over the poster *image*, but here we have an overlay with play button regardless. Perhaps specifying a poster currentTime or script might work? */
    	background: rgba(53, 47, 47, 0.5);
    	opacity: 0.5;
    	transition: opacity 0.2s linear;
    	background-repeat: no-repeat;
    	background-position: center;
    	background-image: url("data:image/svg+xml,%3C?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3E%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='66'%20height='66'%3E%3Cfilter%20id='f'%3E%3CfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20.5%200'/%3E%3CfeGaussianBlur%20result='r'%20stdDeviation='2'/%3E%3CfeComposite%20in='SourceGraphic'%20in2='r'/%3E%3C/filter%3E%3Cpath%20fill='%23ddd'%20stroke='%23ccc'%20stroke-width='1'%20d='M33,5.5A27.5,27.5%200%200%200%205.5,33%2027.5,27.5%200%200%200%2033,60.5%2027.5,27.5%200%200%200%2060.5,33%2027.5,27.5%200%200%200%2033,5.5Zm-9.5,13%2025,14.5-25,14.5%200,-29z'%20filter='url(%23f)'/%3E%3C/svg%3E");
    	position: absolute;
    	top: 0;
    	left: 0;
    	right: 0;
    	bottom: 0;
    }
    
    tty-player[controls] tty-player-poster {
    	bottom: 28px;
    }
    
    tty-player:hover tty-player-poster {
    	opacity: 1;
    }
    
    tty-player-controls {
    	position: absolute;
    	left: 0;
    	right: 0;
    	bottom: 0;
    	background: rgba(53, 47, 47, 0.5);
    	opacity: 0;
    	display: flex;
    	flex-direction: row;
    	transition: opacity 0.2s linear;
    	cursor: default;
    }
    
    /* Browsers tend to show the controls when a <video> ends, too; I, however, am not doing this for now at least as the controls will overlap with what is often the most important part of the terminal (the bottom). For this reason, I haven’t hooked up any support for that either, only showing controls persistently when the poster is up. */
    tty-player-controls.poster,
    tty-player:hover tty-player-controls {
    	opacity: 1;
    }
    
    tty-player-controls input[type=range], tty-player-controls button {
    	margin: 0;
    	padding: 0;
    	border: none;
    	background: none;
    	font: inherit;
    	line-height: inherit;
    	-moz-appearance: none;
    	-webkit-appearance: none;
    }
    
    tty-player-controls button {
    	padding: 0;
    	background: none;
    	opacity: 0.75;
    	flex: 0 1 auto;
    	line-height: 1;
    	width: 28px;
    	height: 28px;
    }
    
    tty-player-controls button:hover {
    	color: #777;
    	opacity: 1;
    }
    
    tty-player-controls input[type=range] {
    	flex: 1;
    	height: 8px;
    	margin: 10px 5px;
    }
    
    tty-player-controls button {
    	background-repeat: no-repeat;
    	background-position: center;
    }
    
    tty-player-controls button.play {
    	background-image: url("data:image/svg+xml,%3C?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3E%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='14'%20height='16'%3E%3Cpath%20fill='%23ccc'%20d='M0,0%200,16%2014,8Z'/%3E%3C/svg%3E");
    }
    
    tty-player-controls button.pause {
    	background-image: url("data:image/svg+xml,%3C?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3E%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='14'%20height='16'%3E%3Cpath%20fill='%23ccc'%20d='M1,0L1,16L5,16L5,0L0,0zM9,0L9,16L13,16L13,0L9,0z'/%3E%3C/svg%3E");
    }
    
    tty-player-controls input[type=range]:focus {
    	box-shadow: none;
    	outline: none;
    }
    
    tty-player-controls input[type=range]::-moz-range-track,
    tty-player-controls input[type=range]::-moz-range-thumb,
    tty-player-controls input[type=range]::-moz-range-progress {
    	border-radius: 4px;
    	height: 8px;
    }
    
    tty-player-controls input[type=range]::-moz-range-track {
    	background: rgba(255, 255, 255, 0.5);
    }
    
    tty-player-controls input[type=range]::-moz-range-thumb {
    	-moz-appearance: none;
    	width: 0;
    	background: transparent;
    	border: 0;
    	border-radius: 0;
    	box-shadow: 0;
    	position: relative;
    }
    
    tty-player-controls input[type=range]::-moz-range-progress {
    	background: #fff;
    }
    
    input[type=range] {
    	overflow: hidden;
    }
    
    tty-player-controls input[type=range]::-webkit-slider-runnable-track {
    	-webkit-appearance: none;
    	height: 8px;
    	background: rgba(255, 255, 255, 0.5);
    	//border-radius: 4px;
    }
    
    tty-player-controls input[type=range]::-webkit-slider-thumb:before {
    	position: absolute;
    	top: 0;
    	right: 50%;
    	left: -9999px;
    	background: #fff;
    	content: '';
    	height: 8px;
    	pointer-events: none;
    }
    
    tty-player-controls input[type=range]::-webkit-slider-thumb {
    	-webkit-appearance: none;
    	width: 0;
    	height: 0;
    	position: relative;
    }
    
    /* I have not altered IE’s styles because I feel them already satisfactory */
    
    tty-player-controls .current-time {
    	position: absolute;
    	color: #ddd;
    	background: #888;
    	font-family: sans-serif;
    	font-size: 12px;
    	display: block;
    	box-shadow: 0 1px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.2);
    	padding: 0 5px;
    	line-height: 16px;
    	border-radius: 4px;
    	top: -7px;
    }
    
    tty-player-controls .current-time::after {
    	content: "";
    	position: absolute;
    	width: 8px;
    	height: 8px;
    	background: linear-gradient(-45deg, #888 50%, transparent 50%);
    	box-shadow: 1px 1px rgba(0, 0, 0, 0.5), 1px 1px 1px rgba(0, 0, 0, 0.5);
    	bottom: -3px;
    	left: 50%;
    	margin-left: -5px;
    	transform: rotate(45deg);
    }
    
    tty-player-controls .duration {
    	font-family: sans-serif;
    	font-size: 12px;
    	color: #999;
    	line-height: 18px;
    	padding: 5px;
    }