Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/theme.js
blob: 066d60bc37f3632434262787d8c82a26ddcdb741 (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
// Theme component
enyo.kind({
	name: "Abcd.Theme",
	kind: "Abcd.Item",
	published: { index: "" },
	classes: "theme",
	components: [	
		{ name: "spinner", kind: "Image", src: "images/spinner-light.gif", classes: "spinner"},	
		{ name: "contentBox", showing: false, components: [		
			{ name: "itemImage", classes: "themeImage", kind: "Image", onload: "imageLoaded" },
			{ name: "itemText", classes: "themeText" }
		]}
	],
	
	// Constructor
	create: function() {
		this.inherited(arguments);
		this.indexChanged();
	},
	
	// Display only when image is load
	imageLoaded: function() {
		if (this.index !== "") {
			this.$.spinner.hide();
			this.$.contentBox.show();
		}
	},
	
	// Localization changed, update text 
	setLocale: function() {
		this.indexChanged();
		this.inherited(arguments);
	},
	
	// Card setup
	indexChanged: function() {
		var theme = Abcd.themes[this.index];
		var entry = Abcd.entries[theme.img];
		var image = "images/database/"+entry.code+".png";
		var text = __$FC(theme.text);
		if (Abcd.context.upper)
			text = text.toUpperCase();
		this.$.itemImage.setAttribute("src", image);
		this.$.itemText.setContent(text);
		this.addClass("themeColor"+this.index);
	}
});