From 2015d1cd0d9bdeddf2ed1e1193fa7fc428d24edd Mon Sep 17 00:00:00 2001
From: callison <chrisandcaseyallison@gmail.com>
Date: Wed, 2 Mar 2011 21:14:19 +0700
Subject: [PATCH 1/2] Issue #1008886 by callison: Upgrading to be compatible with Drupal 7.

---
 image_caption.info   |    5 +----
 image_caption.js     |    6 +++++-
 image_caption.module |   19 ++++++++-----------
 3 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/image_caption.info b/image_caption.info
index 2253580..027e9ac 100644
--- a/image_caption.info
+++ b/image_caption.info
@@ -1,6 +1,3 @@
-;$Id;
 name = "Image Caption"
 description = "Provides a caption for images using jquery."
-core = "6.x"
-php = "4.7"
-version = "6.x-1.0"
\ No newline at end of file
+core = 7.x
diff --git a/image_caption.js b/image_caption.js
index 5daf4e5..02b982c 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -1,3 +1,5 @@
+(function ($) {
+
 $(document).ready(function(){
   $("img.caption").each(function(i) {
     var imgwidth = $(this).width();
@@ -15,4 +17,6 @@ $(document).ready(function(){
     }
     $(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">" + captiontext + "</span>");
   });
-});
\ No newline at end of file
+});
+
+})(jQuery);
diff --git a/image_caption.module b/image_caption.module
index 718da55..48aa9d1 100644
--- a/image_caption.module
+++ b/image_caption.module
@@ -12,7 +12,6 @@
 /**
 * Implementation of hook_menu().
 */
-
 function image_caption_menu() {
   $items = array();
 
@@ -33,7 +32,8 @@ function image_caption_menu() {
 function image_caption_admin_settings() {
 
   //node type settings
-  $node_types = node_get_types();
+  $node_types = node_type_get_types();
+  //$node_types = node_get_types();
   foreach ($node_types as $type) {
     $types[$type->type] = $type->name;
   }
@@ -48,15 +48,12 @@ function image_caption_admin_settings() {
 }
 
 /*
-* Implementation of hook_nodeapi()
-* On view, add captioning javascript to page for certain node types
+* Implementation of hook_node_view()
+* Add captioning javascript to page for certain node types
 */
-function image_caption_nodeapi(&$node, $op) {
-  
-  if ($op == 'view') {
-    if (in_array($node->type, variable_get('image_caption_node_types', array()))) {  
-      $path = drupal_get_path('module', 'image_caption');
-      drupal_add_js($path.'/image_caption.js','module', 'header');
-    }
+function image_caption_node_view($node, $view_mode, $langcode) {
+  if (in_array($node->type, variable_get('image_caption_node_types', array()))) {
+    $path = drupal_get_path('module', 'image_caption');
+    drupal_add_js($path.'/image_caption.js');
   }
 }
-- 
1.7.3.1.msysgit.0


From a75be2297f0e1c528d08263126314dc3f40f5dda Mon Sep 17 00:00:00 2001
From: callison <chrisandcaseyallison@gmail.com>
Date: Wed, 2 Mar 2011 21:18:18 +0700
Subject: [PATCH 2/2] Issue #1008886 by callison: Upgrading to be compatible with Drupal 7.

---
 image_caption.module |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/image_caption.module b/image_caption.module
index 48aa9d1..bef15a1 100644
--- a/image_caption.module
+++ b/image_caption.module
@@ -33,7 +33,6 @@ function image_caption_admin_settings() {
 
   //node type settings
   $node_types = node_type_get_types();
-  //$node_types = node_get_types();
   foreach ($node_types as $type) {
     $types[$type->type] = $type->name;
   }
-- 
1.7.3.1.msysgit.0

