(ampdoc)
| 25 | * @param {!./service/ampdoc-impl.AmpDoc} ampdoc |
| 26 | */ |
| 27 | export function installAutoLightboxExtension(ampdoc) { |
| 28 | const {win} = ampdoc; |
| 29 | // Only enabled on single documents tagged as <html amp> or <html ⚡>. |
| 30 | if ( |
| 31 | !isAmphtml(win.document) || |
| 32 | !ampdoc.isSingleDoc() || |
| 33 | // Prevent loading auto lightbox when disabled using 'data-amp-auto-lightbox-disable' attribute (#37854) |
| 34 | // Check if HTML Tag has 'data-amp-auto-lightbox-disable' attribute |
| 35 | win.document.documentElement.hasAttribute('data-amp-auto-lightbox-disable') |
| 36 | ) { |
| 37 | return; |
| 38 | } |
| 39 | chunk( |
| 40 | ampdoc, |
| 41 | () => { |
| 42 | isStoryDocument(ampdoc).then((isStory) => { |
| 43 | // Do not enable on amp-story documents. |
| 44 | if (isStory) { |
| 45 | return; |
| 46 | } |
| 47 | Services.extensionsFor(win).installExtensionForDoc( |
| 48 | ampdoc, |
| 49 | 'amp-auto-lightbox' |
| 50 | ); |
| 51 | }); |
| 52 | }, |
| 53 | ChunkPriority_Enum.LOW |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @param {!Element} element |
no test coverage detected