Browse Source

Moved to defer attribute for js include script.

Martin Edenhofer 11 years ago
parent
commit
66b4f2d2db

+ 5 - 0
app/assets/javascripts/application.js

@@ -71,3 +71,8 @@ jQuery.event.special.remove = {
     if (e.handler) e.handler();
   }
 };
+
+// start application
+jQuery(function(){
+  new App.Run();
+});

+ 1 - 6
app/views/init/index.html.erb

@@ -5,9 +5,4 @@
 </div>
 <div id="splash">
   <div class="logo">booting...</div>
-</div>
-<script type="text/javascript">
-  jQuery(function(){
-    new App.Run();
-  })
-</script>
+</div>

+ 4 - 0
app/views/layouts/application.html.erb

@@ -3,7 +3,11 @@
 <head>
   <title><%= Setting.get('product_name') %></title>
   <%= stylesheet_link_tag    "application" %>
+  <% if Rails.configuration.assets.debug %>
   <%= javascript_include_tag "application" %>
+  <% else %>
+  <%= javascript_include_tag "application", :defer => 'defer' %>
+  <% end %>
   <%= csrf_meta_tags %>
 </head>
 <body>