🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@ndla/article-scripts

Package Overview
Dependencies
Maintainers
4
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndla/article-scripts - npm Package Compare versions

Comparing version

to
0.5.14

25

es/footnoteScripts.js

@@ -9,3 +9,3 @@ /**

import jump from 'jump.js';
import { forEachElement, inIframe } from './domHelpers';
import { forEachElement, inIframe, getElementOffset } from './domHelpers';
export var addFootnoteClickListeners = function addFootnoteClickListeners() {

@@ -18,10 +18,23 @@ forEachElement('.c-footnotes__ref sup a, .c-footnotes__cite sup a', function (el) {

e.preventDefault();
var scrollOffset = inIframe() ? -100 : -200; // different offset because of no menu in iFrame
var scrollTarget = document.getElementById(hash.slice(1));
jump(hash, {
offset: scrollOffset,
duration: 300
});
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.
}, '*');
jump(hash, {
offset: -100,
duration: 300
});
} else {
jump(hash, {
offset: -200,
duration: 300
});
}
};
});
};

@@ -28,8 +28,21 @@ "use strict";

e.preventDefault();
var scrollOffset = (0, _domHelpers.inIframe)() ? -100 : -200; // different offset because of no menu in iFrame
var scrollTarget = document.getElementById(hash.slice(1));
(0, _jump.default)(hash, {
offset: scrollOffset,
duration: 300
});
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.
}, '*');
(0, _jump.default)(hash, {
offset: -100,
duration: 300
});
} else {
(0, _jump.default)(hash, {
offset: -200,
duration: 300
});
}
};

@@ -36,0 +49,0 @@ });

{
"name": "@ndla/article-scripts",
"version": "0.5.13",
"version": "0.5.14",
"description": "A collection of functions for making article content responsive (and interactive)",

@@ -30,3 +30,3 @@ "license": "GPL-3.0",

},
"gitHead": "edeb7d9691fa512a1e059fae47028cfd83a9684b"
"gitHead": "d069c980fcbc8a2ec4e2cebccc1ddeb129e526e3"
}