Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A framework for building exercises to work with Khan Academy.
HTML JavaScript CSS Python

Fix the regex intended to strip external scripts

Summary:
We have to strip out external scripts when loading the exercise html file,
otherwise, IE will try to execute them and try to fetch local-only files for
which we return 404s.

See #10957 for more.

Aaanyway, that regex probably worked back in 2012, but isn't working now
because many external script tags now have `data-main=...` between the
`script` and the `src=`. This fixes the regex so it can cope with that.

Test Plan:
Load /e/addition_1 in IE9 before this fix and see a 404 for local-only/requre.js
Load /e/addition_1 in IE9 after this fix and don't see any 404
Verify inline scripts still work by loading /e/logarithms_1 in IE9 and take all the hints, one of which depends on an inline script.

Reviewers: tom, alpert

Reviewed By: tom, alpert

Subscribers: alpert

Differential Revision: https://phabricator.khanacademy.org/D17664
latest commit 7524767aa1
@beneater beneater authored
Failed to load latest commit information.
build Rewrite pack.rb in javascript, to remove the main ruby dep on our cod…
css Prevent issue form labels from appearing on a new line after their re…
exercises Change word polynomial to binomial
fonts Move all answer area content to the bottom of the question area
genfiles Remove references to `USERNAME`
images Update badge images and fix clipping
local-only Upgrade katex in to v0.2.0
test Tests: Make tests run again
third_party Use webpack to bundle JS together, not requirejs
tools Add tools/runlint.py, which will be automatically run by khan-linter.
utils Don't remove dummy points/lines when calling removeAllTools
.arcconfig update .arcconfig to https
.gitignore Fixed a few TODOs.
.gitmodules Move qunit to a more-global directory
.travis.yml Try a different room ID!
Makefile Get rid of an obsolete comment.
README.md Link to careers page, not Jobvite
exercises-stub.js (khan-exercises) Replace top-level var declaration with explicit glob…
history.js Fix coach report answer correctness color
interface.js Log more information on out-of-order (and other) errors.
khan-exercise.js Fix the regex intended to strip external scripts
lint_blacklist.txt Use webpack to bundle JS together, not requirejs
main.js Use requirejs for module loading
package.json Rewrite pack.rb in javascript, to remove the main ruby dep on our cod…
requirements.txt First pass at creating a new extract-strings.py script for our i18n e…

README.md

Khan Academy Exercises

Copyright (c) 2014 Khan Academy

The exercise framework is MIT licensed.

The exercises are under a Creative Commons by-nc-sa license.

Exercise Framework

Khan Academy has created a generic framework for building exercises. This framework, together with the exercises themselves, can be used completely independently of the Khan Academy application.

The framework exists in two components:

  • An HTML markup for specifying exercises.
  • A jQuery plugin for generating a usable, interactive, exercise from the HTML markup.

Using the Framework Locally

You need to serve the files from some sort of a server. You can't just open the files directly in a browser. For example:

cd khan-exercises
python -m SimpleHTTPServer # or python3 -m http.server

Now if you open your browser to http://localhost:8000 (or http://127.0.0.1:8000/) you should see the contents of the khan-exercises directory. Navigate to the exercises subfolder, and an HTML file under there to see an exercise.

Exercise Development

This framework supports over 450 of our current math exercises including updated versions of many exercises Sal built for his cousins before he made his first video! New exercises on Khan Academy, however, are now written by many content experts using Perseus and stored in our datastore as individual questions.

More

If you're passionate about providing a free world-class education for anyone, anywhere and want to apply to be a full-time or intern software developer at Khan Academy, please do so.

Something went wrong with that request. Please try again.