lendo MathJax 3 enfileirado com function register_assets
This commit is contained in:
@@ -216,6 +216,8 @@ function outras_brafitec($es, $ms, $est, $apy, $acy, $cy, $ly, $ry, $ea, $pa, $c
|
|||||||
|
|
||||||
function simulador_mob_shortcode() {
|
function simulador_mob_shortcode() {
|
||||||
|
|
||||||
|
\wp_enqueue_script( 'mathjax' );
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
|
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||||
//var_dump($_POST);
|
//var_dump($_POST);
|
||||||
if (isset($_POST["calcular"])) {
|
if (isset($_POST["calcular"])) {
|
||||||
@@ -653,8 +655,6 @@ foreach ($sie_niveis as $sie_rotulo => $sie_valor) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function start() {
|
function start() {
|
||||||
var inputReproRec = document.querySelector("#repro_rec");
|
var inputReproRec = document.querySelector("#repro_rec");
|
||||||
@@ -724,4 +724,17 @@ start();
|
|||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function register_assets() {
|
||||||
|
// MathJax 3 renderiza as formulas $$...$$. Registrado aqui e carregado via
|
||||||
|
// wp_enqueue_script() so quando o shortcode aparece na pagina; no rodape e async.
|
||||||
|
\wp_register_script(
|
||||||
|
'mathjax',
|
||||||
|
'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js',
|
||||||
|
array(),
|
||||||
|
'3',
|
||||||
|
array( 'in_footer' => true, 'strategy' => 'async' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
\add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\register_assets' );
|
||||||
|
|
||||||
\add_shortcode( 'simulador_mob', __NAMESPACE__ . '\\simulador_mob_shortcode' );
|
\add_shortcode( 'simulador_mob', __NAMESPACE__ . '\\simulador_mob_shortcode' );
|
||||||
|
|||||||
Reference in New Issue
Block a user