]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Fixed docs when Vimeo fails to load
authorDaniel <lightswitch05@users.noreply.github.com>
Wed, 18 Jul 2018 21:02:59 +0000 (21:02 +0000)
committerJeremy Thomas <bbxdesign@gmail.com>
Wed, 18 Jul 2018 21:08:23 +0000 (22:08 +0100)
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

index 08753358af60347f749561bb2b1f0f5dbb84484a..a7678c1e30d2d53be05cc35e21a374a56b929af1 100644 (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!';