PageSourceSearch

https://www.guitarrepairbench.com/wp-content/plugins/inboundwp/mod…/assets/js/ibwp-sp-public.js?ver=1.0

js guitarrepairbench.com collected 2026-10-02 10:53:09 UTC 8,304 bytes, 316 lines download raw bytes

1(function($) {
2	"use strict";
3
4	var ibwp_nf_interval, ibwp_nf_conf;
5
6	jQuery( document ).ready(function() {
7
8		/* Display Notification */
9		$('.ibwp-sp-nf-conf').each(function(e) {
10
11			ibwp_nf_conf = $(this).data('conf');
12			ibwp_sp_process_nf( ibwp_nf_conf );
13		});
14
15		/* Close Notification */
16		$(document).on('click', '.ibwp-sp-nf-close-btn', function() {
17
18			var cls_ele = $(this).closest('.ibwp-sp-notification-wrap');
19
20			if( ibwp_nf_conf.close_behaviour == 'reload' ) { /* Show notification until next reload */
21
22				clearInterval( ibwp_nf_interval );
23
24			} else if( ibwp_nf_conf.close_behaviour == 'browser' ) { /* Show notification until next browser session */
25
26				ibwp_sp_nf_browser_data( ibwp_nf_conf.id, 'set' );
27				clearInterval( ibwp_nf_interval );
28			}
29
30			ibwp_sp_hide_nf( cls_ele );
31		});
32
33		/* Fetch Notification Data & Process */
34		function ibwp_sp_process_nf( nf_conf ) {
35
36			/* Browser Session */
37			var nf_session = ibwp_sp_nf_browser_data( nf_conf.id );
38
39			/* Initialize Notification */
40			if ( 'undefined' === typeof nf_conf || (nf_conf.close_behaviour == 'browser' && nf_session == 1) ) {
41				return;
42			}
43
44			var sp_data	= {
45							'action'	: 'ibwp_sp_display_notification',
46							'conf'		: nf_conf,
47						};
48
49			jQuery.post(ibwp_ajaxurl, sp_data, function( response ) {
50				if( response.success == 1 ) {
51					ibwp_sp_render_nf( response.content, nf_conf );
52				}
53			});
54		}
55
56		/* Render Notification Data */
57		function ibwp_sp_render_nf( nf_html, config ) {
58
59			var nf_count			= 0;
60			var interval_nf_count	= 0;
61			var interval_last_nf	= -1;
62			var nf_html				= $( nf_html );
63			var last_nf				= ibwp_sp_last_nf_data( config.id );
64
65			if( last_nf > -1 ) {
66				last_nf		= ( last_nf < nf_html.length ) ? last_nf : -1;
67				nf_count	= ( nf_html.length > (last_nf + 1) ) ? (last_nf + 1) : nf_count;
68			}
69
70			/* Display first notification after initial time */
71			setTimeout(function() {
72
73				/* Show first notification */
74				ibwp_sp_show_nf( $( nf_html[nf_count] ), config, nf_count );
75
76				setTimeout(function() {
77
78					/* Hide notification when duration time is over */
79					ibwp_sp_hide_nf( $( nf_html[nf_count] ), config );
80
81					/* Increase notification nf_count */
82					nf_count++;
83
84				}, config.display_time);
85
86				/* Notification Interval
87				 *
88				 * Only start the interval when loop is enabled or remaining notification is there
89				 */
90				if( nf_html.length == 1 && config.loop == 0 ) {
91
92				} else {
93
94					if( (nf_count >= (nf_html.length - 1)) ) {
95						interval_nf_count = 0;
96					} else {
97						interval_nf_count = (nf_count + 1);
98					}
99					interval_last_nf = ( last_nf >= 0 ) ? last_nf : (nf_html.length - 1);
100
101					ibwp_sp_nf_interval( nf_html, config, interval_nf_count, interval_last_nf );
102				}
103
104			}, config.initial_delay);
105		}
106
107		/* Notification Interval */
108		function ibwp_sp_nf_interval( nf_html, config, nf_count, last_nf ) {
109
110			/* Render next notification */
111			ibwp_nf_interval = setInterval(function() {
112
113				/* Show next notification */
114				ibwp_sp_show_nf( $( nf_html[nf_count] ), config, nf_count );
115
116				setTimeout(function() {
117
118					/* Hide notification when duration time is over */
119					ibwp_sp_hide_nf( $( nf_html[nf_count] ), config );
120
121					if ( ( nf_count >= config.max_per_page - 1 ) || ( nf_count >= nf_html.length - 1 ) || ( config.loop <= 0 && last_nf == nf_count ) ) {
122
123						if ( config.loop <= 0 && last_nf == nf_count ) {
124							clearInterval( ibwp_nf_interval );
125						}
126						nf_count = 0;
127
128					} else {
129						nf_count++;
130					}
131
132				}, config.display_time);
133
134			}, (config.delay_between + config.display_time) );
135		}
136
137		/* Show Notification */
138		function ibwp_sp_show_nf( ele_wrap, config, nf_count ) {
139			$('body').append( ele_wrap );
140
141			/* Fade Animation */
142			if( ele_wrap.hasClass('ibwp-sp-nf-fade') ) {
143				var animate_obj = {'opacity': 1};
144			}
145
146			if( ele_wrap.hasClass('ibwp-sp-nf-bottom-left') ) {
147
148				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
149
150					var animate_obj = {'bottom': '0', 'opacity': '1'};
151
152				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
153
154					var animate_obj = {'left': '0', 'opacity': '1'};
155				}
156
157			} else if( ele_wrap.hasClass('ibwp-sp-nf-bottom-right') ) {
158
159				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
160
161					var animate_obj = {'bottom': '0', 'opacity': '1'};
162
163				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
164
165					var animate_obj = {'right': '0', 'opacity': '1'};
166				}
167
168			} else if( ele_wrap.hasClass('ibwp-sp-nf-top-left') ) {
169
170				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
171
172					var animate_obj = {'top': '0', 'opacity': '1'};
173
174				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
175
176					var animate_obj = {'left': '0', 'opacity': '1'};
177				}
178
179			} else if( ele_wrap.hasClass('ibwp-sp-nf-top-right') ) {
180
181				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
182
183					var animate_obj = {'top': '0', 'opacity': '1'};
184
185				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
186
187					var animate_obj = {'right': '0', 'opacity': '1'};
188				}
189			}
190
191			if( animate_obj ) {
192				ele_wrap.animate(animate_obj, {
193					queue		: false,
194					duration	: 600,
195				});
196			}
197
198			/* Function to save last notification */
199			ibwp_sp_last_nf_data( config.id, nf_count, 'set' );
200		}
201
202		/* Hide Notification */
203		function ibwp_sp_hide_nf( ele_wrap, config ) {
204
205			var config = config ? config : false;
206
207			/* Fade Animation */
208			if( ele_wrap.hasClass('ibwp-sp-nf-fade') ) {
209				var animate_obj = {'opacity': 0};
210			}
211
212			if( ele_wrap.hasClass('ibwp-sp-nf-bottom-left') ) {
213
214				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
215
216					var animate_obj = {'bottom': '-150px', 'opacity': '1'};
217
218				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
219
220					var animate_obj = {'left': '-999px', 'opacity': '1'};
221				}
222
223			} else if( ele_wrap.hasClass('ibwp-sp-nf-bottom-right') ) {
224
225				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
226
227					var animate_obj = {'bottom': '-150px', 'opacity': '1'};
228
229				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
230
231					var animate_obj = {'right': '-999px', 'opacity': '1'};
232				}
233
234			} else if( ele_wrap.hasClass('ibwp-sp-nf-top-left') ) {
235
236				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
237
238					var animate_obj = {'top': '-150px', 'opacity': '1'};
239
240				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
241
242					var animate_obj = {'left': '-999px', 'opacity': '1'};
243				}
244
245			} else if( ele_wrap.hasClass('ibwp-sp-nf-top-right') ) {
246
247				if( ele_wrap.hasClass('ibwp-sp-nf-slide') ) {
248
249					var animate_obj = {'top': '-150px', 'opacity': '1'};
250
251				} else if( ele_wrap.hasClass('ibwp-sp-nf-slide-side') ) {
252
253					var animate_obj = {'right': '-999px', 'opacity': '1'};
254				}
255			}
256
257			if( animate_obj ) {
258				ele_wrap.animate(animate_obj, {
259					queue		: false,
260					duration	: 600,
261					complete	: function() {
262									ele_wrap.remove();
263								}
264				});
265			}
266		}
267
268		/* Function to store last notification data (object) in local storage */
269		function ibwp_sp_last_nf_data( nf_id, nf_count, type ) {
270
271			var get_last	= -1;
272			var stored_data = '';
273			nf_count 		= nf_count	? nf_count 	: 0;
274			type 			= type		? type 		: 'get';
275
276			/* Check browser support */
277			if ( typeof(Storage) !== "undefined" && nf_id > 0 ) {
278
279				if( type == 'set' ) {
280
281					localStorage.setItem( 'ibwp_sp_nf_'+nf_id, nf_count );
282
283				} else if( type == 'get' ) {
284
285					get_last = localStorage.getItem( 'ibwp_sp_nf_'+nf_id );
286					get_last = parseInt( get_last );
287				}
288			}
289
290			return get_last;
291		}
292
293		/* Function to set notification browser session */
294		function ibwp_sp_nf_browser_data( nf_id, type ) {
295
296			var nf_session	= -1;
297			type			= type ? type : 'get';
298
299			/* Check browser support */
300			if (typeof(Storage) !== "undefined") {
301
302				if( type == 'set' ) {
303
304					sessionStorage.setItem( 'ibwp_sp_nf_' + nf_id, '1' );
305
306				} else if( type == 'get' ) {
307
308					nf_session = sessionStorage.getItem( 'ibwp_sp_nf_' + nf_id );
309					nf_session = parseInt( nf_session );
310				}
311			}
312
313			return nf_session;
314		}
315	});
316})(jQuery);

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.