MCPcopy Index your code
hub / github.com/ampproject/amphtml / installAutoLightboxExtension

Function installAutoLightboxExtension

src/auto-lightbox.js:27–55  ·  view source on GitHub ↗
(ampdoc)

Source from the content-addressed store, hash-verified

25 * @param {!./service/ampdoc-impl.AmpDoc} ampdoc
26 */
27export 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

Callers 1

bootstrapFunction · 0.90

Calls 6

isAmphtmlFunction · 0.90
chunkFunction · 0.90
isStoryDocumentFunction · 0.90
isSingleDocMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected