Thanks Jeff, I have been able to whitelist iframes in the past but is not the behavior that I’m looking for.
Hola Rafael,
I guess I’m bad at explaining. There is an example on this post:
At the bottom of that link on my post it says “Loading”. That is a div with specific attirbutes that is supposed to trigger the external scripts that I have placed in the admin theme /body section (where scripts go) and get generated with content (filled up with statistic bars) via JavaScript.
In the end it should look like the codepen that I linked previously at the top of this topic when the data is generated.
The custom data attributes are already whitelisted by default with discourse and do not get removed from the div like id or class does.
My issue is, how can I make these external scripts execute and generate data inside these empty divs based on attributes? Based on these attributes, they could be different per topic or post and trigger the script to display different data that gets generated by these external scripts.
To summarize what I’m intending to do
External scripts placed on the admin > customize > theme “Edit CSS/HTML” section:
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://bloodmallet.com/js/bloodmallet_chart_import.min.js"></script>
Input on the editor by a user or me:
<div
data-bloodmallet="chart"
data-wow-class="shaman"
data-wow-spec="elemental"
data-chart-engine="highcharts"
data-tooltip-engine="wowhead"
data-type="trinkets"
data-azerite-tier="all"
data-fight-style="patchwerk"
data-entries="7"
data-background-color="#343a40"
data-font-color="#f8f9fa"
data-axis-color="#828282"
data-language="en"
>Loading...</div>
Output when the div is found and external javascript (the scripts that I placed on the admin side) are executed and triggered to generate content based on those data attributes:
Am I making sense? I apologize if I can’t explain myself well, as I’m bilingual and sometimes I tend to make things sound more complicated.