Forum Discussion
Copy text from screen of published module?
Hey Josh, I would love to see the script you came up with.
- JoshOlsen-132a04 years agoCommunity Member
Hey Phil,
The Script has to regularly poll the DOM and iterate over the SVG text elements.
It's not perfect, hence being a prototype, but it solves a problem I have.
var a11y = {
intervalId: null,
toUnlock: [],
pollForSVGTextElements: function() {
var textEls = document.querySelectorAll('svg g.vector-text-item');
a11y.toUnlock = [];
var textElParent = null;
textEls.forEach((textEl) => {
textElParent = textEl.parentElement;
if (textElParent.classList.contains('uneventable')) {
a11y.toUnlock.push(textElParent);
}
});
a11y.removeClass();
},
removeClass: function() {
a11y.toUnlock.forEach((lockedEl) => {
lockedEl.classList.remove('uneventable');
});
},
init: function() {
a11y.intervalId = setInterval(function() {
a11y.pollForSVGTextElements();
}, 1000);
}
}
a11y.init();- PhilRobinson4 years agoCommunity Member
Thanks for sharing.
- BogdanHotea-0ef4 years agoCommunity Member
Hi Josh,
I'm interested in trying out your solution for this, but don't know where to begin.
Can you please tell me where the CSS and JS need to go?
For example, once I export the slides I need, which file (or files) do I need to open to insert the code? Is there a specific spot inside the file that the code needs to be added to?
- JoshOlsen-132a04 years agoCommunity Member
Hey Bogdan 👋
Sorry for the late reply. I don't seem to be getting alerts.
You need to publish the slides as either "web" or "LMS".
Both the CSS and JS go in the published
story.html
file for "web" publish or theindex_lms.html
file for "LMS" publish.Place the CSS within an existing
STYLE
element in theHEAD
element of the HTML file:<head>
...
<style>
html, body { height: 100%; padding: 0; margin: 0 }
#app { height: 100%; width: 100%; }
-->> add CSS here <<--
</style>
...
</head>And add the JS in a new
SCRIPT
tag before the closingBODY
tag:...
<link rel="stylesheet" href="html5/data/css/output.min.css" data-noprefix/>
<script>
-->> add JS here <<--
</script>
</body>This is a post-publish hack so you'll need to make the above changes every time you make a change to the .story file.
Related Content
- 9 months ago
- 22 days ago