Permalink
Browse files

Use requirejs for module loading

Summary: Also did some misc cleanup in khan-exercise.js, mostly related to module-y things ("151 ++----"). I combined local jquery-ui into one file to make it easier to load.

Test Plan:
Opened addition_1, deriviative_intuition, graphing_points_2 locally, and all looked fine.

In webapp/khan-exercises/, ran:

```
npm install -g requirejs
r.js -o requirejs.config.js
```

then saw that /exercises/addition_1 looked right.

Reviewers: eater, jack

Reviewed By: jack

CC: alex

Differential Revision: http://phabricator.khanacademy.org/D7095
  • Loading branch information...
1 parent 9c31e6b commit ac1415e815beffcfb496f443226f74b4bb5d2ccb @spicyj spicyj committed Mar 5, 2014
Showing 501 changed files with 10,303 additions and 7,621 deletions.
View
@@ -2,3 +2,4 @@
_hashed-*.js
exercises-packed
exercises-packed.zip
+genfiles/**
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Finding absolute values</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Absolute value equations</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>Absolute value of complex numbers</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>Adding and subtracting complex numbers</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting decimals word problems</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting fractions</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting negative numbers</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting polynomials</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting radicals</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational expressions 1</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<style type="text/css">
#solutionarea td {
text-align: center;
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational expressions 0.5</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<style type="text/css">
#solutionarea td {
text-align: center;
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational expressions 1.5</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script type="text/javascript">
function getRationalExpression(variables) {
var terms = [];
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational expressions 2</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<style type="text/css">
#solutionarea td {
text-align: center;
@@ -2,7 +2,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational expressions 3</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<style type="text/css">
#solutionarea td {
text-align: center;
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting with unlike denominators 5</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting with unlike denominators 6</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational numbers</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding decimals 1</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding decimals 0.5</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding decimals 2</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding fractions</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding fractions 0.5</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding fractions with common denominators</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding negative numbers</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -2,7 +2,7 @@
<html data-require="math math-format">
<head>
<title>Adding and subtracting mixed numbers 0.5</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
@@ -2,7 +2,7 @@
<html data-require="math math-format">
<head>
<title>Adding and subtracting mixed numbers 1</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding vectors</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>1-digit addition</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>2-digit addition</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Addition with carrying</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>4-digit addition with carrying</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Age word problems</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Angle addition postulate</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Angle bisector theorem</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Angle types</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script>
function protractorHint( pro, rot, angle ) {
pro.translate( 0, 0, true );
View
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Angles 1</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
View
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Angles 2</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Angles of a polygon</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
View
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Area 1</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Area of a circle</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script type="text/javascript">
var R_COLOR = "purple";
var D_COLOR = "green";
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Area of parallelograms</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script type="text/javascript">
KhanUtil.parallelogram = function(B, H, UNIT, SH) {
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Area problems</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
@@ -2,7 +2,7 @@
<html data-require="math math-format graphie graphie-helpers">
<head>
<title>Areas of circles and sectors</title>
- <script src="../khan-exercise.js"></script>
+ <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
Oops, something went wrong.

0 comments on commit ac1415e

Please sign in to comment.