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 | 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 | 88 | $('a.add-to-text').live('click', function() { |
84 | 89 | var $item = $(this).closest('.item'); |
85 | 90 | var html_selector = $item.attr('data-item'); |
... | ... | @@ -91,7 +96,10 @@ jQuery(function($) { |
91 | 96 | var $item = $(this).closest('.item'); |
92 | 97 | var html_selector = $item.attr('data-item'); |
93 | 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 | 103 | return false; |
96 | 104 | }); |
97 | 105 | $('a.close').live('click', function() { | ... | ... |