@ndla/article-scripts
Advanced tools
Comparing version 0.5.12 to 0.5.13
@@ -9,3 +9,3 @@ /** | ||
import jump from 'jump.js'; | ||
import { forEachElement, inIframe, getElementOffset } from './domHelpers'; | ||
import { forEachElement, inIframe } from './domHelpers'; | ||
export var addFootnoteClickListeners = function addFootnoteClickListeners() { | ||
@@ -18,19 +18,10 @@ forEachElement('.c-footnotes__ref sup a, .c-footnotes__cite sup a', function (el) { | ||
e.preventDefault(); | ||
var scrollTarget = document.getElementById(hash.slice(1)); | ||
var scrollOffset = inIframe() ? -100 : -200; // different offset because of no menu in iFrame | ||
if (inIframe() && window.parent) { | ||
var elementOffset = getElementOffset(scrollTarget); | ||
window.parent.postMessage({ | ||
event: 'scrollTo', | ||
top: elementOffset.top - 100 // different offset because of no menu in iframe. | ||
}, '*'); | ||
} else { | ||
jump(hash, { | ||
offset: -200, | ||
duration: 300 | ||
}); | ||
} | ||
jump(hash, { | ||
offset: scrollOffset, | ||
duration: 300 | ||
}); | ||
}; | ||
}); | ||
}; |
@@ -28,17 +28,8 @@ "use strict"; | ||
e.preventDefault(); | ||
var scrollTarget = document.getElementById(hash.slice(1)); | ||
var scrollOffset = (0, _domHelpers.inIframe)() ? -100 : -200; // different offset because of no menu in iFrame | ||
if ((0, _domHelpers.inIframe)() && window.parent) { | ||
var elementOffset = (0, _domHelpers.getElementOffset)(scrollTarget); | ||
window.parent.postMessage({ | ||
event: 'scrollTo', | ||
top: elementOffset.top - 100 // different offset because of no menu in iframe. | ||
}, '*'); | ||
} else { | ||
(0, _jump.default)(hash, { | ||
offset: -200, | ||
duration: 300 | ||
}); | ||
} | ||
(0, _jump.default)(hash, { | ||
offset: scrollOffset, | ||
duration: 300 | ||
}); | ||
}; | ||
@@ -45,0 +36,0 @@ }); |
{ | ||
"name": "@ndla/article-scripts", | ||
"version": "0.5.12", | ||
"version": "0.5.13", | ||
"description": "A collection of functions for making article content responsive (and interactive)", | ||
@@ -30,3 +30,3 @@ "license": "GPL-3.0", | ||
}, | ||
"gitHead": "1b251643714d8c6167af3e9219d35e1af0602268" | ||
"gitHead": "edeb7d9691fa512a1e059fae47028cfd83a9684b" | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
108940
1733