Sha256: 8836da15276f574ce27b156d6e870497117afdc2c50681cb0a59f655cf351682
Contents?: true
Size: 1.82 KB
Versions: 7
Compression:
Stored size: 1.82 KB
Contents
$(function() { $(".lady-josephine-block--video .vimeo-block").each(function(i, element) { var vimeoUrl = $(element).attr("data-vimeo-url"); var videoId = $(element).attr("data-video-id"); var srcset = $(element).attr("srcset"); var srcset = $(element).attr("sizes"); var buttonHtml = "<div class='dummy-media__message remove-me'></div>" + '<div class="remove-me"><button class="btn--icon dummy-media__play"><span aria-hidden="true" class="icon--play"></span><span class="visuallyhidden">Play Video</span></button></div>' + "<div id='" + videoId + "'/>"; function getVideoImage(id) { return $.getJSON({ url: "//vimeo.com/api/v2/video/" + id + ".json", data: { format: 'js' }, success: function(data) { var image = data[0]; $(element).append("<img class='dummy-media__thumb' src='" + image.thumbnail_large + "' srcset='" + image.thumbnail_large + " 640w, " + image.thumbnail_medium + " 480w, " + image.thumbnail_large + " 320w' sizes='(max-width:1000px) 50vw, 680px' />" + buttonHtml); } }); }; if (srcset !== null && srcset !== undefined) { element.append("<img class='dummy-media__thumb' src='" + srcset.split(', ')[0].split(' ')[0] + "' srcset='" + srcset + "' sizes='" + sizes + "' />" + buttonHtml) } else { getVideoImage(videoId) } $(element).on('click', function(event) { var oembedUrl = '//vimeo.com/api/oembed.json'; var params = { url: vimeoUrl, maxwidth: 500, autoplay: 1 }; $.getJSON({ url: oembedUrl, data: params, success: function(data) { $(element).html( data.html ); }, dataType: "jsonp" }); }); }); });
Version data entries
7 entries across 7 versions & 1 rubygems