JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
make selection display clickable (when it's a word)
[hexbog.git] / main.coffee
index 9db18fe..015ce7c 100644 (file)
@@ -245,8 +245,8 @@ update_selection_display = ->
        word = selected_word()
        $big_tip.removeClass('good')
        if word.length > 0
-               $big_tip.html word
                if word.length < 3
+                       $big_tip.html word
                        $little_tip.html "Click more tiles (3 minimum)"
                else
                        if is_word word
@@ -255,8 +255,10 @@ update_selection_display = ->
                                else
                                        last = ''
                                $little_tip.html "Click the #{last}\"#{word.substr(word.length - 1)}\" for #{score_for word} points"
+                               $big_tip.html "<a href=\"http://en.wiktionary.org/wiki/#{word}\" target=\"_blank\" title=\"click for definition\">#{word}</a>"
                                $big_tip.addClass('good')
                        else
+                               $big_tip.html word
                                $little_tip.html "\"#{word}\" is not in the word list."
        else
                $big_tip.html "← Click a word"
@@ -526,8 +528,8 @@ extract_wiktionary_definiton = (html) ->
                if part and el.tagName is 'OL'
                        $(el).children().each (i, el) ->
                                new_def = $(el).text()
-                               if new_def.substr(0, 9) is '(obsolete' or new_def.substr(0, 8) is "(archaic"
-                                       key = 'obsolete'
+                               if new_def.substr(0, 9) is '(obsolete' or new_def.substr(0, 8) is "(archaic" or new_def.substr(0, 20) is "Alternative form of " or new_def.substr(0, 24) is "Alternative spelling of "
+                                       key = 'lame'
                                else
                                        if part is 'verb'
                                                key = 'verb'
@@ -541,7 +543,7 @@ extract_wiktionary_definiton = (html) ->
                        if found.verb
                                return false # break
 
-       part_defs = (finds[i] for i in ['verb', 'nonverb', 'obsolete'] when finds[i])
+       part_defs = (finds[i] for i in ['verb', 'nonverb', 'lame'] when finds[i])
        unless part_defs.length
                return false