Permalink
Browse files

Alas, khanscript doesn't seem to work outside dev mode :(

  • Loading branch information...
1 parent 1602377 commit d615b988b3fe9be2f2e6479812a19dbca78aec49 @beneater beneater committed Sep 11, 2012
View
6 exercises/evaluating_expressions_1.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html data-require="math khanscript">
+<html data-require="math graphie">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Evaluating expressions 1</title>
@@ -32,10 +32,10 @@
<div class="hints">
<div>
- <script type="text/khanscript">
+ <div class="graphie">
$("#foo").addClass("hint_pink");
$("#var").addClass("hint_pink");
- </script>
+ </div>
<p>
Plug in <code>\pink{<var>X</var>}</code> for
<code>x</code>.
View
10 exercises/evaluating_expressions_2.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html data-require="math math-format khanscript">
+<html data-require="math math-format graphie">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Evaluating expressions 2</title>
@@ -41,10 +41,10 @@
<div class="hints">
<div>
- <script type="text/khanscript">
+ <div class="graphie">
$(".var1").addClass("hint_pink");
$(".var2").addClass("hint_blue");
- </script>
+ </div>
<p>
Plug in <code class="hint_pink"><var>A</var></code>
for <code>\pink{<var>AN</var>}</code> and
@@ -86,10 +86,10 @@
<div class="hints">
<div>
- <script type="text/khanscript">
+ <div class="graphie">
$(".var1").addClass("hint_pink");
$(".var2").addClass("hint_blue");
- </script>
+ </div>
<p>
Plug in <code class="hint_pink"><var>A</var></code>
for <code>\pink{<var>AN</var>}</code> and
View
32 exercises/one_step_equation_intuition.html
@@ -80,7 +80,7 @@
</form>
</div>
</div>
- <script type="text/graphie" id="scale">
+ <div class="graphie" id="scale">
scale.onChange = function(leftCoef, a, rightCoef, b) {
$("#sub-left").prop("disabled", a === 0);
@@ -91,28 +91,28 @@
var desc1 = "You";
var leftOp = "";
var rightOp = "";
- if (a - A < 0) {
- desc1 += " <span class='hint_blue'>subtracted " +
- abs(a - A) + " from the left side</span>";
+ if (a - A &lt; 0) {
+ desc1 += " &lt;span class='hint_blue'&gt;subtracted " +
+ abs(a - A) + " from the left side&lt;/span&gt;";
leftOp = " \\blue{- " + abs(a - A) + "}"
- } else if (a - A > 0) {
- desc1 += " <span class='hint_blue'>added " +
- abs(a - A) + " to the left side</span>";
+ } else if (a - A &lt; 0) {
+ desc1 += " &lt;span class='hint_blue'&gt;added " +
+ abs(a - A) + " to the left side&lt;/span&gt;";
leftOp = " \\blue{+ " + abs(a - A) + "}"
}
- if (a - A !== 0 && b - B !== 0) {
+ if (a - A !== 0 &amp;&amp; b - B !== 0) {
desc1 += " and";
}
- if (b - B < 0) {
- desc1 += " <span class='hint_green'>subtracted " +
- abs(b - B) + " from the right side</span>";
+ if (b - B &lt; 0) {
+ desc1 += " &lt;span class='hint_green'&gt;subtracted " +
+ abs(b - B) + " from the right side&lt;/span&gt;";
rightOp = " \\green{- " + abs(b - B) + "}"
- } else if (b - B > 0) {
- desc1 += " <span class='hint_green'>added " +
- abs(b - B) + " to the right side</span>";
+ } else if (b - B &gt; 0) {
+ desc1 += " &lt;span class='hint_green'&gt;added " +
+ abs(b - B) + " to the right side&lt;/span&gt;";
rightOp = " \\green{+ " + abs(b - B) + "}"
}
- if (a - A === 0 && b - B === 0) {
+ if (a - A === 0 &amp;&amp; b - B === 0) {
desc1 = "You haven't added or removed "
+ "anything from either side, so we can't "
+ "directly tell what " + UNKNOWN + "'s "
@@ -173,7 +173,7 @@
rightConst: B,
image: IMAGE
});
- </script>
+ </div>
</p>
<div style="width: 480px; position: relative; top: -60px; right: 50px;">
<div style="text-align: center; float: right;">
View
6 exercises/solutions_to_quadratic_equations.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html data-require="math math-format graphie khanscript">
+<html data-require="math math-format graphie">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Solutions to quadratic equations</title>
@@ -50,12 +50,12 @@
</code>
</div>
<div>
- <script type="text/khanscript">
+ <div class="graphie">
$("#quadratic").text("\\qquad x = \\dfrac{-b \\pm" +
" \\sqrt{\\blue{b^2 - 4ac}}}{2a}");
MathJax.Hub.Queue(["Reprocess", MathJax.Hub,
$("#quadratic")[0]]);
- </script>
+ </div>
<div>
Think about what the part of the quadratic
formula <span class="hint_blue">under the

6 comments on commit d615b98

@spicyj
Khan Academy member

Why not?

@beneater
Khan Academy member

Somewhere khan-exercises.js is filtering out script tags and executing them around line 1155. It doesn't seem to discriminate against non-text/javascript scripts.

@spicyj
Khan Academy member

Ah, yup. Line 2833.

@beneater
Khan Academy member

so, um, what does that regex look like if it skips non-javascript tags?

@spicyj
Khan Academy member

Um.

@spicyj
Khan Academy member

I feel that these regexes are a bad idea.

Please sign in to comment.