From 277cf55286b181b55f9fbe1c697c2a04a58d75df Mon Sep 17 00:00:00 2001
From: Max Bronsema <Max.Bronsema@wwu.edu>
Date: Thu, 21 Feb 2013 11:46:43 -0800
Subject: [PATCH] Issue 1918618 - adding styles to the figures.

---
 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..8995b8f 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..e422a6b 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(a){Drupal.behaviors.image_caption={attach:function(b,c){a("img.caption:not(.caption-processed)").each(function(f){var h=a(this).width()?a(this).width():false;var e=a(this).height()?a(this).height():false;var d=a(this).attr("title");if(a(this).attr("align")){var j=a(this).attr("align");a(this).css({"float":j});a(this).removeAttr("align")}else{if(a(this).css("float")){var j=a(this).css("float")}else{var j="normal"}}var g=a(this).attr("style")?a(this).attr("style"):"";a(this).removeAttr("width");a(this).removeAttr("height");a(this).css("width","");a(this).css("height","");a(this).removeAttr("align");a(this).removeAttr("style");a(this).wrap('<figure class="image-caption-container" style="'+g+'"></figure>');a(this).parent().addClass("image-caption-container-"+j);if(h){a(this).width(h);a(this).parent().width(h)}if(e){a(this).height(e)}a(this).parent().append('<figcaption class="image-caption">'+d+"</figcaption>");a(this).addClass("caption-processed")})}}})(jQuery);
\ No newline at end of file
-- 
1.7.9.6 (Apple Git-31.1)

