Skip to content

Commit

Permalink
I’ve run out of excuses to hold it back, polishing
Browse files Browse the repository at this point in the history
It is still not complete (audio is my biggest desire),
but it’s well and truly usable.
  • Loading branch information
chris-morgan committed Jun 23, 2015
0 parents commit 7076b31
Show file tree
Hide file tree
Showing 8 changed files with 2,282 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.min.js
*.min.css
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015 Chris Morgan <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# … and why not?

.PHONY: all clean

all: tty-player.min.js tty-player.min.css

clean:
rm -f tty-player.min.js

tty-player.min.js: tty-player.js
@echo Minifying tty-player.js...
@curl http://www.closure-compiler.appspot.com/compile --compressed -H 'Content-Type: application/x-www-form-urlencoded;charset=utf-8' --data compilation_level=ADVANCED_OPTIMIZATIONS --data output_format=text --data output_info=compiled_code --data-urlencode [email protected] --data-urlencode [email protected]/src/term.js > tty-player.min.js

tty-player.min.css: tty-player.css
@echo Minifying tty-player.css...
@uglifycss tty-player.css > tty-player.min.css
311 changes: 311 additions & 0 deletions README.md

Large diffs are not rendered by default.

218 changes: 218 additions & 0 deletions tty-player.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
.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;
}
Loading

0 comments on commit 7076b31

Please sign in to comment.