Created
January 29, 2015 20:18
-
-
Save pvdz/3cccc4f36c8319e09bb7 to your computer and use it in GitHub Desktop.
JS1k 2015 bare shim. This is loaded in an iframe dynamically. You can opt for an empty DOM during submit, a 2d canvas, or a webgl canvas. You can also specify max canvas width/height during submit, defaults to 100%. If empty, `a`, `c`, and `g` will obviously not exist. `top.reload()` replaces the iframe containing your demo with a new instance, …
This file contains hidden or 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
<!doctype html> | |
<html style="margin: 0; padding: 0; border: 0; width: 100%; height: 100%;"> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body style="margin: 0; padding: 0; border: 0; width: 100%; height: 100%;"> | |
<canvas style="display: block; width: WIDTHpx; height: HEIGHTpx;" width="WIDTH" height="HEIGHT"></canvas> | |
<script> | |
// shim... | |
var a = canvas; | |
var b = body; | |
var c = context('2d'); | |
var g = context('3d'); | |
top.reload(); | |
onorientationchange = top.reload; // optional | |
// unprefixed: AudioContext, requestAnimationFrame, canvas/body.requestPointerLock, getUserMedia | |
// if webgl, same shim setup as last year | |
// THIS IS WHERE YOUR DEMO GOES | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
one request:
Can we have the script in it's own tag with an ID? This would make it easier to hack some cool quines: