Skip to content

Instantly share code, notes, and snippets.

@drzax
Created August 17, 2017 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drzax/6c2a9fce59714cd9c3b1cbe8c44cb272 to your computer and use it in GitHub Desktop.
Save drzax/6c2a9fce59714cd9c3b1cbe8c44cb272 to your computer and use it in GitHub Desktop.
/** @jsx Preact.h */
import Preact from 'preact';
import Stage from './components/stage';
const container = document.querySelector('[data-encryption-explainer]');
const stage = container.querySelector('.scrollyteller-stage');
// Get rid of support message.
document.querySelector('.interactive_support_msg').parentNode.remove();
const init = e => {
console.log('init', e.detail);
let stage = container.querySelector('.scrollyteller-stage');
Preact.render(
<Stage container={container} activated={e.detail.activated} deactivated={e.detail.deactivated} />,
stage
);
container.removeEventListener('mark', init);
};
// Initialise
if (stage) {
console.log('stage already set');
init({
detail: {
activated: stage.__SCROLLYTELLER__.activated,
deactivated: stage.__SCROLLYTELLER__.deactivated
}
});
} else {
console.log('waiting for the stage');
document.addEventListener('mark', init);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment