diff --git i/hypothesis.module w/hypothesis.module
index 4b65535..19780ea 100644
--- i/hypothesis.module
+++ w/hypothesis.module
@@ -18,7 +18,7 @@ define('HYPOTHESIS_VISIBILITY_LISTED', 1);
 /**
  * Implements hook_page_build().
  */
-function hypothesis_page_build() {
+function hypothesis_page_build(&$page) {
 
   if (path_is_admin(current_path()) || !_hypothesis_check_visibility()) {
     return;
@@ -28,12 +28,25 @@ function hypothesis_page_build() {
     'showHighlights' => (bool) variable_get('hypothesis_highlights_on', '0'),
     'sidebarOpen' => (bool) variable_get('hypothesis_sidebar_open', '0'),
   );
-  drupal_add_js(array('hypothesis' => $default_settings), 'setting');
-  drupal_add_js(drupal_get_path('module', 'hypothesis') . '/js/showdefaults.js');
+
+  $page['content']['#attached']['js'][] = array(
+    'data' => array('hypothesis' => $default_settings),
+    'type' => 'setting',
+  );
+
+  $showdefaults = drupal_get_path('module', 'hypothesis') . '/js/showdefaults.js';
+
+  $page['content']['#attached']['js'][$showdefaults] = array(
+    'type' => 'file',
+  );
+
   if (user_access('load hypothesis')) {
     global $is_https;
     $protocol = $is_https ? 'https' : 'http';
-    drupal_add_js($protocol . '://hypothes.is/embed.js', 'external');
+    $hypothesis_embed = $protocol . '://hypothes.is/embed.js';
+    $page['content']['#attached']['js'][$hypothesis_embed] = array(
+      'type' => 'external',
+    );
   }
 
 }
