Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | 'use strict'; const hasTarget = require('../utils/has-target'); const { link, meta } = require('../utils/tag-builder'); module.exports = function apple(manifest) { let tags = []; if (manifest.apple === false) { return tags; } return tags.concat(links(manifest), metas(manifest)); }; function links(manifest) { let tags = []; if (!manifest.icons || !manifest.icons.length) { return tags; } return tags.concat(icons(manifest), mask(manifest)); } function icons(manifest) { let precomposed = manifest.apple && manifest.apple.precomposed ? '-precomposed' : ''; return manifest.icons .filter(icon => !icon.targets || hasTarget(icon, 'apple')) .map(icon => link({ rel: `apple-touch-icon${precomposed}`, href: icon.src, sizes: icon.sizes, }) ); } function mask(manifest) { return manifest.icons .filter(icon => hasTarget(icon, 'safari-pinned-tab')) .map(icon => link({ rel: 'mask-icon', href: icon.src, color: icon.safariPinnedTabColor, }) ); } function metas(manifest) { let tags = []; capability(manifest, tags); title(manifest, tags); statusBarStyle(manifest, tags); formatDetection(manifest, tags); return tags; } function capability(manifest, tags) { let webAppCapable = manifest.apple && manifest.apple.webAppCapable; let standalone = ['fullscreen', 'standalone'].includes(manifest.display); if ((standalone && webAppCapable !== false) || webAppCapable === true) { tags.push(meta({ name: 'apple-mobile-web-app-capable', content: 'yes' })); } } function title(manifest, tags) { if (manifest.name) { tags.push( meta({ name: 'apple-mobile-web-app-title', content: manifest.name }) ); } } function statusBarStyle(manifest, tags) { tags.push( meta({ name: 'apple-mobile-web-app-status-bar-style', content: manifest.apple && manifest.apple.statusBarStyle ? manifest.apple.statusBarStyle : 'default', }) ); } function formatDetection(manifest, tags) { if (manifest.apple && manifest.apple.formatDetection) { let detection = manifest.apple.formatDetection; let content = ''; if (detection.telephone === false) { content += 'telephone=no'; } if (content) { tags.push(meta({ name: 'format-detection', content })); } } } |