From 1746aa94052ec9e71fd549e494b13c4cd1111e12 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Fri, 13 Jul 2012 10:38:42 -0300 Subject: [PATCH] Extract Method --- public/javascripts/article.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/javascripts/article.js b/public/javascripts/article.js index 6095a5f..f6ff887 100644 --- a/public/javascripts/article.js +++ b/public/javascripts/article.js @@ -80,6 +80,11 @@ jQuery(function($) { } } + function zoom_dialog_html(img) { + // FIXME organize this code better + return '
' + '
' + add_to_text_button('with-text') + '   ' + close_button('with-text') + '
' + } + $('a.add-to-text').live('click', function() { var $item = $(this).closest('.item'); var html_selector = $item.attr('data-item'); @@ -91,7 +96,10 @@ jQuery(function($) { var $item = $(this).closest('.item'); var html_selector = $item.attr('data-item'); var img = $item.find(html_selector).find('img').attr('src'); - $.colorbox({ html: '
' + '
' + add_to_text_button('with-text') + '   ' + close_button('with-text') + '
', scrolling: false }); + $.colorbox({ + html: zoom_dialog_html(img), + scrolling: false + }); return false; }); $('a.close').live('click', function() { -- libgit2 0.21.2