@ndla/article-scripts
Advanced tools
Comparing version 2.4.1 to 2.5.0
@@ -52,3 +52,3 @@ /** | ||
while (target.nodeName !== 'BODY' && !clickedInside) { | ||
while (target && target.nodeName !== 'BODY' && !clickedInside) { | ||
if (target.getAttribute('data-concept-id') || target.getAttribute('data-dialog-id')) { | ||
@@ -91,3 +91,2 @@ clickedInside = true; | ||
popup.style.top = "".concat(openBtnBottom - 500, "px"); | ||
var conceptNotionIdentifier = popup.querySelector('figcaption'); | ||
var viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); | ||
@@ -97,14 +96,12 @@ var popupTop = getElementOffset(popup).top; | ||
var offset = 0; | ||
var plainId = id.split('notion-')[1]; | ||
var conceptNotionIdentifier = openBtn.closest("#visual-element-".concat(plainId)); // checks if it is part of a notionblock | ||
if (conceptNotionIdentifier) { | ||
//checks if it is part of a notionblock | ||
if (conceptNotionIdentifier === null || conceptNotionIdentifier === void 0 ? void 0 : conceptNotionIdentifier.contains(openBtn)) { | ||
// Positions the popup so that it does not expand the page | ||
if (popupTop + popupHeight > documentHeight) { | ||
//Positions the popup so that it does not expand the page | ||
popup.style.top = "".concat(openBtnBottom - 900, "px"); | ||
popup.style.top = "".concat(openBtnBottom - popupHeight, "px"); | ||
} | ||
jump(popup, { | ||
offset: -((viewportHeight - popupHeight) / 2), | ||
duration: 300 | ||
}); | ||
offset = -((viewportHeight - popupHeight) / 2); | ||
} else { | ||
@@ -131,3 +128,3 @@ popup.style.top = "".concat(openBtnBottom + 20, "px"); | ||
if (inIframe() && window.parent) { | ||
if (!conceptNotionIdentifier && inIframe() && window.parent) { | ||
window.parent.postMessage({ | ||
@@ -134,0 +131,0 @@ event: 'scrollTo', |
@@ -63,3 +63,3 @@ "use strict"; | ||
while (target.nodeName !== 'BODY' && !clickedInside) { | ||
while (target && target.nodeName !== 'BODY' && !clickedInside) { | ||
if (target.getAttribute('data-concept-id') || target.getAttribute('data-dialog-id')) { | ||
@@ -102,3 +102,2 @@ clickedInside = true; | ||
popup.style.top = "".concat(openBtnBottom - 500, "px"); | ||
var conceptNotionIdentifier = popup.querySelector('figcaption'); | ||
var viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); | ||
@@ -108,14 +107,12 @@ var popupTop = (0, _domHelpers.getElementOffset)(popup).top; | ||
var offset = 0; | ||
var plainId = id.split('notion-')[1]; | ||
var conceptNotionIdentifier = openBtn.closest("#visual-element-".concat(plainId)); // checks if it is part of a notionblock | ||
if (conceptNotionIdentifier) { | ||
//checks if it is part of a notionblock | ||
if (conceptNotionIdentifier === null || conceptNotionIdentifier === void 0 ? void 0 : conceptNotionIdentifier.contains(openBtn)) { | ||
// Positions the popup so that it does not expand the page | ||
if (popupTop + popupHeight > documentHeight) { | ||
//Positions the popup so that it does not expand the page | ||
popup.style.top = "".concat(openBtnBottom - 900, "px"); | ||
popup.style.top = "".concat(openBtnBottom - popupHeight, "px"); | ||
} | ||
(0, _jump["default"])(popup, { | ||
offset: -((viewportHeight - popupHeight) / 2), | ||
duration: 300 | ||
}); | ||
offset = -((viewportHeight - popupHeight) / 2); | ||
} else { | ||
@@ -142,3 +139,3 @@ popup.style.top = "".concat(openBtnBottom + 20, "px"); | ||
if ((0, _domHelpers.inIframe)() && window.parent) { | ||
if (!conceptNotionIdentifier && (0, _domHelpers.inIframe)() && window.parent) { | ||
window.parent.postMessage({ | ||
@@ -145,0 +142,0 @@ event: 'scrollTo', |
{ | ||
"name": "@ndla/article-scripts", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "A collection of functions for making article content responsive (and interactive)", | ||
@@ -30,3 +30,3 @@ "license": "GPL-3.0", | ||
}, | ||
"gitHead": "298d5a979c3567dac82017d8d051b0fee0890939" | ||
"gitHead": "62b9f1deac1941e5a58497d5c0946278464bc48f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112082
1821