|
116 | 116 | <img src="{{.URLPrefix}}/assets/images/fleet-logo.svg" />
|
117 | 117 | </header>
|
118 | 118 | <section id="main-content">
|
119 |
| - <h1>Enroll your device to Fleet</h1> |
| 119 | + <h1> |
| 120 | + Enroll your |
| 121 | + <span data-attribute="dynamic-device-type">iPhone or iPad</span> to |
| 122 | + Fleet |
| 123 | + </h1> |
120 | 124 | <p class="page-description">
|
121 |
| - Follow the instructions below to download and install the Fleet profile |
122 |
| - on your device. |
| 125 | + On your |
| 126 | + <span data-attribute="dynamic-device-type">iPhone or iPad</span>, follow |
| 127 | + the instructions below to download and install the Fleet profile. |
123 | 128 | </p>
|
124 | 129 | <ol>
|
125 | 130 | <li>
|
@@ -159,22 +164,34 @@ <h1>Enroll your device to Fleet</h1>
|
159 | 164 | </ol>
|
160 | 165 | </section>
|
161 | 166 | <script>
|
162 |
| - const os = navigator.userAgent.includes("iPhone") ? "ios" : "iPadOS"; |
163 |
| - |
164 |
| - const profileDownloadedImg = document.querySelector( |
165 |
| - ".profile-downloaded-img" |
166 |
| - ); |
167 |
| - const installProfileImg = document.querySelector(".install-profile-img"); |
168 |
| - |
169 |
| - // setting image src based on OS |
170 |
| - profileDownloadedImg.setAttribute( |
171 |
| - "src", |
172 |
| - `{{.URLPrefix}}/assets/images/${os}-profile-downloaded.png` |
173 |
| - ); |
174 |
| - installProfileImg.setAttribute( |
175 |
| - "src", |
176 |
| - `{{.URLPrefix}}/assets/images/${os}-install-profile.png` |
177 |
| - ); |
| 167 | + document.addEventListener("DOMContentLoaded", function () { |
| 168 | + const userAgent = navigator.userAgent; |
| 169 | + const isIPhone = /iPhone/.test(userAgent); |
| 170 | + const isIPad = /iPad/.test(userAgent); |
| 171 | + |
| 172 | + // update text content for device type |
| 173 | + let deviceType = "iPhone or iPad"; // Default value |
| 174 | + |
| 175 | + if (isIPhone) { |
| 176 | + deviceType = "iPhone"; |
| 177 | + } else if (isIPad) { |
| 178 | + deviceType = "iPad"; |
| 179 | + } |
| 180 | + document |
| 181 | + .querySelectorAll('[data-attribute="dynamic-device-type"]') |
| 182 | + .forEach((el) => { |
| 183 | + el.textContent = deviceType; |
| 184 | + }); |
| 185 | + |
| 186 | + // update image src based on OS |
| 187 | + const osImagePrefix = isIPhone ? "ios" : "iPadOS"; |
| 188 | + document.querySelector( |
| 189 | + ".profile-downloaded-img" |
| 190 | + ).src = `{{.URLPrefix}}/assets/images/${osImagePrefix}-profile-downloaded.png`; |
| 191 | + document.querySelector( |
| 192 | + ".install-profile-img" |
| 193 | + ).src = `{{.URLPrefix}}/assets/images/${osImagePrefix}-install-profile.png`; |
| 194 | + }); |
178 | 195 | </script>
|
179 | 196 | </body>
|
180 | 197 | </html>
|
0 commit comments