FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Adding mathjax by nadr0 · Pull Request #209 · algorithm-visualizer/algorithm-visualizer · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .html  (1) .js  (2) .json  (3) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions algorithm/backtracking/knight's_tour/desc.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
};

Back | FazBrowse Home | New Git URL