PageSourceSearch

https://www.classtrucks.com/wp-content/themes/hello-elementor/asse…?ver=5202609250717903181121

js classtrucks.com collected 2026-09-25 07:01:14 UTC 16,533 bytes, 447 lines download raw bytes

1function  horizontalProductCardLayout(product, notification){
2
3	const productId = product.code;
4	userCurrency = ClasstrucksUser.currency;
5	currencySlug = '€';
6	
7	if(userCurrency == 'pln')
8	{
9		currencySlug = 'PLN'
10	}
11	else
12	{
13		userCurrency = 'eur';
14	}
15	
16	productPrice = new Intl.NumberFormat('en-US').format(product.price) + ' '+currencySlug;
17	
18	const data = {
19		code: product.code,
20		countryCode: product.countryCode,
21		location: product.location,
22		modelName: product.modelName,
23		availability: product.availability,
24		registrationDate: product.registrationDate,
25		mileage: product.mileage,
26		year: product.year,//
27		operatingHours: product.operatingHours,
28		euroStandard: product.euroStandard,
29		horsePower: product.horsePower,
30		price: product.price,
31		price_lt_eur: new Intl.NumberFormat('en-US').format(product.price_lt_eur) + ' €',
32        price_pl_eur: new Intl.NumberFormat('en-US').format(product.price_pl_eur) + ' €',
33        price_es_eur: new Intl.NumberFormat('en-US').format(product.price_es_eur) + ' €',
34        price_nl_eur: new Intl.NumberFormat('en-US').format(product.price_nl_eur) + ' €',
35		price_lt_pln: new Intl.NumberFormat('en-US').format(product.price_lt_pln) + ' PLN',
36        price_pl_pln: new Intl.NumberFormat('en-US').format(product.price_pl_pln) + ' PLN',
37        price_es_pln: new Intl.NumberFormat('en-US').format(product.price_es_pln) + ' PLN',
38        price_nl_pln: new Intl.NumberFormat('en-US').format(product.price_nl_pln) + ' PLN',
39		truckPackage: product.truckPackage,
40	};
41	
42	if(data.availability == 4 || data.availability == 5)
43	{
44		data.registrationDate = data.year;
45		
46		if(data.mileage)
47		{
48			data.mileage = Math.floor(parseInt(data.mileage) / 1000) * 1000;
49			data.mileage = data.mileage.toString();
50		}
51		
52		if(data.operatingHours)
53		{
54			data.operatingHours = Math.floor(parseInt(data.operatingHours) / 1000) * 1000;
55			
56			if(data.operatingHours > 0)
57			{
58				data.mileage = '';
59			}
60			
61			data.operatingHours = data.operatingHours.toString();
62		}
63	}
64	
65	if(data.operatingHours)
66	{
67		if(data.operatingHours > 0)
68		{
69			data.mileage = '';
70		}
71	}
72	
73	let priceChangedBadge = '';
74	let productArrived = '';
75	let readedClass = '';
76	let priceChangeProcentage = '';
77	let priceChangeOldPrice = '';
78	let realPrice = productPrice;
79	let dataNotification = '';
80	
81	waitingmatrixEnabled = 'waitingmatrix';
82	
83	if(typeof IPMatrix !== 'undefined')
84	{
85		if(IPMatrix.country)
86		{
87			countryCheck = IPMatrix.country;
88			
89			if(IPMatrix.yard == "LT_METL")
90			{
91				countryCheck = 'lt';
92			}
93			else if(IPMatrix.yard == "ES_VLNC")
94			{
95				countryCheck = 'es';
96			}
97			else if(IPMatrix.yard == "PL_RAWA")
98			{
99				countryCheck = 'pl';
100			}
101			else if(IPMatrix.yard == "NL_HTRN")
102			{
103				countryCheck = 'nl';
104			}
105			
106			matrix_price = 'price_'+countryCheck+'_'+userCurrency;
107
108			data.price = data[matrix_price];
109			
110			productPrice = data.price;
111			realPrice = productPrice;
112			waitingmatrixEnabled = '';
113		}
114	}
115
116	if(typeof notification !== 'undefined' && notification !== null && typeof notification.notification_type !== 'undefined')
117	{
118		if(notification.notification_type == 1) // price_change
119		{
120			priceChangedBadge = '<div class="product-price-changed-badge">'+getTranslate('accountNotificationLabelPriceChanged')+'</div>';
121			
122			//notificationData = JSON.parse(notification.notification_data);
123			notificationData = notification.notification_data;
124			
125			realPrice = `${new Intl.NumberFormat('lt-LT', {minimumFractionDigits: 0,}).format(notificationData.to)} €`;
126			oldPrice = `${new Intl.NumberFormat('lt-LT', {minimumFractionDigits: 0,}).format(notificationData.from)} €`;
127			
128			procentage = 0;
129			procentageClass = '';
130			
131			if(notificationData.to < notificationData.from)
132			{
133				procentage = '-'+Math.round(notificationData.from - notificationData.to);
134				procentageClass = 'lower-price';
135			}
136			else
137			{
138				procentage = '+'+Math.round(notificationData.to - notificationData.from);
139				procentageClass = 'bigger-price';
140			}
141			
142			priceChangeProcentage = `<span class="new-price-procentage ${procentageClass}">${procentage} €</span>`;
143// 			priceChangeOldPrice = '<span class="old-price">'+oldPrice+'</span>';
144			dataNotification = ' data-filter="price-change"';
145			
146		}
147		else if(notification.notification_type == 2) // atvyko
148		{
149			productArrived = '<div class="product-arrived-badge">'+getTranslate('accountNotificationLabelArrived')+'</div>';
150			dataNotification = ' data-filter="arrival"';
151		}
152		else if(notification.notification_type == 3) // nauji
153		{
154			productArrived = '<div class="product-new-badge">'+getTranslate('accountNotificationLabelNew')+'</div>';
155			dataNotification = ' data-filter="new"';
156		}
157		else if(notification.notification_type == 4) // special
158		{
159			productArrived = '<div class="product-special-badge">'+getTranslate('accountNotificationLabelSpecialOffer')+'</div>';
160			dataNotification = ' data-filter="special"';
161		}
162		
163		if(notification.readed == 0)
164		{
165			readedClass = ' notification-unreaded';
166		}
167	}
168	
169	availabilityLeftBadge = getTranslate('AvailabilityStatus_'+data.availability+'_Title');
170	availabilityRightBadge = getTranslate('AvailabilityStatus_'+data.availability+'_DurationTitle');
171	
172	
173	notificationsEnabled = '';
174	favoritedEnabled = '';
175	favoritedEnabledText = getTranslate('ProductCardAddFavorite');
176	notificationsArrival = 'false';
177	notificationsPriceChange = 'false';
178	notificationsChannelSMS = 'false';
179	notificationsChannelEmail = 'false';
180	reservedEnabled = '';
181	reservedDisabled = '';
182	reservedText = getTranslate('ProductCardReserveNow');
183	
184	if(typeof ClasstrucksUser !== 'undefined')
185	{
186		if(ClasstrucksUser.reservations)
187		{
188			if(ClasstrucksUser.reservations.includes(product.code))
189			{
190				reservedEnabled = ' reserved';
191				reservedDisabled = ' disabled';
192				reservedText = getTranslate('ProductCardAlreadyReserved');
193			}
194		}
195
196		if(ClasstrucksUser.productNotifications)
197		{
198			if (product.code in ClasstrucksUser.productNotifications) {
199				if(ClasstrucksUser.productNotifications[product.code].arrival == 1 || ClasstrucksUser.productNotifications[product.code].price_change == 1)
200				{
201					notificationsEnabled = ' notification-enabled';
202					notificationsArrival = ClasstrucksUser.productNotifications[product.code].arrival;
203					notificationsPriceChange = ClasstrucksUser.productNotifications[product.code].price_change;
204					notificationsChannelSMS = ClasstrucksUser.productNotifications[product.code].sms;
205					notificationsChannelEmail = ClasstrucksUser.productNotifications[product.code].email;
206				}
207			}
208		}
209		
210		if(ClasstrucksUser.favorites)
211		{
212			if(ClasstrucksUser.favorites.includes(product.code))
213			{
214				favoritedEnabled = ' favorited';
215				favoritedEnabledText = getTranslate('ProductCardAlreadyAddedFavorite');
216			}
217		}
218	}
219	
220	let deliveryOnReservationBadge = "";
221	
222	if (product.availability == 4 || product.availability == 5) {
223	    deliveryOnReservationBadge = `
224	    <div class="availability-badge-on-img-block">
225	        <div class="availability-badge-on-img-inner">${availabilityLeftBadge}</div>
226	        <div class="availability-badge-sliced-block"></div>
227	    </div>`
228	}
229	
230	let showDiscountPrice = product.is_discounted;
231
232	galleryUrls = product.galleryImages.map(image => {
233		const formattedImage = image.toLowerCase().replace('.jpg', '_1024x683.jpg');
234		
235		return `${formattedImage}`;
236	});
237	
238	let totalImagesCount = galleryUrls.length;
239	let productUrl = getProductUrl(product.permalink, product.category);
240
241	let mainImageUrl = product.mainImageUrl || '';
242	
243	if(mainImageUrl != '')
244	{
245		mainImageUrl = mainImageUrl.replace('.jpg', '_1024x683.jpg');
246	}
247	
248	let videoUrl = product.youtubeVideoId
249		? `https://www.youtube.com/embed/${product.youtubeVideoId}`
250		: '';
251	
252	if(galleryUrls.length < 1)
253	{
254		mainImageUrl = getImagePlaceholder(product);
255		galleryUrls.push(mainImageUrl);
256	}
257
258	const html = `
259<div class="horizontal-product-card-with-slider${readedClass}"${dataNotification}>
260		<div class="product-information"
261			data-product-id="${productId}"
262			data-product-code="${productId}"
263			data-product-title="${product.title}"
264			data-product-price="${productPrice}"
265			data-product-price-lt-eur="${data.price_lt_eur}"
266			data-product-price-es-eur="${data.price_es_eur}"
267			data-product-price-pl-eur="${data.price_pl_eur}"
268			data-product-price-nl-eur="${data.price_nl_eur}"
269			data-product-price-lt-pln="${data.price_lt_pln}"
270			data-product-price-es-pln="${data.price_es_pln}"
271			data-product-price-pl-pln="${data.price_pl_pln}"
272			data-product-price-nl-pln="${data.price_nl_pln}"
273			data-product-country_code="${data.countryCode}"
274			data-product-location="${data.location}"
275			data-product-availability="${data.availability}"
276			data-product-code="${data.code}"
277			data-product-image="${mainImageUrl}"
278			data-product-video-url="${videoUrl}"
279			data-product-gallery="${[...galleryUrls].join(',')}"
280			data-product-country-code="${data.countryCode}">
281		</div>
282
283		<div class="horizontal-first-column-image-slider" data-slider-product-availability="${product.availability}">
284		
285		${showDiscountPrice 
286			? (
287				'<div class="custom-product-card-discount-price-badge-block">' +
288					'<div class="custom-product-card-discount-price-symbol-block">' +
289						'<div class="custom-product-card-discount-price-symbol-icon"></div>' +
290					'</div>' +
291					'<div class="custom-product-card-discount-price-text">' +
292						getTranslate("productDiscountTopBadgeText") +
293					'</div>' +
294				'</div>'
295			) 
296			: ''
297		}
298			
299			<div class="horizontal-slider-header">
300				<div class="${(typeof notification !== 'undefined' && notification !== null && typeof notification.notification_type !== 'undefined' && showDiscountPrice) 
301                    ? 'product-card-slider-badges price-change' 
302                    : 'product-card-slider-badges'}">
303					${priceChangedBadge}
304					${productArrived}
305				${data.truckPackage === '1 now-commented' ? '<button class="horizontal-package-button">Volvo paketas</button>' : ''}
306				</div>
307				<div class="horizontal-slider-buttons">
308				${videoUrl ? `
309							<button class="video-button" data-product-id="${product.code}" data-video-url="${videoUrl}">
310								<div class="video-button-icon"></div>
311							</button>` : ''}
312					<button class="images-quantity-button" data-product-id="${productId}">
313						<div class="images-quantity-icon"></div>
314						${totalImagesCount}
315					</button>
316				</div>
317			</div>
318			<a href="${productUrl}" class="horizontal-product-card-link">
319				<div class="horizontal-slider-wrapper">
320					${deliveryOnReservationBadge}
321					${galleryUrls.slice(0, 5).map(url => `<img src="${url.replace('full','thumbnails').replace('1024x683','335x252')}" class="horizontal-slider-image" alt="Product Image" />`).join('')}
322				</div>
323			</a>
324			<div class="horizontal-indicator-wrapper"></div>
325			<button class="horizontal-slider-arrow horizontal-left-arrow">&lt;</button>
326			<button class="horizontal-slider-arrow horizontal-right-arrow">&gt;</button>
327		</div>
328
329		<div class="horizontal-second-column-card-content-after-images">
330			<div class="horizontal-second-column-first-part">
331				<div class="horizontal-product-header-location">
332					<div class="location">
333						<div class="location-flag-icon flag-${data.countryCode}"></div>
334						${data.location}
335					</div>
336					<span class="horizontal-location-code">${data.code}</span>
337				</div>
338				<a href="${productUrl}" class="horizontal-product-card-link">
339					<h2 class="horizontal-product-title">${product.title}</h2>
340				</a>
341				<div class="product-card-specs-wrapper">
342					<div class="product-card-specs">
343						${data.registrationDate ? `<div class="registration-date"><div class="registration-date-icon"></div>${data.registrationDate}</div>` : (data.year ? `<div class="registration-date"><div class="registration-date-icon"></div>${data.year}</div>` : '')}
344						${data.mileage ? `<div class="kilometers"><div class="mileage-icon"></div>${data.mileage.replace(/\B(?=(\d{3})+(?!\d))/g, ",")} km</div>` : ''}
345						${data.operatingHours ? `<div class="kilometers"><div class="mileage-icon"></div>${data.operatingHours} h</div>` : ''}
346						${data.euroStandard ? `<div class="euro-standard"><div class="euro-standard-icon"></div>${data.euroStandard}</div>` : ''}
347						${(data.horsePower && parseInt(data.horsePower) > 0) ? `<div class="horse-power"><div class="horse-power-icon"></div>${data.horsePower} HP</div>` : ''}
348					</div>
349				</div>
350			</div>
351			<div class="horizontal-second-column-second-part">
352				<div class="availability">
353					<span class="badge-availability left-badge priority-color-${data.availability}">
354						${availabilityLeftBadge}
355						<div class="tooltip-wrapper">
356							<span class="tooltip">
357								${getTranslate('AvailabilityStatus_'+data.availability+'_Description')}
358							</span>
359						</div>
360					</span>
361					<span class="right-badge">${availabilityRightBadge}</span>
362				</div>
363			</div>
364		</div>
365
366		<div class="horizontal-third-column">
367			<div class="horizontal-notification-favorite-buttons">
368				<button class="notification-button${notificationsEnabled}" data-product-id="${product.code}" data-channel-email="${notificationsChannelEmail}" data-channel-sms="${notificationsChannelSMS}" data-arrival="${notificationsArrival}" data-price_change="${notificationsPriceChange}">
369					<div class="notification-btn-icon"></div>
370					<span>${getTranslate('ProductCardNotifications')}</span>
371				</button>
372				<button class="favorite-button${favoritedEnabled}" data-product-id="${productId}">
373					<div class="favorite-btn-icon"></div>
374					<span data-favorite-text="${getTranslate('ProductCardAlreadyAddedFavorite')}" data-unfavorite-text="${getTranslate('ProductCardAddFavorite')}">${favoritedEnabledText}</span>
375				</button>
376			</div>
377			<div class="horizontal-third-column-last-blocks">
378				<a href="${productUrl}" class="horizontal-product-card-link">
379					${
380				  showDiscountPrice
381					? (
382						'<div class="' +
383						  (
384							typeof notification !== "undefined" &&
385							notification !== null &&
386							typeof notification.notification_type !== "undefined"
387							  ? "product-card-discount-price-block horizontal price-change"
388							  : "product-card-discount-price-block horizontal"
389						  ) +
390						'">' +
391						  '<div class="product-card-discount-price-inner-block">' +
392							'<div class="product-card-discount-symbol-block">' +
393							  '<div class="product-card-discount-symbol-icon"></div>' +
394							'</div>' +
395							
396							'<div class="product-card-price">' +
397							  '<span class="product-card-price ' +
398								waitingmatrixEnabled +
399								'" data-product-id="' + product.code + '">' +
400								realPrice +
401							  '</span>' +
402							'</div>' +
403						  '</div>' +
404
405						  '<div class="product-card-old-price-vat-block">' +
406							'<div>' +
407							  '<p class="horizontal-without-pvm">' +
408								(currentLanguage == "lt" ? "Be PVM" : "") +
409							  "</p>" +
410							"</div>" +
411							'<div class="horizontal-price">' +
412							  priceChangeProcentage +
413							  priceChangeOldPrice +
414							'</div>' +
415						  "</div>" +
416
417						"</div>"
418					  )
419					: (
420						'<div class="horizontal-price">' +
421						  '<span class="product-card-price ' + waitingmatrixEnabled +
422							'" data-product-id="' + product.code + '">' +
423							realPrice +
424						  '</span>' +
425						  priceChangeOldPrice +
426						  '<p class="horizontal-without-pvm">' +
427							(currentLanguage == "lt" ? "Be PVM" : "") +
428						  '</p>' +
429						  priceChangeProcentage +
430						'</div>'
431					  )
432				}
433				</a>
434				<div class="horizontal-gray-border"></div>
435				<div class="product-card-cta-buttons">
436					<button class="reservation-button" data-product-id="${productId}">${getTranslate('ProductCardGetOffer')}</button>
437					<button class="reserve-now-button${reservedEnabled}" data-product-id="${productId}"${reservedDisabled}>
438						<div class="reserve-now-btn-icon"></div>
439						<span data-reserve-text="${getTranslate('ProductCardReserveNow')}" data-reserved-text="${getTranslate('ProductCardAlreadyReserved')}">${reservedText}</span>
440					</button>
441				</div>
442			</div>
443		</div>
444	</div>`;
445
446	return html;
447}

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.