Created
October 30, 2012 09:30
-
-
Save biojazzard/3979237 to your computer and use it in GitHub Desktop.
html5-FS
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
| e = document.getElementById("fullscreen") | |
| pfx = ["webkit", "moz", "ms", "o", ""] | |
| e.onClick => | |
| if RunPrefixMethod document, "FullScreen" || RunPrefixMethod document, "IsFullScreen" | |
| RunPrefixMethod e, "CancelFullScreen" | |
| else | |
| RunPrefixMethod e, "RequestFullScreen" | |
| prefixMethod (obj, method)=> | |
| m = method | |
| if pfx[p] = "" | |
| m = m.substr(0,1).toLowerCase() + m.substr(1) | |
| m = pfx[p] + m | |
| t = typeof obj[m] | |
| if t != "undefined" | |
| pfx = pfx = [pfx[p]] | |
| else | |
| pfx = '' | |
| t = if "function" then obj[m]() else obj[m] | |
| RunPrefixMethod (obj, method) => | |
| p = 0 | |
| prefixMethod obj, method while p < pfx.length and !obj[m] | |
| return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment