Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/entry.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/entry.js')
-rw-r--r--html/entry.js37
1 files changed, 32 insertions, 5 deletions
diff --git a/html/entry.js b/html/entry.js
index ee57655..4062775 100644
--- a/html/entry.js
+++ b/html/entry.js
@@ -10,8 +10,12 @@ enyo.kind({
{ name: "itemImage", classes: "entryImage", kind: "Image", onload: "imageLoaded" },
{ name: "soundIcon", kind: "Image", src: "images/sound_icon.png", classes: "entrySoundIcon" },
{ name: "itemText", classes: "entryText" }
- ]}
+ ]},
+ {kind: "Signals", onEndOfSound: "endOfSound"}
],
+ events: {
+ onEntrySoundEnded: ""
+ },
// Constructor
create: function() {
@@ -36,25 +40,48 @@ enyo.kind({
// Card setup
indexChanged: function() {
+ // Get content
var entry = Abcd.entries[this.index];
var image = "images/database/"+entry.code+".png";
var text = __$FC(entry.text);
- if (Abcd.context.upper)
+ if (Abcd.context.casevalue == 1)
text = text.toUpperCase();
+
+ // Get sound
if (entry[Abcd.context.lang]) {
this.sound = "audio/"+Abcd.context.lang+"/database/"+entry.code;
- this.$.soundIcon.setSrc("images/sound_icon.png");
+ this.$.soundIcon.setSrc("images/sound_off.png");
} else {
this.sound = null;
- this.$.soundIcon.setSrc("images/nosound_icon.png");
+ this.$.soundIcon.setSrc("images/sound_none.png");
}
+
+ // Display all
this.$.itemImage.setAttribute("src", image);
+ this.$.itemText.removeClass("entryText0");
+ this.$.itemText.removeClass("entryText1");
+ this.$.itemText.removeClass("entryText2");
+ this.$.itemText.addClass("entryText"+Abcd.context.casevalue);
this.$.itemText.setContent(text);
},
// Play sound using the media
play: function(media) {
- if (this.sound != null)
+ if (this.sound != null) {
+ this.$.soundIcon.setSrc("images/sound_on.png");
media.play(this.sound);
+ }
+ },
+
+ endOfSound: function(e, s) {
+ if (s == this.sound) {
+ this.doEntrySoundEnded();
+ this.$.soundIcon.setSrc("images/sound_off.png");
+ }
+ },
+
+ abort: function() {
+ if (this.$.soundIcon !== undefined)
+ this.$.soundIcon.setSrc("images/sound_off.png");
}
}); \ No newline at end of file