give names to callback functions

This commit is contained in:
Sacha Greif 2015-04-27 10:12:48 +09:00
parent 01ddf50c3e
commit 1f87ae90fc
2 changed files with 7 additions and 5 deletions

View file

@ -69,8 +69,9 @@ var thumbnailHeightProperty = {
}
Settings.registerField(thumbnailHeightProperty);
// add callback that adds "has-thumbnail" or "no-thumbnail" CSS classes
Telescope.callbacks.register("postClass", function (post, postClass){
function addThumbnailClass (post, postClass){
var thumbnailClass = !!post.thumbnailUrl ? "has-thumbnail" : "no-thumbnail";
return postClass + " " + thumbnailClass;
});
}
// add callback that adds "has-thumbnail" or "no-thumbnail" CSS classes
Telescope.callbacks.register("postClass", addThumbnailClass);

View file

@ -62,7 +62,8 @@ getCategoryUrl = function(slug){
};
// add callback that adds categories CSS classes
Telescope.callbacks.register("postClass", function (post, postClass){
function addCategoryClass (post, postClass){
var classArray = _.map(getPostCategories(post), function (category){return "category-"+category.slug});
return postClass + " " + classArray.join(' ');
});
}
Telescope.callbacks.register("postClass", addCategoryClass);