Permalink
Browse files

peep: add a placeholder

  • Loading branch information...
1 parent 03d1cd7 commit 58de87687eaa7cbe026b522febedf9e5f9a0866e @msantos committed Feb 28, 2011
Showing with 7 additions and 2 deletions.
  1. BIN priv/www/default.png
  2. +7 −2 priv/www/js/peep.js
View
BIN priv/www/default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 priv/www/js/peep.js
@@ -3,6 +3,7 @@ var peep = function () {
var json = {};
var url = "/web/peep:show";
var MAX = 9;
+ var PLACEHOLDER = "/default.png";
var slots = _.map(_.range(MAX), function (n) {
return null;
});
@@ -20,7 +21,10 @@ var peep = function () {
},
'json': function (v) {
return (v ? json = v : json);
- }
+ },
+ 'placeholder': function () {
+ return (PLACEHOLDER);
+ },
};
}();
@@ -62,7 +66,8 @@ function redraw(json) {
});
$.each(nslots, function (n) {
- set_image(nslots[n], n);
+ var img = nslots[n] ? nslots[n] : peep.placeholder();
+ set_image(img, n);
});
peep.slots(nslots);
}

0 comments on commit 58de876

Please sign in to comment.