Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ndla/article-scripts

Package Overview
Dependencies
Maintainers
10
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 2.1.0 to 2.1.1-alpha.20

27

es/figureScripts.js

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

import { copyTextToClipboard } from '@ndla/util';
import jump from 'jump.js';
import { forEachElement } from './domHelpers';

@@ -116,3 +117,29 @@ export var toggleLicenseInfoBox = function toggleLicenseInfoBox() {

};
export var addEventListenerForNotionExpandButton = function addEventListenerForNotionExpandButton() {
forEachElement('button[data-notion-expand-media]', function (el) {
var target = el;
target.onclick = function () {
var id = target.getAttribute('data-notion-media-id');
var media = document.getElementById(id);
if (media && target.dataset.expanded) {
media.classList.remove('expanded');
media.classList.add('fadeOut');
target.classList.remove("expanded");
delete target.dataset.expanded;
} else if (media) {
target.classList.add("expanded");
media.classList.add('expanded');
media.classList.remove('fadeOut');
target.dataset.expanded = true;
jump(media, {
duration: 300,
offset: -150
});
}
};
});
};
var handler = function handler() {

@@ -119,0 +146,0 @@ return updateIFrameDimensions(false);

5

es/index.js

@@ -10,3 +10,3 @@ /**

import { addFilelistTooltipListners } from './fileListScript';
import { addCopyToClipboardListeners, updateIFrameDimensions, addEventListenerForResize, removeEventListenerForResize, toggleLicenseInfoBox, addEventListenerForFigureZoomButton } from './figureScripts';
import { addCopyToClipboardListeners, updateIFrameDimensions, addEventListenerForResize, removeEventListenerForResize, toggleLicenseInfoBox, addEventListenerForFigureZoomButton, addEventListenerForNotionExpandButton } from './figureScripts';
import { addShowDialogClickListeners, removeShowDialogClickListeners, addCloseDialogClickListeners } from './dialogScripts';

@@ -38,3 +38,4 @@ import { addToggleAlternativeVideoListener } from './alternativeVideoPlugin';

addEventListenerForFigureZoomButton();
addEventListenerForNotionExpandButton();
};
export { initTableScript, removeTableEventListeners, updateIFrameDimensions, addFactBoxClickListener, removeFactBoxClickListener, addEventListenerForResize, removeEventListenerForResize, addCloseDialogClickListeners, addCopyToClipboardListeners, addShowConceptDefinitionClickListeners, addShowDialogClickListeners, addToggleAlternativeVideoListener, removeShowDialogClickListeners, addDetailsEventListeners, removeDetailsEventListeners, addFootnoteClickListeners, toggleLicenseInfoBox, toggleRelatedArticles, addFilelistTooltipListners, initArticleTabs, addEventListenerForFigureZoomButton };
export { initTableScript, removeTableEventListeners, updateIFrameDimensions, addFactBoxClickListener, removeFactBoxClickListener, addEventListenerForResize, removeEventListenerForResize, addCloseDialogClickListeners, addCopyToClipboardListeners, addShowConceptDefinitionClickListeners, addShowDialogClickListeners, addToggleAlternativeVideoListener, removeShowDialogClickListeners, addDetailsEventListeners, removeDetailsEventListeners, addFootnoteClickListeners, toggleLicenseInfoBox, toggleRelatedArticles, addFilelistTooltipListners, initArticleTabs, addEventListenerForFigureZoomButton, addEventListenerForNotionExpandButton };

35

lib/figureScripts.js

@@ -6,8 +6,12 @@ "use strict";

});
exports.removeEventListenerForResize = exports.addEventListenerForResize = exports.addEventListenerForFigureZoomButton = exports.updateIFrameDimensions = exports.addCopyToClipboardListeners = exports.toggleLicenseInfoBox = void 0;
exports.removeEventListenerForResize = exports.addEventListenerForResize = exports.addEventListenerForNotionExpandButton = exports.addEventListenerForFigureZoomButton = exports.updateIFrameDimensions = exports.addCopyToClipboardListeners = exports.toggleLicenseInfoBox = void 0;
var _util = require("@ndla/util");
var _jump = _interopRequireDefault(require("jump.js"));
var _domHelpers = require("./domHelpers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**

@@ -137,2 +141,31 @@ * Copyright (c) 2016-present, NDLA.

var addEventListenerForNotionExpandButton = function addEventListenerForNotionExpandButton() {
(0, _domHelpers.forEachElement)('button[data-notion-expand-media]', function (el) {
var target = el;
target.onclick = function () {
var id = target.getAttribute('data-notion-media-id');
var media = document.getElementById(id);
if (media && target.dataset.expanded) {
media.classList.remove('expanded');
media.classList.add('fadeOut');
target.classList.remove("expanded");
delete target.dataset.expanded;
} else if (media) {
target.classList.add("expanded");
media.classList.add('expanded');
media.classList.remove('fadeOut');
target.dataset.expanded = true;
(0, _jump["default"])(media, {
duration: 300,
offset: -150
});
}
};
});
};
exports.addEventListenerForNotionExpandButton = addEventListenerForNotionExpandButton;
var handler = function handler() {

@@ -139,0 +172,0 @@ return updateIFrameDimensions(false);

@@ -60,2 +60,8 @@ "use strict";

});
Object.defineProperty(exports, "addEventListenerForNotionExpandButton", {
enumerable: true,
get: function get() {
return _figureScripts.addEventListenerForNotionExpandButton;
}
});
Object.defineProperty(exports, "addShowDialogClickListeners", {

@@ -201,4 +207,5 @@ enumerable: true,

(0, _figureScripts.addEventListenerForFigureZoomButton)();
(0, _figureScripts.addEventListenerForNotionExpandButton)();
};
exports.initArticleScripts = initArticleScripts;
{
"name": "@ndla/article-scripts",
"version": "2.1.0",
"version": "2.1.1-alpha.20+22d4e1c49",
"description": "A collection of functions for making article content responsive (and interactive)",

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

"dependencies": {
"@ndla/util": "^2.0.2",
"@ndla/util": "^2.0.3-alpha.64+22d4e1c49",
"focus-trap": "^6.7.3",

@@ -31,3 +31,3 @@ "jump.js": "^1.0.2",

},
"gitHead": "7d6db8f3945947b35bdbb3c38229dec942d43ec1"
"gitHead": "22d4e1c498b4c967fa6463ce0a8b8ee3bbd2336e"
}

@@ -8,3 +8,3 @@ # ndla-article-scripts

```sh
$ npm install ndla-article-scripts
npm install @ndla/article-scripts
```

@@ -15,3 +15,3 @@

```sh
$ yarn add ndla-article-scripts
yarn add @ndla/article-scripts
```

@@ -18,0 +18,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc