Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gesquive/slate.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGus Esquivel <gesquive@gmail.com>2017-05-17 16:25:24 +0300
committerGus Esquivel <gesquive@gmail.com>2017-05-17 16:25:24 +0300
commit86b73ea29136f87aa2ed91135e10f822fd5636b4 (patch)
tree1b656c1e7adc34468cb2ebe5b7e306d44d9eaf7a
parent81989acb958710629b71e9258df8f5060884a1e7 (diff)
silence errors when missing background images
-rw-r--r--src/js/slate.js4
-rw-r--r--static/js/slate.js4
2 files changed, 4 insertions, 4 deletions
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;