optimization image check.

This commit is contained in:
yanxd 2014-07-10 10:12:16 +08:00
parent 2b57e170ef
commit 2ff24841fd
1 changed files with 4 additions and 8 deletions

View File

@ -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);