diff --git a/src/js/slate.js b/src/js/slate.js index a9f8d60..b76aaa3 100644 --- a/src/js/slate.js +++ b/src/js/slate.js @@ -264,8 +264,8 @@ renderTiles(); var getBackgroundImages = function() { var backgrounds = document.getElementsByTagName("body"); var images = []; - if (backgrounds.length > 0) { - var imgString = backgrounds[0].getAttribute("data-backgrounds"); + var imgString = backgrounds[0].getAttribute("data-backgrounds"); + if (imgString) { images = imgString.split(/[\s,]+/).filter(Boolean); } return images; diff --git a/static/js/slate.js b/static/js/slate.js index b546c22..a48cc6a 100644 --- a/static/js/slate.js +++ b/static/js/slate.js @@ -3465,8 +3465,8 @@ renderTiles(); var getBackgroundImages = function() { var backgrounds = document.getElementsByTagName("body"); var images = []; - if (backgrounds.length > 0) { - var imgString = backgrounds[0].getAttribute("data-backgrounds"); + var imgString = backgrounds[0].getAttribute("data-backgrounds"); + if (imgString) { images = imgString.split(/[\s,]+/).filter(Boolean); } return images;