diff options
Diffstat (limited to 'html/collection.js')
-rw-r--r-- | html/collection.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/html/collection.js b/html/collection.js index 4c9c2b5..d6ddd38 100644 --- a/html/collection.js +++ b/html/collection.js @@ -7,7 +7,7 @@ enyo.kind({ components: [ { name: "spinner", kind: "Image", src: "images/spinner-light.gif", classes: "spinner-small"}, { name: "contentBox", showing: false, components: [ - { name: "itemImage", classes: "collectionImage", kind: "Image", onload: "imageLoaded" }, + { name: "itemImage", classes: "collectionImage", kind: "Image", onload: "imageLoaded", onerror: "imageError" }, { name: "itemText", classes: "collectionText" } ]} ], @@ -25,6 +25,11 @@ enyo.kind({ this.$.contentBox.show(); } }, + + // Error loading image, probably lost connection to database + imageError: function() { + Abcd.goHome(); + }, // Localization changed, update text setLocale: function() { @@ -36,13 +41,13 @@ enyo.kind({ indexChanged: function() { var collection = Abcd.collections[this.index]; var entry = Abcd.entries[collection.img]; - var image = "images/database/"+entry.code+".png"; + var image = Abcd.context.database+"images/database/"+entry.code+".png"; var text = __$FC(collection.text); if (Abcd.context.casevalue == 1) text = text.toUpperCase(); this.$.itemImage.setAttribute("src", image); this.$.itemText.removeClass("collectionText0"); - this.$.itemText.removeClass("collectionText1"); + this.$.itemText.removeClass("colle0ctionText1"); this.$.itemText.removeClass("collectionText2"); this.$.itemText.addClass("collectionText"+Abcd.context.casevalue); this.$.itemText.setContent(text); |