forked from llaske/sugarizer
-
Notifications
You must be signed in to change notification settings - Fork 53
/
letter.js
41 lines (36 loc) · 967 Bytes
/
letter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Letter component
enyo.kind({
name: "Abcd.Letter",
kind: "Abcd.Item",
published: { letter: "" },
classes: "itemLetter",
showing: false,
components: [
{ name: "itemImage", kind: "Image", classes: "itemImage", onload: "imageLoaded" }
],
// Constructor
create: function() {
this.inherited(arguments);
this.letterChanged();
this.selectedChanged();
},
// Display only when image is load
imageLoaded: function() {
if (this.letter !== "")
this.show();
},
// Localization changed, nothing to do
setLocale: function() {
},
// Letter setup
letterChanged: function() {
if (this.letter !== "") {
this.letter = this.letter.toLowerCase();
this.$.itemImage.setAttribute("src", "images/letters/"+this.letter+Abcd.context.casevalue+".png");
}
},
// Play sound for this letter
play: function(media) {
media.play(Abcd.context.getDatabase()+"audio/"+Abcd.context.lang+"/database/upper_"+this.letter.toUpperCase());
}
});