PageSourceSearch

https://nwtgroup.com/wp-content/themes/lavan/js/jquery.fitvids.js

js nwtgroup.com collected 2026-09-26 15:25:09 UTC 2,762 bytes, 73 lines download raw bytes

vendor: 2,762 bytes, lines 1-73
1/*jshint multistr:true browser:true */
2/*!
3* FitVids 1.0.3
4*
5* Copyright 2013, 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  "use strict";
15
16  $.fn.fitVids = function( options ) {
17    var settings = {
18      customSelector: null
19    };
20
21    if(!document.getElementById('fit-vids-style')) {
22
23      var div = document.createElement('div'),
24          ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0],
25          cssStyles = '&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>';
26
27      div.className = 'fit-vids-style';
28      div.id = 'fit-vids-style';
29      div.style.display = 'none';
30      div.innerHTML = cssStyles;
31
32      ref.parentNode.insertBefore(div,ref);
33
34    }
35
36    if ( options ) {
37      $.extend( settings, options );
38    }
39
40    return this.each(function(){
41      var selectors = [
42        "iframe[src*='player.vimeo.com']",
43        "iframe[src*='youtube.com']",
44        "iframe[src*='youtube-nocookie.com']",
45        "iframe[src*='kickstarter.com'][src*='video.html']",
46        "object",
47        "embed"
48      ];
49
50      if (settings.customSelector) {
51        selectors.push(settings.customSelector);
52      }
53
54      var $allVideos = $(this).find(selectors.join(','));
55      $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
56
57      $allVideos.each(function(){
58        var $this = $(this);
59        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
60        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
61            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
62            aspectRatio = height / width;
63        if(!$this.attr('id')){
64          var videoID = 'fitvid' + Math.floor(Math.random()*999999);
65          $this.attr('id', videoID);
66        }
67        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
68        $this.removeAttr('height').removeAttr('width');
69      });
70    });
71  };
72// Works with either jQuery or Zepto
73})( window.jQuery || window.Zepto );

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.