WIP
13
assets/icons/collapse.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>collapse</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1">
|
||||
<g id="collapse" sketch:type="MSLayerGroup" transform="translate(-1.000000, -1.000000)">
|
||||
<path d="M15.00325,9.01 L15.00325,5.377 L16.29625,6.694 C16.68825,7.082 17.32125,7.082 17.71325,6.694 C18.10525,6.306 18.10425,5.678 17.71325,5.291 L14.74625,2.291 C14.55825,2.105 14.30425,2 14.03725,2 C14.02625,2 14.01425,2 14.00325,2.001 C13.99225,2.002 13.98025,2 13.96925,2 C13.70325,2 13.44825,2.105 13.26025,2.291 L10.29325,5.291 C9.90225,5.679 9.90225,6.307 10.29325,6.694 C10.68425,7.081 11.31825,7.082 11.71025,6.694 L13.00425,5.377 L13.00425,9.01 C13.00425,9.557 13.44725,10 13.99425,10 L14.01225,10 C14.55925,10 15.00225,9.557 15.00225,9.01 L15.00325,9.01 Z" id="Shape" sketch:type="MSShapeGroup" transform="translate(14.003438, 6.000000) rotate(-135.000000) translate(-14.003438, -6.000000) "></path>
|
||||
<path d="M7.00668756,13.377 L8.29968756,14.694 C8.69168756,15.082 9.32468756,15.082 9.71668756,14.694 C10.1086876,14.306 10.1076876,13.678 9.71668756,13.291 L6.74968756,10.291 C6.56168756,10.105 6.30768756,10 6.04068756,10 C6.02968756,10 6.01768756,10 6.00668756,10.001 C5.99568756,10.002 5.98368756,10 5.97268756,10 C5.70668756,10 5.45168756,10.105 5.26368756,10.291 L2.29668756,13.291 C1.90568756,13.679 1.90568756,14.307 2.29668756,14.694 C2.68768756,15.081 3.32168756,15.082 3.71368756,14.694 L5.00768756,13.377 L5.00768756,17.01 C5.00768756,17.557 5.45068756,18 5.99768756,18 C6.56268756,18 7.00568756,17.557 7.00568756,17.01 L7.00668756,13.377 Z" id="Shape-2" sketch:type="MSShapeGroup" transform="translate(6.006875, 14.000000) rotate(45.000000) translate(-6.006875, -14.000000) "></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
13
assets/icons/expand.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>expand</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="expand" sketch:type="MSLayerGroup" transform="translate(-1.000000, -1.000000)" fill="#444444">
|
||||
<path d="M7.00325,17.01 L7.00325,13.377 L8.29625,14.694 C8.68825,15.082 9.32125,15.082 9.71325,14.694 C10.10525,14.306 10.10425,13.678 9.71325,13.291 L6.74625,10.291 C6.55825,10.105 6.30425,10 6.03725,10 C6.02625,10 6.01425,10 6.00325,10.001 C5.99225,10.002 5.98025,10 5.96925,10 C5.70325,10 5.44825,10.105 5.26025,10.291 L2.29325,13.291 C1.90225,13.679 1.90225,14.307 2.29325,14.694 C2.68425,15.081 3.31825,15.082 3.71025,14.694 L5.00425,13.377 L5.00425,17.01 C5.00425,17.557 5.44725,18 5.99425,18 L6.01225,18 C6.55925,18 7.00225,17.557 7.00225,17.01 L7.00325,17.01 Z" id="Shape" sketch:type="MSShapeGroup" transform="translate(6.003438, 14.000000) rotate(-135.000000) translate(-6.003438, -14.000000) "></path>
|
||||
<path d="M15.0066876,5.377 L16.2996876,6.694 C16.6916876,7.082 17.3246876,7.082 17.7166876,6.694 C18.1086876,6.306 18.1076876,5.678 17.7166876,5.291 L14.7496876,2.291 C14.5616876,2.105 14.3076876,2 14.0406876,2 C14.0296876,2 14.0176876,2 14.0066876,2.001 C13.9956876,2.002 13.9836876,2 13.9726876,2 C13.7066876,2 13.4516876,2.105 13.2636876,2.291 L10.2966876,5.291 C9.90568756,5.679 9.90568756,6.307 10.2966876,6.694 C10.6876876,7.081 11.3216876,7.082 11.7136876,6.694 L13.0076876,5.377 L13.0076876,9.01 C13.0076876,9.557 13.4506876,10 13.9976876,10 C14.5626876,10 15.0056876,9.557 15.0056876,9.01 L15.0066876,5.377 Z" id="Shape-2" sketch:type="MSShapeGroup" transform="translate(14.006875, 6.000000) rotate(45.000000) translate(-14.006875, -6.000000) "></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
6
assets/icons/fast-forward.svg
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by IcoMoon.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18">
|
||||
<path d="M17.569 8.246l-10.569-6.246c-0.552 0-1 0.448-1 1v1.954l-5-2.954c-0.552 0-1 0.448-1 1v12c0 0.552 0.448 1 1 1l5-2.955v1.955c0 0.552 0.448 1 1 1l10.569-6.246c0.267-0.158 0.431-0.444 0.431-0.754s-0.164-0.597-0.431-0.754zM6 10.722l-4 2.364v-8.172l4 2.364v3.444zM8 13.086v-8.172l6.915 4.086-6.915 4.086z"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 635 B |
6
assets/icons/film.svg
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by IcoMoon.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18">
|
||||
<path d="M17 2h-16c-0.552 0-1 0.448-1 1v12c0 0.552 0.448 1 1 1h16c0.552 0 1-0.448 1-1v-12c0-0.552-0.448-1-1-1zM2 4h2v2h-2v-2zM2 8h2v2h-2v-2zM2 14v-2h2v2h-2zM6 14v-10h6v10h-6zM16 14h-2v-2h2v2zM16 10h-2v-2h2v2zM16 6h-2v-2h2v2z"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 553 B |
13
assets/icons/pause.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>pause</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="pause" sketch:type="MSLayerGroup" transform="translate(3.000000, 3.000000)" stroke="#FFFFFF" stroke-width="2">
|
||||
<rect id="Rectangle-1" sketch:type="MSShapeGroup" x="8" y="0" width="4" height="12" rx="1"></rect>
|
||||
<rect id="Rectangle-2" sketch:type="MSShapeGroup" x="0" y="0" width="4" height="12" rx="1"></rect>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 899 B |
6
assets/icons/play.svg
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by IcoMoon.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18">
|
||||
<path d="M5 4.914l6.915 4.086-6.915 4.086v-8.172zM4 2c-0.552 0-1 0.448-1 1v12c0 0.552 0.448 1 1 1l10.569-6.246c0.267-0.158 0.431-0.444 0.431-0.754s-0.164-0.597-0.431-0.754l-10.569-6.246z"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 515 B |
7
assets/icons/refresh.svg
Executable file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by IcoMoon.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18">
|
||||
<path d="M8.013 14.006h-0.822c-2.372-0.388-4.187-2.453-4.187-4.934 0-0.831 0.213-1.609 0.574-2.299l0.613 0.85c0.446 0.618 1.409 0.446 1.614-0.289l1.162-4.179c0.162-0.58-0.275-1.155-0.877-1.154l-4.174 0.006c-0.741 0.001-1.17 0.841-0.736 1.443l1.128 1.564c-0.817 1.145-1.302 2.544-1.302 4.059 0 3.499 2.566 6.399 5.918 6.917 0.091 0.014 0.18 0.010 0.267-0.001v0.012h0.822c0.545 0 0.987-0.442 0.987-0.987v-0.020c0-0.545-0.442-0.987-0.987-0.987z"></path>
|
||||
<path d="M16.82 14.551l-1.129-1.564c0.818-1.145 1.302-2.544 1.302-4.059 0-3.499-2.566-6.399-5.918-6.918-0.091-0.014-0.18-0.010-0.267 0.001v-0.013h-0.822c-0.545 0-0.986 0.442-0.986 0.987v0.020c0 0.546 0.442 0.988 0.986 0.988h0.822c2.372 0.388 4.187 2.453 4.187 4.934 0 0.831-0.213 1.609-0.573 2.299l-0.614-0.85c-0.446-0.618-1.409-0.446-1.613 0.289l-1.163 4.179c-0.161 0.581 0.275 1.155 0.878 1.154l4.174-0.006c0.742-0.001 1.17-0.842 0.736-1.443z"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
10
assets/icons/rewind.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="18px" height="21px" viewBox="0 0 18 21" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.2.2 (9983) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>rewind</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" sketch:type="MSPage">
|
||||
<path d="M17.569,9.246 L7,3 C6.448,3 6,3.448 6,4 L6,5.954 L1,3 C0.448,3 0,3.448 0,4 L0,16 C0,16.552 0.448,17 1,17 L6,14.045 L6,16 C6,16.552 6.448,17 7,17 L17.569,10.754 C17.836,10.596 18,10.31 18,10 C18,9.69 17.836,9.403 17.569,9.246 L17.569,9.246 Z M6,11.722 L2,14.086 L2,5.914 L6,8.278 L6,11.722 L6,11.722 Z M8,14.086 L8,5.914 L14.915,10 L8,14.086 L8,14.086 Z" id="Shape" sketch:type="MSShapeGroup" transform="translate(9.000000, 10.000000) rotate(-180.000000) translate(-9.000000, -10.000000) "></path>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1021 B |
7
assets/icons/sound.svg
Executable file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generated by IcoMoon.io -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18">
|
||||
<path d="M10.214 2c-0.111 0-0.225 0.032-0.334 0.101l-4.048 2.81c-0.083 0.058-0.182 0.089-0.283 0.089h-3.553c-0.55 0-0.996 0.448-0.996 1v6c0 0.552 0.446 1 0.996 1h3.553c0.102 0 0.2 0.031 0.283 0.089l4.048 2.81c0.109 0.069 0.223 0.101 0.334 0.101 0.392 0 0.747-0.4 0.747-0.949v-12.101c0-0.55-0.355-0.949-0.747-0.949zM8.969 12.834l-2.387-1.657c-0.166-0.115-0.364-0.178-0.566-0.178h-2.525c-0.275 0-0.498-0.224-0.498-0.5v-3c0-0.276 0.223-0.5 0.498-0.5h2.525c0.202 0 0.4-0.062 0.566-0.178l2.387-1.657v7.669z"></path>
|
||||
<path d="M16.934 8.799c-0.086-1.748-1.514-2.991-2.507-3.649-0.47-0.312-1.094-0.122-1.325 0.408l-0.038 0.086c-0.188 0.431-0.045 0.939 0.336 1.194 0.706 0.473 1.586 1.247 1.624 2.065 0.032 0.676-0.553 1.468-1.663 2.27-0.398 0.288-0.529 0.839-0.285 1.275l0.042 0.075c0.266 0.475 0.866 0.624 1.3 0.312 1.74-1.251 2.586-2.606 2.516-4.037z"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
19
assets/js/docs.js
Normal file
@ -0,0 +1,19 @@
|
||||
// ==========================================================================
|
||||
// Docs example
|
||||
// ==========================================================================
|
||||
|
||||
/*global InitPxVideo, Mustache, templates */
|
||||
|
||||
// Initialize
|
||||
var video = new InitPxVideo({
|
||||
"videoId": "myvid",
|
||||
"captionsOnDefault": true,
|
||||
"seekInterval": 20,
|
||||
"videoTitle": "PayPal Austin promo",
|
||||
"debug": true,
|
||||
"html": templates.controls.render({
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
console.log(video);
|
802
assets/js/lib/hogan-3.0.2.mustache.js
Normal file
@ -0,0 +1,802 @@
|
||||
/*!
|
||||
* Copyright 2011 Twitter, Inc.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// A wrapper for compatibility with Mustache.js, quirks and all
|
||||
|
||||
|
||||
|
||||
var Hogan = {};
|
||||
|
||||
(function (Hogan) {
|
||||
Hogan.Template = function (codeObj, text, compiler, options) {
|
||||
codeObj = codeObj || {};
|
||||
this.r = codeObj.code || this.r;
|
||||
this.c = compiler;
|
||||
this.options = options || {};
|
||||
this.text = text || '';
|
||||
this.partials = codeObj.partials || {};
|
||||
this.subs = codeObj.subs || {};
|
||||
this.buf = '';
|
||||
}
|
||||
|
||||
Hogan.Template.prototype = {
|
||||
// render: replaced by generated code.
|
||||
r: function (context, partials, indent) { return ''; },
|
||||
|
||||
// variable escaping
|
||||
v: hoganEscape,
|
||||
|
||||
// triple stache
|
||||
t: coerceToString,
|
||||
|
||||
render: function render(context, partials, indent) {
|
||||
return this.ri([context], partials || {}, indent);
|
||||
},
|
||||
|
||||
// render internal -- a hook for overrides that catches partials too
|
||||
ri: function (context, partials, indent) {
|
||||
return this.r(context, partials, indent);
|
||||
},
|
||||
|
||||
// ensurePartial
|
||||
ep: function(symbol, partials) {
|
||||
var partial = this.partials[symbol];
|
||||
|
||||
// check to see that if we've instantiated this partial before
|
||||
var template = partials[partial.name];
|
||||
if (partial.instance && partial.base == template) {
|
||||
return partial.instance;
|
||||
}
|
||||
|
||||
if (typeof template == 'string') {
|
||||
if (!this.c) {
|
||||
throw new Error("No compiler available.");
|
||||
}
|
||||
template = this.c.compile(template, this.options);
|
||||
}
|
||||
|
||||
if (!template) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// We use this to check whether the partials dictionary has changed
|
||||
this.partials[symbol].base = template;
|
||||
|
||||
if (partial.subs) {
|
||||
// Make sure we consider parent template now
|
||||
if (!partials.stackText) partials.stackText = {};
|
||||
for (key in partial.subs) {
|
||||
if (!partials.stackText[key]) {
|
||||
partials.stackText[key] = (this.activeSub !== undefined && partials.stackText[this.activeSub]) ? partials.stackText[this.activeSub] : this.text;
|
||||
}
|
||||
}
|
||||
template = createSpecializedPartial(template, partial.subs, partial.partials,
|
||||
this.stackSubs, this.stackPartials, partials.stackText);
|
||||
}
|
||||
this.partials[symbol].instance = template;
|
||||
|
||||
return template;
|
||||
},
|
||||
|
||||
// tries to find a partial in the current scope and render it
|
||||
rp: function(symbol, context, partials, indent) {
|
||||
var partial = this.ep(symbol, partials);
|
||||
if (!partial) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return partial.ri(context, partials, indent);
|
||||
},
|
||||
|
||||
// render a section
|
||||
rs: function(context, partials, section) {
|
||||
var tail = context[context.length - 1];
|
||||
|
||||
if (!isArray(tail)) {
|
||||
section(context, partials, this);
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < tail.length; i++) {
|
||||
context.push(tail[i]);
|
||||
section(context, partials, this);
|
||||
context.pop();
|
||||
}
|
||||
},
|
||||
|
||||
// maybe start a section
|
||||
s: function(val, ctx, partials, inverted, start, end, tags) {
|
||||
var pass;
|
||||
|
||||
if (isArray(val) && val.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof val == 'function') {
|
||||
val = this.ms(val, ctx, partials, inverted, start, end, tags);
|
||||
}
|
||||
|
||||
pass = !!val;
|
||||
|
||||
if (!inverted && pass && ctx) {
|
||||
ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
|
||||
}
|
||||
|
||||
return pass;
|
||||
},
|
||||
|
||||
// find values with dotted names
|
||||
d: function(key, ctx, partials, returnFound) {
|
||||
var found,
|
||||
names = key.split('.'),
|
||||
val = this.f(names[0], ctx, partials, returnFound),
|
||||
doModelGet = this.options.modelGet,
|
||||
cx = null;
|
||||
|
||||
if (key === '.' && isArray(ctx[ctx.length - 2])) {
|
||||
val = ctx[ctx.length - 1];
|
||||
} else {
|
||||
for (var i = 1; i < names.length; i++) {
|
||||
found = findInScope(names[i], val, doModelGet);
|
||||
if (found !== undefined) {
|
||||
cx = val;
|
||||
val = found;
|
||||
} else {
|
||||
val = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (returnFound && !val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!returnFound && typeof val == 'function') {
|
||||
ctx.push(cx);
|
||||
val = this.mv(val, ctx, partials);
|
||||
ctx.pop();
|
||||
}
|
||||
|
||||
return val;
|
||||
},
|
||||
|
||||
// find values with normal names
|
||||
f: function(key, ctx, partials, returnFound) {
|
||||
var val = false,
|
||||
v = null,
|
||||
found = false,
|
||||
doModelGet = this.options.modelGet;
|
||||
|
||||
for (var i = ctx.length - 1; i >= 0; i--) {
|
||||
v = ctx[i];
|
||||
val = findInScope(key, v, doModelGet);
|
||||
if (val !== undefined) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
return (returnFound) ? false : "";
|
||||
}
|
||||
|
||||
if (!returnFound && typeof val == 'function') {
|
||||
val = this.mv(val, ctx, partials);
|
||||
}
|
||||
|
||||
return val;
|
||||
},
|
||||
|
||||
// higher order templates
|
||||
ls: function(func, cx, partials, text, tags) {
|
||||
var oldTags = this.options.delimiters;
|
||||
|
||||
this.options.delimiters = tags;
|
||||
this.b(this.ct(coerceToString(func.call(cx, text)), cx, partials));
|
||||
this.options.delimiters = oldTags;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
// compile text
|
||||
ct: function(text, cx, partials) {
|
||||
if (this.options.disableLambda) {
|
||||
throw new Error('Lambda features disabled.');
|
||||
}
|
||||
return this.c.compile(text, this.options).render(cx, partials);
|
||||
},
|
||||
|
||||
// template result buffering
|
||||
b: function(s) { this.buf += s; },
|
||||
|
||||
fl: function() { var r = this.buf; this.buf = ''; return r; },
|
||||
|
||||
// method replace section
|
||||
ms: function(func, ctx, partials, inverted, start, end, tags) {
|
||||
var textSource,
|
||||
cx = ctx[ctx.length - 1],
|
||||
result = func.call(cx);
|
||||
|
||||
if (typeof result == 'function') {
|
||||
if (inverted) {
|
||||
return true;
|
||||
} else {
|
||||
textSource = (this.activeSub && this.subsText && this.subsText[this.activeSub]) ? this.subsText[this.activeSub] : this.text;
|
||||
return this.ls(result, cx, partials, textSource.substring(start, end), tags);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
// method replace variable
|
||||
mv: function(func, ctx, partials) {
|
||||
var cx = ctx[ctx.length - 1];
|
||||
var result = func.call(cx);
|
||||
|
||||
if (typeof result == 'function') {
|
||||
return this.ct(coerceToString(result.call(cx)), cx, partials);
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
sub: function(name, context, partials, indent) {
|
||||
var f = this.subs[name];
|
||||
if (f) {
|
||||
this.activeSub = name;
|
||||
f(context, partials, this, indent);
|
||||
this.activeSub = false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//Find a key in an object
|
||||
function findInScope(key, scope, doModelGet) {
|
||||
var val;
|
||||
|
||||
if (scope && typeof scope == 'object') {
|
||||
|
||||
if (scope[key] !== undefined) {
|
||||
val = scope[key];
|
||||
|
||||
// try lookup with get for backbone or similar model data
|
||||
} else if (doModelGet && scope.get && typeof scope.get == 'function') {
|
||||
val = scope.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function createSpecializedPartial(instance, subs, partials, stackSubs, stackPartials, stackText) {
|
||||
function PartialTemplate() {};
|
||||
PartialTemplate.prototype = instance;
|
||||
function Substitutions() {};
|
||||
Substitutions.prototype = instance.subs;
|
||||
var key;
|
||||
var partial = new PartialTemplate();
|
||||
partial.subs = new Substitutions();
|
||||
partial.subsText = {}; //hehe. substext.
|
||||
partial.buf = '';
|
||||
|
||||
stackSubs = stackSubs || {};
|
||||
partial.stackSubs = stackSubs;
|
||||
partial.subsText = stackText;
|
||||
for (key in subs) {
|
||||
if (!stackSubs[key]) stackSubs[key] = subs[key];
|
||||
}
|
||||
for (key in stackSubs) {
|
||||
partial.subs[key] = stackSubs[key];
|
||||
}
|
||||
|
||||
stackPartials = stackPartials || {};
|
||||
partial.stackPartials = stackPartials;
|
||||
for (key in partials) {
|
||||
if (!stackPartials[key]) stackPartials[key] = partials[key];
|
||||
}
|
||||
for (key in stackPartials) {
|
||||
partial.partials[key] = stackPartials[key];
|
||||
}
|
||||
|
||||
return partial;
|
||||
}
|
||||
|
||||
var rAmp = /&/g,
|
||||
rLt = /</g,
|
||||
rGt = />/g,
|
||||
rApos = /\'/g,
|
||||
rQuot = /\"/g,
|
||||
hChars = /[&<>\"\']/;
|
||||
|
||||
function coerceToString(val) {
|
||||
return String((val === null || val === undefined) ? '' : val);
|
||||
}
|
||||
|
||||
function hoganEscape(str) {
|
||||
str = coerceToString(str);
|
||||
return hChars.test(str) ?
|
||||
str
|
||||
.replace(rAmp, '&')
|
||||
.replace(rLt, '<')
|
||||
.replace(rGt, '>')
|
||||
.replace(rApos, ''')
|
||||
.replace(rQuot, '"') :
|
||||
str;
|
||||
}
|
||||
|
||||
var isArray = Array.isArray || function(a) {
|
||||
return Object.prototype.toString.call(a) === '[object Array]';
|
||||
};
|
||||
|
||||
})(typeof exports !== 'undefined' ? exports : Hogan);
|
||||
|
||||
|
||||
|
||||
(function (Hogan) {
|
||||
// Setup regex assignments
|
||||
// remove whitespace according to Mustache spec
|
||||
var rIsWhitespace = /\S/,
|
||||
rQuot = /\"/g,
|
||||
rNewline = /\n/g,
|
||||
rCr = /\r/g,
|
||||
rSlash = /\\/g,
|
||||
rLineSep = /\u2028/,
|
||||
rParagraphSep = /\u2029/;
|
||||
|
||||
Hogan.tags = {
|
||||
'#': 1, '^': 2, '<': 3, '$': 4,
|
||||
'/': 5, '!': 6, '>': 7, '=': 8, '_v': 9,
|
||||
'{': 10, '&': 11, '_t': 12
|
||||
};
|
||||
|
||||
Hogan.scan = function scan(text, delimiters) {
|
||||
var len = text.length,
|
||||
IN_TEXT = 0,
|
||||
IN_TAG_TYPE = 1,
|
||||
IN_TAG = 2,
|
||||
state = IN_TEXT,
|
||||
tagType = null,
|
||||
tag = null,
|
||||
buf = '',
|
||||
tokens = [],
|
||||
seenTag = false,
|
||||
i = 0,
|
||||
lineStart = 0,
|
||||
otag = '{{',
|
||||
ctag = '}}';
|
||||
|
||||
function addBuf() {
|
||||
if (buf.length > 0) {
|
||||
tokens.push({tag: '_t', text: new String(buf)});
|
||||
buf = '';
|
||||
}
|
||||
}
|
||||
|
||||
function lineIsWhitespace() {
|
||||
var isAllWhitespace = true;
|
||||
for (var j = lineStart; j < tokens.length; j++) {
|
||||
isAllWhitespace =
|
||||
(Hogan.tags[tokens[j].tag] < Hogan.tags['_v']) ||
|
||||
(tokens[j].tag == '_t' && tokens[j].text.match(rIsWhitespace) === null);
|
||||
if (!isAllWhitespace) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return isAllWhitespace;
|
||||
}
|
||||
|
||||
function filterLine(haveSeenTag, noNewLine) {
|
||||
addBuf();
|
||||
|
||||
if (haveSeenTag && lineIsWhitespace()) {
|
||||
for (var j = lineStart, next; j < tokens.length; j++) {
|
||||
if (tokens[j].text) {
|
||||
if ((next = tokens[j+1]) && next.tag == '>') {
|
||||
// set indent to token value
|
||||
next.indent = tokens[j].text.toString()
|
||||
}
|
||||
tokens.splice(j, 1);
|
||||
}
|
||||
}
|
||||
} else if (!noNewLine) {
|
||||
tokens.push({tag:'\n'});
|
||||
}
|
||||
|
||||
seenTag = false;
|
||||
lineStart = tokens.length;
|
||||
}
|
||||
|
||||
function changeDelimiters(text, index) {
|
||||
var close = '=' + ctag,
|
||||
closeIndex = text.indexOf(close, index),
|
||||
delimiters = trim(
|
||||
text.substring(text.indexOf('=', index) + 1, closeIndex)
|
||||
).split(' ');
|
||||
|
||||
otag = delimiters[0];
|
||||
ctag = delimiters[delimiters.length - 1];
|
||||
|
||||
return closeIndex + close.length - 1;
|
||||
}
|
||||
|
||||
if (delimiters) {
|
||||
delimiters = delimiters.split(' ');
|
||||
otag = delimiters[0];
|
||||
ctag = delimiters[1];
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (state == IN_TEXT) {
|
||||
if (tagChange(otag, text, i)) {
|
||||
--i;
|
||||
addBuf();
|
||||
state = IN_TAG_TYPE;
|
||||
} else {
|
||||
if (text.charAt(i) == '\n') {
|
||||
filterLine(seenTag);
|
||||
} else {
|
||||
buf += text.charAt(i);
|
||||
}
|
||||
}
|
||||
} else if (state == IN_TAG_TYPE) {
|
||||
i += otag.length - 1;
|
||||
tag = Hogan.tags[text.charAt(i + 1)];
|
||||
tagType = tag ? text.charAt(i + 1) : '_v';
|
||||
if (tagType == '=') {
|
||||
i = changeDelimiters(text, i);
|
||||
state = IN_TEXT;
|
||||
} else {
|
||||
if (tag) {
|
||||
i++;
|
||||
}
|
||||
state = IN_TAG;
|
||||
}
|
||||
seenTag = i;
|
||||
} else {
|
||||
if (tagChange(ctag, text, i)) {
|
||||
tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
|
||||
i: (tagType == '/') ? seenTag - otag.length : i + ctag.length});
|
||||
buf = '';
|
||||
i += ctag.length - 1;
|
||||
state = IN_TEXT;
|
||||
if (tagType == '{') {
|
||||
if (ctag == '}}') {
|
||||
i++;
|
||||
} else {
|
||||
cleanTripleStache(tokens[tokens.length - 1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buf += text.charAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filterLine(seenTag, true);
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
function cleanTripleStache(token) {
|
||||
if (token.n.substr(token.n.length - 1) === '}') {
|
||||
token.n = token.n.substring(0, token.n.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
function trim(s) {
|
||||
if (s.trim) {
|
||||
return s.trim();
|
||||
}
|
||||
|
||||
return s.replace(/^\s*|\s*$/g, '');
|
||||
}
|
||||
|
||||
function tagChange(tag, text, index) {
|
||||
if (text.charAt(index) != tag.charAt(0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 1, l = tag.length; i < l; i++) {
|
||||
if (text.charAt(index + i) != tag.charAt(i)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// the tags allowed inside super templates
|
||||
var allowedInSuper = {'_t': true, '\n': true, '$': true, '/': true};
|
||||
|
||||
function buildTree(tokens, kind, stack, customTags) {
|
||||
var instructions = [],
|
||||
opener = null,
|
||||
tail = null,
|
||||
token = null;
|
||||
|
||||
tail = stack[stack.length - 1];
|
||||
|
||||
while (tokens.length > 0) {
|
||||
token = tokens.shift();
|
||||
|
||||
if (tail && tail.tag == '<' && !(token.tag in allowedInSuper)) {
|
||||
throw new Error('Illegal content in < super tag.');
|
||||
}
|
||||
|
||||
if (Hogan.tags[token.tag] <= Hogan.tags['$'] || isOpener(token, customTags)) {
|
||||
stack.push(token);
|
||||
token.nodes = buildTree(tokens, token.tag, stack, customTags);
|
||||
} else if (token.tag == '/') {
|
||||
if (stack.length === 0) {
|
||||
throw new Error('Closing tag without opener: /' + token.n);
|
||||
}
|
||||
opener = stack.pop();
|
||||
if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
|
||||
throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
|
||||
}
|
||||
opener.end = token.i;
|
||||
return instructions;
|
||||
} else if (token.tag == '\n') {
|
||||
token.last = (tokens.length == 0) || (tokens[0].tag == '\n');
|
||||
}
|
||||
|
||||
instructions.push(token);
|
||||
}
|
||||
|
||||
if (stack.length > 0) {
|
||||
throw new Error('missing closing tag: ' + stack.pop().n);
|
||||
}
|
||||
|
||||
return instructions;
|
||||
}
|
||||
|
||||
function isOpener(token, tags) {
|
||||
for (var i = 0, l = tags.length; i < l; i++) {
|
||||
if (tags[i].o == token.n) {
|
||||
token.tag = '#';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isCloser(close, open, tags) {
|
||||
for (var i = 0, l = tags.length; i < l; i++) {
|
||||
if (tags[i].c == close && tags[i].o == open) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function stringifySubstitutions(obj) {
|
||||
var items = [];
|
||||
for (var key in obj) {
|
||||
items.push('"' + esc(key) + '": function(c,p,t,i) {' + obj[key] + '}');
|
||||
}
|
||||
return "{ " + items.join(",") + " }";
|
||||
}
|
||||
|
||||
function stringifyPartials(codeObj) {
|
||||
var partials = [];
|
||||
for (var key in codeObj.partials) {
|
||||
partials.push('"' + esc(key) + '":{name:"' + esc(codeObj.partials[key].name) + '", ' + stringifyPartials(codeObj.partials[key]) + "}");
|
||||
}
|
||||
return "partials: {" + partials.join(",") + "}, subs: " + stringifySubstitutions(codeObj.subs);
|
||||
}
|
||||
|
||||
Hogan.stringify = function(codeObj, text, options) {
|
||||
return "{code: function (c,p,i) { " + Hogan.wrapMain(codeObj.code) + " }," + stringifyPartials(codeObj) + "}";
|
||||
}
|
||||
|
||||
var serialNo = 0;
|
||||
Hogan.generate = function(tree, text, options) {
|
||||
serialNo = 0;
|
||||
var context = { code: '', subs: {}, partials: {} };
|
||||
Hogan.walk(tree, context);
|
||||
|
||||
if (options.asString) {
|
||||
return this.stringify(context, text, options);
|
||||
}
|
||||
|
||||
return this.makeTemplate(context, text, options);
|
||||
}
|
||||
|
||||
Hogan.wrapMain = function(code) {
|
||||
return 'var t=this;t.b(i=i||"");' + code + 'return t.fl();';
|
||||
}
|
||||
|
||||
Hogan.template = Hogan.Template;
|
||||
|
||||
Hogan.makeTemplate = function(codeObj, text, options) {
|
||||
var template = this.makePartials(codeObj);
|
||||
template.code = new Function('c', 'p', 'i', this.wrapMain(codeObj.code));
|
||||
return new this.template(template, text, this, options);
|
||||
}
|
||||
|
||||
Hogan.makePartials = function(codeObj) {
|
||||
var key, template = {subs: {}, partials: codeObj.partials, name: codeObj.name};
|
||||
for (key in template.partials) {
|
||||
template.partials[key] = this.makePartials(template.partials[key]);
|
||||
}
|
||||
for (key in codeObj.subs) {
|
||||
template.subs[key] = new Function('c', 'p', 't', 'i', codeObj.subs[key]);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
||||
function esc(s) {
|
||||
return s.replace(rSlash, '\\\\')
|
||||
.replace(rQuot, '\\\"')
|
||||
.replace(rNewline, '\\n')
|
||||
.replace(rCr, '\\r')
|
||||
.replace(rLineSep, '\\u2028')
|
||||
.replace(rParagraphSep, '\\u2029');
|
||||
}
|
||||
|
||||
function chooseMethod(s) {
|
||||
return (~s.indexOf('.')) ? 'd' : 'f';
|
||||
}
|
||||
|
||||
function createPartial(node, context) {
|
||||
var prefix = "<" + (context.prefix || "");
|
||||
var sym = prefix + node.n + serialNo++;
|
||||
context.partials[sym] = {name: node.n, partials: {}};
|
||||
context.code += 't.b(t.rp("' + esc(sym) + '",c,p,"' + (node.indent || '') + '"));';
|
||||
return sym;
|
||||
}
|
||||
|
||||
Hogan.codegen = {
|
||||
'#': function(node, context) {
|
||||
context.code += 'if(t.s(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),' +
|
||||
'c,p,0,' + node.i + ',' + node.end + ',"' + node.otag + " " + node.ctag + '")){' +
|
||||
't.rs(c,p,' + 'function(c,p,t){';
|
||||
Hogan.walk(node.nodes, context);
|
||||
context.code += '});c.pop();}';
|
||||
},
|
||||
|
||||
'^': function(node, context) {
|
||||
context.code += 'if(!t.s(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),c,p,1,0,0,"")){';
|
||||
Hogan.walk(node.nodes, context);
|
||||
context.code += '};';
|
||||
},
|
||||
|
||||
'>': createPartial,
|
||||
'<': function(node, context) {
|
||||
var ctx = {partials: {}, code: '', subs: {}, inPartial: true};
|
||||
Hogan.walk(node.nodes, ctx);
|
||||
var template = context.partials[createPartial(node, context)];
|
||||
template.subs = ctx.subs;
|
||||
template.partials = ctx.partials;
|
||||
},
|
||||
|
||||
'$': function(node, context) {
|
||||
var ctx = {subs: {}, code: '', partials: context.partials, prefix: node.n};
|
||||
Hogan.walk(node.nodes, ctx);
|
||||
context.subs[node.n] = ctx.code;
|
||||
if (!context.inPartial) {
|
||||
context.code += 't.sub("' + esc(node.n) + '",c,p,i);';
|
||||
}
|
||||
},
|
||||
|
||||
'\n': function(node, context) {
|
||||
context.code += write('"\\n"' + (node.last ? '' : ' + i'));
|
||||
},
|
||||
|
||||
'_v': function(node, context) {
|
||||
context.code += 't.b(t.v(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));';
|
||||
},
|
||||
|
||||
'_t': function(node, context) {
|
||||
context.code += write('"' + esc(node.text) + '"');
|
||||
},
|
||||
|
||||
'{': tripleStache,
|
||||
|
||||
'&': tripleStache
|
||||
}
|
||||
|
||||
function tripleStache(node, context) {
|
||||
context.code += 't.b(t.t(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));';
|
||||
}
|
||||
|
||||
function write(s) {
|
||||
return 't.b(' + s + ');';
|
||||
}
|
||||
|
||||
Hogan.walk = function(nodelist, context) {
|
||||
var func;
|
||||
for (var i = 0, l = nodelist.length; i < l; i++) {
|
||||
func = Hogan.codegen[nodelist[i].tag];
|
||||
func && func(nodelist[i], context);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
Hogan.parse = function(tokens, text, options) {
|
||||
options = options || {};
|
||||
return buildTree(tokens, '', [], options.sectionTags || []);
|
||||
}
|
||||
|
||||
Hogan.cache = {};
|
||||
|
||||
Hogan.cacheKey = function(text, options) {
|
||||
return [text, !!options.asString, !!options.disableLambda, options.delimiters, !!options.modelGet].join('||');
|
||||
}
|
||||
|
||||
Hogan.compile = function(text, options) {
|
||||
options = options || {};
|
||||
var key = Hogan.cacheKey(text, options);
|
||||
var template = this.cache[key];
|
||||
|
||||
if (template) {
|
||||
var partials = template.partials;
|
||||
for (var name in partials) {
|
||||
delete partials[name].instance;
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
||||
template = this.generate(this.parse(this.scan(text, options.delimiters), text, options), text, options);
|
||||
return this.cache[key] = template;
|
||||
}
|
||||
})(typeof exports !== 'undefined' ? exports : Hogan);
|
||||
|
||||
|
||||
var Mustache = (function (Hogan) {
|
||||
|
||||
// Mustache.js has non-spec partial context behavior
|
||||
function mustachePartial(name, context, partials, indent) {
|
||||
var partialScope = this.f(name, context, partials, 0);
|
||||
var cx = context;
|
||||
if (partialScope) {
|
||||
cx = cx.concat(partialScope);
|
||||
}
|
||||
|
||||
return Hogan.Template.prototype.rp.call(this, name, cx, partials, indent);
|
||||
}
|
||||
|
||||
var HoganTemplateWrapper = function(renderFunc, text, compiler){
|
||||
this.rp = mustachePartial;
|
||||
Hogan.Template.call(this, renderFunc, text, compiler);
|
||||
};
|
||||
HoganTemplateWrapper.prototype = Hogan.Template.prototype;
|
||||
|
||||
// Add a wrapper for Hogan's generate method. Mustache and Hogan keep
|
||||
// separate caches, and Mustache returns wrapped templates.
|
||||
var wrapper;
|
||||
var HoganWrapper = function(){
|
||||
this.cache = {};
|
||||
this.generate = function(code, text, options) {
|
||||
return new HoganTemplateWrapper(new Function('c', 'p', 'i', code), text, wrapper);
|
||||
}
|
||||
};
|
||||
HoganWrapper.prototype = Hogan;
|
||||
wrapper = new HoganWrapper();
|
||||
|
||||
return {
|
||||
to_html: function(text, data, partials, sendFun) {
|
||||
var template = wrapper.compile(text);
|
||||
var result = template.render(data, partials);
|
||||
if (!sendFun) {
|
||||
return result;
|
||||
}
|
||||
|
||||
sendFun(result);
|
||||
}
|
||||
}
|
||||
|
||||
})(Hogan);
|
627
assets/js/simple-media.js
Normal file
@ -0,0 +1,627 @@
|
||||
function InitPxVideo(options) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// Replace all
|
||||
// ---------------------------------
|
||||
if (!String.prototype.replaceAll) {
|
||||
Object.defineProperty(String.prototype, "replaceAll", {
|
||||
value: function(find, replace) {
|
||||
return this.replace(new RegExp(find.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"), "g"), replace);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Utilities for caption time codes
|
||||
function video_timecode_min(tc) {
|
||||
var tcpair = [];
|
||||
tcpair = tc.split(" --> ");
|
||||
return videosub_tcsecs(tcpair[0]);
|
||||
}
|
||||
|
||||
function video_timecode_max(tc) {
|
||||
var tcpair = [];
|
||||
tcpair = tc.split(" --> ");
|
||||
return videosub_tcsecs(tcpair[1]);
|
||||
}
|
||||
|
||||
function videosub_tcsecs(tc) {
|
||||
if (tc === null || tc === undefined) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
var tc1 = [],
|
||||
tc2 = [],
|
||||
seconds;
|
||||
tc1 = tc.split(",");
|
||||
tc2 = tc1[0].split(":");
|
||||
seconds = Math.floor(tc2[0]*60*60) + Math.floor(tc2[1]*60) + Math.floor(tc2[2]);
|
||||
return seconds;
|
||||
}
|
||||
}
|
||||
|
||||
// For "manual" captions, adjust caption position when play time changed (via rewind, clicking progress bar, etc.)
|
||||
function adjustManualCaptions(obj) {
|
||||
obj.subcount = 0;
|
||||
while (video_timecode_max(obj.captions[obj.subcount][0]) < obj.movie.currentTime.toFixed(1)) {
|
||||
obj.subcount++;
|
||||
if (obj.subcount > obj.captions.length-1) {
|
||||
obj.subcount = obj.captions.length-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display captions container and button (for initialization)
|
||||
function showCaptionContainerAndButton(obj) {
|
||||
//obj.captionsBtnContainer.className = "px-video-captions-btn-container show";
|
||||
if (obj.isCaptionDefault) {
|
||||
obj.captionsContainer.className = "px-video-captions show";
|
||||
obj.captionsBtn.setAttribute("checked", "checked");
|
||||
}
|
||||
}
|
||||
|
||||
// Unfortunately, due to scattered support, browser sniffing is required
|
||||
function browserSniff() {
|
||||
var nAgt = navigator.userAgent,
|
||||
browserName = navigator.appName,
|
||||
fullVersion = ""+parseFloat(navigator.appVersion),
|
||||
majorVersion = parseInt(navigator.appVersion,10),
|
||||
nameOffset,
|
||||
verOffset,
|
||||
ix;
|
||||
|
||||
// MSIE 11
|
||||
if ((navigator.appVersion.indexOf("Windows NT") !== -1) && (navigator.appVersion.indexOf("rv:11") !== -1)) {
|
||||
browserName = "IE";
|
||||
fullVersion = "11;";
|
||||
}
|
||||
// MSIE
|
||||
else if ((verOffset=nAgt.indexOf("MSIE")) !== -1) {
|
||||
browserName = "IE";
|
||||
fullVersion = nAgt.substring(verOffset+5);
|
||||
}
|
||||
// Chrome
|
||||
else if ((verOffset=nAgt.indexOf("Chrome")) !== -1) {
|
||||
browserName = "Chrome";
|
||||
fullVersion = nAgt.substring(verOffset+7);
|
||||
}
|
||||
// Safari
|
||||
else if ((verOffset=nAgt.indexOf("Safari")) !== -1) {
|
||||
browserName = "Safari";
|
||||
fullVersion = nAgt.substring(verOffset+7);
|
||||
if ((verOffset=nAgt.indexOf("Version")) !== -1) {
|
||||
fullVersion = nAgt.substring(verOffset+8);
|
||||
}
|
||||
}
|
||||
// Firefox
|
||||
else if ((verOffset=nAgt.indexOf("Firefox")) !== -1) {
|
||||
browserName = "Firefox";
|
||||
fullVersion = nAgt.substring(verOffset+8);
|
||||
}
|
||||
// In most other browsers, "name/version" is at the end of userAgent
|
||||
else if ( (nameOffset=nAgt.lastIndexOf(" ")+1) < (verOffset=nAgt.lastIndexOf("/")) ) {
|
||||
browserName = nAgt.substring(nameOffset,verOffset);
|
||||
fullVersion = nAgt.substring(verOffset+1);
|
||||
if (browserName.toLowerCase()==browserName.toUpperCase()) {
|
||||
browserName = navigator.appName;
|
||||
}
|
||||
}
|
||||
// Trim the fullVersion string at semicolon/space if present
|
||||
if ((ix=fullVersion.indexOf(";")) !== -1) {
|
||||
fullVersion=fullVersion.substring(0,ix);
|
||||
}
|
||||
if ((ix=fullVersion.indexOf(" ")) !== -1) {
|
||||
fullVersion=fullVersion.substring(0,ix);
|
||||
}
|
||||
// Get major version
|
||||
majorVersion = parseInt(""+fullVersion,10);
|
||||
if (isNaN(majorVersion)) {
|
||||
fullVersion = ""+parseFloat(navigator.appVersion);
|
||||
majorVersion = parseInt(navigator.appVersion,10);
|
||||
}
|
||||
// Return data
|
||||
return [browserName, majorVersion];
|
||||
}
|
||||
|
||||
// Global variable
|
||||
var obj = {};
|
||||
|
||||
obj.arBrowserInfo = browserSniff();
|
||||
obj.browserName = obj.arBrowserInfo[0];
|
||||
obj.browserMajorVersion = obj.arBrowserInfo[1];
|
||||
|
||||
// If IE8, stop customization (use fallback)
|
||||
// If IE9, stop customization (use native controls)
|
||||
if (obj.browserName === "IE" && (obj.browserMajorVersion === 8 || obj.browserMajorVersion === 9) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If smartphone or tablet, stop customization as video (and captions in latest devices) are handled natively
|
||||
obj.isSmartphoneOrTablet = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
|
||||
if (obj.isSmartphoneOrTablet) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set debug mode
|
||||
if (typeof(options.debug)==="undefined") {
|
||||
options.debug = false;
|
||||
}
|
||||
obj.debug = options.debug;
|
||||
|
||||
// Output browser info to log if debug on
|
||||
if (options.debug) {
|
||||
console.log(obj.browserName + " " + obj.browserMajorVersion);
|
||||
}
|
||||
|
||||
// Set up aria-label for Play button with the videoTitle option
|
||||
if ((typeof(options.videoTitle)==="undefined") || (options.videoTitle==="")) {
|
||||
obj.playAriaLabel = "Play";
|
||||
}
|
||||
else {
|
||||
obj.playAriaLabel = "Play video, " + options.videoTitle;
|
||||
}
|
||||
|
||||
// Get the container, video element, and controls container
|
||||
obj.container = document.getElementById(options.videoId);
|
||||
obj.container.className = obj.container.className + " stopped";
|
||||
obj.movie = obj.container.getElementsByTagName("video")[0];
|
||||
obj.controls = obj.container.getElementsByClassName("px-video-controls")[0];
|
||||
|
||||
// Remove native video controls
|
||||
obj.movie.removeAttribute("controls");
|
||||
|
||||
// Generate random number for ID/FOR attribute values for controls
|
||||
obj.randomNum = Math.floor(Math.random() * (10000));
|
||||
|
||||
// Insert custom video controls
|
||||
if (options.debug) {
|
||||
console.log("Inserting custom video controls");
|
||||
}
|
||||
obj.controls.innerHTML = options.html
|
||||
.replaceAll("{aria-label}", obj.playAriaLabel)
|
||||
.replaceAll("{id}", obj.randomNum);
|
||||
|
||||
// Responsive ffs
|
||||
// ----
|
||||
// Adjust layout per width of video - container
|
||||
//obj.movieWidth = obj.movie.width;
|
||||
//if (obj.movieWidth < 360) {
|
||||
// obj.movieWidth = 360;
|
||||
//}
|
||||
//obj.container.setAttribute("style", "width:" + obj.movieWidth + "px");
|
||||
|
||||
// Adjust layout per width of video - controls/mute offset
|
||||
obj.labelMute = document.getElementById("labelMute" + obj.randomNum);
|
||||
obj.labelMuteOffset = obj.movieWidth - 390;
|
||||
if (obj.labelMuteOffset < 0) {
|
||||
obj.labelMuteOffset = 0;
|
||||
}
|
||||
obj.labelMute.setAttribute("style", "margin-left:" + obj.labelMuteOffset + "px");
|
||||
|
||||
// Get URL of caption file if exists
|
||||
var captionSrc = "",
|
||||
kind,
|
||||
children = obj.movie.childNodes;
|
||||
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
if (children[i].nodeName.toLowerCase() === "track") {
|
||||
kind = children[i].getAttribute("kind");
|
||||
if (kind === "captions") {
|
||||
captionSrc = children[i].getAttribute("src");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Record if caption file exists or not
|
||||
obj.captionExists = true;
|
||||
if (captionSrc === "") {
|
||||
obj.captionExists = false;
|
||||
if (options.debug) {
|
||||
console.log("No caption track found.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.debug) {
|
||||
console.log("Caption track found; URI: " + captionSrc);
|
||||
}
|
||||
}
|
||||
|
||||
// Set captions on/off - on by default
|
||||
if (typeof(options.captionsOnDefault) === "undefined") {
|
||||
options.captionsOnDefault = true;
|
||||
}
|
||||
obj.isCaptionDefault = options.captionsOnDefault;
|
||||
|
||||
// Number of seconds for rewind and forward buttons
|
||||
if (typeof(options.seekInterval) === "undefined") {
|
||||
options.seekInterval = 10;
|
||||
}
|
||||
obj.seekInterval = options.seekInterval;
|
||||
|
||||
// Get the elements for the controls
|
||||
obj.btnPlay = obj.container.getElementsByClassName("px-video-play")[0];
|
||||
obj.btnPause = obj.container.getElementsByClassName("px-video-pause")[0];
|
||||
obj.btnRestart = obj.container.getElementsByClassName("px-video-restart")[0];
|
||||
obj.btnRewind = obj.container.getElementsByClassName("px-video-rewind")[0];
|
||||
obj.btnForward = obj.container.getElementsByClassName("px-video-forward")[0];
|
||||
obj.btnVolume = obj.container.getElementsByClassName("px-video-volume")[0];
|
||||
obj.btnMute = obj.container.getElementsByClassName("px-video-mute")[0];
|
||||
obj.progressBar = obj.container.getElementsByClassName("px-video-progress")[0];
|
||||
obj.progressBarSpan = obj.progressBar.getElementsByTagName("span")[0];
|
||||
obj.captionsContainer = obj.container.getElementsByClassName("px-video-captions")[0];
|
||||
obj.captionsBtn = obj.container.getElementsByClassName("px-video-btnCaptions")[0];
|
||||
obj.captionsBtnContainer = obj.container.getElementsByClassName("px-video-captions-btn-container")[0];
|
||||
obj.duration = obj.container.getElementsByClassName("px-video-duration")[0];
|
||||
obj.txtSeconds = obj.container.getElementsByClassName("px-seconds");
|
||||
|
||||
// Update number of seconds in rewind and fast forward buttons
|
||||
obj.txtSeconds[0].innerHTML = obj.seekInterval;
|
||||
obj.txtSeconds[1].innerHTML = obj.seekInterval;
|
||||
|
||||
// Determine if HTML5 textTracks is supported (for captions)
|
||||
obj.isTextTracks = false;
|
||||
if (obj.movie.textTracks) {
|
||||
obj.isTextTracks = true;
|
||||
}
|
||||
|
||||
// Play
|
||||
obj.btnPlay.addEventListener("click", function() {
|
||||
obj.movie.play();
|
||||
|
||||
obj.container.className = obj.container.className.replace("stopped", "playing");
|
||||
|
||||
obj.btnPlay.className = "px-video-play hide";
|
||||
obj.btnPause.className = "px-video-pause px-video-show-inline";
|
||||
obj.btnPause.focus();
|
||||
}, false);
|
||||
|
||||
// Pause
|
||||
obj.btnPause.addEventListener("click", function() {
|
||||
obj.movie.pause();
|
||||
|
||||
obj.container.className = obj.container.className.replace("playing", "stopped");
|
||||
|
||||
obj.btnPlay.className = "px-video-play px-video-show-inline";
|
||||
obj.btnPause.className = "px-video-pause hide";
|
||||
obj.btnPlay.focus();
|
||||
}, false);
|
||||
|
||||
// Restart
|
||||
obj.btnRestart.addEventListener("click", function() {
|
||||
// Move to beginning
|
||||
obj.movie.currentTime = 0;
|
||||
|
||||
// Special handling for "manual" captions
|
||||
if (!obj.isTextTracks) {
|
||||
obj.subcount = 0;
|
||||
}
|
||||
|
||||
// Play and ensure the play button is in correct state
|
||||
obj.movie.play();
|
||||
obj.btnPlay.className = "px-video-play hide";
|
||||
obj.btnPause.className = "px-video-pause px-video-show-inline";
|
||||
|
||||
}, false);
|
||||
|
||||
// Rewind
|
||||
obj.btnRewind.addEventListener("click", function() {
|
||||
var targetTime = obj.movie.currentTime - obj.seekInterval;
|
||||
if (targetTime < 0) {
|
||||
obj.movie.currentTime = 0;
|
||||
}
|
||||
else {
|
||||
obj.movie.currentTime = targetTime;
|
||||
}
|
||||
// Special handling for "manual" captions
|
||||
if (!obj.isTextTracks) {
|
||||
adjustManualCaptions(obj);
|
||||
}
|
||||
}, false);
|
||||
|
||||
// Fast forward
|
||||
obj.btnForward.addEventListener("click", function() {
|
||||
var targetTime = obj.movie.currentTime + obj.seekInterval;
|
||||
if (targetTime > obj.movie.duration) {
|
||||
obj.movie.currentTime = obj.movie.duration;
|
||||
}
|
||||
else {
|
||||
obj.movie.currentTime = targetTime;
|
||||
}
|
||||
// Special handling for "manual" captions
|
||||
if (!obj.isTextTracks) {
|
||||
adjustManualCaptions(obj);
|
||||
}
|
||||
}, false);
|
||||
|
||||
// Get the HTML5 range input element and append audio volume adjustment on change
|
||||
obj.btnVolume.addEventListener("change", function() {
|
||||
obj.movie.volume = parseFloat(this.value / 10);
|
||||
}, false);
|
||||
|
||||
// Mute
|
||||
obj.btnMute.addEventListener("click", function() {
|
||||
if (obj.movie.muted === true) {
|
||||
obj.movie.muted = false;
|
||||
}
|
||||
else {
|
||||
obj.movie.muted = true;
|
||||
}
|
||||
}, false);
|
||||
|
||||
// Duration
|
||||
obj.movie.addEventListener("timeupdate", function() {
|
||||
obj.secs = parseInt(obj.movie.currentTime % 60);
|
||||
obj.mins = parseInt((obj.movie.currentTime / 60) % 60);
|
||||
|
||||
// Ensure it"s two digits. For example, 03 rather than 3.
|
||||
obj.secs = ("0" + obj.secs).slice(-2);
|
||||
obj.mins = ("0" + obj.mins).slice(-2);
|
||||
|
||||
// Render
|
||||
obj.duration.innerHTML = obj.mins + ":" + obj.secs;
|
||||
}, false);
|
||||
|
||||
// Progress bar
|
||||
obj.movie.addEventListener("timeupdate", function() {
|
||||
obj.percent = (100 / obj.movie.duration) * obj.movie.currentTime;
|
||||
if (obj.percent > 0) {
|
||||
obj.progressBar.value = obj.percent;
|
||||
obj.progressBarSpan.innerHTML = obj.percent;
|
||||
}
|
||||
}, false);
|
||||
|
||||
// Skip when clicking progress bar
|
||||
obj.progressBar.addEventListener("click", function(e) {
|
||||
obj.pos = (e.pageX - this.offsetLeft) / this.offsetWidth;
|
||||
obj.movie.currentTime = obj.pos * obj.movie.duration;
|
||||
|
||||
// Special handling for "manual" captions
|
||||
if (!obj.isTextTracks) {
|
||||
adjustManualCaptions(obj);
|
||||
}
|
||||
});
|
||||
|
||||
// Clear captions at end of video
|
||||
obj.movie.addEventListener("ended", function() {
|
||||
obj.captionsContainer.innerHTML = "";
|
||||
});
|
||||
|
||||
// ***
|
||||
// Captions
|
||||
// ***
|
||||
|
||||
// Toggle display of captions via captions button
|
||||
obj.captionsBtn.addEventListener("click", function() {
|
||||
if (this.checked) {
|
||||
obj.captionsContainer.className = "px-video-captions show";
|
||||
} else {
|
||||
obj.captionsContainer.className = "px-video-captions hide";
|
||||
}
|
||||
}, false);
|
||||
|
||||
// If no caption file exists, hide container for caption text
|
||||
if (!obj.captionExists) {
|
||||
obj.captionsContainer.className = "px-video-captions hide";
|
||||
}
|
||||
|
||||
// If caption file exists, process captions
|
||||
else {
|
||||
|
||||
// If IE 10/11 or Firefox 31+ or Safari 7+, don"t use native captioning (still doesn"t work although they claim it"s now supported)
|
||||
if ((obj.browserName==="IE" && obj.browserMajorVersion===10) ||
|
||||
(obj.browserName==="IE" && obj.browserMajorVersion===11) ||
|
||||
(obj.browserName==="Firefox" && obj.browserMajorVersion>=31) ||
|
||||
(obj.browserName==="Safari" && obj.browserMajorVersion>=7)) {
|
||||
if (options.debug) {
|
||||
console.log("Detected IE 10/11 or Firefox 31+ or Safari 7+");
|
||||
}
|
||||
// set to false so skips to "manual" captioning
|
||||
obj.isTextTracks = false;
|
||||
|
||||
// turn off native caption rendering to avoid double captions [doesn"t work in Safari 7; see patch below]
|
||||
var track = {};
|
||||
var tracks = obj.movie.textTracks;
|
||||
for (var j=0; j < tracks.length; j++) {
|
||||
track = obj.movie.textTracks[j];
|
||||
track.mode = "hidden";
|
||||
}
|
||||
}
|
||||
|
||||
// Rendering caption tracks - native support required - http://caniuse.com/webvtt
|
||||
if (obj.isTextTracks) {
|
||||
if (options.debug) {
|
||||
console.log("textTracks supported");
|
||||
}
|
||||
showCaptionContainerAndButton(obj);
|
||||
|
||||
var track = {};
|
||||
var tracks = obj.movie.textTracks;
|
||||
for (var j=0; j < tracks.length; j++) {
|
||||
track = obj.movie.textTracks[j];
|
||||
track.mode = "hidden";
|
||||
if (track.kind === "captions") {
|
||||
track.addEventListener("cuechange",function() {
|
||||
if (this.activeCues[0]) {
|
||||
if (this.activeCues[0].hasOwnProperty("text")) {
|
||||
obj.captionsContainer.innerHTML = this.activeCues[0].text;
|
||||
}
|
||||
}
|
||||
},false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Caption tracks not natively supported
|
||||
else {
|
||||
if (options.debug) {
|
||||
console.log("textTracks not supported so rendering captions manually");
|
||||
}
|
||||
showCaptionContainerAndButton(obj);
|
||||
|
||||
// Render captions from array at appropriate time
|
||||
obj.currentCaption = "";
|
||||
obj.subcount = 0;
|
||||
obj.captions = [];
|
||||
|
||||
obj.movie.addEventListener("timeupdate", function() {
|
||||
// Check if the next caption is in the current time range
|
||||
if (obj.movie.currentTime.toFixed(1) > video_timecode_min(obj.captions[obj.subcount][0]) &&
|
||||
obj.movie.currentTime.toFixed(1) < video_timecode_max(obj.captions[obj.subcount][0])) {
|
||||
obj.currentCaption = obj.captions[obj.subcount][1];
|
||||
}
|
||||
// Is there a next timecode?
|
||||
if (obj.movie.currentTime.toFixed(1) > video_timecode_max(obj.captions[obj.subcount][0]) &&
|
||||
obj.subcount < (obj.captions.length-1)) {
|
||||
obj.subcount++;
|
||||
}
|
||||
// Render the caption
|
||||
obj.captionsContainer.innerHTML = obj.currentCaption;
|
||||
}, false);
|
||||
|
||||
if (captionSrc !== "") {
|
||||
// Create XMLHttpRequest object
|
||||
var xhr;
|
||||
if (window.XMLHttpRequest) {
|
||||
xhr = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) { // IE8
|
||||
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
if (options.debug) {
|
||||
console.log("xhr = 200");
|
||||
}
|
||||
|
||||
obj.captions = [];
|
||||
var records = [],
|
||||
record,
|
||||
req = xhr.responseText;
|
||||
records = req.split("\n\n");
|
||||
for (var r=0; r < records.length; r++) {
|
||||
record = records[r];
|
||||
obj.captions[r] = [];
|
||||
obj.captions[r] = record.split("\n");
|
||||
}
|
||||
// Remove first element ("VTT")
|
||||
obj.captions.shift();
|
||||
|
||||
if (options.debug) {
|
||||
console.log("Successfully loaded the caption file via ajax.");
|
||||
}
|
||||
} else {
|
||||
if (options.debug) {
|
||||
console.log("There was a problem loading the caption file via ajax.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.open("get", captionSrc, true);
|
||||
xhr.send();
|
||||
}
|
||||
}
|
||||
|
||||
// If Safari 7, removing track from DOM [see "turn off native caption rendering" above]
|
||||
if (obj.browserName === "Safari" && obj.browserMajorVersion === 7) {
|
||||
console.log("Safari 7 detected; removing track from DOM");
|
||||
var tracks = obj.movie.getElementsByTagName("track");
|
||||
obj.movie.removeChild(tracks[0]);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*$(function() {
|
||||
$("video").simplePlayer();
|
||||
});*/
|
||||
|
||||
// Simple player plugin
|
||||
// ---------------------------------
|
||||
/*;(function($) {
|
||||
$.fn.simplePlayer = function (settings) {
|
||||
// Config defaults
|
||||
var config = {
|
||||
wrapperClass: "media", // Class name added to replaced selects
|
||||
shownClass: "in",
|
||||
autoplay: false,
|
||||
templates: {
|
||||
controls: "<div class="media-controls js-media-controls"> \
|
||||
<button type="button" class="play button-toggle-play js-button-toggle-play"> \
|
||||
<span class="icon-play"></span> \
|
||||
</button> \
|
||||
<div class="progress progress-play js-progress-play" role="progress-bar"> \
|
||||
<div class="progress-buffered js-progress-buffered"></div> \
|
||||
<div class="progress-played js-progress-played"></div> \
|
||||
</div> \
|
||||
<div class="time js-time"> \
|
||||
<span class="time-elapsed js-time-elapsed">88:88</span> \
|
||||
<span class="time-seperator js-time-seperator">/</span> \
|
||||
<span class="time-total js-time-total">88:88</span> \
|
||||
</div> \
|
||||
<div class="volume has-popover js-volume"> \
|
||||
<button type="button" class="button-toggle-mute js-button-toggle-mute"> \
|
||||
<span class="icon-volume-up"></span> \
|
||||
</button> \
|
||||
<div class="popover popover-volume js-popover-volume"> \
|
||||
<div class="progress vertical-progress progress-audio-volume js-progress-audio-volume"> \
|
||||
<div class="progress-volume js-progress-volume" style="height: 80%"></div> \
|
||||
</div> \
|
||||
<div class="volume-label js-volume-label">100%</div> \
|
||||
</div> \
|
||||
</div> \
|
||||
<button type="button" class="fullscreen button-fullscreen js-button-fullscreen"> \
|
||||
<span class="icon-resize-full"></span> \
|
||||
</button> \
|
||||
</div>",
|
||||
overlay: "<div class="overlay overlay-play"><span><i class="icon-play"></i></span></div>"
|
||||
}
|
||||
};
|
||||
|
||||
// Extend settings if they"re passed
|
||||
if (settings) {
|
||||
$.extend(config, settings);
|
||||
}
|
||||
|
||||
this.each(function() {
|
||||
var player = this,
|
||||
status = {},
|
||||
$player = $(this).wrap("<div class="" + config.wrapperClass + (config.autoplay ? " playing" : " stopped") + "" />"),
|
||||
$wrapper = $player.parents("." + config.wrapperClass),
|
||||
supportMP4 = (function (v) { return (v.canPlayType && v.canPlayType("video/mp4")); }(document.createElement("video")));
|
||||
|
||||
console.log($wrapper);
|
||||
|
||||
// Inject the controls
|
||||
$(config.templates.controls).insertAfter($player);
|
||||
$(config.templates.overlay).insertAfter($player);
|
||||
|
||||
// Select controls
|
||||
var $playbackToggle = $(".js-button-toggle-play"),
|
||||
$muteToggle = $(".js-button-toggle-mute");
|
||||
|
||||
function togglePlayback() {
|
||||
if(status.playing && status.playing == true) {
|
||||
player.pause();
|
||||
status.playing = false;
|
||||
$wrapper.removeClass("playing").addClass("paused");
|
||||
} else {
|
||||
player.play();
|
||||
status.playing = true;
|
||||
$wrapper.removeClass("paused stopped").addClass("playing");
|
||||
}
|
||||
$("span", this).attr("class", "icon-" + (status.playing ? "pause" : "play"));
|
||||
};
|
||||
|
||||
function toggleMute() {
|
||||
player.muted = !status.muted;
|
||||
status.muted = player.muted;
|
||||
$("span", this).attr("class", "icon-" + (status.muted ? "mute" : "volume-up"));
|
||||
};
|
||||
|
||||
$playbackToggle.on("click", togglePlayback);
|
||||
$muteToggle.on("click", toggleMute);
|
||||
});
|
||||
};
|
||||
})(jQuery);*/
|
37
assets/less/docs.less
Normal file
@ -0,0 +1,37 @@
|
||||
// ==========================================================================
|
||||
// HTML5 Video Player Demo Page
|
||||
// ==========================================================================
|
||||
|
||||
// Reset
|
||||
@import "lib/normalize.less";
|
||||
// Mixins
|
||||
@import "lib/mixins.less";
|
||||
|
||||
// BORDER-BOX ALL THE THINGS!
|
||||
// http://paulirish.com/2012/box-sizing-border-box-ftw/
|
||||
*, *::after, *::before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html {
|
||||
font-size: 62.5%;
|
||||
}
|
||||
body {
|
||||
font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
.font-size(18);
|
||||
color: #6D797F;
|
||||
line-height: 1.5;
|
||||
background: #ECF0F1;
|
||||
max-width: 960px;
|
||||
margin: 50px auto;
|
||||
text-align: center;
|
||||
}
|
||||
h1 {
|
||||
.font-size(48);
|
||||
letter-spacing: -.025em;
|
||||
color: #2E3C44;
|
||||
margin: 0 0 20px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
p {
|
||||
margin: 0 0 20px;
|
||||
}
|
27
assets/less/lib/mixins.less
Normal file
@ -0,0 +1,27 @@
|
||||
// ==========================================================================
|
||||
// Mixins
|
||||
// ==========================================================================
|
||||
|
||||
// Contain floats: nicolasgallagher.com/micro-clearfix-hack/
|
||||
.clearfix() {
|
||||
zoom: 1;
|
||||
&:before,
|
||||
&:after { content: ""; display: table; }
|
||||
&:after { clear: both; }
|
||||
}
|
||||
|
||||
// Webkit-style focus
|
||||
.tab-focus() {
|
||||
// Default
|
||||
outline: thin dotted @gray-dark;
|
||||
// Webkit
|
||||
//outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
// Use rems for font sizing
|
||||
.font-size(@font-size: 16){
|
||||
@rem: (@font-size / 10);
|
||||
font-size: @font-size * 1px;
|
||||
font-size: ~"@{rem}rem";
|
||||
}
|
406
assets/less/lib/normalize.less
vendored
Normal file
@ -0,0 +1,406 @@
|
||||
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
|
||||
|
||||
/* ==========================================================================
|
||||
HTML5 display definitions
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Correct `block` display not defined in IE 8/9.
|
||||
*/
|
||||
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
main,
|
||||
nav,
|
||||
section,
|
||||
summary {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct `inline-block` display not defined in IE 8/9.
|
||||
*/
|
||||
|
||||
audio,
|
||||
canvas,
|
||||
video {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent modern browsers from displaying `audio` without controls.
|
||||
* Remove excess height in iOS 5 devices.
|
||||
*/
|
||||
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address `[hidden]` styling not present in IE 8/9.
|
||||
* Hide the `template` element in IE, Safari, and Firefox < 22.
|
||||
*/
|
||||
|
||||
[hidden],
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Base
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Set default font family to sans-serif.
|
||||
* 2. Prevent iOS text size adjust after orientation change, without disabling
|
||||
* user zoom.
|
||||
*/
|
||||
|
||||
html {
|
||||
font-family: sans-serif; /* 1 */
|
||||
-ms-text-size-adjust: 100%; /* 2 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove default margin.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Links
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the gray background color from active links in IE 10.
|
||||
*/
|
||||
|
||||
a {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address `outline` inconsistency between Chrome and other browsers.
|
||||
*/
|
||||
|
||||
a:focus {
|
||||
outline: thin dotted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Improve readability when focused and also mouse hovered in all browsers.
|
||||
*/
|
||||
|
||||
a:active,
|
||||
a:hover {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Typography
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Address variable `h1` font-size and margin within `section` and `article`
|
||||
* contexts in Firefox 4+, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address styling not present in IE 8/9, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address styling not present in Safari 5 and Chrome.
|
||||
*/
|
||||
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address differences between Firefox and other browsers.
|
||||
*/
|
||||
|
||||
hr {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address styling not present in IE 8/9.
|
||||
*/
|
||||
|
||||
mark {
|
||||
background: #ff0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct font family set oddly in Safari 5 and Chrome.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, serif;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/**
|
||||
* Improve readability of pre-formatted text in all browsers.
|
||||
*/
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set consistent quote types.
|
||||
*/
|
||||
|
||||
q {
|
||||
quotes: "\201C" "\201D" "\2018" "\2019";
|
||||
}
|
||||
|
||||
/**
|
||||
* Address inconsistent and variable font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove border when inside `a` element in IE 8/9.
|
||||
*/
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct overflow displayed oddly in IE 9.
|
||||
*/
|
||||
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Figures
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Address margin not present in IE 8/9 and Safari 5.
|
||||
*/
|
||||
|
||||
figure {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Define consistent border, margin, and padding.
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct `color` not being inherited in IE 8/9.
|
||||
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
|
||||
*/
|
||||
|
||||
legend {
|
||||
border: 0; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct font family not being inherited in all browsers.
|
||||
* 2. Correct font size not being inherited in all browsers.
|
||||
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 2 */
|
||||
margin: 0; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
|
||||
* the UA stylesheet.
|
||||
*/
|
||||
|
||||
button,
|
||||
input {
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Address inconsistent `text-transform` inheritance for `button` and `select`.
|
||||
* All other form control elements do not inherit `text-transform` values.
|
||||
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
|
||||
* Correct `select` style inheritance in Firefox 4+ and Opera.
|
||||
*/
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
|
||||
* and `video` controls.
|
||||
* 2. Correct inability to style clickable `input` types in iOS.
|
||||
* 3. Improve usability and consistency of cursor style between image-type
|
||||
* `input` and others.
|
||||
*/
|
||||
|
||||
button,
|
||||
html input[type="button"], /* 1 */
|
||||
input[type="reset"],
|
||||
input[type="submit"] {
|
||||
-webkit-appearance: button; /* 2 */
|
||||
cursor: pointer; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-set default cursor for disabled elements.
|
||||
*/
|
||||
|
||||
button[disabled],
|
||||
html input[disabled] {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Address box sizing set to `content-box` in IE 8/9/10.
|
||||
* 2. Remove excess padding in IE 8/9/10.
|
||||
*/
|
||||
|
||||
input[type="checkbox"],
|
||||
input[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
|
||||
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
|
||||
* (include `-moz` to future-proof).
|
||||
*/
|
||||
|
||||
input[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
-moz-box-sizing: content-box;
|
||||
-webkit-box-sizing: content-box; /* 2 */
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove inner padding and search cancel button in Safari 5 and Chrome
|
||||
* on OS X.
|
||||
*/
|
||||
|
||||
input[type="search"]::-webkit-search-cancel-button,
|
||||
input[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove inner padding and border in Firefox 4+.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
input::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Remove default vertical scrollbar in IE 8/9.
|
||||
* 2. Improve readability and alignment in all browsers.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto; /* 1 */
|
||||
vertical-align: top; /* 2 */
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Tables
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove most spacing between table cells.
|
||||
*/
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
552
assets/less/simple-player.less
Normal file
@ -0,0 +1,552 @@
|
||||
// ==========================================================================
|
||||
// HTML5 Media Player
|
||||
// ==========================================================================
|
||||
|
||||
// Variables
|
||||
// -------------------------------
|
||||
@base-color: #2E3C44;
|
||||
@green: #1ABC9C;
|
||||
@red: #D44334;
|
||||
//@green: #4CB953;
|
||||
@blue: #3498DB;
|
||||
@control-color: @blue;
|
||||
|
||||
|
||||
// BORDER-BOX ALL THE THINGS! (http://paulirish.com/2012/box-sizing-border-box-ftw/)
|
||||
// -------------------------------
|
||||
.player,
|
||||
.player *,
|
||||
.player *::after,
|
||||
.player *::before {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
// Utility classes & mixins
|
||||
// -------------------------------
|
||||
.sr-only {
|
||||
position: absolute !important;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
padding: 0 !important;
|
||||
border: 0 !important;
|
||||
height: 1px !important;
|
||||
width: 1px !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
.show-inline {
|
||||
display: inline-block;
|
||||
}
|
||||
// Contain floats: nicolasgallagher.com/micro-clearfix-hack/
|
||||
.clearfix() {
|
||||
zoom: 1;
|
||||
&:before,
|
||||
&:after { content: ""; display: table; }
|
||||
&:after { clear: both; }
|
||||
}
|
||||
|
||||
// Base
|
||||
.player {
|
||||
position: relative;
|
||||
max-width: 100%;
|
||||
overflow: hidden; // For the controls
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
.controls {
|
||||
.clearfix();
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 10px 5px;
|
||||
background: rgba(0,0,0, .75);
|
||||
transition: transform .3s ease;
|
||||
line-height: 1;
|
||||
|
||||
button {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
overflow: hidden;
|
||||
}
|
||||
label,
|
||||
button {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 2px;
|
||||
padding: 5px 10px;
|
||||
color: #ddd;
|
||||
transition: background .3s ease;
|
||||
border-radius: 3px;
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
fill: currentColor;
|
||||
transition: fill .3s ease;
|
||||
}
|
||||
&:focus {
|
||||
background: #000;
|
||||
outline: 0;
|
||||
}
|
||||
&:hover {
|
||||
background: @control-color;
|
||||
}
|
||||
&:hover svg,
|
||||
&:focus svg {
|
||||
fill: #fff;
|
||||
}
|
||||
}
|
||||
.px-video-time {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
padding-top: 3px;
|
||||
margin-left: 10px;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
}
|
||||
progress {
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 10px;
|
||||
margin: 0;
|
||||
vertical-align: top;
|
||||
|
||||
&[value] {
|
||||
/* Reset the default appearance */
|
||||
-webkit-appearance: none;
|
||||
border: none;
|
||||
|
||||
&::-webkit-progress-bar {
|
||||
background-color: #eee;
|
||||
}
|
||||
&::-webkit-progress-value {
|
||||
background-color: @control-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
.play-controls {
|
||||
float: left;
|
||||
}
|
||||
.sound-controls {
|
||||
float: right;
|
||||
}
|
||||
/*&.playing .controls {
|
||||
transform: translateY(100%);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
/* containers */
|
||||
.px-video-img-captions-container * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.px-video-img-captions-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* progress indicator */
|
||||
.px-video-progress {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* time */
|
||||
/*.px-video-time {
|
||||
float: right;
|
||||
margin-top: 2px;
|
||||
font-size: 14px;
|
||||
}*/
|
||||
|
||||
/* caption area */
|
||||
.px-video-captions {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: .5em;
|
||||
min-height: 2.5em;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
font-size: 1.1em;
|
||||
text-align: center;
|
||||
opacity: 0.75;
|
||||
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* buttons */
|
||||
.px-video-controls button {
|
||||
|
||||
//background: no-repeat url('../images/px-video-sprite.png');
|
||||
}
|
||||
.px-video-controls button:focus {
|
||||
//border: 1px #999 dotted;
|
||||
//outline: none;
|
||||
}
|
||||
.px-video-controls button {
|
||||
//cursor: pointer;
|
||||
}
|
||||
|
||||
/* captions button */
|
||||
.px-video-captions-btn-container label {
|
||||
display: inline-block;
|
||||
width: 25px;
|
||||
height: 20px;
|
||||
margin-left: 25px;
|
||||
background: no-repeat url('../images/px-video-sprite.png');
|
||||
background-position: -6px -835px;
|
||||
}
|
||||
.px-video-captions-btn-container input[type="checkbox"]:focus+label {
|
||||
outline: 1px #999 dotted;
|
||||
background-position: -6px -799px;
|
||||
}
|
||||
.px-video-captions-btn-container input[type="checkbox"]:hover+label {
|
||||
background-position: -6px -799px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.px-video-captions-btn-container input[type="checkbox"]:focus+label {
|
||||
outline: 1px #999 dotted;
|
||||
background-position: -6px -799px;
|
||||
}
|
||||
.px-video-captions-btn-container input[type="checkbox"]:checked+label {
|
||||
background-position: -6px -871px;
|
||||
}
|
||||
|
||||
/* mute button */
|
||||
.px-video-mute-btn-container label {
|
||||
display: inline-block;
|
||||
width: 25px;
|
||||
height: 20px;
|
||||
margin-left: 240px;
|
||||
margin-top: 2px;
|
||||
background: no-repeat url('../images/px-video-sprite.png');
|
||||
background-position: -6px -476px;
|
||||
}
|
||||
.px-video-mute-btn-container input[type="checkbox"]:focus+label {
|
||||
outline: 1px #999 dotted;
|
||||
background-position: -6px -440px;
|
||||
}
|
||||
.px-video-mute-btn-container input[type="checkbox"]:hover+label {
|
||||
background-position: -6px -440px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.px-video-mute-btn-container input[type="checkbox"]:focus+label {
|
||||
outline: 1px #999 dotted;
|
||||
background-position: -6px -440px;
|
||||
}
|
||||
/* checked state of mute button */
|
||||
.px-video-mute-btn-container input[type="checkbox"]:checked+label {
|
||||
background-position: -6px -692px;
|
||||
}
|
||||
.px-video-mute-btn-container input[type="checkbox"]:checked:hover+label,
|
||||
.px-video-mute-btn-container input[type="checkbox"]:checked:focus+label {
|
||||
background-position: -6px -656px;
|
||||
}
|
||||
|
||||
/* volume range input */
|
||||
.px-video-controls input[type='range'] {
|
||||
-webkit-appearance: none;
|
||||
height: 6px;
|
||||
width: 100px;
|
||||
margin-top: 8px;
|
||||
background-color: #E6E6E6;
|
||||
outline:none;
|
||||
}
|
||||
.px-video-controls input[type='range']:focus::-webkit-slider-thumb {
|
||||
outline: 1px #999 dotted;
|
||||
}
|
||||
.px-video-controls input[type='range']::-moz-range-track {
|
||||
-moz-appearance: none;
|
||||
height: 6px;
|
||||
background-color: #E6E6E6;
|
||||
border: none;
|
||||
}
|
||||
.px-video-controls input[type='range']::-webkit-slider-thumb {
|
||||
-webkit-appearance: none !important;
|
||||
height: 10px;
|
||||
width: 6px;
|
||||
background-color: #666;
|
||||
}
|
||||
.px-video-controls input[type='range']::-moz-range-thumb {
|
||||
height: 12px;
|
||||
width: 8px;
|
||||
}
|
||||
/* fixing display for IE10+ */
|
||||
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
||||
.px-video-controls input[type='range'] {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
height: 8px;
|
||||
top: -3px;
|
||||
}
|
||||
.px-video-time {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.px-video-captions {
|
||||
padding: 8px;
|
||||
min-height: 36px;
|
||||
}
|
||||
}
|
||||
|
||||
/*.media {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
|
||||
video {
|
||||
width: 100%;
|
||||
|
||||
&::-webkit-media-controls {
|
||||
display:none !important;
|
||||
}
|
||||
}
|
||||
&.stopped,
|
||||
&.paused {
|
||||
.overlay-play {
|
||||
display: block;
|
||||
}
|
||||
.media-controls {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
.media-controls {
|
||||
height: 50px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 2;
|
||||
|
||||
.translate3d(0, 100%, 0);
|
||||
.transition-transform(.5s);
|
||||
|
||||
background-color: @base-color;
|
||||
color: #fff;
|
||||
.font-size(15);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-weight: 600;
|
||||
.user-select(none);
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
padding: 8px 15px;
|
||||
margin: 0;
|
||||
|
||||
-webkit-appearance: none;
|
||||
background: none;
|
||||
border: none;
|
||||
color: #fff;
|
||||
.font-size(24);
|
||||
|
||||
.transition();
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
text-shadow: 0 0 15px @green;
|
||||
}
|
||||
}
|
||||
|
||||
.progress {
|
||||
position: relative;
|
||||
.border-radius(10px);
|
||||
height: 10px;
|
||||
background: lighten(@base-color, 10%);
|
||||
|
||||
div {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
.border-radius(10px);
|
||||
height: 10px;
|
||||
min-width: 10px; // So it doesn't look strange at 0%
|
||||
|
||||
&.progress-played,
|
||||
&.progress-volume {
|
||||
background: @green;
|
||||
z-index: 2;
|
||||
}
|
||||
&.progress-buffered {
|
||||
background: lighten(@base-color, 20%);
|
||||
}
|
||||
}
|
||||
&.vertical-progress {
|
||||
margin: 0 auto;
|
||||
width: 10px;
|
||||
height: auto;
|
||||
min-height: 100px;
|
||||
|
||||
div {
|
||||
bottom: 0;
|
||||
width: 10px;
|
||||
height: auto;
|
||||
min-height: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popover {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 100%;
|
||||
margin-bottom: 10px;
|
||||
|
||||
background: @base-color;
|
||||
.border-radius(4px);
|
||||
|
||||
-webkit-animation: pop-upwards 160ms forwards linear;
|
||||
-moz-animation: pop-upwards 160ms forwards linear;
|
||||
-ms-animation: pop-upwards 160ms forwards linear;
|
||||
-o-animation: pop-upwards 160ms forwards linear;
|
||||
animation: pop-upwards 160ms forwards linear;
|
||||
|
||||
.transition();
|
||||
|
||||
// Psuedo bits
|
||||
&::before {
|
||||
position: absolute;
|
||||
bottom: -7px;
|
||||
left: 50%;
|
||||
margin-left: -7px;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-right: 7px solid transparent;
|
||||
border-top: 7px solid @base-color;
|
||||
border-left: 7px solid transparent;
|
||||
content: '';
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
.has-popover:focus,
|
||||
.has-popover:hover {
|
||||
.popover {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.popover-volume {
|
||||
width: 54px;
|
||||
padding: 15px 5px 8px;
|
||||
margin-left: -27px;
|
||||
|
||||
text-align: center;
|
||||
|
||||
.progress {
|
||||
height: 120px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
// Layout
|
||||
.play,
|
||||
.progress-play,
|
||||
.volume,
|
||||
.time,
|
||||
.fullscreen {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
}
|
||||
.play {
|
||||
left: 10px;
|
||||
}
|
||||
.progress-play {
|
||||
left: 70px;
|
||||
right: 240px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.time {
|
||||
right: 120px;
|
||||
width: 100px;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
padding-top: 17px;
|
||||
}
|
||||
.volume {
|
||||
right: 60px;
|
||||
}
|
||||
.fullscreen {
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
@media only screen
|
||||
and (max-width: 480px) {
|
||||
.time-seperator,
|
||||
.time-total {
|
||||
display: none;
|
||||
}
|
||||
.time {
|
||||
width: 50px;
|
||||
right: 70px;
|
||||
}
|
||||
.fullscreen {
|
||||
display: none;
|
||||
}
|
||||
.volume {
|
||||
right: 10px;
|
||||
}
|
||||
.progress-play {
|
||||
right: 140px;
|
||||
}
|
||||
}
|
||||
@media only screen
|
||||
and (max-width: 320px) {
|
||||
.time {
|
||||
display: none;
|
||||
}
|
||||
.progress-play {
|
||||
right: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.media-pause .mejs-overlay-play {
|
||||
background: rgba(0,0,0, .1);
|
||||
}
|
||||
.overlay {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background: rgba(0,0,0, .1);
|
||||
}
|
||||
.overlay-play > span {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
line-height: 1.5;
|
||||
margin: -34px 0 0 -34px !important;
|
||||
text-align: center;
|
||||
background: rgba(red(@base-color), green(@base-color), blue(@base-color), .8);
|
||||
border: 4px solid #fff;
|
||||
color: #fff;
|
||||
.border-radius(50%);
|
||||
@shadow: 0 1px 5px rgba(0,0,0, .25), inset 0 1px 1px rgba(0,0,0,.25);
|
||||
.box-shadow(@shadow);
|
||||
.font-size(34);
|
||||
}*/
|
51
assets/templates/controls.html
Normal file
@ -0,0 +1,51 @@
|
||||
<div class="controls">
|
||||
<progress class="px-video-progress" max="100" value="0"><span>0</span>% played</progress>
|
||||
|
||||
<div class="play-controls">
|
||||
<button class="px-video-restart" data-player="restart">
|
||||
<svg><use xlink:href="#icon-refresh"></use></svg>
|
||||
<span class="sr-only">Restart</span>
|
||||
</button>
|
||||
<button class="px-video-rewind" data-player="rewind">
|
||||
<svg><use xlink:href="#icon-rewind"></use></svg>
|
||||
<span class="sr-only">Rewind <span class="px-seconds">10</span> seconds</span>
|
||||
</button>
|
||||
<button class="px-video-play" aria-label="{aria-label}" data-player="play">
|
||||
<svg><use xlink:href="#icon-play"></use></svg>
|
||||
<span class="sr-only">Play</span>
|
||||
</button>
|
||||
<button class="px-video-pause hide" data-player="pause">
|
||||
<svg><use xlink:href="#icon-pause"></use></svg>
|
||||
<span class="sr-only">Pause</span>
|
||||
</button>
|
||||
<button class="px-video-forward" data-player="fast-forward">
|
||||
<svg><use xlink:href="#icon-fast-forward"></use></svg>
|
||||
<span class="sr-only">Fast forward <span class="px-seconds">10</span> seconds</span>
|
||||
</button>
|
||||
<div class="px-video-time">
|
||||
<span class="sr-only">Time</span>
|
||||
<span class="px-video-duration">00:00</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sound-controls">
|
||||
<!--<div class="px-video-mute-btn-container">-->
|
||||
<input class="px-video-mute sr-only" id="btnMute{id}" type="checkbox">
|
||||
<label id="labelMute{id}" for="btnMute{id}">
|
||||
<svg><use xlink:href="#icon-sound"></use></svg>
|
||||
<span class="sr-only">Mute</span>
|
||||
</label>
|
||||
<!--</div>-->
|
||||
|
||||
<label for="volume{id}" class="sr-only">Volume:</label>
|
||||
<input id="volume{id}" class="px-video-volume" type="range" min="0" max="10" value="5">
|
||||
|
||||
<!--<div class="px-video-captions-btn-container hide">-->
|
||||
<input class="px-video-btnCaptions sr-only" id="btnCaptions{id}" type="checkbox">
|
||||
<label for="btnCaptions{id}">
|
||||
<svg><use xlink:href="#icon-film"></use></svg>
|
||||
<span class="sr-only">Captions</span>
|
||||
</label>
|
||||
<!--</div>-->
|
||||
</div>
|
||||
</div>
|