aboutsummaryrefslogtreecommitdiffstats
path: root/demo/src
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2017-10-26 00:10:56 +1100
committerSam Potts <me@sampotts.me>2017-10-26 00:10:56 +1100
commit959b5a20e39c2ba4a05c6e417c02184ca24804cd (patch)
tree28b2cb298fae25e58ecc6e6d88d8f951931ee92d /demo/src
parent9de5c0cf39f12a4e2e62b62cb68b71159b3c77ac (diff)
downloadplyr-959b5a20e39c2ba4a05c6e417c02184ca24804cd.tar.lz
plyr-959b5a20e39c2ba4a05c6e417c02184ca24804cd.tar.xz
plyr-959b5a20e39c2ba4a05c6e417c02184ca24804cd.zip
Inlined SVGs, fixed build
Diffstat (limited to 'demo/src')
-rw-r--r--demo/src/js/lib/sprite.js89
-rw-r--r--demo/src/js/main.js3
-rw-r--r--demo/src/less/layout/core.less12
-rw-r--r--demo/src/less/settings/icons.less2
-rwxr-xr-xdemo/src/sprite/icon-github.svg12
-rwxr-xr-xdemo/src/sprite/icon-twitter.svg11
-rwxr-xr-xdemo/src/sprite/icon-vimeo.svg9
-rwxr-xr-xdemo/src/sprite/icon-youtube.svg9
8 files changed, 13 insertions, 134 deletions
diff --git a/demo/src/js/lib/sprite.js b/demo/src/js/lib/sprite.js
deleted file mode 100644
index bcd8a0b7..00000000
--- a/demo/src/js/lib/sprite.js
+++ /dev/null
@@ -1,89 +0,0 @@
-// ==========================================================================
-// SVG sprite loading and caching
-// This file should be at the top of the body to avoid a flash
-// Usage: loadSprite('https://cdn.com/path/to/sprite.svg', 'sprite-id');
-// The second argument is optional but prevents loading twice
-// ==========================================================================
-
-(function() {
- window.loadSprite = function(url, id) {
- if (typeof url !== "string") {
- return;
- }
-
- var body = document.body;
- var prefix = "cache-";
- var hasId = typeof id === "string";
- var isCached = false;
-
- // Check for *actual* storage support
- var cacheSupported = (function() {
- if (!hasId) {
- return false;
- }
- var test = '___test';
- try {
- localStorage.setItem(test, test);
- localStorage.removeItem(test);
- return true;
- } catch (e) {
- return false;
- }
- })();
-
- function updateSprite(container, data) {
- // Inject content
- container.innerHTML = data;
-
- // Inject the SVG to the body
- body.insertBefore(container, body.childNodes[0]);
- }
-
- // Only load once
- if (!hasId || document.querySelectorAll("#" + id).length === 0) {
- // Create container
- var container = document.createElement("div");
- container.setAttribute("hidden", "");
-
- if (hasId) {
- container.setAttribute("id", id);
- }
-
- // Check in cache
- if (cacheSupported) {
- var cached = localStorage.getItem(prefix + id);
- isCached = cached !== null;
-
- if (isCached) {
- var data = JSON.parse(cached);
- updateSprite(container, data.content);
- }
- }
-
- // ReSharper disable once InconsistentNaming
- var xhr = new XMLHttpRequest();
-
- // XHR for Chrome/Firefox/Opera/Safari
- if ("withCredentials" in xhr) {
- xhr.open("GET", url, true);
- }
- // Not supported
- else {
- return;
- }
-
- // Once loaded, inject to container and body
- xhr.onload = function() {
- if (cacheSupported) {
- localStorage.setItem(prefix + id, JSON.stringify({
- content: xhr.responseText
- }));
- }
-
- updateSprite(container, xhr.responseText);
- };
-
- xhr.send();
- }
- }
-})();
diff --git a/demo/src/js/main.js b/demo/src/js/main.js
index 16c31f1c..981f691a 100644
--- a/demo/src/js/main.js
+++ b/demo/src/js/main.js
@@ -48,9 +48,6 @@
// Expose for testing
window.player = player;
- // Load demo sprite
- window.loadSprite('dist/demo.svg', 'demo-sprite');
-
// Setup type toggle
var buttons = document.querySelectorAll('[data-source]');
var types = {
diff --git a/demo/src/less/layout/core.less b/demo/src/less/layout/core.less
index aca66952..3d3b15d2 100644
--- a/demo/src/less/layout/core.less
+++ b/demo/src/less/layout/core.less
@@ -27,6 +27,9 @@ main {
}
aside {
+ display: flex;
+ align-items: center;
+ justify-content: center;
width: 100%;
padding: (@spacing-base * 0.75);
background: #fff;
@@ -34,6 +37,15 @@ aside {
color: @gray;
text-shadow: none;
+ .icon {
+ margin-right: (@spacing-base / 2);
+ fill: @color-twitter;
+ }
+
+ p {
+ margin: 0;
+ }
+
a {
color: @color-twitter;
diff --git a/demo/src/less/settings/icons.less b/demo/src/less/settings/icons.less
index d0b09b0b..546607c7 100644
--- a/demo/src/less/settings/icons.less
+++ b/demo/src/less/settings/icons.less
@@ -2,4 +2,4 @@
// Icons
// ==========================================================================
-@icon-size: 18px;
+@icon-size: 16px;
diff --git a/demo/src/sprite/icon-github.svg b/demo/src/sprite/icon-github.svg
deleted file mode 100755
index 685dd746..00000000
--- a/demo/src/sprite/icon-github.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
-<path fill-rule="evenodd" clip-rule="evenodd" d="M8,0.2c-4.4,0-8,3.6-8,8c0,3.5,2.3,6.5,5.5,7.6
- C5.9,15.9,6,15.6,6,15.4c0-0.2,0-0.7,0-1.4C3.8,14.5,3.3,13,3.3,13c-0.4-0.9-0.9-1.2-0.9-1.2c-0.7-0.5,0.1-0.5,0.1-0.5
- c0.8,0.1,1.2,0.8,1.2,0.8C4.4,13.4,5.6,13,6,12.8c0.1-0.5,0.3-0.9,0.5-1.1c-1.8-0.2-3.6-0.9-3.6-4c0-0.9,0.3-1.6,0.8-2.1
- c-0.1-0.2-0.4-1,0.1-2.1c0,0,0.7-0.2,2.2,0.8c0.6-0.2,1.3-0.3,2-0.3c0.7,0,1.4,0.1,2,0.3c1.5-1,2.2-0.8,2.2-0.8
- c0.4,1.1,0.2,1.9,0.1,2.1c0.5,0.6,0.8,1.3,0.8,2.1c0,3.1-1.9,3.7-3.7,3.9C9.7,12,10,12.5,10,13.2c0,1.1,0,1.9,0,2.2
- c0,0.2,0.1,0.5,0.6,0.4c3.2-1.1,5.5-4.1,5.5-7.6C16,3.8,12.4,0.2,8,0.2z"/>
-</svg>
diff --git a/demo/src/sprite/icon-twitter.svg b/demo/src/sprite/icon-twitter.svg
deleted file mode 100755
index b3f644b1..00000000
--- a/demo/src/sprite/icon-twitter.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
- <title>Twitter</title>
-<path d="M16,3c-0.6,0.3-1.2,0.4-1.9,0.5c0.7-0.4,1.2-1,1.4-1.8c-0.6,0.4-1.3,0.6-2.1,0.8c-0.6-0.6-1.5-1-2.4-1
- C9.3,1.5,7.8,3,7.8,4.8c0,0.3,0,0.5,0.1,0.7C5.2,5.4,2.7,4.1,1.1,2.1c-0.3,0.5-0.4,1-0.4,1.7c0,1.1,0.6,2.1,1.5,2.7
- c-0.5,0-1-0.2-1.5-0.4c0,0,0,0,0,0c0,1.6,1.1,2.9,2.6,3.2C3,9.4,2.7,9.4,2.4,9.4c-0.2,0-0.4,0-0.6-0.1c0.4,1.3,1.6,2.3,3.1,2.3
- c-1.1,0.9-2.5,1.4-4.1,1.4c-0.3,0-0.5,0-0.8,0c1.5,0.9,3.2,1.5,5,1.5c6,0,9.3-5,9.3-9.3c0-0.1,0-0.3,0-0.4C15,4.3,15.6,3.7,16,3z"/>
-</svg>
diff --git a/demo/src/sprite/icon-vimeo.svg b/demo/src/sprite/icon-vimeo.svg
deleted file mode 100755
index 83dd3dc0..00000000
--- a/demo/src/sprite/icon-vimeo.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
-<path d="M16,4.3c-0.1,1.6-1.2,3.7-3.3,6.4c-2.2,2.8-4,4.2-5.5,4.2c-0.9,0-1.7-0.9-2.4-2.6C4,9.9,3.4,5,2,5
- C1.9,5,1.5,5.3,0.8,5.8L0,4.8c0.8-0.7,3.5-3.4,4.7-3.5C5.9,1.2,6.7,2,7,3.8c0.3,2,0.8,6.1,1.8,6.1c0.9,0,2.5-3.4,2.6-4
- c0.1-0.9-0.3-1.9-2.3-1.1c0.8-2.6,2.3-3.8,4.5-3.8C15.3,1.1,16.1,2.2,16,4.3z"/>
-</svg>
diff --git a/demo/src/sprite/icon-youtube.svg b/demo/src/sprite/icon-youtube.svg
deleted file mode 100755
index 8b5d6897..00000000
--- a/demo/src/sprite/icon-youtube.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
-<path d="M15.8,4.8c-0.2-1.3-0.8-2.2-2.2-2.4C11.4,2,8,2,8,2S4.6,2,2.4,2.4C1,2.6,0.3,3.5,0.2,4.8C0,6.1,0,8,0,8
- s0,1.9,0.2,3.2c0.2,1.3,0.8,2.2,2.2,2.4C4.6,14,8,14,8,14s3.4,0,5.6-0.4c1.4-0.3,2-1.1,2.2-2.4C16,9.9,16,8,16,8S16,6.1,15.8,4.8z
- M6,11V5l5,3L6,11z"/>
-</svg>