vanilla-lazyload
4 months ago
jquery.lazy.av.min.js
4 years ago
jquery.lazy.iframe.min.js
4 years ago
jquery.lazy.js
3 years ago
jquery.lazy.min.js
3 years ago
lazyload.min.js
4 years ago
loader.js
1 week ago
two_delay.js
1 week ago
two_elementor_video_to_iframe.js
4 years ago
two_lazyload.js
3 years ago
two_merge_google_font_faces.js
3 years ago
two_worker.js
2 years ago
two_yt_vi_lazyload.js
3 years ago
two_yt_vi_lazyload.min.js
3 years ago
two_elementor_video_to_iframe.js
53 lines
| 1 | var two_video_els = document.querySelectorAll(".elementor-widget-video"); |
| 2 | for (var i = 0, len = two_video_els.length; i < len; i++) { |
| 3 | var elementor_widget_video_data = two_video_els[i].getAttribute('data-settings'); |
| 4 | elementor_widget_video_data = JSON.parse(elementor_widget_video_data); |
| 5 | two_video_els[i].setAttribute('data-settings', ""); |
| 6 | |
| 7 | if(typeof elementor_widget_video_data.youtube_url !== "undefined"){ |
| 8 | var video_id = two_getId(elementor_widget_video_data.youtube_url); |
| 9 | if(video_id){ |
| 10 | var video_url = "https://www.youtube.com/embed/"+video_id; |
| 11 | if(typeof elementor_widget_video_data.autoplay !== "undefined"){ |
| 12 | video_url+="?autoplay=1"; |
| 13 | }else{ |
| 14 | video_url+="?autoplay=0"; |
| 15 | } |
| 16 | if(typeof elementor_widget_video_data.controls !== "undefined"){ |
| 17 | video_url+="&controls=1"; |
| 18 | }else{ |
| 19 | video_url+="&controls=0"; |
| 20 | } |
| 21 | if(typeof elementor_widget_video_data.mute !== "undefined"){ |
| 22 | video_url+="&mute=1"; |
| 23 | }else{ |
| 24 | video_url+="&mute=0"; |
| 25 | } |
| 26 | if(typeof elementor_widget_video_data.modestbranding !== "undefined"){ |
| 27 | video_url+="&modestbranding=1"; |
| 28 | }else{ |
| 29 | video_url+="&modestbranding=0"; |
| 30 | } |
| 31 | if(typeof elementor_widget_video_data.play_on_mobile !== "undefined"){ |
| 32 | video_url+="&playsinline=1"; |
| 33 | }else{ |
| 34 | video_url+="&playsinline=0"; |
| 35 | } |
| 36 | |
| 37 | var two_iframe = '<iframe class="yt-lazyload lazy" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" src="" data-src="'+video_url+'" ></iframe>'; |
| 38 | var elementor_video_tag = two_video_els[i].querySelector(".elementor-video"); |
| 39 | elementor_video_tag.innerHTML = two_iframe; |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | function two_getId(url) { |
| 44 | var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; |
| 45 | var match = url.match(regExp); |
| 46 | |
| 47 | if (match && match[2].length == 11) { |
| 48 | return match[2]; |
| 49 | } else { |
| 50 | return false; |
| 51 | } |
| 52 | } |
| 53 |