Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/letter.js
blob: b7b2bad9bae29c62a9a5a21d00885735852e8bd8 (plain)
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
42
43
44
45
46
47
48
// Theme component
enyo.kind({
	name: "Abcd.Letter",
	kind: "Abcd.Item",
	published: { letter: "", selected: false },
	classes: "itemLetter",
	showing: false,
	components: [
		{ name: "itemImage", kind: "Image", 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");
		}
	},
	
	selectedChanged: function() {
		if (this.selected)
			this.addClass("itemLetter-selected");
		else
			this.removeClass("itemLetter-selected");
	},
	
	// Play sound for this letter
	play: function(media) {	
		media.play("audio/"+Abcd.context.lang+"/database/upper_"+this.letter.toUpperCase());
	}	
});