From 69745cfda542dd716404c5b0aeb7fd0b2b8087e1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 18 Jul 2018 21:02:59 +0000 Subject: [PATCH] Fixed docs when Vimeo fails to load All javascript breaks if Vimeo fails to load or is blocked. Checking for `Vimeo` before accessing it should fix it. This can easily be reproduced using [uMatrix](https://github.com/gorhill/uMatrix). --- docs/_javascript/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/_javascript/index.js b/docs/_javascript/index.js index 08753358..a7678c1e 100644 --- a/docs/_javascript/index.js +++ b/docs/_javascript/index.js @@ -4,12 +4,14 @@ document.addEventListener('DOMContentLoaded', () => { const introVideo = document.getElementById('introVideo'); const introIframe = document.getElementById('introIframe'); - const introPlayer = new Vimeo.Player(introIframe); const npmClipboard = new Clipboard('#npmCopy'); - introPlayer.ready().then(function() { - introVideo.classList.add('has-loaded'); - }); + if (Vimeo) { + const introPlayer = new Vimeo.Player(introIframe); + introPlayer.ready().then(function() { + introVideo.classList.add('has-loaded'); + }); + } npmClipboard.on('success', function(e) { e.trigger.innerText = 'copied!';