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).
This commit is contained in:
Daniel 2018-07-18 21:02:59 +00:00 committed by Jeremy Thomas
parent ae662fefc0
commit 69745cfda5

View File

@ -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!';