PageSourceSearch

https://www.ilusso.com/wp-content/themes/aanWordpress/js/get-featured-inventory.js?=1771451380

js ilusso.com collected 2026-10-02 18:38:28 UTC 4,625 bytes, 100 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2    // Variables to control behavior
3    const numberOfEntries = 10; // Replace this to show a different number of entries
4    const includeYear = true;  // Set to false to exclude the year
5    const includeMake = true; // Set to false to exclude the make
6    const includeModel = true; // Set to false to exclude the model
7    let dealerLocation = "Costa Mesa"; 
8
9    fetch('/isapi_xml.php?module=inventory&pageID=741')
10        .then(response => response.json()) // Parse the JSON response
11        .then(data => {
12            // Select the container where the data will be displayed
13            let container = document.getElementById('inventory-display-cm'); //checking for element in Costa Mesa
14            if (!container) {
15
16                container = document.getElementById('inventory-display-pb') //if Costa Mesa Not Found, checking for Palm Beach
17
18                dealerLocation= "Palm Beach";
19            }
20            if (!container) {
21
22                container = document.getElementById('inventory-display-htx') //if Palm Beach Not Found, checking for Houston
23
24                dealerLocation= "Houston";
25            }
26            if (!container) {
27
28                container = document.getElementById('inventory-display-saz') //if Houston Not Found, checking for Scottsdale
29
30                dealerLocation= "Scottsdale";
31            }
32            
33            if(!container){
34                console.error('Container element with ID "inventory-display-xx" not found.');
35                return;
36            }
37
38            // Filter the entries by dealerLocation and get the most recent entries
39            const filteredEntries = data.filter(item => item.location === dealerLocation).slice(0, numberOfEntries);
40
41            // Loop through the filtered entries and create HTML for each
42            filteredEntries.forEach((item) => {
43                // Skip the item if the image_link matches the unwanted URL
44                if (item.image_link === 'https://www.ilusso.com/wp-content/themes/aanWordpress/images/ina_l.jpg?1736969828') {
45                    return; // Skip this iteration and move to the next one
46                }
47
48                // Create a link element to wrap the whole item
49                const link = document.createElement('a');
50                link.href = item.url_link || '#'; // Use the URL from the response or '#' as a fallback
51                link.target = '_blank'; // Open the link in a new tab
52
53                // Create the item div
54                const itemDiv = document.createElement('div');
55                itemDiv.className = 'inventory-item';
56
57                // Create an image element
58                const image = document.createElement('img');
59                image.src = item.image_link || 'https://www.ilusso.com/wp-content/uploads/iLusso-Logo-Schema.jpg'; // Fallback placeholder
60                image.alt = item.model || 'Vehicle Image';
61                image.loading = 'eager';
62
63                // Create a container for the details (year, make, model) to display in one line
64                const detailsDiv = document.createElement('p');
65                detailsDiv.style.display = 'flex';
66                detailsDiv.style.alignItems = 'center';
67                detailsDiv.style.marginTop = '5px';
68
69                // Combine year, make, and model into a single string without the labels
70                let detailsText = '';
71                if (includeYear) {
72                    detailsText += `${item.year || 'N/A'} `;
73                }
74                if (includeMake) {
75                    detailsText += `${item.make || 'N/A'} `;
76                }
77                if (includeModel) {
78                    detailsText += `${item.model || 'N/A'}`;
79                }
80
81                // Create a single span for the combined details
82                const detailsSpan = document.createElement('span');
83                detailsSpan.textContent = detailsText.trim(); // Trim extra spaces at the end
84
85                // Append the details span to the details div
86                detailsDiv.appendChild(detailsSpan);
87
88                // Append the image, details div, and item div to the link
89                itemDiv.appendChild(image);
90                itemDiv.appendChild(detailsDiv);
91                link.appendChild(itemDiv); // Append the entire itemDiv to the link
92
93                // Append the link to the container
94                container.appendChild(link);
95            });
96        })
97        .catch(error => {
98            console.error('Error fetching inventory data:', error);
99        });
100});

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.