PageSourceSearch

https://lajmi.net/wp-content/plugins/youtube-embed-plus/scripts/fitvids.js?ver=14.0.1.1

js lajmi.net collected 2026-10-02 06:48:04 UTC 6,929 bytes, 181 lines download raw bytes

1var epdofitvids = epdofitvids || function ($)
2{
3
4    $.fn.fitVidsEP = function (options)
5    {
6        if (_EPYT_.epresponsiveselector.constructor !== Array)
7        {
8            _EPYT_.epresponsiveselector = JSON.parse(_EPYT_.epresponsiveselector);
9        }
10        var settings = {
11            customSelector: null
12        };
13
14        if (!document.getElementById('fit-vids-style'))
15        {
16
17            var div = document.createElement('div'),
18                    ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0],
19                    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>';
20
21            div.className = 'fit-vids-style';
22            div.id = 'fit-vids-style';
23            div.style.display = 'none';
24            div.innerHTML = cssStyles;
25
26            ref.parentNode.insertBefore(div, ref);
27
28        }
29
30        if (options)
31        {
32            $.extend(settings, options);
33        }
34
35        return this.each(function ()
36        {
37//            var selectors = [
38//            "iframe[src*='youtube.com']",
39//            "iframe[src*='youtube-nocookie.com']"
40//            ];
41            var selectors = _EPYT_.epresponsiveselector;
42
43            if (settings.customSelector)
44            {
45                selectors.push(settings.customSelector);
46            }
47
48            var $allVideos = $(this).find(selectors.join(','));
49            $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
50
51            $allVideos.each(function ()
52            {
53                var $this = $(this);
54                if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length
55                        || $this.parent('.fluid-width-video-wrapper').length
56                        || $this.css('position') === 'absolute'
57                        )
58                {
59                    return;
60                }
61                if ($this.is('[data-origwidth]:not([width])'))
62                {
63                    $this.attr('width', $this.data('origwidth'));
64                }
65                if ($this.is('[data-origheight]:not([height])'))
66                {
67                    $this.attr('height', $this.data('origheight'));
68                }
69                var height = (this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10)))) ? parseInt($this.attr('height'), 10) : $this.height(),
70                        width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
71                        aspectRatio = height / width;
72                if (!$this.attr('id'))
73                {
74                    var videoID = 'fitvid' + Math.floor(Math.random() * 999999);
75                    $this.attr('id', videoID);
76                }
77
78                var attrWidth = $this.attr('width');
79                var attrHeight = $this.attr('height');
80                if ($this.parent().hasClass('epyt-video-wrapper'))
81                {
82                    try
83                    {
84                        $this.parent().addClass('fluid-width-video-wrapper').attr('style', 'padding-top: ' + (aspectRatio * 100) + "% !important;");
85                        $this.removeAttr('height').removeAttr('width');
86
87                        setTimeout(function ()
88                        {
89                            var resizeEvent = null;
90                            if (typeof (Event) === 'function')
91                            {
92                                resizeEvent = new Event('resize');
93                            }
94                            else
95                            {
96                                resizeEvent = document.createEvent('Event');
97                                resizeEvent.initEvent('resize', true, true);
98                            }
99                            window.dispatchEvent(resizeEvent);
100                        }, 10);
101
102                        setTimeout(function ()
103                        {
104                            if (parseInt($this.parent().css('padding-top'), 10) > $this.height() + 20)
105                            {
106                                $this.parent().removeClass('fluid-width-video-wrapper').css('padding-top', '');
107                                $this.attr('width', attrWidth);
108                                $this.attr('height', attrHeight);
109                            }
110                        }, 100);
111                    }
112                    catch (wraperr)
113                    {
114                    }
115                }
116                else
117                {
118                    var fwvwrap = document.createElement('div');
119                    fwvwrap.className = 'fluid-width-video-wrapper';
120                    try
121                    {
122                        $this.wrap(fwvwrap).parent('.fluid-width-video-wrapper').attr('style', 'padding-top: ' + (aspectRatio * 100) + "% !important;");
123                        $this.removeAttr('height').removeAttr('width');
124
125                        setTimeout(function ()
126                        {
127                            var resizeEvent = null;
128                            if (typeof (Event) === 'function')
129                            {
130                                resizeEvent = new Event('resize');
131                            }
132                            else
133                            {
134                                resizeEvent = document.createEvent('Event');
135                                resizeEvent.initEvent('resize', true, true);
136                            }
137                            window.dispatchEvent(resizeEvent);
138                        }, 10);
139
140                        setTimeout(function ()
141                        {
142                            if (parseInt($this.parent().css('padding-top'), 10) > $this.height() + 20)
143                            {
144                                $this.parent().removeClass('fluid-width-video-wrapper').css('padding-top', '');
145                                $this.attr('width', attrWidth);
146                                $this.attr('height', attrHeight);
147                            }
148                        }, 100);
149                    }
150                    catch (wraperr)
151                    {
152                    }
153                }
154            });
155        });
156    };
157
158    $(document).ready(function ()
159    {
160        $("body").fitVidsEP();
161
162        $(document).ajaxSuccess(function (e, xhr, settings)
163        {
164            if (xhr && xhr.responseText && xhr.responseText.indexOf('<iframe ') !== -1)
165            {
166                $("body").fitVidsEP();
167            }
168        });
169    });
170    return true;
171};
172
173try
174{
175    epdofitvids(window.jQuery);
176}
177catch (err)
178{
179}
180
181

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.