PageSourceSearch

https://freedivenusa.com/wp-content/cache/wpo-minify/1790487685/as…ify-footer-fca_pc_video_js1778658616.min.js

js freedivenusa.com collected 2026-10-02 17:50:40 UTC 7,631 bytes, 147 lines download raw bytes

1
2if(typeof fcaPcOptions==='object'&&fcaPcOptions.video_enabled){class EventEmitter{constructor(){this.events={}}
3on(event,listener){if(typeof this.events[event]!=='object'){this.events[event]=[]}
4this.events[event].push(listener)
5return()=>this.removeListener(event,listener)}
6removeListener(event,listener){if(typeof this.events[event]==='object'){const idx=this.events[event].indexOf(listener)
7if(idx>-1){this.events[event].splice(idx,1)}}}
8emit(event,...args){if(typeof this.events[event]==='object'){this.events[event].forEach(listener=>listener.apply(this,args))}}
9once(event,listener){const remove=this.on(event,(...args)=>{remove()
10listener.apply(this,args)})}}
11class FCA_PC_Video extends EventEmitter{constructor(selector){super()
12this.video_ready=!1
13if(typeof selector===undefined){return}
14this.element=selector
15this.init()}
16init(){this.setup_events()
17this.type=this.video_type()
18this.load_api()}
19load_api(){switch(this.type){case 'YOUTUBE':this.api_youtube_load()
20break
21case 'WISTIA':this.api_wistia_load()
22break
23case 'VIMEO':this.api_vimeo_load()
24break}}
25setup_events(){this.on('api_youtube_loaded',this.api_youtube_setup)
26this.on('api_vimeo_loaded',this.api_vimeo_setup)
27this.on('api_wistia_loaded',this.api_wistia_setup)}
28video_type(){let src=this.element.attr('src')
29if(src===''){this.revoke('pixel cat video: video link not found.')
30return!1}
31if(src.indexOf('youtube.com')>-1)return'YOUTUBE'
32if(src.indexOf('vimeo.com')>-1)return'VIMEO'
33if(src.indexOf('fast.wistia.com')>-1)return'WISTIA'}
34revoke(message){if(fcaPcOptions.debug){console.log(message)
35console.log('pixel cat video: revoked ')}}
36api_vimeo_load(){jQuery.getScript('https://player.vimeo.com/api/player.js',()=>{this.emit('api_vimeo_loaded')})}
37api_vimeo_setup(){let player_dom=this.element[0]
38try{this.api=new Vimeo.Player(player_dom)
39this.api.ready().then(()=>{this.api_vimeo_ready()})}catch(e){if(fcaPcOptions.debug)
40console.log(e.message)
41return}}
42api_vimeo_ready(){if(fcaPcOptions.debug){console.log('Pixel Cat video: Vimeo video ready')}
43this.video_ready=!0
44this.api.getVideoId().then(id=>{this.video_id=id})
45this.api.getVideoTitle().then(title=>{this.title=title})
46this.api.getVideoUrl().then(url=>{this.url=url})
47this.api.getDuration().then(duration=>{this.duration=duration})
48this.events_triggered={}
49this.api_vimeo_state_change()}
50api_vimeo_state_change(){this.api.on('play',event=>{this.trigger_event('VideoPlay')
51this.timer=setInterval(this.track_progress.bind(this),1000)})
52this.api.on('pause',event=>{this.trigger_event('VideoPause',{percentage_watched:this.percentage_watched()+'%'})
53clearInterval(this.timer)})
54this.api.on('ended',event=>{this.trigger_event('VideoWatchToEnd')
55clearInterval(this.timer)})}
56api_wistia_load(){jQuery.getScript('//fast.wistia.net/assets/external/E-v1.js',()=>{this.emit('api_wistia_loaded')})}
57api_wistia_setup(){let player_dom=this.element
58let video_src=player_dom.attr('src')
59if(typeof video_src==='undefined'){return}
60const pattern=/(https:\/\/fast\.wistia\.com\/embed\/medias)\/(.*)\.jsonp/
61let match=video_src.match(pattern)
62if(match===null){if(fcaPcOptions.debug){console.log('no video id match')}
63return}
64this.url=match[1]
65let video_id=match[2]
66if(typeof video_id==='undefined'){if(fcaPcOptions.debug){console.log('pixel cat video: wistia video_id not found.')}
67return}
68window._wq=window._wq||[]
69this.api=window._wq
70this.api.push({id:video_id,onReady:this.api_wistia_ready.bind(this)})}
71api_wistia_ready(video){if(fcaPcOptions.debug){console.log('pixel cat video: wistia video ready.')}
72this.video_ready=!0
73this.api=video
74this.video_id=video.data.media.hashedId
75this.title=video.data.media.name!==undefined?video.data.media.name:'Untitled'
76this.url=this.url+'/'+this.video_id
77this.events_triggered={}
78this.api_wistia_state_change.bind(this)()}
79api_wistia_state_change(){this.api.bind('play',event=>{this.trigger_event('VideoPlay')})
80this.api.bind('pause',event=>{this.trigger_event('VideoPause',{percentage_watched:this.percentage_watched()+'%'})})
81this.api.bind('percentwatchedchanged',(percent,lastPercent)=>{this.track_progress()})
82this.api.bind('end',event=>{this.trigger_event('VideoWatchToEnd')})}
83api_youtube_load(){this.load_async_script('https://www.youtube.com/iframe_api')}
84api_youtube_setup(){let player_dom=this.element[0]
85this.api=new YT.Player(player_dom,{events:{'onReady':this.api_youtube_ready.bind(this),'onStateChange':this.api_youtube_state_change.bind(this)}})}
86api_youtube_ready(event){if(fcaPcOptions.debug){console.log('pixel cat video: youtube video ready')}
87this.video_ready=!0
88this.data=this.api.getVideoData()
89this.video_id=this.data.video_id
90this.title=this.data.title
91this.url=this.api.getVideoUrl()
92this.events_triggered={}}
93api_youtube_state_change(event){if(fcaPcOptions.debug){console.log(event)}
94switch(event.data){case 0:this.trigger_event('VideoWatchToEnd')
95clearInterval(this.timer)
96break
97case 1:this.trigger_event('VideoPlay')
98this.timer=setInterval(this.track_progress.bind(this),1000)
99break
100case 2:this.trigger_event('VideoPause',{percentage_watched:this.percentage_watched()+'%'})
101clearInterval(this.timer)
102break}}
103video_youtube_end(){if(fcaPcOptions.debug){console.log('end')}}
104load_async_script(url){let new_script=document.createElement('script')
105let first_script=document.getElementsByTagName('script')[0]
106new_script.src=url
107first_script.parentNode.insertBefore(new_script,first_script)
108if(fcaPcOptions.debug){console.log('pixel cat video: '+url+' has been loaded.')}}
109track_progress(){switch(this.video_type()){case 'YOUTUBE':case 'VIMEO':case 'WISTIA':this.video_track_progress()
110break}}
111video_track_progress(){let percent=this.percentage_watched()
112if(fcaPcOptions.debug){console.log(this.percentage_watched())}
113switch(!0){case(percent>=10&&percent<25):this.trigger_event('VideoWatch10Percent')
114break
115case(percent>=25&&percent<50):this.trigger_event('VideoWatch25Percent')
116break
117case(percent>=50&&percent<75):this.trigger_event('VideoWatch50Percent')
118break
119case(percent>=75&&percent<90):this.trigger_event('VideoWatch75Percent')
120break
121case(percent>=90&&percent<100):this.trigger_event('VideoWatch90Percent')
122break}}
123video_params(){return{video_title:this.title,video_url:this.url,video_id:this.video_id}}
124percentage_watched(){switch(this.type){case 'YOUTUBE':return Math.round(this.api.getCurrentTime()/this.api.getDuration()*100)
125case 'VIMEO':this.api.getCurrentTime().then(current_time=>{this.current_time=current_time})
126return Math.round(this.current_time/this.duration*100)
127case 'WISTIA':return Math.round(this.api.time()/this.api.duration()*100)
128default:return!1}}
129trigger_event(action,additional_params={}){if(this.events_triggered[action]){return}
130let params=Object.assign({},this.video_params(),additional_params)
131this.emit('pixel_event','trackCustom',action,params)
132if(action!=='VideoPause'){this.events_triggered[action]=!0}}}
133FCA_PC_Video.prototype.__proto__=EventEmitter.prototype;function onYouTubeIframeAPIReady(){fcaPcVideos.forEach(video=>{if(video.type!=='YOUTUBE'){return}
134video.emit('api_youtube_loaded')})}
135window.fcaPcVideos=[];function detect_videos(){let videos=[];jQuery('iframe').each(function(){var char=jQuery(this)[0].src.includes('?')?'&':'?'
136jQuery(this)[0].src=jQuery(this)[0].src+char+'enablejsapi=1'
137videos.push(jQuery(this))})
138jQuery('script').each(function(){let src=jQuery(this).attr('src')
139if(typeof src==='undefined'){return}
140if(src.indexOf('https://fast.wistia.com/embed/medias/')===-1){return}
141videos.push(jQuery(this))})
142if(videos.length===0){if(fcaPcOptions.debug){console.log('No videos detected')}
143return}
144videos.forEach(function(video){window.fcaPcVideos.push(new FCA_PC_Video(video))})}
145detect_videos()};
146
147

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.