From 86ebba453dd186ddec62d6c553da11917ed3e88b Mon Sep 17 00:00:00 2001 From: Kevin Nadro Date: Tue, 12 Jul 2016 06:54:17 -0700 Subject: [PATCH] added mathjax example --- index.html | 15 ++++++++++++++- js/dom/show_algorithm.js | 9 +++------ js/utils/index.js | 9 +++++++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 86ed1f4..2475f17 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,20 @@ Algorithm Visualizer + + @@ -36,7 +50,6 @@ Generate -
Share diff --git a/js/dom/show_algorithm.js b/js/dom/show_algorithm.js index 61783e1..deb68c5 100644 --- a/js/dom/show_algorithm.js +++ b/js/dom/show_algorithm.js @@ -1,11 +1,7 @@ 'use strict'; const app = require('../app'); - -const { - isScratchPaper -} = require('../utils'); - +const utils = require('../utils'); const showDescription = require('./show_description'); const addFiles = require('./add_files'); @@ -14,7 +10,7 @@ module.exports = (category, algorithm, data, requestedFile) => { let category_name; let algorithm_name; - if (isScratchPaper(category)) { + if (utils.isScratchPaper(category)) { $menu = $('#scratch-paper'); category_name = 'Scratch Paper'; algorithm_name = algorithm ? 'Shared' : 'Temporary'; @@ -45,4 +41,5 @@ module.exports = (category, algorithm, data, requestedFile) => { showDescription(data); addFiles(category, algorithm, files, requestedFile); + utils.renderMathJax(); }; diff --git a/js/utils/index.js b/js/utils/index.js index ac60825..ffdbf5f 100644 --- a/js/utils/index.js +++ b/js/utils/index.js @@ -14,8 +14,13 @@ const getFileDir = (category, algorithm, file) => { return `./algorithm/${category}/${algorithm}/${file}/`; }; +const renderMathJax = () =>{ + MathJax.Hub.Queue(["Typeset",MathJax.Hub]); +}; + module.exports = { isScratchPaper, getAlgorithmDir, - getFileDir -}; \ No newline at end of file + getFileDir, + renderMathJax +}; -- GitLab