Permalink
Browse files

Use jquery getScript & use fallbacks.

  • Loading branch information...
1 parent 14cceaf commit dcbcd5b4dedafd4af0fc8d92e50e91d6dc69cded @markosullivan markosullivan committed with tburry May 17, 2012
Showing with 6 additions and 7 deletions.
  1. +1 −1 index.php
  2. +5 −6 js/embed.js
View
@@ -13,7 +13,7 @@
*/
define('APPLICATION', 'Vanilla');
-define('APPLICATION_VERSION', '2.1a16');
+define('APPLICATION_VERSION', '2.1a17');
// Report and track all errors.
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
View
@@ -249,13 +249,12 @@ window.vanilla.embed = function(host) {
if (container) {
// If jQuery is present in the page, include our defer-until-visible script
if (typeof jQuery != 'undefined') {
- var vanillaLazyLoad = document.createElement('script');
- vanillaLazyLoad.type = 'text/javascript';
- vanillaLazyLoad.src = vanilla_forum_url + '/js/library/jquery.appear.js';
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(vanillaLazyLoad);
jQuery(document).ready(function($) {
- $('#vanilla-comments').appear(function() {
- container.appendChild(vanillaIframe);
+ $.getScript('http://cdn.vanillaforums.com/js/jquery.appear.js', function() {
+ if ($.fn.appear)
+ $('#vanilla-comments').appear(function() {container.appendChild(vanillaIframe);});
+ else
+ container.appendChild(vanillaIframe); // fallback
});
});
} else {

0 comments on commit dcbcd5b

Please sign in to comment.