diff options
author | Lionel LASKE <llaske@c2s.fr> | 2013-04-14 19:08:15 (GMT) |
---|---|---|
committer | Lionel LASKE <llaske@c2s.fr> | 2013-04-14 19:08:15 (GMT) |
commit | 595bc7b6e805bcd48725ec5cb300a1ca9236e291 (patch) | |
tree | 556c532348b8e715db09a6da548a22c9fe6c2891 /html/letter.js | |
parent | 396a38ba8e978a6cfe6037fccc0a21616e0992a1 (diff) |
Add filter on letters in play game
Diffstat (limited to 'html/letter.js')
-rw-r--r-- | html/letter.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/html/letter.js b/html/letter.js index 431e052..b7b2bad 100644 --- a/html/letter.js +++ b/html/letter.js @@ -2,7 +2,7 @@ enyo.kind({ name: "Abcd.Letter", kind: "Abcd.Item", - published: { letter: "" }, + published: { letter: "", selected: false }, classes: "itemLetter", showing: false, components: [ @@ -13,6 +13,7 @@ enyo.kind({ create: function() { this.inherited(arguments); this.letterChanged(); + this.selectedChanged(); }, // Display only when image is load @@ -25,10 +26,19 @@ enyo.kind({ setLocale: function() { }, - // Card setup + // Letter setup letterChanged: function() { - this.letter = this.letter.toLowerCase() - this.$.itemImage.setAttribute("src", "images/letters/"+this.letter+Abcd.context.casevalue+".png"); + 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 |