Skip to content

Adding mathjax #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions algorithm/backtracking/knight's_tour/desc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Knight’s tour problem": "A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed, otherwise it is open.",
"Complexity": {
"time": "Worst O(8<sup>N<sup>2</sup></sup>)",
"space": "Worst O(N<sup>2</sup>)"
"time": "Worst $$O(8^{N^{2}})$$",
"space": "Worst $$O(N^2)$$"
},
"References": [
"<a href='https://en.wikipedia.org/wiki/Knight%27s_tour'>Wikipedia</a>"
Expand Down
4 changes: 2 additions & 2 deletions algorithm/backtracking/n_queens/desc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"Searching"
],
"Complexity": {
"time": "Worst O(N!)",
"space": "Worst O(N)"
"time": "Worst $$O(N!)$$",
"space": "Worst $$O(N)$$"
},
"References": [
"<a href='http://www.geeksforgeeks.org/backtracking-set-3-n-queen-problem/'>geeksforgeeks</a>"
Expand Down
4 changes: 2 additions & 2 deletions algorithm/number_theory/sieve_of_eratosthenes/desc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"Sieve of Eratosthenes": "Finding all prime numbers up to a given range.",
"Complexity": {
"time": "O(n(log n)(log log n))",
"space": "O(n<sup>1/2</sup>)"
"time": "$$O(n\\,(log\\,n)(log\\,log\\,n))$$",
"space": "$$O(n^{\\frac{1}{2}})$$"
},
"References": [
"<a href='https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes'>Wikipedia</a>"
Expand Down
18 changes: 17 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
<title>Algorithm Visualizer</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="public/algorithm_visualizer.min.css">
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
styles: {
".MJXc-display": {
"display": "inline !important",
"margin": "0 !important"
},
}
});
</script>
<script type="text/javascript" async
src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>

<body>
Expand All @@ -36,7 +50,6 @@ <h3>
<span class="btn-text">Generate</span>
</div>
</div>

<div class="btn" id="btn_share">
<div class="wrapper">
<i class="fa fa-share" aria-hidden="true"></i> Share <input type="text" class="collapse" id="shared">
Expand Down Expand Up @@ -109,6 +122,9 @@ <h3>
<a href="https://github.com/simonwhitaker/github-fork-ribbon-css">
<button class="indent">simonwhitaker/github-fork-ribbon-css</button>
</a>
<a href="https://github.com/mathjax/MathJax">
<button class="indent">mathjax/MathJax</button>
</a>
</div>
</div>
<a class="github-fork-ribbon left-bottom" href="http://github.com/parkjs814/AlgorithmVisualizer"
Expand Down
9 changes: 3 additions & 6 deletions js/dom/show_algorithm.js
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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';
Expand Down Expand Up @@ -45,4 +41,5 @@ module.exports = (category, algorithm, data, requestedFile) => {

showDescription(data);
addFiles(category, algorithm, files, requestedFile);
utils.renderMathJax();
};
9 changes: 7 additions & 2 deletions js/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
getFileDir,
renderMathJax
};
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy