diff options
Diffstat (limited to 'html/entry.js')
-rw-r--r-- | html/entry.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/html/entry.js b/html/entry.js index 5107cd8..ea25a5f 100644 --- a/html/entry.js +++ b/html/entry.js @@ -7,7 +7,7 @@ enyo.kind({ components: [ { name: "spinner", kind: "Image", src: "images/spinner-light.gif", classes: "spinner"}, { name: "contentBox", showing: false, components: [ - { name: "itemImage", classes: "entryImage", kind: "Image", onload: "imageLoaded" }, + { name: "itemImage", classes: "entryImage", kind: "Image", onload: "imageLoaded", onerror: "imageError" }, { name: "soundIcon", kind: "Image", classes: "entrySoundIcon" }, { name: "itemText", classes: "entryText" } ]}, @@ -34,6 +34,11 @@ enyo.kind({ this.$.contentBox.show(); } }, + + // Error loading image, probably lost connection to database + imageError: function() { + Abcd.goHome(); + }, // Unique visibility options imageonlyChanged: function() { @@ -61,7 +66,7 @@ enyo.kind({ indexChanged: function() { // Get content var entry = Abcd.entries[this.index]; - var image = "images/database/"+entry.code+".png"; + var image = Abcd.context.database+"images/database/"+entry.code+".png"; var text = __$FC(entry.text); if (Abcd.context.casevalue == 1) text = text.toUpperCase(); @@ -69,7 +74,7 @@ enyo.kind({ // Get sound if (this.soundonly) this.$.soundIcon.addClass("entrySoundIconOnly"); if (entry[Abcd.context.lang]) { - this.sound = "audio/"+Abcd.context.lang+"/database/"+entry.code; + this.sound = Abcd.context.database+"audio/"+Abcd.context.lang+"/database/"+entry.code; this.$.soundIcon.setSrc("images/sound_off"+(this.soundonly?1:0)+".png"); } else { this.sound = null; |