Created
May 22, 2011 03:09
-
-
Save johan/985137 to your computer and use it in GitHub Desktop.
Google Closure Library loader bookmarklet
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
// Enumerate your own list of goog.require:s, if you want something else than TableSorter and XhrIo. | |
// Similarly, you can pass a callback that will get the library in its first parameter, once loaded, | |
// or leave it as is, if you'd rather overwrite the top window's "goog" with your own custom version. | |
javascript:(function(requires, callback) { | |
var base = 'http://closure-library.googlecode.com/svn/trunk/closure/goog/' | |
, iframe = document.body.appendChild(document.createElement('iframe')); | |
iframe.src = 'about:blank'; | |
iframe.style.display = 'none'; | |
iframe.contentWindow.cb = callback; | |
iframe.contentDocument.write('<head><script src="'+ base +'base.js"></script><script src="'+ base + | |
'deps.js"></script><script>'+JSON.stringify(requires)+'.forEach(goog.require);</script><script>' + | |
(callback ? 'cb.call(parent, goog)' : 'parent.goog = goog') + ';</script></head><body></body>'); | |
})(['goog.ui.TableSorter','goog.net.XhrIo']/*, function optional(goog){alert(goog.net.XhrIo.send)}*/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment