1window.addEventListener('load', function () { 2 let videoElements = document.querySelectorAll('div.image-wrapper div.video-wrapper video'); 3 let dreamUid = ''; 4 if (videoElements.length > 0) { 5 videoElements.forEach(function(video) { 6 video.addEventListener('play', function () { 7 let divElem = video.closest('[data-video-id]') || video.closest('[data-uid]'); 8 9 if (divElem) { 10 let newDreamUid = divElem.dataset.uid; 11 if (newDreamUid && dreamUid != newDreamUid) { 12 dreamUid = newDreamUid; 13 $.ajax({ 14 type: "POST", 15 url: "/video/count-views/" + dreamUid, 16 dataType: 'json', 17 data: {}, 18 headers: { 19 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'), 20 }, 21 success: function (data) { 22 // console.log('Views was counted'); 23 } 24 }); 25 } 26 } 27 }); 28 }); 29 } 30 31 setTimeout(function() { 32 33 if (typeof userPage == 'undefined' || userPage === 'false') { 34 let uids = document.querySelectorAll('div.info div.rating div.dream-like'); 35 let dreamUids = []; 36 if (uids.length > 0) { 37 for (const uid of uids) { 38 let dreamUid = uid.getAttribute('ddg-uid'); 39 dreamUids.push(dreamUid); 40 } 41 calculateDreamsViews(dreamUids); 42 } 43 44 // new deign for feed page 45 newDesignuids = document.querySelectorAll('div.bottom-info div.rating div.dream-like'); 46 dreamUids = []; 47 if (newDesignuids.length > 0) { 48 for (const uid of newDesignuids) { 49 let dreamUid = uid.getAttribute('ddg-uid'); 50 dreamUids.push(dreamUid); 51 } 52 calculateDreamsViews(dreamUids); 53 } 54 } 55 }, 4000); //4 seconds 56}); 57 58 59function calculateDreamsViews(dreamUids){ 60 $.ajax({ 61 type: "POST", 62 url: "/dreams/count-views/", 63 dataType: 'json', 64 data: {dreamUids: dreamUids}, 65 headers: { 66 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'), 67 }, 68 success: function (data) { 69 //console.log('Dreams were counted'); 70 } 71 }); 72 73}
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.