From 4120d11ab11a265a8803caf0fc4f557fe7c241e3 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Thu, 21 Aug 2008 07:47:05 +0000
Subject: [PATCH 01/19] D6 version bump

---
 image_caption.info   |    1 +
 image_caption.module |   16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/image_caption.info b/image_caption.info
index 3024910..2253580 100644
--- a/image_caption.info
+++ b/image_caption.info
@@ -1,3 +1,4 @@
+;$Id;
 name = "Image Caption"
 description = "Provides a caption for images using jquery."
 core = "6.x"
diff --git a/image_caption.module b/image_caption.module
index eb8187a..736f758 100644
--- a/image_caption.module
+++ b/image_caption.module
@@ -17,14 +17,14 @@
 function image_caption_menu() {
   $items = array();
 
-    $items['admin/settings/image_caption'] = array(
-      'path' => 'admin/settings/image_caption',
-      'title' => t('Image Caption Settings'),
-      'description' => t('Configure image caption settings.'),
-      'page callback' => 'drupal_get_form',
-      'page arguments' => array('image_caption_admin_settings'),
-    );
-        //'access arguments' => user_access('administer site configuration')
+  $items['admin/settings/image_caption'] = array(
+    'title' => t('Image Caption Settings'),
+    'description' => t('Configure image caption settings.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('image_caption_admin_settings'),
+    'access arguments' => array('administer site configuration')
+  );
+
   return $items;
 }
 
-- 
1.7.9.6 (Apple Git-31.1)


From 680e4bcf8805b5f2a370f287083a2e734fe3ca13 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Thu, 21 Aug 2008 08:24:15 +0000
Subject: [PATCH 02/19] added new contrib module for image caption via filter,
 courtesy of fletchgqc (
 http://drupal.org/user/236219/contact )

---
 contrib/image_caption_filter.info   |    5 ++
 contrib/image_caption_filter.module |   93 +++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100755 contrib/image_caption_filter.info
 create mode 100755 contrib/image_caption_filter.module

diff --git a/contrib/image_caption_filter.info b/contrib/image_caption_filter.info
new file mode 100755
index 0000000..ed94890
--- /dev/null
+++ b/contrib/image_caption_filter.info
@@ -0,0 +1,5 @@
+; $Id$
+name = Image caption filter
+description = Create captions on images using the title attribute.
+core = 6.x
+version = 6.x-1.x-dev
diff --git a/contrib/image_caption_filter.module b/contrib/image_caption_filter.module
new file mode 100755
index 0000000..1def3af
--- /dev/null
+++ b/contrib/image_caption_filter.module
@@ -0,0 +1,93 @@
+<?php
+/*
+  This module looks for <img> tags of the class 'image-left', 'image-right' or 'standalone-image'
+  with a title attibute set.  It then places the <img> tag in a <div> with the width and class
+  attributes set. A <div> tag of class "caption" is also added with the caption text obtained
+  from the title.  It removes the class attribute from the <img> tag.
+  <img> tags missing alt attributes are also marked with warning text to draw attention to 
+   this fact.
+  @info
+  http://drupal.org/node/264932
+  @author
+  John Fletcher
+  @contact
+  http://drupal.org/user/236219/contact
+*/
+
+/**
+* Display help and module information
+* @param path which path of the site we're displaying help
+* @param arg array that holds the current path as would be returned from arg() function
+* @return help text for the path
+*/
+function image_caption_filter_help($path, $arg) {
+  $output = '';
+  switch ($path) {
+    case "admin/help#image_caption_filter":
+      $output = '<p>' .  t("Adds captions to images") . '</p>';
+      break;
+  }
+  return $output;
+} //function image_caption_filter_help
+
+//filter hook implementation
+function image_caption_filter_filter($op, $delta = 0, $format = -1, $text = '') {
+  switch ($op) {
+    case 'list':
+      return array(0 => t('Image caption filter'));
+
+    case 'description':
+      return t('Adds captions to images via a filter');
+
+    case 'prepare':
+      // Nothing to prepare
+      return $text;
+
+    case "process":
+      //Look for <img> tags and run the doImgTitles function on the <img> tag
+      $text = preg_replace_callback('|(<img.*?>)|s', 'doImgTitles', $text);
+      return $text;
+
+    default:
+      return $text;
+  }
+} //function image_caption_filter_filter
+
+
+//helper function to do the actual manipulation
+function doImgTitles($matches) {
+  $imgText = $matches[0];
+
+  //Get the title out of the <img> tag
+  preg_match ('/title=\"(.+?)\"/i', $imgText, &$matches);
+  $title = $matches[1];
+
+  //Get the width out of the <img> tag
+  preg_match ('/width=\"(.+?)\"/i', $imgText, &$matches);
+  $width = $matches[1];
+
+  //Get class out of the <img> tag
+  preg_match ('/class=\"(.+?)\"/i', $imgText, &$matches);
+  $class = $matches[1];
+
+  //See if there is an alt attribute in the <img> tag, if not insert a LOUD warning
+  preg_match ('/alt=\"(.+?)\"/i', $imgText, &$matches);
+  $alt = $matches[1];
+  if (empty($alt)) {
+    $alt_warning = '<font size="+3" color="pink" style="line-height:1em">No alternate text on picture! - define alternate text in image properties</font>';
+  } else {
+    $alt_warning = '';
+  }
+
+  //Only insert the caption and modify the <img> tag if it is has a title attribute and is one of the classes we are interested in
+  if (in_array($class, array('image-left', 'image-right', 'standalone-image')) && ($title)) {
+    $imgText = preg_replace ('/class=\"(.+?)\"/i', '', $imgText);
+    $returnText = "<div class=\"" . $class . "\" style=\"width: " . $width . "px\">"
+                  . $imgText 
+                  . "<div class=\"caption\">" . $title . "</div></div>";
+    return $returnText . $alt_warning;
+  }
+  return $imgText . $alt_warning;
+} //function doImgTitles
+
+?>
-- 
1.7.9.6 (Apple Git-31.1)


From e50a69b79632a4f302a18fce85e5587a5598efb9 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Fri, 14 Nov 2008 09:23:31 +0000
Subject: [PATCH 03/19] fix call-time pass-by-reference error

---
 contrib/image_caption_filter.module |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/image_caption_filter.module b/contrib/image_caption_filter.module
index 1def3af..d2806a9 100755
--- a/contrib/image_caption_filter.module
+++ b/contrib/image_caption_filter.module
@@ -59,19 +59,19 @@ function doImgTitles($matches) {
   $imgText = $matches[0];
 
   //Get the title out of the <img> tag
-  preg_match ('/title=\"(.+?)\"/i', $imgText, &$matches);
+  preg_match ('/title=\"(.+?)\"/i', $imgText, $matches);
   $title = $matches[1];
 
   //Get the width out of the <img> tag
-  preg_match ('/width=\"(.+?)\"/i', $imgText, &$matches);
+  preg_match ('/width=\"(.+?)\"/i', $imgText, $matches);
   $width = $matches[1];
 
   //Get class out of the <img> tag
-  preg_match ('/class=\"(.+?)\"/i', $imgText, &$matches);
+  preg_match ('/class=\"(.+?)\"/i', $imgText, $matches);
   $class = $matches[1];
 
   //See if there is an alt attribute in the <img> tag, if not insert a LOUD warning
-  preg_match ('/alt=\"(.+?)\"/i', $imgText, &$matches);
+  preg_match ('/alt=\"(.+?)\"/i', $imgText, $matches);
   $alt = $matches[1];
   if (empty($alt)) {
     $alt_warning = '<font size="+3" color="pink" style="line-height:1em">No alternate text on picture! - define alternate text in image properties</font>';
-- 
1.7.9.6 (Apple Git-31.1)


From ea22cbea5a88bde69cac884827b2e02b95aae737 Mon Sep 17 00:00:00 2001
From: Balint Csuthy <pasqualle@80733.no-reply.drupal.org>
Date: Tue, 10 Feb 2009 18:30:18 +0000
Subject: [PATCH 04/19] by Zoltan Balogh: Hungarian translation

---
 translations/hu.po |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 translations/hu.po

diff --git a/translations/hu.po b/translations/hu.po
new file mode 100644
index 0000000..7a2dce6
--- /dev/null
+++ b/translations/hu.po
@@ -0,0 +1,66 @@
+# Hungarian translation of image_caption (6.x-2.3)
+# Copyright (c) 2009 by the Hungarian translation team
+# Generated from files:
+#  image_caption.module,v 1.2.2.1 2008/08/21 07:47:05 davidwhthomas
+#  image_caption/image_caption.info: n/a
+#  image_caption/contrib/image_caption_filter.module: n/a
+#  image_caption_filter.info,v 1.1.2.1 2008/08/21 08:24:15 davidwhthomas
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: image_caption (6.x-2.3)\n"
+"POT-Creation-Date: 2009-02-10 12:27-0600\n"
+"PO-Revision-Date: 2008-11-05 00:37-0600\n"
+"Last-Translator: Balogh Zoltán\n"
+"Language-Team: Hungarian http://forditas.mindworks.hu\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n!=1);\n"
+
+#: image_caption.module:21
+msgid "Image Caption Settings"
+msgstr "Képaláírás beállításai"
+
+#: image_caption.module:22
+msgid "Configure image caption settings."
+msgstr "Képaláírás lehetőségeinek beállítása."
+
+#: image_caption.module:43
+msgid "Select node types to include in image captioning"
+msgstr "Képaláírással ellátható tartalomtípusok kiválasztása"
+
+#: image_caption.module:0
+msgid "image_caption"
+msgstr "image_caption"
+
+#: image_caption.info:0
+msgid "Image Caption"
+msgstr "Képaláírás"
+
+#: image_caption.info:0
+msgid "Provides a caption for images using jquery."
+msgstr "jQuery használatával képaláírásokat nyújt."
+
+#: contrib/image_caption_filter.module:27
+msgid "Adds captions to images"
+msgstr "Képaláírásokat ad a képekhez"
+
+#: contrib/image_caption_filter.module:37; contrib/image_caption_filter.info:0
+msgid "Image caption filter"
+msgstr "Képaláírás beviteli forma"
+
+#: contrib/image_caption_filter.module:40
+msgid "Adds captions to images via a filter"
+msgstr "Képaláírásokat ad a képekhez a beviteli formák segítségével"
+
+#: contrib/image_caption_filter.module:0
+msgid "image_caption_filter"
+msgstr "image_caption_filter"
+
+#: contrib/image_caption_filter.info:0
+msgid "Create captions on images using the title attribute."
+msgstr ""
+"Képaláírásokat hoz létre a képekhez a „title” tulajdonság "
+"használatával."
+
-- 
1.7.9.6 (Apple Git-31.1)


From 1b8120c510572916917a337672fa65aa634c348e Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Sun, 3 Jan 2010 05:39:18 +0000
Subject: [PATCH 05/19] Update to address http://drupal.org/node/300779 thanks
 awolfey and ngmaloney

---
 image_caption.js |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/image_caption.js b/image_caption.js
index 1bdffc1..eb3f134 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -4,9 +4,11 @@ $(document).ready(function(){
     var imgwidth = $(this).width();
     var imgheight = $(this).height();
     var captiontext = $(this).attr('title');
+    var style = $(this).attr('style');
     var alignment = $(this).attr('align');
-    $(this).attr({align:""});
-    $(this).wrap("<div class=\"image-caption-container\" style=\"float:" + alignment + "\"></div>");
+    //Clear image styles to prevent conflicts with parent div
+    $(this).attr('style','');
+    $(this).wrap("<div class=\"image-caption-container\" style=\"" + style + "; text-align: " + alignment + "\"></div>");
     $(this).parent().width(imgwidth);
     $(this).parent().append("<div class=\"image-caption\">" + captiontext + "</div>");
   });
-- 
1.7.9.6 (Apple Git-31.1)


From 991c93a3b4f85f9313fee0adbcc9d251cd47d37e Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Fri, 8 Jan 2010 22:43:24 +0000
Subject: [PATCH 06/19] Make caption wrappers spans, not divs for XHTML
 validity  ( http://drupal.org/node/374415 ) Also,
 check for zero width before applying to caption
 container ( http://drupal.org/node/675002 )

---
 image_caption.js |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/image_caption.js b/image_caption.js
index eb3f134..74df693 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -8,8 +8,10 @@ $(document).ready(function(){
     var alignment = $(this).attr('align');
     //Clear image styles to prevent conflicts with parent div
     $(this).attr('style','');
-    $(this).wrap("<div class=\"image-caption-container\" style=\"" + style + "; text-align: " + alignment + "\"></div>");
-    $(this).parent().width(imgwidth);
-    $(this).parent().append("<div class=\"image-caption\">" + captiontext + "</div>");
+    $(this).wrap("<span class=\"image-caption-container\" style=\"display:block;" + style + "; text-align: " + alignment + "\"></span>");
+    if(imgwidth != 'undefined' && imgwidth != 0){
+      $(this).parent().width(imgwidth);
+    }
+    $(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">" + captiontext + "</span>");
   });
 });
\ No newline at end of file
-- 
1.7.9.6 (Apple Git-31.1)


From 40ede19fce5ec61e337a3a382d0efb9537d69730 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Wed, 3 Feb 2010 07:50:25 +0000
Subject: [PATCH 07/19] Applied Stella's patch from
 http://drupal.org/node/702248

---
 image_caption.js |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/image_caption.js b/image_caption.js
index 74df693..c0079b1 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -7,8 +7,10 @@ $(document).ready(function(){
     var style = $(this).attr('style');
     var alignment = $(this).attr('align');
     //Clear image styles to prevent conflicts with parent div
-    $(this).attr('style','');
-    $(this).wrap("<span class=\"image-caption-container\" style=\"display:block;" + style + "; text-align: " + alignment + "\"></span>");
+    $(this).attr({align:""});
+    $(this).attr({style:""});
+    $(this).wrap("<span class=\"image-caption-container\" style=\"display:block;" + style + "; float: " + alignment + "\"></span>");
+    $(this).parent().addClass('image-caption-container-' + alignment);
     if(imgwidth != 'undefined' && imgwidth != 0){
       $(this).parent().width(imgwidth);
     }
-- 
1.7.9.6 (Apple Git-31.1)


From 0f2efb93c0cc77627e2c014a01ccc10876284f8b Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Wed, 3 Feb 2010 07:52:47 +0000
Subject: [PATCH 08/19] Removed no alt text warning - people who care about
 this will find out anyway

---
 contrib/image_caption_filter.module |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/contrib/image_caption_filter.module b/contrib/image_caption_filter.module
index d2806a9..1f4914c 100755
--- a/contrib/image_caption_filter.module
+++ b/contrib/image_caption_filter.module
@@ -73,11 +73,6 @@ function doImgTitles($matches) {
   //See if there is an alt attribute in the <img> tag, if not insert a LOUD warning
   preg_match ('/alt=\"(.+?)\"/i', $imgText, $matches);
   $alt = $matches[1];
-  if (empty($alt)) {
-    $alt_warning = '<font size="+3" color="pink" style="line-height:1em">No alternate text on picture! - define alternate text in image properties</font>';
-  } else {
-    $alt_warning = '';
-  }
 
   //Only insert the caption and modify the <img> tag if it is has a title attribute and is one of the classes we are interested in
   if (in_array($class, array('image-left', 'image-right', 'standalone-image')) && ($title)) {
@@ -85,9 +80,9 @@ function doImgTitles($matches) {
     $returnText = "<div class=\"" . $class . "\" style=\"width: " . $width . "px\">"
                   . $imgText 
                   . "<div class=\"caption\">" . $title . "</div></div>";
-    return $returnText . $alt_warning;
+    return $returnText;
   }
-  return $imgText . $alt_warning;
+  return $imgText;
 } //function doImgTitles
 
 ?>
-- 
1.7.9.6 (Apple Git-31.1)


From a0d8ebac6fcbaca292948aff599caa81ade64372 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@151344.no-reply.drupal.org>
Date: Wed, 3 Feb 2010 09:44:27 +0000
Subject: [PATCH 09/19] Remove remainder of alt text warning.

---
 contrib/image_caption_filter.module |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/contrib/image_caption_filter.module b/contrib/image_caption_filter.module
index 1f4914c..20bf7c5 100755
--- a/contrib/image_caption_filter.module
+++ b/contrib/image_caption_filter.module
@@ -70,10 +70,6 @@ function doImgTitles($matches) {
   preg_match ('/class=\"(.+?)\"/i', $imgText, $matches);
   $class = $matches[1];
 
-  //See if there is an alt attribute in the <img> tag, if not insert a LOUD warning
-  preg_match ('/alt=\"(.+?)\"/i', $imgText, $matches);
-  $alt = $matches[1];
-
   //Only insert the caption and modify the <img> tag if it is has a title attribute and is one of the classes we are interested in
   if (in_array($class, array('image-left', 'image-right', 'standalone-image')) && ($title)) {
     $imgText = preg_replace ('/class=\"(.+?)\"/i', '', $imgText);
-- 
1.7.9.6 (Apple Git-31.1)


From 8e569a39269f207db4b581a521ca75c15bcff877 Mon Sep 17 00:00:00 2001
From: The Great Git Migration <tggm@no-reply.drupal.org>
Date: Fri, 25 Feb 2011 02:08:27 +0000
Subject: [PATCH 10/19] Stripping CVS keywords

---
 README.txt                        |    1 -
 contrib/image_caption_filter.info |    1 -
 image_caption.js                  |    1 -
 image_caption.module              |    1 -
 4 files changed, 4 deletions(-)

diff --git a/README.txt b/README.txt
index 3ceefe6..f8ae60c 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,3 @@
-$Id$
 DESCRIPTION:
 This module uses JQuery to add captions to images.
 The image title attribute is used to create the image
diff --git a/contrib/image_caption_filter.info b/contrib/image_caption_filter.info
index ed94890..15212a6 100755
--- a/contrib/image_caption_filter.info
+++ b/contrib/image_caption_filter.info
@@ -1,4 +1,3 @@
-; $Id$
 name = Image caption filter
 description = Create captions on images using the title attribute.
 core = 6.x
diff --git a/image_caption.js b/image_caption.js
index c0079b1..5daf4e5 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -1,4 +1,3 @@
-/*$Id$*/
 $(document).ready(function(){
   $("img.caption").each(function(i) {
     var imgwidth = $(this).width();
diff --git a/image_caption.module b/image_caption.module
index 736f758..718da55 100644
--- a/image_caption.module
+++ b/image_caption.module
@@ -1,7 +1,6 @@
 <?php
 /**
 * @file
-* $Id$
 * Image Captioner Module using JQuery
 * Requires javascript as enabled on client pc
 * Adds a caption to images with 'caption' as their class using JQuery
-- 
1.7.9.6 (Apple Git-31.1)


From e600ab19b8ad228938e44db7485cedc6f99c4e28 Mon Sep 17 00:00:00 2001
From: The Great Git Migration <tggm@no-reply.drupal.org>
Date: Fri, 25 Feb 2011 02:08:27 +0000
Subject: [PATCH 11/19] Removing translation directories

---
 translations/hu.po |   66 ----------------------------------------------------
 1 file changed, 66 deletions(-)
 delete mode 100644 translations/hu.po

diff --git a/translations/hu.po b/translations/hu.po
deleted file mode 100644
index 7a2dce6..0000000
--- a/translations/hu.po
+++ /dev/null
@@ -1,66 +0,0 @@
-# Hungarian translation of image_caption (6.x-2.3)
-# Copyright (c) 2009 by the Hungarian translation team
-# Generated from files:
-#  image_caption.module,v 1.2.2.1 2008/08/21 07:47:05 davidwhthomas
-#  image_caption/image_caption.info: n/a
-#  image_caption/contrib/image_caption_filter.module: n/a
-#  image_caption_filter.info,v 1.1.2.1 2008/08/21 08:24:15 davidwhthomas
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: image_caption (6.x-2.3)\n"
-"POT-Creation-Date: 2009-02-10 12:27-0600\n"
-"PO-Revision-Date: 2008-11-05 00:37-0600\n"
-"Last-Translator: Balogh Zoltán\n"
-"Language-Team: Hungarian http://forditas.mindworks.hu\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n!=1);\n"
-
-#: image_caption.module:21
-msgid "Image Caption Settings"
-msgstr "Képaláírás beállításai"
-
-#: image_caption.module:22
-msgid "Configure image caption settings."
-msgstr "Képaláírás lehetőségeinek beállítása."
-
-#: image_caption.module:43
-msgid "Select node types to include in image captioning"
-msgstr "Képaláírással ellátható tartalomtípusok kiválasztása"
-
-#: image_caption.module:0
-msgid "image_caption"
-msgstr "image_caption"
-
-#: image_caption.info:0
-msgid "Image Caption"
-msgstr "Képaláírás"
-
-#: image_caption.info:0
-msgid "Provides a caption for images using jquery."
-msgstr "jQuery használatával képaláírásokat nyújt."
-
-#: contrib/image_caption_filter.module:27
-msgid "Adds captions to images"
-msgstr "Képaláírásokat ad a képekhez"
-
-#: contrib/image_caption_filter.module:37; contrib/image_caption_filter.info:0
-msgid "Image caption filter"
-msgstr "Képaláírás beviteli forma"
-
-#: contrib/image_caption_filter.module:40
-msgid "Adds captions to images via a filter"
-msgstr "Képaláírásokat ad a képekhez a beviteli formák segítségével"
-
-#: contrib/image_caption_filter.module:0
-msgid "image_caption_filter"
-msgstr "image_caption_filter"
-
-#: contrib/image_caption_filter.info:0
-msgid "Create captions on images using the title attribute."
-msgstr ""
-"Képaláírásokat hoz létre a képekhez a „title” tulajdonság "
-"használatával."
-
-- 
1.7.9.6 (Apple Git-31.1)


From 81e9febc5e7282f84a4da5e339e506d00dfba76f Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@gmail.com>
Date: Thu, 14 Apr 2011 21:28:31 +1200
Subject: [PATCH 12/19] Initial Drupal 7 version commit

---
 .gitignore                          |    1 +
 contrib/image_caption_filter.info   |    4 --
 contrib/image_caption_filter.module |   84 -----------------------------------
 image_caption.info                  |    8 ++--
 image_caption.js                    |   68 ++++++++++++++++++++--------
 image_caption.module                |   56 +++--------------------
 6 files changed, 60 insertions(+), 161 deletions(-)
 create mode 100644 .gitignore
 delete mode 100755 contrib/image_caption_filter.info
 delete mode 100755 contrib/image_caption_filter.module

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fbdcf80
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.komodoproject
diff --git a/contrib/image_caption_filter.info b/contrib/image_caption_filter.info
deleted file mode 100755
index 15212a6..0000000
--- a/contrib/image_caption_filter.info
+++ /dev/null
@@ -1,4 +0,0 @@
-name = Image caption filter
-description = Create captions on images using the title attribute.
-core = 6.x
-version = 6.x-1.x-dev
diff --git a/contrib/image_caption_filter.module b/contrib/image_caption_filter.module
deleted file mode 100755
index 20bf7c5..0000000
--- a/contrib/image_caption_filter.module
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/*
-  This module looks for <img> tags of the class 'image-left', 'image-right' or 'standalone-image'
-  with a title attibute set.  It then places the <img> tag in a <div> with the width and class
-  attributes set. A <div> tag of class "caption" is also added with the caption text obtained
-  from the title.  It removes the class attribute from the <img> tag.
-  <img> tags missing alt attributes are also marked with warning text to draw attention to 
-   this fact.
-  @info
-  http://drupal.org/node/264932
-  @author
-  John Fletcher
-  @contact
-  http://drupal.org/user/236219/contact
-*/
-
-/**
-* Display help and module information
-* @param path which path of the site we're displaying help
-* @param arg array that holds the current path as would be returned from arg() function
-* @return help text for the path
-*/
-function image_caption_filter_help($path, $arg) {
-  $output = '';
-  switch ($path) {
-    case "admin/help#image_caption_filter":
-      $output = '<p>' .  t("Adds captions to images") . '</p>';
-      break;
-  }
-  return $output;
-} //function image_caption_filter_help
-
-//filter hook implementation
-function image_caption_filter_filter($op, $delta = 0, $format = -1, $text = '') {
-  switch ($op) {
-    case 'list':
-      return array(0 => t('Image caption filter'));
-
-    case 'description':
-      return t('Adds captions to images via a filter');
-
-    case 'prepare':
-      // Nothing to prepare
-      return $text;
-
-    case "process":
-      //Look for <img> tags and run the doImgTitles function on the <img> tag
-      $text = preg_replace_callback('|(<img.*?>)|s', 'doImgTitles', $text);
-      return $text;
-
-    default:
-      return $text;
-  }
-} //function image_caption_filter_filter
-
-
-//helper function to do the actual manipulation
-function doImgTitles($matches) {
-  $imgText = $matches[0];
-
-  //Get the title out of the <img> tag
-  preg_match ('/title=\"(.+?)\"/i', $imgText, $matches);
-  $title = $matches[1];
-
-  //Get the width out of the <img> tag
-  preg_match ('/width=\"(.+?)\"/i', $imgText, $matches);
-  $width = $matches[1];
-
-  //Get class out of the <img> tag
-  preg_match ('/class=\"(.+?)\"/i', $imgText, $matches);
-  $class = $matches[1];
-
-  //Only insert the caption and modify the <img> tag if it is has a title attribute and is one of the classes we are interested in
-  if (in_array($class, array('image-left', 'image-right', 'standalone-image')) && ($title)) {
-    $imgText = preg_replace ('/class=\"(.+?)\"/i', '', $imgText);
-    $returnText = "<div class=\"" . $class . "\" style=\"width: " . $width . "px\">"
-                  . $imgText 
-                  . "<div class=\"caption\">" . $title . "</div></div>";
-    return $returnText;
-  }
-  return $imgText;
-} //function doImgTitles
-
-?>
diff --git a/image_caption.info b/image_caption.info
index 2253580..f1be512 100644
--- a/image_caption.info
+++ b/image_caption.info
@@ -1,6 +1,4 @@
-;$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
+description = "Provides a caption for images from the title attribute using jQuery."
+version = "7.x-1.0-dev"
+core = 7.x
\ No newline at end of file
diff --git a/image_caption.js b/image_caption.js
index 5daf4e5..479c209 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -1,18 +1,50 @@
-$(document).ready(function(){
-  $("img.caption").each(function(i) {
-    var imgwidth = $(this).width();
-    var imgheight = $(this).height();
-    var captiontext = $(this).attr('title');
-    var style = $(this).attr('style');
-    var alignment = $(this).attr('align');
-    //Clear image styles to prevent conflicts with parent div
-    $(this).attr({align:""});
-    $(this).attr({style:""});
-    $(this).wrap("<span class=\"image-caption-container\" style=\"display:block;" + style + "; float: " + alignment + "\"></span>");
-    $(this).parent().addClass('image-caption-container-' + alignment);
-    if(imgwidth != 'undefined' && imgwidth != 0){
-      $(this).parent().width(imgwidth);
-    }
-    $(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">" + captiontext + "</span>");
-  });
-});
\ No newline at end of file
+(function($) {
+  
+Drupal.behaviors.image_caption = {
+  attach: function (context, settings) {
+    $("img.caption").each(function(i) {
+      var imgwidth = $(this).width() ? $(this).width() : false;
+      var imgheight = $(this).height() ? $(this).height() : false;
+      
+      // Get caption from title attribute
+      var captiontext = $(this).attr('title');
+      
+      // Get image alignment and style to apply to container
+      if($(this).attr('align')){
+        var alignment = $(this).attr('align');
+        $(this).css({'float':alignment}); // add to css float
+        $(this).removeAttr('align');
+      }else if($(this).css('float')){
+        var alignment = $(this).css('float');
+      }else{
+        var alignment = 'normal';
+      }
+      var style = $(this).attr('style') ? $(this).attr('style') : '';
+
+      // Reset img styles as are added to container instead      
+      $(this).removeAttr('width');
+      $(this).removeAttr('height');
+      $(this).css('width', '');
+      $(this).css('height', '');     
+      $(this).removeAttr('align');
+      $(this).removeAttr('style');
+      
+      //Display inline block so it doesn't break any text aligns on the parent contatiner
+      $(this).wrap("<span class=\"image-caption-container\" style=\"display:inline-block;" + style + "\"></span>");
+      $(this).parent().addClass('image-caption-container-' + alignment);
+      
+      // Add dimensions, if available
+      if(imgwidth){
+        $(this).width(imgwidth);
+        $(this).parent().width(imgwidth);
+      }
+      if(imgheight){
+        $(this).height(imgheight);
+      }
+      // Append caption
+      $(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">" + captiontext + "</span>");
+    });
+  }
+};
+
+})(jQuery);
diff --git a/image_caption.module b/image_caption.module
index 718da55..d07158e 100644
--- a/image_caption.module
+++ b/image_caption.module
@@ -10,53 +10,9 @@
 */
 
 /**
-* Implementation of hook_menu().
-*/
-
-function image_caption_menu() {
-  $items = array();
-
-  $items['admin/settings/image_caption'] = array(
-    'title' => t('Image Caption Settings'),
-    'description' => t('Configure image caption settings.'),
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('image_caption_admin_settings'),
-    'access arguments' => array('administer site configuration')
-  );
-
-  return $items;
-}
-
-/*
-* Implementation of the hook_admin_settings()
-*/
-function image_caption_admin_settings() {
-
-  //node type settings
-  $node_types = node_get_types();
-  foreach ($node_types as $type) {
-    $types[$type->type] = $type->name;
-  }
-  $form['image_caption_node_types'] = array(
-    '#type' => 'select',
-    '#title' => t('Select node types to include in image captioning'),
-    '#default_value' => variable_get('image_caption_node_types', array()),
-    '#multiple' => TRUE,
-    '#options' => $types
-  );
-  return system_settings_form($form);
-}
-
-/*
-* Implementation of hook_nodeapi()
-* On 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');
-    }
-  }
-}
+ * Implementation of hook_init
+ * Add captioning javascript
+ */
+function image_caption_init(){
+  drupal_add_js(drupal_get_path('module', 'image_caption') . '/image_caption.min.js');
+}
\ No newline at end of file
-- 
1.7.9.6 (Apple Git-31.1)


From 65c926ca8b6b0bd42acc1127abf4b21b975500eb Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@gmail.com>
Date: Thu, 14 Apr 2011 21:28:53 +1200
Subject: [PATCH 13/19] Add minified JS

---
 image_caption.min.js |    4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 image_caption.min.js

diff --git a/image_caption.min.js b/image_caption.min.js
new file mode 100644
index 0000000..8f2e353
--- /dev/null
+++ b/image_caption.min.js
@@ -0,0 +1,4 @@
+(function($){Drupal.behaviors.image_caption={attach:function(context,settings){$("img.caption").each(function(i){var imgwidth=$(this).width()?$(this).width():false;var imgheight=$(this).height()?$(this).height():false;var captiontext=$(this).attr('title');if($(this).attr('align')){var alignment=$(this).attr('align');$(this).css({'float':alignment});$(this).removeAttr('align');}else if($(this).css('float')){var alignment=$(this).css('float');}else{var alignment='normal';}
+var style=$(this).attr('style')?$(this).attr('style'):'';$(this).removeAttr('width');$(this).removeAttr('height');$(this).css('width','');$(this).css('height','');$(this).removeAttr('align');$(this).removeAttr('style');$(this).wrap("<span class=\"image-caption-container\" style=\"display:inline-block;"+style+"\"></span>");$(this).parent().addClass('image-caption-container-'+alignment);if(imgwidth){$(this).width(imgwidth);$(this).parent().width(imgwidth);}
+if(imgheight){$(this).height(imgheight);}
+$(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">"+captiontext+"</span>");});}};})(jQuery);
\ No newline at end of file
-- 
1.7.9.6 (Apple Git-31.1)


From f5330afd2723003997a2dbbc62e4d8042b0f8b84 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@gmail.com>
Date: Sun, 24 Apr 2011 17:15:18 +1200
Subject: [PATCH 14/19] Remove .gitignore from public commit

---
 .gitignore |    1 -
 1 file changed, 1 deletion(-)
 delete mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index fbdcf80..0000000
--- a/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.komodoproject
-- 
1.7.9.6 (Apple Git-31.1)


From e79a01271bcba21268d269e5b1de10ede7ccf210 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@gmail.com>
Date: Sun, 24 Apr 2011 20:33:27 +1200
Subject: [PATCH 15/19] Add image caption filter module, thanks to Florian
 Weber (webflo)

---
 contrib/image_caption_filter.info   |    4 +
 contrib/image_caption_filter.module |  171 +++++++++++++++++++++++++++++++++++
 2 files changed, 175 insertions(+)
 create mode 100644 contrib/image_caption_filter.info
 create mode 100644 contrib/image_caption_filter.module

diff --git a/contrib/image_caption_filter.info b/contrib/image_caption_filter.info
new file mode 100644
index 0000000..5230570
--- /dev/null
+++ b/contrib/image_caption_filter.info
@@ -0,0 +1,4 @@
+name = "Image caption filter"
+description = "Create captions on images using the title attribute."
+version = "7.x-1.0-beta1"
+core = 7.x
\ No newline at end of file
diff --git a/contrib/image_caption_filter.module b/contrib/image_caption_filter.module
new file mode 100644
index 0000000..766ed2c
--- /dev/null
+++ b/contrib/image_caption_filter.module
@@ -0,0 +1,171 @@
+<?php
+/*
+  This module looks for <img> tags of the class 'image-left', 'image-right' or 'standalone-image'
+  with a title attibute set.  It then places the <img> tag in a <div> with the width and class
+  attributes set. A <div> tag of class "caption" is also added with the caption text obtained
+  from the title.  It removes the class attribute from the <img> tag.
+  @info
+  http://drupal.org/node/264932
+  @author
+  John Fletcher
+  http://drupal.org/user/236219/contact
+  Florian Weber
+  http://drupal.org/user/254778/contact
+*/
+
+/**
+ * Implements hook_filter_info().
+ */
+function image_caption_filter_filter_info() {
+  $filters['filter_image_caption'] = array(
+    'title' => t('Image caption filter'),
+    'settings callback' => 'image_caption_filter_filter_filter_image_caption_settings',
+    'process callback' => 'image_caption_filter_filter_filter_image_caption_process',
+    'tips callback' => 'image_caption_filter_filter_filter_image_caption_tips',
+    'default settings' => array(
+      'classes' => variable_get('image_caption_filter_classes', 'image-left image-right standalone-image'),
+    ),
+  );
+ 
+  return $filters;
+}
+
+/**
+ * Implements hook_filter_FILTER_settings().
+ */
+function image_caption_filter_filter_filter_image_caption_settings($form, &$form_state, $filter, $format, $defaults, $filters) {
+  $filter->settings += $defaults;
+  $elements = array();
+  
+  $elements['classes'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Classes to be searched for image captions'),
+    '#default_value' => $filter->settings['classes'],
+    '#size' => 80,
+    '#description' => t('Enter a space-separated list of classes. The filter will only operate on images which have one of these CSS classes and have a title attribute.'),
+    '#required' => TRUE,
+  );
+  
+  return $elements;
+}
+
+/**
+ * Implements hook_filter_FILTER_process().
+ */
+function image_caption_filter_filter_filter_image_caption_process($text, $filter, $format, $langcode, $cache, $cache_id) {
+  image_caption_filter_active_classes(array_filter(explode(' ', $filter->settings['classes'])));
+  return preg_replace_callback('|(<img.*?>)|s', '_image_caption_filter_do_img_titles', $text);
+}
+
+/**
+ * Implements hook_filter_FILTER_tips().
+ *
+ * Display help and module information
+ * @param path which path of the site we're displaying help
+ * @param arg array that holds the current path as would be returned from arg() function
+ * @return help text for the path
+ */
+function image_caption_filter_filter_filter_image_caption_tips($filter, $format, $long = FALSE) {
+  return t('Adds captions, from the title attribute, to images with one of the following classes: %classes', array('%classes' => variable_get('image_caption_filter_classes', 'image-left image-right standalone-image')));
+}
+
+/**
+ * Storage for active class names
+ * 
+ * _image_caption_filter_do_img_titles() is called by preg_replace_callback() and this function allows only one argument.
+ */
+function image_caption_filter_active_classes($classes = NULL) {
+  static $_classes = array();
+  if ($classes != NULL) { 
+    $_classes = $classes; 
+  }
+  
+  return $_classes;
+}
+
+/**
+ * Helper function to do the actual manipulation.
+ */
+function _image_caption_filter_do_img_titles($img_tag_matches, $active_classes = NULL) {
+  $img_tag = $img_tag_matches[0];
+  $return_text = $img_tag;
+
+  // only execute this filter on img tags with (at least) one of the classes we are interested in
+  $has_class = preg_match('/class=\"(.+?)\"/i', $img_tag, $matches) > 0;
+  if ($has_class) {
+    $class = $matches[1];
+    // formally, class is a space separated list of classes, but we allow all horizontal whitespace in any quantity
+    // that's why we use preg_split instead of explode
+    $classes = preg_split('/\s+/', $class, null, PREG_SPLIT_NO_EMPTY);
+
+    // get active classes via image_caption_filter_active_classes() because preg_replace_callback() does not support addional arguments.
+    if ($active_classes == NULL) {
+      $active_classes = image_caption_filter_active_classes();
+    }
+
+    if (count(array_intersect($classes, $active_classes)) > 0) {
+      // only execute this filter on img tags that have a title attribute
+      $has_title = preg_match('/title=\"(.+?)\"/i', $img_tag, $matches) > 0;
+      if ($has_title) {
+        $title = $matches[1];
+
+        // search for width specified as an inline style or width attribute,
+        // if no width specified, don't output it on the outer span, assume width will be handled with css external to this module/filter
+        $width = '';
+        if (preg_match('/width:\s*(\d+)px/i', $img_tag, $matches) == 1 || preg_match ('/width=\"(\d+?)\"/i', $img_tag, $matches) == 1) {
+          $width = $matches[1];
+        }
+
+        // search for float specified as an inline style on the image
+        $float = '';
+        if (preg_match('/float:\s*(\w+)/i', $img_tag, $matches) == 1) {
+          $float = $matches[1];
+        }
+
+        // remove the class from the image tag
+        $img_tag = preg_replace('/class=\"(.+?)\"/i', '', $img_tag);
+
+        // build the image and caption
+        $caption = array(
+          'img' => array(
+            '#type' => 'markup',
+            '#markup' => $img_tag,
+          ),
+          'caption' => array(
+            '#type' => 'html_tag',
+            '#tag' => 'span',
+            '#attributes' => array(
+              'class' => 'caption',
+              'style' => 'display:block',
+            ),
+            '#value' => $title,
+          ),
+        );
+
+        // build the wrapping elemement.
+        $element = array(
+          'image_caption' => array(
+            '#type' => 'html_tag',
+            '#tag' => 'span',
+            '#attributes' => array(
+              'class' => $class
+            ),
+            '#value' => render($caption),
+          ),
+        );
+
+        if (!empty($width)) {
+          $element['image_caption']['#attributes']['style'][] = 'width:' . $width . 'px;';
+        }
+        
+        if (!empty($float)) {
+          $element['image_caption']['#attributes']['style'][] = 'float:' . $float;
+        }
+        
+        $return_text = render($element);
+      }
+    }
+  }
+  
+  return $return_text;
+}
-- 
1.7.9.6 (Apple Git-31.1)


From d33fa596b34324858bf3d1bda96b1dd9f1de27b2 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@gmail.com>
Date: Sun, 24 Apr 2011 20:35:04 +1200
Subject: [PATCH 16/19] Bump version number

---
 contrib/image_caption_filter.info |    4 ++--
 image_caption.info                |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/image_caption_filter.info b/contrib/image_caption_filter.info
index 5230570..8ac99f1 100644
--- a/contrib/image_caption_filter.info
+++ b/contrib/image_caption_filter.info
@@ -1,4 +1,4 @@
 name = "Image caption filter"
 description = "Create captions on images using the title attribute."
-version = "7.x-1.0-beta1"
-core = 7.x
\ No newline at end of file
+version = "7.x-1.0-beta2"
+core = 7.x
diff --git a/image_caption.info b/image_caption.info
index f1be512..e9bcedb 100644
--- a/image_caption.info
+++ b/image_caption.info
@@ -1,4 +1,4 @@
-name = "Image Caption"
+name = "Image caption"
 description = "Provides a caption for images from the title attribute using jQuery."
-version = "7.x-1.0-dev"
-core = 7.x
\ No newline at end of file
+version = "7.x-1.0-beta2"
+core = 7.x
-- 
1.7.9.6 (Apple Git-31.1)


From 834b5e9e345702a8cc7eb420ee70b9727b738dd7 Mon Sep 17 00:00:00 2001
From: David Thomas <davidwhthomas@gmail.com>
Date: Wed, 27 Apr 2011 20:22:32 +1200
Subject: [PATCH 17/19] #1139112 prevent caption duplication on DOM change

---
 contrib/image_caption_filter.info |    1 -
 image_caption.info                |    1 -
 image_caption.js                  |    5 ++++-
 image_caption.min.js              |    4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/contrib/image_caption_filter.info b/contrib/image_caption_filter.info
index 8ac99f1..69000c5 100644
--- a/contrib/image_caption_filter.info
+++ b/contrib/image_caption_filter.info
@@ -1,4 +1,3 @@
 name = "Image caption filter"
 description = "Create captions on images using the title attribute."
-version = "7.x-1.0-beta2"
 core = 7.x
diff --git a/image_caption.info b/image_caption.info
index e9bcedb..7a16abe 100644
--- a/image_caption.info
+++ b/image_caption.info
@@ -1,4 +1,3 @@
 name = "Image caption"
 description = "Provides a caption for images from the title attribute using jQuery."
-version = "7.x-1.0-beta2"
 core = 7.x
diff --git a/image_caption.js b/image_caption.js
index 479c209..82199ea 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -2,7 +2,7 @@
   
 Drupal.behaviors.image_caption = {
   attach: function (context, settings) {
-    $("img.caption").each(function(i) {
+    $("img.caption:not(.caption-processed)").each(function(i) {
       var imgwidth = $(this).width() ? $(this).width() : false;
       var imgheight = $(this).height() ? $(this).height() : false;
       
@@ -43,6 +43,9 @@ Drupal.behaviors.image_caption = {
       }
       // Append caption
       $(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">" + captiontext + "</span>");
+      
+      // Add class to prevent duplicate caption adding
+      $(this).addClass('caption-processed');
     });
   }
 };
diff --git a/image_caption.min.js b/image_caption.min.js
index 8f2e353..90f540f 100644
--- a/image_caption.min.js
+++ b/image_caption.min.js
@@ -1,4 +1,4 @@
-(function($){Drupal.behaviors.image_caption={attach:function(context,settings){$("img.caption").each(function(i){var imgwidth=$(this).width()?$(this).width():false;var imgheight=$(this).height()?$(this).height():false;var captiontext=$(this).attr('title');if($(this).attr('align')){var alignment=$(this).attr('align');$(this).css({'float':alignment});$(this).removeAttr('align');}else if($(this).css('float')){var alignment=$(this).css('float');}else{var alignment='normal';}
+(function($){Drupal.behaviors.image_caption={attach:function(context,settings){$("img.caption:not(.caption-processed)").each(function(i){var imgwidth=$(this).width()?$(this).width():false;var imgheight=$(this).height()?$(this).height():false;var captiontext=$(this).attr('title');if($(this).attr('align')){var alignment=$(this).attr('align');$(this).css({'float':alignment});$(this).removeAttr('align');}else if($(this).css('float')){var alignment=$(this).css('float');}else{var alignment='normal';}
 var style=$(this).attr('style')?$(this).attr('style'):'';$(this).removeAttr('width');$(this).removeAttr('height');$(this).css('width','');$(this).css('height','');$(this).removeAttr('align');$(this).removeAttr('style');$(this).wrap("<span class=\"image-caption-container\" style=\"display:inline-block;"+style+"\"></span>");$(this).parent().addClass('image-caption-container-'+alignment);if(imgwidth){$(this).width(imgwidth);$(this).parent().width(imgwidth);}
 if(imgheight){$(this).height(imgheight);}
-$(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">"+captiontext+"</span>");});}};})(jQuery);
\ No newline at end of file
+$(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">"+captiontext+"</span>");$(this).addClass('caption-processed');});}};})(jQuery);
\ No newline at end of file
-- 
1.7.9.6 (Apple Git-31.1)


From 82f855b27f8e9912f6e328d588d5354395e6722a Mon Sep 17 00:00:00 2001
From: John Fletcher <john@saltwebsites.com>
Date: Wed, 24 Aug 2011 17:06:02 +0200
Subject: [PATCH 18/19] Removed whitespace

---
 README.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.txt b/README.txt
index f8ae60c..c24881a 100644
--- a/README.txt
+++ b/README.txt
@@ -3,7 +3,7 @@ This module uses JQuery to add captions to images.
 The image title attribute is used to create the image
 
 EXAMPLE:
-<img src="/files/example.jpg" title="example caption" class="caption" />
+<img src="/files/example.jpg" title="example caption" class="caption"/>
 This will result in an image with the caption of 'example caption'
 
 Important:
-- 
1.7.9.6 (Apple Git-31.1)


From 0bd9d7537c7f3d181acfa04ca78cd920058501b0 Mon Sep 17 00:00:00 2001
From: Max Bronsema <Max.Bronsema@wwu.edu>
Date: Thu, 21 Feb 2013 10:24:30 -0800
Subject: [PATCH 19/19] Styles were injected into the wrong location in the
 initial patch.

---
 image_caption.js     |   12 ++++++------
 image_caption.min.js |    5 +----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/image_caption.js b/image_caption.js
index 82199ea..31509be 100644
--- a/image_caption.js
+++ b/image_caption.js
@@ -21,7 +21,7 @@ Drupal.behaviors.image_caption = {
       }
       var style = $(this).attr('style') ? $(this).attr('style') : '';
 
-      // Reset img styles as are added to container instead      
+      // Reset img styles are added to container instead      
       $(this).removeAttr('width');
       $(this).removeAttr('height');
       $(this).css('width', '');
@@ -29,8 +29,8 @@ Drupal.behaviors.image_caption = {
       $(this).removeAttr('align');
       $(this).removeAttr('style');
       
-      //Display inline block so it doesn't break any text aligns on the parent contatiner
-      $(this).wrap("<span class=\"image-caption-container\" style=\"display:inline-block;" + style + "\"></span>");
+      //Display as a figure element
+      $(this).wrap("<figure class=\"image-caption-container\" style=\""+ style + "\"></figure>");
       $(this).parent().addClass('image-caption-container-' + alignment);
       
       // Add dimensions, if available
@@ -41,8 +41,8 @@ Drupal.behaviors.image_caption = {
       if(imgheight){
         $(this).height(imgheight);
       }
-      // Append caption
-      $(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">" + captiontext + "</span>");
+      // Append caption as a figcaption element
+      $(this).parent().append("<figcaption class=\"image-caption\">" + captiontext + "</figcaption>");
       
       // Add class to prevent duplicate caption adding
       $(this).addClass('caption-processed');
@@ -50,4 +50,4 @@ Drupal.behaviors.image_caption = {
   }
 };
 
-})(jQuery);
+})(jQuery);
\ No newline at end of file
diff --git a/image_caption.min.js b/image_caption.min.js
index 90f540f..e108008 100644
--- a/image_caption.min.js
+++ b/image_caption.min.js
@@ -1,4 +1 @@
-(function($){Drupal.behaviors.image_caption={attach:function(context,settings){$("img.caption:not(.caption-processed)").each(function(i){var imgwidth=$(this).width()?$(this).width():false;var imgheight=$(this).height()?$(this).height():false;var captiontext=$(this).attr('title');if($(this).attr('align')){var alignment=$(this).attr('align');$(this).css({'float':alignment});$(this).removeAttr('align');}else if($(this).css('float')){var alignment=$(this).css('float');}else{var alignment='normal';}
-var style=$(this).attr('style')?$(this).attr('style'):'';$(this).removeAttr('width');$(this).removeAttr('height');$(this).css('width','');$(this).css('height','');$(this).removeAttr('align');$(this).removeAttr('style');$(this).wrap("<span class=\"image-caption-container\" style=\"display:inline-block;"+style+"\"></span>");$(this).parent().addClass('image-caption-container-'+alignment);if(imgwidth){$(this).width(imgwidth);$(this).parent().width(imgwidth);}
-if(imgheight){$(this).height(imgheight);}
-$(this).parent().append("<span style=\"display:block;\" class=\"image-caption\">"+captiontext+"</span>");$(this).addClass('caption-processed');});}};})(jQuery);
\ No newline at end of file
+(function(e){Drupal.behaviors.image_caption={attach:function(t,n){e("img.caption:not(.caption-processed)").each(function(t){var n=e(this).width()?e(this).width():false;var r=e(this).height()?e(this).height():false;var i=e(this).attr("title");if(e(this).attr("align")){var s=e(this).attr("align");e(this).css({"float":s});e(this).removeAttr("align")}else if(e(this).css("float")){var s=e(this).css("float")}else{var s="normal"}var o=e(this).attr("style")?e(this).attr("style"):"";e(this).removeAttr("width");e(this).removeAttr("height");e(this).css("width","");e(this).css("height","");e(this).removeAttr("align");e(this).removeAttr("style");e(this).wrap('<figure class="image-caption-container" style="'+o+'"></figure>');e(this).parent().addClass("image-caption-container-"+s);if(n){e(this).width(n);e(this).parent().width(n)}if(r){e(this).height(r)}e(this).parent().append('<figcaption class="image-caption">'+i+"</figcaption>");e(this).addClass("caption-processed")})}}})(jQuery)
\ No newline at end of file
-- 
1.7.9.6 (Apple Git-31.1)

