1/** 2 * Responsive Embeds 3 */ 4 5// Use FitVids.js for responsive videos and other embeds 6// Note: Rdio and Spotify are correct when loading at final size ( browser resize is bad demo ) 7ctfw_embed_fitvids_selectors = [ 8 9 // Default (from fitVids.js) 10 // We redefine these here so they can be hidden prior to FitVids.js 11 "iframe[src*='player.vimeo.com']", 12 "iframe[src*='youtube.com']", 13 "iframe[src*='youtube-nocookie.com']", 14 "iframe[src*='kickstarter.com'][src*='video.html']", 15 "object", 16 "embed", 17 18 // Custom 19 "iframe[src*='youtu.be']", 20 "iframe[src*='blip.tv']", 21 "iframe[src*='hulu.com']", 22 "iframe[src*='dailymotion.com']", 23 "iframe[src*='revision3.com']", 24 "iframe[src*='slideshare.net']", 25 "iframe[src*='scribed.com']", 26 "iframe[src*='viddler.com']", 27 "iframe[src*='rd.io']", 28 "iframe[src*='rdio.com']", 29 //"iframe[src*='spotify.com']", // has issues, not needed (see https://dev.churchthemes.local/exodus/sermons/tes/) 30 "iframe[src*='soundcloud.com']:not([width$='%'])", // Jetpack soundcloud shortcode is already responsive with %, so exclude 31 "iframe[src*='snd.sc']", 32 "iframe[src*='livestream.com']", 33 "iframe[src*='soundfaith.com']", 34 "iframe[src*='ustream.tv']", 35 "iframe[src*='sermon.net']:not([src*='/main']):not([src*='.sermon.net/embed'])", 36 "iframe[src*='read.amazon.com']", 37 38]; 39ctfw_embed_fitvids_selectors_list = ctfw_embed_fitvids_selectors.join(', '); 40 41// Other embedded media only need max-width: 100% ( height is static ) - MediaElement.js 42// Important: when done via stylesheet, MediaElement.js volume control flickers 43ctfw_embed_other_selectors_list = '.wp-video-shortcode, .wp-audio-shortcode'; 44 45// Hide videos before resizing 46// This keeps them from showing briefly at small size before showing at full width 47ctfw_embed_all_selectors_list = ctfw_embed_fitvids_selectors_list + ', ' + ctfw_embed_other_selectors_list; 48jQuery('head').prepend('<style type="text/css" id="ctfw-hide-responsive-embeds">' + ctfw_embed_all_selectors_list + ' { visibility: hidden; }</style>' + "\n"); 49 50// Resize videos to 100% width 51jQuery(document).ready(function ($) { 52 53 // Ignore those already being made responsive with WordPress. 54 if (ctfw_responsive_embeds.wp_responsive_embeds) { 55 56 // Loop selectors 57 jQuery.each(ctfw_embed_fitvids_selectors, function (i, selector) { 58 59 // Ignore FitVids if WP already making responsive. 60 if (jQuery(selector).parents('.wp-has-aspect-ratio').length) { 61 62 // Loop each element matching selector. 63 jQuery.each(jQuery(selector), function (i, element) { 64 65 // Not sermon media element (problem when also have media in content). 66 if (jQuery(element).parents('[id$=-sermon-video-player]').length) { 67 return; 68 } 69 70 jQuery(element).addClass('fitvidsignore'); 71 72 }); 73 74 } 75 76 }); 77 78 } 79 80 // Remove <object> element from Blip.tv (use iframe only) - creates a gap w/FitVid 81 $("embed[src*='blip.tv']").remove(); 82 83 // FitVids.js for most embeds 84 $('body').fitVids({ 85 customSelector: ctfw_embed_fitvids_selectors, 86 }); 87 88 // Other embeds (MediaElement.js) 89 $(ctfw_embed_other_selectors_list).css('max-width', '100%'); 90 91 // Show embeds after resize 92 $('#ctfw-hide-responsive-embeds').remove(); 93 94 95});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.