PageSourceSearch

https://www.psbbet.com/js/smartlander23112022.js

js psbbet.com collected 2026-09-28 01:44:20 UTC 6,851 bytes, 275 lines download raw bytes

1$( document ).ready(function() {
2	
3	fitty('h1.main-title',{maxSize:60});
4	
5	var lightboxesBound = false;
6	var singleFormSubmitPending = false;
7	var singleFormSubmitAction = null;
8	
9	const options = {
10		size: 'xl'
11	};
12	
13	// Bind default lightboxes
14	document.querySelectorAll('.lightbox').forEach((el) => el.addEventListener('click', (e) => {
15		e.preventDefault();
16		const lightbox = new Lightbox(el, options);
17		lightbox.show();
18	}));
19
20	// Submitting the first step of an offer form
21	$( '#offer_step_one' ).click(function(e) {
22					
23		if ($('form#offer_form_first')[0].checkValidity()) {
24			
25			$('section#make_offer_full_screen').removeClass('d-none');
26			var offer_first = $('input#offer_first').val();
27			$('input#offer').val(offer_first);
28			return false;
29			
30		} 
31		
32	});
33	
34	var source_lang = 'en';
35
36	$(document).on('click', '#form_submit_single', function() {
37		var form = $(this).closest('form');
38
39		if (form.length && form[0].checkValidity && form[0].checkValidity() === false) {
40			return;
41		}
42
43		singleFormSubmitPending = true;
44		singleFormSubmitAction = form.attr('action') || null;
45
46		$('div#preloader').show();
47		$('div#preloader').fadeTo(0, 0.8);
48		$('div#preloader #status').show();
49	});
50
51	$(document).ajaxComplete(function(event, xhr, settings) {
52		if (!singleFormSubmitPending) {
53			return;
54		}
55
56		if (singleFormSubmitAction && settings && settings.url !== singleFormSubmitAction) {
57			return;
58		}
59
60		singleFormSubmitPending = false;
61		singleFormSubmitAction = null;
62		$('div#preloader').hide();
63		$('div#preloader #status').hide();
64	});
65
66	$(document).ajaxError(function(event, xhr, settings) {
67		if (!singleFormSubmitPending) {
68			return;
69		}
70
71		if (singleFormSubmitAction && settings && settings.url !== singleFormSubmitAction) {
72			return;
73		}
74
75		singleFormSubmitPending = false;
76		singleFormSubmitAction = null;
77		$('div#preloader').hide();
78		$('div#preloader #status').hide();
79	});
80	
81	// Close the make offer dialog and reset it's content				
82	$( 'a.translate').click(function( e ) {
83			
84
85			e.preventDefault();
86			$('div#preloader').show();
87			
88			var destination_lang = $(this).data('lang');
89			var translations = {};
90			var languages = {};
91			
92			languages['en'] = 'English';
93			languages['nl'] = 'Dutch';
94			languages['de'] = 'German';
95			languages['es'] = 'Spanish';
96			languages['fr'] = 'French';
97			languages['jp'] = 'Japanese';
98			languages['et'] = 'Estonian';
99			languages['fi'] = 'Finnish';
100			languages['hu'] = 'Hungarian';
101			languages['id'] = 'Indonesian';
102			languages['it'] = 'Italian';
103			languages['lt'] = 'Lithuanian';
104			languages['lv'] = 'Latvian';
105			languages['pl'] = 'Polish';
106			languages['pt'] = 'Portuguese';
107			languages['ro'] = 'Romanian';
108			languages['ru'] = 'Russian';
109			languages['sk'] = 'Slovak';
110			languages['sl'] = 'Slovenian';
111			languages['sv'] = 'Swedish';
112			languages['tr'] = 'Turkish';
113			languages['uk'] = 'Ukrainian';
114			languages['zh'] = 'Chinese (simplified)';
115			languages['bg'] = 'Bulgarian';
116			languages['cs'] = 'Czech';
117			languages['da'] = 'Danish';
118			languages['el'] = 'Greek';
119			
120			$('.translatable').each(function(i, obj) {
121				
122				var current_txt = $(obj).html();
123				var label = $(obj).data('element');
124				translations[label] = current_txt;
125				
126			});
127			
128			$.post('ajax/smartlanders/translate/',
129			{
130				lang: destination_lang,
131				text: translations
132			},
133			function(data, status){
134				translations = JSON.parse(data);
135				
136				$.each(translations, function(index, value) {
137					$('*[data-element="'+index+'"]').html(value);
138				}); 
139				
140				source_lang = destination_lang;
141				$('.curlang').html(languages[destination_lang]);
142			})  
143			.done(function() {
144				$('div#preloader').hide();
145			});
146			//Odf.ajax.get('ajax/smartlanders/translate/', $(obj), { function () { console.log('test'); } });    
147			//console.log(translations);
148			
149	});
150
151	// Close the make offer dialog and reset it's content				
152	$( '#close_offer_box').click(function( e ) {
153		
154			e.preventDefault();
155			resetAndHideOfferDialog();
156		
157	});
158			
159	// Close the make offer dialog on hitting Escape
160	$(document).keyup(function(e) {
161		if (e.key === "Escape") {
162			resetAndHideOfferDialog();
163		}
164	});
165	
166	
167	function resetAndHideOfferDialog() {
168		
169		// Reset box with AJAX call feedback
170		$('#form_feedback').empty();
171		
172		// Reset form input fields
173		$("#offer_form_second")[0].reset();
174		
175		// Reset form
176		//$('#offer_box_second_form').removeClass('d-none');
177		//$('#offer_box_second_success').addClass('d-none');
178		
179		// Reset form
180		//$('#offer_box_first_form').removeClass('d-none');
181		//$('#offer_box_first_success').addClass('d-none');	
182	
183		$('section#make_offer_full_screen').addClass('d-none');
184		return false;
185		
186	}
187
188
189	$( "#show_offer_box" ).click(function() {
190		
191		$('#buy_now').addClass('d-none');
192		$('#offer_form').removeClass('d-none');
193		return false;
194		
195	});
196
197
198	$( "#show_bin_box" ).click(function() {
199		
200		$('#buy_now').removeClass('d-none');
201		$('#offer_form').addClass('d-none');
202		return false;
203		
204	});
205	
206	// Hitting the lease to own button
207	$( '#bin_dan_installments' ).click(function(e) {
208		$('section#installments_full_screen').removeClass('d-none');
209		$('body').addClass('prevent-double-scroll');
210		return false;
211		
212	});
213
214
215	// Close theinstallment dialog and reset it's content				
216	$( '#close_installment_box').click(function() {
217		
218		$('section#installments_full_screen').addClass('d-none');
219		$('body').removeClass('prevent-double-scroll');
220		return false;
221		
222		
223	});
224
225	$( "#edit-btn" ).click(function() {
226		
227		var edit_mode = $('.edit-on').hasClass('d-none');
228		var edit_icon_on = $('.edit-on');
229		var edit_icon_off = $('.edit-off');
230		
231		if (edit_mode) {
232			
233			$(this).removeClass('btn-dark');
234			$(this).addClass('btn-success');
235			$(edit_icon_on).removeClass('d-none');
236			$(edit_icon_off).addClass('d-none');
237			$('body').addClass('editmode');
238			$('.instantedit').removeClass('d-none');
239			$('.userhidden').removeClass('d-none');
240			
241			// Add BS tooltips
242			var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
243			var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
244				return new bootstrap.Tooltip(tooltipTriggerEl, {delay: 400})
245			})
246			
247			const options = {
248				size: 'xl'
249			};
250			
251			if (lightboxesBound == false ) {
252				
253				// Bind lightbox
254				document.querySelectorAll('.editable').forEach((el) => el.addEventListener('click', (e) => {
255					e.preventDefault();
256					const lightbox = new Lightbox(el, options);
257					lightbox.show();
258				}));
259			}
260			
261			lightboxesBound = true;
262			
263		} else {
264			
265			$(this).addClass('btn-dark');
266			$(this).removeClass('btn-success');
267			$(edit_icon_on).addClass('d-none');
268			$(edit_icon_off).removeClass('d-none');
269			$('body').removeClass('editmode');
270			$('.editable').attr('data-bs-toggle', '');
271			$('.userhidden').addClass('d-none');
272		}
273	});
274	
275});

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.