PageSourceSearch

https://luukgruwez.be/style/js/jquery.fitvids.js

js luukgruwez.be collected 2026-10-02 14:12:16 UTC 2,194 bytes, 60 lines download raw bytes

1/*global jQuery */
2/*! 
3* FitVids 1.0
4*
5* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
6* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
7* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
8*
9* Date: Thu Sept 01 18:00:00 2011 -0500
10*/
11
12(function( $ ){
13
14  $.fn.fitVids = function() {
15    var div = document.createElement('div'),
16        ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
17        
18  	div.className = 'fit-vids-style';
19    div.innerHTML = '&shy;<style>         \
20      .fluid-width-video-wrapper {        \
21         width: 100%;                     \
22         position: relative;              \
23         padding: 0;                      \
24      }                                   \
25                                          \
26      .fluid-width-video-wrapper iframe,  \
27      .fluid-width-video-wrapper object,  \
28      .fluid-width-video-wrapper embed {  \
29         position: absolute;              \
30         top: 0;                          \
31         left: 0;                         \
32         width: 100%;                     \
33         height: 100%;                    \
34      }                                   \
35    </style>';
36                      
37    ref.parentNode.insertBefore(div,ref);
38  
39    return this.each(function(){
40      var selectors = [
41        "iframe[src^='http://player.vimeo.com']", 
42        "iframe[src^='http://www.youtube.com']", 
43        "iframe[src^='http://www.kickstarter.com']", 
44        "object", 
45        "embed"
46      ];
47
48      var $allVideos = $(this).find(selectors.join(','));
49      
50      $allVideos.each(function(){
51        var $this = $(this), 
52            height = this.tagName == 'OBJECT' ? $this.attr('height') : $this.height(),
53            aspectRatio = height / $this.width();
54        $this.wrap('<div class="fluid-width-video-wrapper" />').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
55        $this.removeAttr('height').removeAttr('width');
56      });
57    });
58  
59  }
60})( jQuery );

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.