Created
April 28, 2010 01:50
-
-
Save kangax/381634 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 uservoiceOptions = { | |
/* ... */ | |
}; | |
function _loadUserVoice() { | |
var s = document.createElement('script'); | |
s.setAttribute('type', 'text/javascript'); | |
s.setAttribute('src', ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js"); | |
document.getElementsByTagName('head')[0].appendChild(s); | |
} | |
_loadSuper = window.onload; | |
window.onload = (typeof window.onload != 'function') ? _loadUserVoice : function() { _loadSuper(); _loadUserVoice(); }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a reason you are using
window.onload
instead of event listeners?Also:
return (typeof original == 'function'
? function() {
original();
_loadUserVoice();
}
: _loadUserVoice
);
Less repetition.