PageSourceSearch

https://vanelliandfriends.com/js/landing-builder/insights-photos.js?v=20260924e

js vanelliandfriends.com collected 2026-10-04 05:03:13 UTC 6,815 bytes, 95 lines download raw bytes

1/* Qualified photo episodes. DOM/player adapters supply facts; this owns IDs and time. */
2(function(root,factory){var api=factory();if(typeof module==='object'&&module.exports)module.exports=api;else root.SlickPicInsightsPhotos=api;}(typeof window!=='undefined'?window:this,function(){
3'use strict';
4function copy(x){return JSON.parse(JSON.stringify(x));}
5function Engine(collector){this.c=collector;this.page=collector.page;this.galleries={};this.impressions={};this.candidates={};this.galleryCandidates={};this.memberIndexes=new WeakMap();this.views={};this.last=collector.e.mono();}
6Engine.prototype.scope=function(m){
7 if(this.page!==this.c.page){this.page=this.c.page;}
8 var key=m.placement_id+':'+m.manifest_id;
9 if(!this.galleries[key]){
10  this.galleries[key]=this.c.e.uuid();
11  this.c.emit('gallery_view',{placement_id:m.placement_id,gallery_visit_id:this.galleries[key],manifest_id:m.manifest_id,gallery_id:m.gallery_id,gallery_type:m.gallery_type,gallery_revision:m.gallery_revision,available_photo_count:m.photos.length},this.c.e.mono());
12 }
13 return {placement_id:m.placement_id,gallery_visit_id:this.galleries[key],manifest_id:m.manifest_id,gallery_id:m.gallery_id,gallery_type:m.gallery_type,gallery_revision:m.gallery_revision};
14};
15Engine.prototype.member=function(m,id,revision){
16 var index=this.memberIndexes.get(m);if(!index){index=Object.create(null);m.photos.forEach(function(p){if(!index[p.photo_id])index[p.photo_id]=p;});this.memberIndexes.set(m,index);}
17 var photo=index[String(id)];return photo&&photo.photo_revision===revision?photo:null;
18};
19Engine.prototype.hasImpression=function(m,id,revision){return this.impressions[this.c.page+':'+m.placement_id+':'+id+':'+revision];};
20Engine.prototype.gallery=function(m,visible,now){
21 var key=m.placement_id+':'+m.manifest_id;
22 if(this.galleries[key])return;
23 if(!visible||!this.c.active||!this.c.page){delete this.galleryCandidates[key];return;}
24 var candidate=this.galleryCandidates[key];
25 if(!candidate||now-candidate.last>1000)candidate=this.galleryCandidates[key]={start:now,last:now};
26 candidate.last=now;if(now-candidate.start>=1000)this.scope(m);
27};
28Engine.prototype.thumb=function(m,id,revision,visible,interaction,now){
29 var photo=this.member(m,id,revision);if(!photo||!this.c.active||!this.c.page)return null;
30 var key=this.c.page+':'+m.placement_id+':'+id+':'+photo.photo_revision;
31 if(!visible){delete this.candidates[key];return null;}
32 if(this.impressions[key])return this.impressions[key];
33 if(this.candidates[key]===undefined)this.candidates[key]={start:now,last:now};
34 if(now-this.candidates[key].last>1000)this.candidates[key].start=now;
35 this.candidates[key].last=now;
36 if(!interaction&&now-this.candidates[key].start<1000)return null;
37 var data=this.scope(m);Object.assign(data,photo,{impression_id:this.c.e.uuid(),qualification:interaction?'interaction':'visibility',qualified_at_ms:this.c.time(now),visible_ms:now-this.candidates[key].start});
38 this.impressions[key]=data.impression_id;this.c.emit('photo_impression',data,now);delete this.candidates[key];return data.impression_id;
39};
40Engine.prototype.activate=function(slot,m,id,revision,options,now){
41 var photo=this.member(m,id,revision);if(!photo){this.end(slot,'destroy',now);return null;}
42 options=options||{};var activation=options.activation;
43 var old=this.views[slot];
44 if(old&&old.activation===activation&&old.m.manifest_id===m.manifest_id&&old.photo.photo_id===photo.photo_id&&old.photo.photo_revision===photo.photo_revision){
45  if(old.options.mode!==options.mode||(old.options.interval||null)!==(options.interval||null)){
46   if(old.qualified===null)old.options=options;
47   else if(!old.presentationChanged){old.presentationChanged=true;old.presentationPending=true;this.pauseView(old,'interval',now);}
48  }
49  return old.id;
50 }
51 var next=this.c.e.uuid();
52 if(old)this.end(slot,options.trigger==='autoplay'?'automatic_next':(options.trigger==='previous'?'manual_previous':(options.trigger==='next'?'manual_next':'unknown')),now,next);
53 this.views[slot]={id:next,activation:activation,m:m,photo:photo,options:options,activated:now,candidate:null,segment:null,total:0,qualified:null,data:null,lastCheckpoint:now};
54 return next;
55};
56Engine.prototype.sample=function(slot,eligible,now){
57 var v=this.views[slot];if(!v)return;
58 eligible=eligible&&this.c.active&&!this.c.stopped&&!!this.c.anchor;
59 if(!eligible){this.pauseView(v,'hidden',now);v.candidate=null;return;}
60 if(v.qualified===null){
61  if(v.candidate===null)v.candidate=now;
62  if(now-v.candidate<1000)return;
63  v.qualified=now;v.segment=v.candidate;v.segmentId=this.c.e.uuid();
64  v.data=this.scope(v.m);Object.assign(v.data,v.photo,{view_id:v.id,viewer_session_id:v.options.viewer_session_id||v.id,origin_impression_
64id:v.options.origin_impression_id||null,
65   surface:v.options.surface,trigger:v.options.trigger||'initial',presentation_mode:v.options.mode||'manual',slide_interval_ms:v.options.interval||null,
66   activated_at_ms:this.c.time(v.activated),qualified_at_ms:this.c.time(now),active_ms_total:now-v.segment});
67  this.c.emit('photo_view_start',copy(v.data),now);v.lastCheckpoint=now;
68 }
69 if(v.segment===null){v.segment=now;v.segmentId=this.c.e.uuid();}
70 if(now-v.lastCheckpoint>=15000){this.pauseView(v,'interval',now);v.segment=now;v.segmentId=this.c.e.uuid();}
71};
72Engine.prototype.take=function(v,now){
73 var segments=[];
74 if(v.segment!==null&&now>v.segment){
75  segments.push({segment_id:v.segmentId,view_id:v.id,started_at_ms:this.c.time(v.segment),ended_at_ms:this.c.time(now)});v.total+=now-v.segment;
76 }
77 v.segment=null;return segments;
78};
79Engine.prototype.pauseView=function(v,reason,now){
80 if(v.qualified===null)return;
81 var segments=this.take(v,now);
82 var total={view_id:v.id,active_ms_total:v.total};if(v.presentationChanged)total.presentation_changed=true;
83 if(segments.length||v.presentationPending)this.c.emit('attention_checkpoint',{reason:reason,totals:[total],segments:segments},now);
84 v.presentationPending=false;
85 v.lastCheckpoint=now;
86};
87Engine.prototype.pause=function(reason,now){var self=this;Object.keys(this.views).forEach(function(k){var v=self.views[k];self.pauseView(v,reason,now);v.candidate=null;});this.candidates={};this.galleryCandidates={};};
88Engine.prototype.end=function(slot,outcome,now,next){
89 var v=this.views[slot];if(!v)return;
90 if(v.qualified!==null){var segments=this.take(v,now),data=copy(v.data);Object.assign(data,{active_ms_total:v.total,ended_at_ms:this.c.time(now),outcome:outcome||'unknown',next_view_id:next||null,segments:segments});if(v.presentationChanged)data.presentation_changed=true;this.c.emit('photo_view_end',data,now);}
91 delete this.views[slot];
92};
93Engine.prototype.reset=function(){this.galleries={};this.impressions={};this.candidates={};this.galleryCandidates={};this.memberIndexes=new WeakMap();this.views={};};
94return {Engine:Engine};
95}));

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.