PageSourceSearch

https://www.seed.ab.ca/wp-content/plugins/full-picture-premium/pub…/common/fupi-helpers-footer.js?ver=10.1.2.1

js seed.ab.ca collected 2026-10-04 00:19:12 UTC 7,738 bytes, 233 lines download raw bytes

1function fupi_footer_helpers(){
2
3	FP.updateScrollValues = function(){
4
5        fpdata.scrolled = fpdata.scrolled || {};
6
7        fpdata.scrolled.current         = Math.round( document.documentElement.scrollTop / ( document.documentElement.scrollHeight - document.documentElement.clientHeight ) * 100 ) || 0;
8        fpdata.scrolled.current_px      = document.documentElement.scrollTop || 0;
9        fpdata.scrolled.max             = fpdata.scrolled.max || fpdata.scrolled.current;
10        fpdata.scrolled.max_px          = fpdata.scrolled.max_px || fpdata.scrolled.current_px;
11
12        if ( fpdata.scrolled.current > fpdata.scrolled.max ) {
13			fpdata.scrolled.max         = fpdata.scrolled.current;
14			fpdata.scrolled.max_px      = fpdata.scrolled.current_px;
15		}
16	}
17	
18	// SET BASE VALUES
19	FP.updateScrollValues();
20
21	FP.makeName = function ( str, el ) {
22		if ( str ) {
23			if ( str.indexOf('[name]') != -1  ) {
24				var textContent = el.textContent;
25				if ( textContent.length > 20 ) {
26					textContent.substring(0, 20);
27				};
28				return str.replace('[name]', textContent);
29			} else {
30				return str;
31			}
32		} else {
33			return false;
34		}
35	}
36
37    FP.isFileUrl = function (url, file_formats) {
38        
39		var last_url_part = url.split('/').pop(),
40        	files_arr = file_formats.split(',').map(function (file) {
41            	return file.trim();
42        	});
43
44		return files_arr.some(function (file) {
45			if ( ! file ) return false; // this will get rid of empty arr values. They show up if someone leaves a comma ',' at the beginning or end of the list of formats
46            return last_url_part.indexOf( '.' + file.toLowerCase() ) != -1;
47        });
48    };
49
50	FP.intersectionObserver = ( newly_added_els, track_settings, slug, callback, unobserve = false, passed_val = false ) => {
51
52		if ( ! ( 'IntersectionObserver' in window ) || ( newly_added_els && newly_added_els.length == 0 ) ) return;
53
54		let els_a = [];
55
56		const observer_name = 'i_' + slug + '_' + Date.now(); // "i" is for "Intersection"
57		
58		const processEl = ( el, val ) => {
59			el.dataset[ slug + '_view' ] = val || 'name not provided';
60			els_a.push(el);
61		}
62
63		// check if tracked elements are in HTML
64		for (const key in track_settings) {
65
66			let selector = track_settings[key]['sel'],
67				value = track_settings[key]['val'];
68
69			if ( newly_added_els ) {
70				newly_added_els.forEach( el => {
71					if ( el.matches && el.matches( selector ) ) processEl( el, value );
72				});
73			} else {
74				FP.findAll( selector ).forEach( el => processEl( el, value ) );
75			}
76		}
77		
78		if ( els_a.length == 0 ) return;
79
80		// create observer
81		const observer = new IntersectionObserver( ( entries, observer ) => {
82			entries.forEach( ( { isIntersecting, target } ) => {
83				if ( isIntersecting ) {
84					if ( fpdata.observed != target ) fpdata.observed = target;
85					if ( unobserve ) observer.unobserve( target ); 
86					callback.call( this, target, passed_val );
87				}
88			});
89		}, { 
90			rootMargin: fp.track.intersections 
91		} );
92
93		fp.observers[observer_name] = observer;
94
95		// attach observer to found elements
96		els_a.forEach( el => fp.observers[observer_name].observe(el) );
97		
98	};
99
100    FP.isScrollTracked = function ( scroll_points ) {
101
102        var reached_point = false,
103			max = scroll_points.length;
104
105		// check if the user reached any scroll point
106		for (var i = 0; i < max; i++) {
107			if ( fpdata.scrolled.max > scroll_points[i] ) {
108				reached_point = scroll_points[i];
109			}
110		}
111
112        return reached_point;
113    };
114
115	FP.getTrackedAffiliateLink = function( obj ){
116	// returns link URL if left empty
117
118		var name = false;
119
120		if ( fpdata.clicked.link ){
121
122			for ( const key in obj ) {
123
124				var url_part = obj[key]['sel'],
125					is_aff_link = fpdata.clicked.link.href.indexOf(url_part) != -1;
126
127				if ( is_aff_link ) {
128					name = FP.makeName( obj[key]['val'], fpdata.clicked.link.element ) || fpdata.clicked.link.href;
129					break;
130				}
131			}
132		}
133
134		return name;
135	}
136
137	FP.getTrackedFilename = function( str ){
138		if ( fpdata.clicked.link && FP.isFileUrl( fpdata.clicked.link.href, str) ) {
139			try {
140				return fpdata.clicked.link.href.split('/').pop().split('?')[0];
141			} catch (e) {
142				console.error(e);
143				return false;
144			}
145		}
146	}
147
148	FP.getClickTarget = function( obj ){
149
150		var name = false;
151
152        for ( const key in obj ) {
153	
154			var selector = obj[key]['sel'],
155				searched_el = false,
156				target = fpdata.clicked.element;
157
158			if ( fpdata.clicked.element.matches( selector ) ) {
159				if ( fpdata.clicked.middle ) {
160					if ( fpdata.clicked.link ) {
161						searched_el = target;
162					}
163				} else {
164					searched_el = target;
165				}
166			} else if ( fpdata.clicked.link && fpdata.clicked.link.element.matches( selector ) ){
167				searched_el = fpdata.clicked.link.element;
168			}
169
170			if ( searched_el ) {
171				name = FP.makeName( obj[key]['val'], searched_el ) || selector;
172				break;
173			}
174        }
175
176		return name;
177	}
178
179	FP.getSubmittedForm = function( obj ){
180
181		var name = false;
182
183		for ( const key in obj ) {
184			if ( fpdata.submitted_form.element.matches( obj[key]['sel'] ) ) {
185				name = obj[key]['val'] || location.host + location.pathname;
186				break;
187			}
188		}
189
190		return name;
191	}
192
193	FP.formatScrollPoints = function( str ){
194		if ( typeof str == 'string' ) return str.split(",").map( function (val) { return parseInt( val.replace('%','') ) } )
195		return str;
196	}
197
198	// ON SCROLL
199
200    function on_scroll() {
201        FP.startActivityTimer();
202        FP.updateScrollValues();
203		FP.doActions( 'scroll' );
204    }
205
206    document.addEventListener( 'scroll', FP.throttle( on_scroll, 50, { trailing: true } ) );
207
208	// SHOW "USER NOT TRACKED" ICON AT THE BOTTOM-LEFT CORNER OF THE SCREEN
209
210	function show_eye_icon(){
211		document.body.insertAdjacentHTML('afterbegin', '<div id=\'fupi_disabled\' title="Tracking disabled"><svg style="width: 20px;" focusable="false" data-prefix="fas" data-icon="eye-slash" class="svg-inline--fa fa-eye-slash fa-w-20" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"></path></svg></div><style>#fupi_disabled{position: fixed; left: 0; bottom: 0; color: #fff; background-color: rgba(0,0,0,.2); padding: 5px 5px 0; border-radius: 0 3px 0 0; z-index: 10000;cursor: pointer;}#fupi_disabled:hover{background-color: rgba(0,0,0,.8);}</style>');
212
213		var disabled_ico = FP.findID('fupi_disabled');
214
215		disabled_ico.addEventListener('click', function (e) {
216			FP.deleteCookie('fp_cookie');
217			fpdata.cookies = false;
218			document.location = location.origin;
219		})
220	}
221
222	if ( fpdata.cookies && fpdata.cookies.disabled ) {
223		if ( document.readyState === "complete" ) {
224			show_eye_icon();
225		} else {
226			document.addEventListener('DOMContentLoaded', show_eye_icon );
227		}
228	}
229
230	FP.loaded('footer_helpers');
231};
232
233FP.load('footer_helpers', 'fupi_footer_helpers', ['head_helpers'])

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.