diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 5952faf99..9bba6cbbd 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -625,15 +625,11 @@ $(document).ready(addFormObserversForDoubleSubmit); function img_thumbnails() { $('.thumbnails a').colorbox({rel:'nofollow'}); $('.attachments').find('a').each(function(index, element) { - if($(element).attr('href').indexOf('.jpg') > 0) { + var href_value = $(element).attr('href'); + if (/\.(jpg|png|gif|bmp)$/.test(href_value)) { $(element).colorbox({rel:'nofollow'}); } - if($(element).attr('href').indexOf('.png') > 0) { - $(element).colorbox({rel:'nofollow'}); - } - if($(element).attr('href').indexOf('.gif') > 0) { - $(element).colorbox({rel:'nofollow'}); - } - }) + + }); } $(document).ready(img_thumbnails);