Skip to content

Commit

Permalink
Fixed a bug: Crashing when trying to select result
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHosnie committed Aug 30, 2015
1 parent 4275809 commit f2274a3
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 58 deletions.
1 change: 1 addition & 0 deletions home.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ a:active {
ul {
padding-left: 1em;
}

107 changes: 51 additions & 56 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,73 +1,68 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<html>
<head>
<title>Latex Calculator</title>
<meta name="viewport" content="width=624">
<head>
<title>Latex Calculator</title>
<meta name="viewport" content="width=624">

<link rel="stylesheet" type="text/css" href="home.css">
<link rel="stylesheet" type="text/css" href="mathquill/mathquill.css">
<link rel="stylesheet" type="text/css" href="home.css">
<link rel="stylesheet" type="text/css" href="mathquill/mathquill.css">

<style type="text/css">
code span {
font: 90% Verdana, sans-serif;
}
.mathquill-textbox {
width: 100%;
}
#html-source {
display: none;
font-size: 90%;
white-space: pre-wrap;
}
</style>
<style type="text/css">
code span {
font: 90% Verdana, sans-serif;
}
.mathquill-textbox {
width: 100%;
}
#html-source {
display: none;
font-size: 90%;
white-space: pre-wrap;
}
</style>

</head>
<body>
<div id="body">
</head>
<body>
<div id="body">

<p>
Type in your math here: <span id="editable-math" class="mathquill-editable">2\cdot\frac{2^3}{3+2}</span>
Result = <span id="result" class="mathquill-embedded-latex"></span>
</p>
<p>
Type in your math here: <span id="editable-math" class="mathquill-editable">2\cdot\frac{2^3}{3+2}</span>
Result = <span id="result" class="mathquill-embedded-latex"></span>
</p>

<p>
Try to type something above </br>
Functions that are currently working:
</p>
<p>
Try to type something above </br>
Functions that are currently working:
</p>

<p>
<ul>
<li>Addition: 2+3</li>
<li>subtraction: 2-3</li>
<li>multiplication: 2*3</li>
<li>division: 2/3</li>
<li>power: 2^3</li>
</ul>
Note: This calculator in its current state doesn't know how to prioritize calculations (yet). </br>
It might for example do an addition before a multiplication.
</p>
<p>
<ul>
<li>Addition: 2+3</li>
<li>subtraction: 2-3</li>
<li>multiplication: 2*3</li>
<li>division: 2/3</li>
<li>power: 2^3</li>
</ul>
Note: This calculator in its current state doesn't know how to prioritize calculations (yet). </br>
It might for example do an addition before a multiplication.
</p>


<p>Latex source: <br><textarea id="latex-source" style="width:80%;vertical-align:top"></textarea></p>
<p>Latex source: <br><textarea id="latex-source" style="width:80%;vertical-align:top"></textarea></p>

<p>
<big><font color="red">Warning!</font></big>
Don't try to select the result. Your browser will crash. This is a known bug and I'm working on a solution.
</p>
<p>If you find this project interesting, fork me on
<big><a href="https://github.com/lordadamson/latexCalculator">github!</a></big></br>
I could use a web designer because I suck at it (as you can obviously tell).
</p>

<p>If you find this project interesting, fork me on
<big><a href="https://github.com/lordadamson/latexCalculator">github!</a></big></br>
I could use a web designer because I suck at it (as you can obviously tell).
</p>
</div>

</div>
<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="mathquill/mathquill.js"></script>
<script type="text/javascript" src="latexParser.js"></script>
<script type="text/javascript" src="main.js"></script>

<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="mathquill/mathquill.js"></script>
<script type="text/javascript" src="latexParser.js"></script>
<script type="text/javascript" src="main.js"></script>

</body>
</body>
</html>

4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $(function() {
latexSource.val(latex);
try {
parsedLatex = latexParser.parse(latex).toString();
result.mathquill().mathquill('latex',parsedLatex);
result.mathquill('latex',parsedLatex);
}
catch(error) {
console.log(error);
Expand All @@ -34,7 +34,7 @@ $(function() {
}
catch(error) {
console.log(error);
result.mathquill().mathquill('latex', '');
result.mathquill('latex', '');
}
}
});
Expand Down

0 comments on commit f2274a3

Please sign in to comment.