PageSourceSearch

https://randomharvest.co.za/DesktopModules/GabbiSlider/Js/owl-tube.min.js?cdv=617

js randomharvest.co.za collected 2026-10-02 10:59:37 UTC 5,140 bytes, 181 lines download raw bytes

1(function ( $ ) {
2    'use strict';
3    var player_api_url  = "//www.youtube.com/player_api/";
4    var apiLoaded       = false;
5    var players         = [];
6
7    var ID = function () {
8        return "YTC_" + Math.random().toString(36).substr(2, 9);
9    };
10
11    function parseUrl(url){
12        var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
13        var match = url.match(regExp);
14        return (match&&match[7].length==11)? match[7] : false;
15    }
16
17    $(document).ready(function(){
18        $.getScript(player_api_url).done(function(){
19            apiLoaded = true;
20        }).fail(function(jqxhr, settings, exception){
21            alert(exception);
22        });
23    });
24    
25    function init(){
26        apiLoaded = true;
27        if(players.length === 0) return true;
28        $(players).each(function(){
29            this.init.call();
30        });
31    }
32
33    window.onYouTubePlayerAPIReady = init;
34
35
36
37    var owlTube = function(el,options){
38        
39        var initialized         = false;
40        var activeElementIndex  = 0;
41        var carouselIframes     = [];
42        var $el = $(el);
43        
44
45        $el.on('changed.owl.carousel',function(event){
46            var item      = event.item.index;     // Position of the current item
47            carouselIframes[activeElementIndex].stopVideo();
48            carouselIframes[item].playVideo();
49            activeElementIndex = item;
50        });
51        
52        $el.bind('changed',function(){
53            console.info('YTPL changed');
54        });
55
56        function __createObject(index,iframe){
57            var $this = $(iframe);
58            var id = $this.attr('id') || false;
59            if(!id){
60                id = ID();
61                $this.attr('id',id);
62            }
63            $this.data('index',index);
64            
65            var p = new YT.Player(id, {
66                autoplay:false,
67                events: {
68                    'onReady': __onPlayerReady,
69                    'onStateChange': __onPlayerStateChange
70                }
71            });
72
73            carouselIframes.push(p);
74        }
75
76        function __initPlayer(){
77            initialized = true;
78            $el.find('iframe').each(__createObject);
79        }
80        
81        // autoplay video
82        function __onPlayerReady(event) {
83            //event.target.playVideo();
84        }
85
86        function __onPlayerStateChange(event) {        
87            if(event.data===0){
88                $el.trigger("next.owl.carousel");
89            }
90      
91        }
92
93
94       
95
96        return {
97            
98            stopAll:function(){    
99                $(carouselIframes).each(function(index){
100                    carouselIframes[index].stopVideo();
101                });
102            },
103            init:function(){
104                if(initialized) return this;
105                __initPlayer();
106            },
107            loadVideoById:function(videoId,options){
108                options = $.extend({},{
109                    'videoId'           : videoId || bHQqvYy5KYo,
110                    'suggestedQuality'  : 'large'
111                },options);
112                p.loadVideoById(options);
113                return this;
114            },
115            loadPlaylist:function(pl,options){
116                options = $.extend({},{
117                    playlist            :pl.join(','),
118                    listType            :'playlist',
119                    'suggestedQuality'  : 'large',
120                    events: {
121                        'onReady'       : __onPlayerReady,
122                        'onStateChange' : __onPlayerStateChange
123                    }
124                },options);
125                
126                p.loadPlaylist(options);
127                return this;
128            },
129            loadVideoByUrl:function(url,options){
130                options = $.extend({},{
131                    'mediaContentUrl'   : url,
132                    'suggestedQuality'  : 'large'
133                },options);
134
135                p.loadVideoByUrl(options)
136            },
137            enqueueVideoId:function(videoId){
138                playlist.push(videoId);  
139            },
140            on:function(ev,callback,data){
141                $el.bind(ev,callback,data);
142                return this;
143            },
144            destroy:function(){},
145        }
146    }
147
148    
149    $.fn.owlTube = function(options) {
150        
151        return $(this).each(function(){
152            var $this   = $(this);
153            var data    = $this.data('owlTube');
154            if(data) return data;
155            options = $.extend({},$.fn.owlTube.options,options);
156            var youtubeController = new owlTube(this,options);
157            $this.data('owlTube',youtubeController);
158
159            try {
160                YT.Player;
161            } catch (error) {
162                players.push(youtubeController);
163            }
164            return youtubeController;
165        });
166
167    };
168
169    $.fn.owlTube.options = {
170        width:640,
171        height:340,
172        autoplay:1,
173        loop:1, 
174        controls: 1,
175        iv_load_policy:3,
176        modestbranding:1,
177        rel:0,
178        showinfo:0
179    };
180
181}( 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.