import regex from '../regex' import { embed } from '../../helpers' export default class Gist { constructor(input, output, options, embeds) { this.input = input; this.output = output; this.options = options; this.embeds = embeds; this.regex = regex.gist; this.service = 'gist'; if(typeof this.options.input !== 'string'){ this.options.input.addEventListener('rendered', () => { this.load() }) } } template(match) { return `
` } load() { let gists = this.options.input.getElementsByClassName('ejs-gist'); for (let i = 0; i < gists.length; i++) { let gistFrame = document.createElement("iframe"); gistFrame.setAttribute("width", "100%"); gistFrame.id = `ejs-gist-${i}`; let zone = gists[i]; zone.innerHTML = ""; zone.appendChild(gistFrame); // Create the iframe's document let url = gists[i].getAttribute('data-src'); url = url.indexOf('http') === -1 ? `https://${url}` : url; let gistFrameHTML = `