diff --git a/plugins/views_plugin_cache.inc b/plugins/views_plugin_cache.inc
index 1b17c07..c91cdc7 100644
--- a/plugins/views_plugin_cache.inc
+++ b/plugins/views_plugin_cache.inc
@@ -175,7 +175,7 @@ class views_plugin_cache extends views_plugin {
     $this->storage['css'] = drupal_add_css();  
     $js = drupal_add_js();
     foreach ($js as $key => $data) {
-      if ($data['scope'] == 'header' || $data['scope'] == 'footer') {
+      if ($data['scope'] == 'header' || $data['scope'] == 'footer'){
         $this->storage['js'][$data['scope']][$key] = $data;
       }
     }
@@ -206,18 +206,33 @@ class views_plugin_cache extends views_plugin {
 
     $js = array();
     // A little less simple for js
-    foreach (array('header', 'footer') as $scope) {
-      $js[$scope] = drupal_add_js(NULL, NULL, $scope);
+    $add_js = drupal_add_js();
+
+    foreach ($add_js as $key => $data) {
+      $js[$data['scope']][$key] = $data;
     }
 
     $start = isset($this->storage['js']) ? $this->storage['js'] : array();
     $this->storage['js'] = array();
 
-return; // @TODO: fixme
+    foreach ($js as $scope => $scopes) {
+      foreach ($scopes as $key => $data) {
+        if (!isset($start[$scope][$key]) && ($data['scope'] == 'header' || $data['scope'] == 'footer')) {
+          $this->storage['js'][$data['scope']][$key] = $data;
+          switch ($data['type']) {
+            // @todo: Fix settings
+//             case 'setting':
+//               $this->storage['js'][] = array($info, $type, $scope);
+//               break;
 
-    foreach ($js as $key => $data) {
-      if (!isset($start[$key][$data['scope']][$key]) && ($data['scope'] == 'header' || $data['scope'] == 'footer')) {
-        $this->storage['js'][$data['scope']][$key] = $data;
+            case 'inline':
+              $this->storage['js'][] = array($data['code'], $data['type'], $scope, $data['defer']);
+              break;
+
+            default:
+              $this->storage['js'][] = array($key, $data['type'], $scope, $info['defer'], $data['cache']);
+          }
+        }
       }
     }
   }
