|
1 | 1 | <template>
|
2 | 2 | <div
|
3 | 3 | class="tracking-consent nq-shadow"
|
4 |
| - :class="theme" |
| 4 | + :class="[ theme, safariFix ]" |
5 | 5 | v-if="uiRequired && uiAllowed"
|
6 | 6 | >
|
7 | 7 | {{ text.main }} ❤️
|
@@ -118,6 +118,7 @@ class TrackingConsent extends Vue {
|
118 | 118 |
|
119 | 119 | private static _instances: Set<TrackingConsent> = new Set();
|
120 | 120 | private uiRequired: boolean = false;
|
| 121 | + private safariFix: string = ''; |
121 | 122 |
|
122 | 123 | public static get _paq() {
|
123 | 124 | if (!window._paq || !Array.isArray(window._paq)) {
|
@@ -243,6 +244,29 @@ class TrackingConsent extends Vue {
|
243 | 244 | this._checkUiRequired();
|
244 | 245 | }
|
245 | 246 |
|
| 247 | + private mounted() { |
| 248 | + /* Safari IOS style fix */ |
| 249 | + const ua = window.navigator.userAgent; |
| 250 | + const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i); |
| 251 | + const webkit = !!ua.match(/WebKit/i); |
| 252 | + const iOSSafari = iOS && webkit && !ua.match(/CriOS/i); |
| 253 | +
|
| 254 | + if (iOSSafari) { |
| 255 | + let majorVersion = null; |
| 256 | +
|
| 257 | + if (/iP(hone|od|ad)/.test(navigator.platform)) { |
| 258 | + const match = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); |
| 259 | + majorVersion = parseInt(match[1], 10); |
| 260 | + } |
| 261 | +
|
| 262 | + if (majorVersion >= 13) { |
| 263 | + this.safariFix = 'ios-safari-13-fix'; |
| 264 | + } else if (majorVersion >= 12) { |
| 265 | + this.safariFix = 'ios-safari-12-fix'; |
| 266 | + } |
| 267 | + } |
| 268 | + } |
| 269 | +
|
246 | 270 | private destroyed() {
|
247 | 271 | /* Remove the event watching for consent changes on tab / window focus */
|
248 | 272 | document.removeEventListener('visibilitychange', this._onVisibilityChange);
|
@@ -413,6 +437,14 @@ export default TrackingConsent;
|
413 | 437 | padding: 2.5rem;
|
414 | 438 | }
|
415 | 439 |
|
| 440 | + .tracking-consent.ios-safari-13-fix { |
| 441 | + bottom: 74px; |
| 442 | + } |
| 443 | +
|
| 444 | + .tracking-consent.ios-safari-12-fix { |
| 445 | + bottom: 34px; |
| 446 | + } |
| 447 | +
|
416 | 448 | .button-group {
|
417 | 449 | margin-left: 0;
|
418 | 450 | margin-top: 16px;
|
|
0 commit comments