1let total_video = video_list.length; 2if(!localStorage.vid_index || !(JSON.parse(localStorage.vid_index)<total_video && JSON.parse(localStorage.vid_index)>=0) ){ 3 localStorage.vid_index = JSON.stringify(0); 4} 5 6if (isAndroidXiaomi() || isAndroidBaidu()) { 7 $("#background_img").attr("src", poster_list[JSON.parse(localStorage.vid_index)]) 8 $("#background_video").remove() 9} else { 10 $("#background_img").remove() 11 if (!isIphone()) { 12 $("#background_video").attr("poster", poster_list[JSON.parse(localStorage.vid_index)]) 13 } 14} 15 16function isAndroidBaidu() { 17 const ua = navigator.userAgent.toLowerCase(); 18 return ua.indexOf('applewebkit') > -1 && ua.indexOf('android') > -1 && ua.indexOf('baidu') > -1; 19} 20 21function isAndroidXiaomi() { 22 const ua = navigator.userAgent.toLowerCase(); 23 return ua.indexOf('applewebkit') > -1 && ua.indexOf('android') > -1 && ua.indexOf('xiaomi') > -1; 24} 25 26function isIphone() { 27 const ua = navigator.userAgent.toLowerCase(); 28 return ua.indexOf('applewebkit') > -1 && ua.indexOf('mobile') > -1 && ua.indexOf('iphone') > -1 && ua.indexOf('safari') > -1; 29} 30 31function updateVideoIndex() { 32 let total_video = video_list.length; 33 if (JSON.parse(localStorage.vid_index)<total_video && JSON.parse(localStorage.vid_index)>=0){ 34 localStorage.vid_index = JSON.stringify( JSON.parse(localStorage.vid_index) + 1 ); 35 } else{ 36 localStorage.vid_index = JSON.stringify( 0 ); 37 } 38} 39 40$(function () { 41 if (isAndroidXiaomi()) { 42 updateVideoIndex() 43 } else if (isAndroidBaidu()) { 44 updateVideoIndex() 45 $("#background_img").scroll() 46 } else { 47 let bv = new Bideo(); 48 bv.init({ 49 // Video element 50 videoEl: document.querySelector('#background_video'), 51 52 // Container element 53 container: document.querySelector('body'), 54 55 // Resize 56 resize: true, 57 58 // autoplay: false, 59 60 isMobile: window.matchMedia('(max-width: 1px)').matches, 61 62 // playButton: document.querySelector('#play'), 63 // pauseButton: document.querySelector('#pause'), 64 65 // Array of objects containing the src and type 66 // of different video formats to add 67 src: [ 68 { 69 src: video_list[JSON.parse(localStorage.vid_index)], 70 type: 'video/mp4' 71 }, 72 { 73 src: 'video-1.webm', 74 type: 'video/webm;codecs="vp8, vorbis"' 75 } 76 ], 77 78 // What to do once video loads (initial frame) 79 onLoad: function () { 80 // document.querySelector('#video_cover').style.display = 'none'; 81 updateVideoIndex() 82 } 83 }) 84 } 85}());
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.