Help with adding script tag to a plugin

plugins

#1

I tried whitelisting simple html tag via plugin - It worked fine.

(function () { Discourse.Markdown.whiteListTag('textarea'); })();

Then tried adding asciinema script as mentioned here

Discourse.Markdown.whiteListTag('script', 'type', 'text/javascript');
Discourse.Markdown.whiteListTag('script', 'src', /https:\/\/asciinema.org\/a\/\d+.js/);
Discourse.Markdown.whiteListTag('script', 'async');
Discourse.Markdown.whiteListTag('textarea');

but I’m unable to whitelist the script tag. I would like to embed bellow on discourse.

<script type="text/javascript" src="https://asciinema.org/a/3uj8c8f04q9434ffsvk4s2sbb.js" id="asciicast-3uj8c8f04q9434ffsvk4s2sbb" async></script> 

I’m really stuck here…awaiting for responses/help on how to achieve this. thanks


(cpradio) #2

You may want to look at how the Google Adsense plugin works

Or the lazyYT plugin (this may be more helpful)


#3

Thanks for the links. Looking into LazyYT implementation. :grinning:


(Ismael Olea) #4

Did you finally got an asciinema integration with Discourse?