PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.4.1
Block Animations, Motion & Scroll Effects – Ghost Kit v3.4.1
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / blocks / gist / frontend.js

frontend.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.4.1, at gutenberg/blocks/gist/frontend.js

45 lines 981 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Block Gist
3 */
4 const {
5 GHOSTKIT: { events },
6 gistSimple,
7 } = window;
8
9 /**
10 * Prepare Gists.
11 */
12 events.on(document, 'init.blocks.gkt', () => {
13 if (typeof gistSimple === 'undefined') {
14 return;
15 }
16
17 document
18 .querySelectorAll('.ghostkit-gist:not(.ghostkit-gist-ready)')
19 .forEach(($this) => {
20 $this.classList.add('ghostkit-gist-ready');
21
22 const match = /^https:\/\/gist.github.com?.+\/(.+)/g.exec(
23 $this.getAttribute('data-url')
24 );
25
26 if (match && typeof match[1] !== 'undefined') {
27 const options = {
28 id: match[1],
29 file: $this.getAttribute('data-file'),
30 caption: $this.getAttribute('data-caption'),
31 showFooter:
32 $this.getAttribute('data-show-footer') === 'true',
33 showLineNumbers:
34 $this.getAttribute('data-show-line-numbers') === 'true',
35 };
36
37 events.trigger($this, 'prepare.gist.gkt', { options });
38
39 gistSimple($this, options);
40
41 events.trigger($this, 'prepared.gist.gkt', { options });
42 }
43 });
44 });
45