Last active
August 29, 2015 13:56
-
-
Save alexgb/9337947 to your computer and use it in GitHub Desktop.
This file contains 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
var values = { | |
// 1: Description | |
49: "Imagine you are creating a fence for a garden. Before you can make the fence, you need to make a model. Using Legos and Lego graph paper, make a model of the fence.", | |
// 2: Step One | |
50: "Your fence should be 20 units long and 10 units wide. Make your fence, take a picture of it and attach it to the card.", | |
// 3: Step 2 | |
51: "Then, find the perimeter of the fence. If you do not remember how to find perimeter, click [here](http://www.brainpopjr.com/math/measurement/perimeter).", | |
// 4: Step 3 | |
52: "Now, find the area of your garden so you know how much space you'll have to plant. If you do not remember how to find area, click [here](http://www.brainpopjr.com/math/measurement/area).", | |
// 5: Reflection | |
53: "Did you enjoy the assignment?", | |
// 6: Reflection | |
54: "What is the perimeter of your garden fence?", | |
// 7: Reflection | |
55: "What will you plant in your garden?" | |
}; | |
$(document).on("keypress", function(e) { | |
// keys 48-57 are numbers | |
var value; | |
if(e.ctrlKey && (value = values[e.which])) { | |
typeIntoInput(value); | |
} | |
}); | |
function typeIntoInput(str) { | |
var el = $(':focus'); | |
var letters = str.split(''); | |
var timeout = window.setInterval(function() { | |
var letter = letters.shift(); | |
if (letters.length === 0) { | |
window.clearTimeout(timeout); | |
} | |
el.val(el.val() + letter); | |
}, 20); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment