PageSourceSearch

https://www.suzuki.com.ar/scripts/model_page/Showcase.js

js suzuki.com.ar collected 2026-10-02 17:23:19 UTC 11,300 bytes, 239 lines download raw bytes

1/* This block will insert first loading content */
2
3let exteriorGallery = top.document.querySelector('#exteriorGalleryiFrame');
4const icon365 = top.document.querySelector('.icon365');
5let exteriorImage = top.document.querySelector('#exteriorGalleryImage');
6let interiorGalleryImage = top.document.querySelector('#interiorGalleryImage');
7
8let selectedColorExternal = top.document.querySelector('#selectedColorExternal');
9let selectedColorInternal = top.document.querySelector('#selectedColorInternal');
10
11let colorListExternal = top.document.querySelector('#listOfColorsExternals');
12let colorListInternal = top.document.querySelector('#listOfColorsInternals');
13
14let characteristics = top.document.querySelector('#characteristics');
15let versionProperties = top.document.querySelector('#versionProperties');
16let versionPrice = top.document.querySelector('#versionPrice');
17let featuresButtons = top.document.querySelector('#featuresButtons');
18
19const disclaimer = top.document.querySelector('.versionSelection .disclaimer');
20
21
22/* IDENTIFYING WHICH VERSION USER SELECTED */
23let selectedVersionObject;
24
25window.onload = () => {
26    if (versionsArrayUMB) {
27        selectedVersionObject = versionsArrayUMB[0];
28
29        document.querySelector(".name_version p").classList.add("active");
30
31        showcase();
32    }
33}
34
35const selectVersion = (e, nombreVersion) => {
36    /* Resetting the src in Html iFrame and Image tags  */
37    exteriorGallery.setAttribute("src","");
38    exteriorImage.setAttribute("src", "");
39
40    selectedVersionObject = versionsArrayUMB.find(e => e.nombreVersion === nombreVersion);
41
42    document.querySelectorAll(".name_version p").forEach(p => p.classList.remove("active"));
43    e.classList.add("active");
44
45    document.querySelector(".version-gallery_exterior_interior .tap-exterior").click();
46    showcase();
47
48}
49
50/* INITIAL LOAD INSERTION (WITHOUT ANY VERSION SELECTED) */
51const showcase = () => {
52    const exteriorGalleryBlock = document.querySelector("#exteriorGalleryBlock");
53    const interiorGalleryBlock = document.querySelector("#interiorGalleryBlock");
54
55    const tapExterior = document.querySelector(".tap-exterior");
56    const tapInterior = document.querySelector(".tap-interior");
57    //inserting exterior content
58    if (selectedVersionObject && selectedVersionObject.propiedadesExteriores.length > 0) {
59        tapExterior.style.display = 'block';
60        tapExterior.classList.add('active');
61        exteriorGalleryBlock.style.display = 'flex';
62        const urlExterior = selectedVersionObject.propiedadesExteriores[0].enlaceIframe;
63        const imageExterior = selectedVersionObject.propiedadesExteriores[0].image;
64        if(imageExterior){        
65            exteriorImage.setAttribute('src', imageExterior);
66            exteriorImage.style.opacity = 1;
67            exteriorGallery.style.display="none";
68            icon365.style.opacity= 0;
69        }else{
70            exteriorGallery.style.display="block";
71            icon365.style.opacity= 1;
72            exteriorGallery.setAttribute('src', urlExterior);
73        }
74        selectedColorExternal.innerHTML = `${selectedVersionObject.propiedadesExteriores[0].nombreColor}`;
75
76        colorListExternal.textContent = "";
77        for (let index = 0; index < selectedVersionObject.propiedadesExteriores.length; index++) {
78            colorListExternal.innerHTML += `
79                <div class="selected-color selected-color_extenal" style="${index == 0 ? "background-color:" + "var(--brand-secundary-border)" + ";" : ''};" onclick="pickingColorExterior(${index}, this)">
80                    <div class="inner-circle">
81                        <div class="background-circle" style="background-color: ${selectedVersionObject.propiedadesExteriores[index].color}"></div>
82                    </div>
83                </div>
84            `;
85        
86        }
87    }else{
88        
89        tapExterior.style.display = 'none';
90        tapExterior.classList.remove("active");
91        tapInterior.click();
92    }
93
94    //Inserting interior content
95    if (selectedVersionObject && selectedVersionObject.propiedadesInteriores.length > 0){
96        tapInterior.style.display = 'block';
97        interiorGalleryImage.setAttribute('src', selectedVersionObject.propiedadesInteriores[0].imageIntUrl);
98        interiorGalleryImage.style.opacity = 1;
99        selectedColorInternal.innerHTML = `${selectedVersionObject.propiedadesInteriores[0].nombreColor}`;
100        colorListInternal.textContent = "";
101        for (let index = 0; index < selectedVersionObject.propiedadesInteriores.length; index++) {
102            colorListInternal.innerHTML += `
103                <div class="selected-color selected-color_extenal" style="${index == 0 ? "background-color:" + "var(--brand-secundary-border)" + ";" : ''};" onclick="pickingColorInterior(${index}, this)">
104                    <div class="inner-circle">
105                        <div class="background-circle" style="background-color: ${selectedVersionObject.propiedadesInteriores[index].color}"></div>
106                    </div>
107                </div>        
108            `;
109        }
110    }else{
111        interiorGalleryBlock.style.display = "none";
112        tapInterior.style.display = "none";
113        tapInterior.classList.remove("active");
114    }
115
116    //Inserting features
117    if (selectedVersionObject) {
118        characteristics.innerHTML = `    
119            <p><strong>${selectedVersionObject.etiquetaMotor}</strong> ${selectedVersionObject.motor}</p>
120            <p><strong>${selectedVersionObject.etiquetaTransmision}</strong> ${selectedVersionObject.transmision} </p>
121            <p><strong>${selectedVersionObject.etiquetaPotencia}</strong> ${selectedVersionObject.potencia}</p>
122            <p><strong>${selectedVersionObject.etiquetaTorque}</strong> ${selectedVersionObject.torque}</p>
123        `;
124        versionProperties.innerHTML = `
125            <h5 class="title-version">${selectedVersionObject.etiquetaVersion}</h5>
126            <h2 class="title-3 model-title">${selectedVersionObject.nombreVersion}</h2>
127        `;
128        versionPrice.innerHTML = `
129            <p>${selectedVersionObject.etiquetaPrecioDesde}</p>
130            <p class="price-label">${selectedVersionObject.precioDesde}</p>
131            <p>${selectedVersionObject.etiquetaCuotaReferencial}</p>
132            <p class="price-label secondary">${selectedVersionObject.cuotaReferencial}</p>
133        `;
134
135        if(selectedVersionObject.botonesVersion.length > 0){
136            featuresButtons.innerHTML = `
137                <a class="version-features_buttons_black w-100" href="${selectedVersionObject.botonesVersion[0].href}" target="${selectedVersionObject.botonesVersion[0].target}">${selectedVersionObject.botonesVersion[0].name}</a>
138            `;
139        }
140
141        if(selectedVersionObject.botonesVersion.length > 1){
142            featuresButtons.innerHTML = `
143                <a class="version-features_buttons_black w-100" href="${selectedVersionObject.botonesVersion[0].href}" target="${selectedVersionObject.botonesVersion[0].target}">${selectedVersionObject.botonesVersion[0].name}</a>
144                <a class="version-features_buttons_white mt-3 w-100" href="${selectedVersionObject.botonesVersion[1].href}" target="${selectedVersionObject.botonesVersion[1].target}">${selectedVersionObject.botonesVersion[1].name}</a>
145            `;
146        }        
147
148       // disclaimer.innerHTML = selectedVersionObject.disclaimer;
149    }
150}
151
152/* This code block will handle show or hide interior/exterior block */
153let exteriorGalleryBlock = top.document.querySelector('#exteriorGalleryBlock');
154let interiorGalleryBlock = top.document.querySelector('#interiorGalleryBlock');
155
156const exterior = (e) =>{
157    exteriorGalleryBlock.style.display = "flex";
158    interiorGalleryBlock.style.display = "none";
159
160    document.querySelectorAll(".version-gallery_exterior_interior p").forEach(p => p.classList.remove("active"));
161    e.classList.add("active");
162    
163}
164const interior = (e) =>{
165    exteriorGalleryBlock.style.display = "none";
166    interiorGalleryBlock.style.display = "flex";
167
168    document.querySelectorAll(".version-gallery_exterior_interior p").forEach(p => p.classList.remove("active"));
169    e.classList.add("active");
170}
171
172
173/* This code block will handle the version selection */
174
175
176
177/* This code block will handle color picker selection */
178
179const pickingColorExterior = (index, e) => {
180    const image = selectedVersionObject.propiedadesExteriores[index].image;
181    const urlExterior = selectedVersionObject.propiedadesExteriores[index].enlaceIframe;
182    if (image) {
183        if (exteriorGallery.hasAttribute("src") && exteriorGallery.getAttribute("src").trim() !== "") {
184            exteriorGallery.style.opacity = 0;
185            icon365.style.opacity = 0;
186            exteriorGallery.addEventListener("transitionend", () => {
187                exteriorGallery.style.display = "none";
188                exteriorImage.style.display = "flex";
189                exteriorImage.setAttribute('src', image);
190                exteriorImage.style.opacity = 1;
191                icon365.style.display = "none";
192                exteriorGallery.removeAttribute("src");
193            }, { once: true });
194        } else {
195
196            exteriorGallery.style.display = "none";
197            exteriorImage.style.display = "flex";
198            exteriorImage.style.opacity = 0;
199            exteriorImage.addEventListener("transitionend", () => {
200                exteriorImage.setAttribute('src', image);
201                exteriorImage.style.opacity = 1;
202            }, { once: true })
203        }
204    } else {
205        if (exteriorImage.hasAttribute("src") && exteriorImage.getAttribute("src").trim() !== "") {
206            exteriorImage.style.opacity = 0;
207            exteriorImage.addEventListener("transitionend", () => {
208                exteriorImage.removeAttribute('src');
209                exteriorImage.style.opacity = 1;
210                exteriorGallery.style.display = "block";
211                exteriorGallery.style.opacity = 1;
212                exteriorGallery.setAttribute('src', urlExterior);
213                exteriorImage.removeAttribute('src');
214            }, { once: true })
215        } else {
216            exteriorGallery.style.display="block";
217            exteriorGallery.style.opacity = 1;
218            exteriorGallery.setAttribute('src', urlExterior);
219        }
220    }
221    //exteriorGallery.setAttribute('src', selectedVersionObject.propiedadesExteriores[index].enlaceIframe);
222    selectedColorExternal.innerHTML = `${selectedVersionObject.propiedadesExteriores[index].nombreColor}`;
223
224    listOfColorsExternals.querySelectorAll("div.selected-color").forEach(div => div.style = "");
225    e.style.backgroundColor = `${"var(--brand-secundary-border)"}`;
226
227}
228
229const pickingColorInterior = (index, e) => {
230    interiorGalleryImage.style.opacity = 0;
231    interiorGalleryImage.addEventListener("transitionend", ()=>{
232        interiorGalleryImage.setAttribute('src', selectedVersionObject.propiedadesInteriores[index].imageIntUrl);
233        interiorGalleryImage.style.opacity = 1;
234    }, {once:true});
235    selectedColorInternal.innerHTML = `${selectedVersionObject.propiedadesInteriores[index].nombreColor}`;
236
237    colorListInternal.querySelectorAll("div.selected-color").forEach(div => div.style = "");
238    e.style.backgroundColor = `${"var(--brand-secundary-border)"}`;
239}

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.