Commit 1746aa94052ec9e71fd549e494b13c4cd1111e12
1 parent
32aacc15
Exists in
master
and in
29 other branches
Extract Method
Showing
1 changed file
with
9 additions
and
1 deletions
Show diff stats
public/javascripts/article.js
@@ -80,6 +80,11 @@ jQuery(function($) { | @@ -80,6 +80,11 @@ jQuery(function($) { | ||
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | + function zoom_dialog_html(img) { | ||
84 | + // FIXME organize this code better | ||
85 | + return '<div class="item" data-item="div"><div><img src="' + img + '" style="max-width: 640px; max-height: 480px"/></div>' + '<div class="button-bar">' + add_to_text_button('with-text') + ' ' + close_button('with-text') + '</div></div>' | ||
86 | + } | ||
87 | + | ||
83 | $('a.add-to-text').live('click', function() { | 88 | $('a.add-to-text').live('click', function() { |
84 | var $item = $(this).closest('.item'); | 89 | var $item = $(this).closest('.item'); |
85 | var html_selector = $item.attr('data-item'); | 90 | var html_selector = $item.attr('data-item'); |
@@ -91,7 +96,10 @@ jQuery(function($) { | @@ -91,7 +96,10 @@ jQuery(function($) { | ||
91 | var $item = $(this).closest('.item'); | 96 | var $item = $(this).closest('.item'); |
92 | var html_selector = $item.attr('data-item'); | 97 | var html_selector = $item.attr('data-item'); |
93 | var img = $item.find(html_selector).find('img').attr('src'); | 98 | var img = $item.find(html_selector).find('img').attr('src'); |
94 | - $.colorbox({ html: '<div class="item" data-item="div"><div><img src="' + img + '" style="max-width: 640px; max-height: 480px"/></div>' + '<div class="button-bar" style="padding-top: 5px;">' + add_to_text_button('with-text') + ' ' + close_button('with-text') + '</div></div>', scrolling: false }); | 99 | + $.colorbox({ |
100 | + html: zoom_dialog_html(img), | ||
101 | + scrolling: false | ||
102 | + }); | ||
95 | return false; | 103 | return false; |
96 | }); | 104 | }); |
97 | $('a.close').live('click', function() { | 105 | $('a.close').live('click', function() { |