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.html "<a href=\"https://en.wiktionary.org/wiki/#{word}\" target=\"_blank\" title=\"click for definition\">#{word}</a>"
$big_tip.addClass('good')
else
$big_tip.html word
update_selection_display()
_unselect_tile = ->
- html_tile = selected.pop().dom
- html_tile.removeClass 'selected_word'
- html_tile.removeClass 'selected'
+ tile = selected.pop()
+ dom = tile.dom
+ if tile.connector?
+ tile.connector.remove()
+ delete tile.connector
+ dom.removeClass 'selected_word'
+ dom.removeClass 'selected'
unselect_all = ->
while selected.length
force = effects.force.last()
if force > 0
for tile in area.up
- tile.new_hp = tile.hp + force
+ if tile.new_hp
+ # for overlap of board and [n]neigbors
+ tile.new_hp += force
+ else
+ tile.new_hp = tile.hp + force
for s in spaces
s.tile.new_hp ?= s.tile.hp - 1
if s.tile.new_hp < 0
activate_selection = ->
word = selected_word()
if word.length < 3
+ # should only happen when trying to blip a word with the keyboard
# FIXME make this a hint
log "Too short: \"#{word}\""
return
unless is_word word
+ # should only happen when trying to blip a word with the keyboard
# FIXME make this automatically part of the selection display
log "Not on word list: \"#{word}\""
return
show_definition = (word, type, definition, language) ->
- html = "<a href=\"http://en.wiktionary.org/wiki/#{word}\" target=\"_blank\">"
+ html = "<a href=\"https://en.wiktionary.org/wiki/#{word}\" target=\"_blank\">"
html += "#{word.substr(0, 1).toUpperCase() + word.substr(1)}</a>, #{type}"
if language isnt 'English'
html += " (#{language})"
html += ': '
html += definition
- html += '<div id="definition_credit">Definition ©<a href="http://en.wiktionary.org/" target="_blank">wiktionary.org</a> CC-BY-SA</div>'
+ html += '<div id="definition_credit">Definition ©<a href="https://en.wiktionary.org/" target="_blank">wiktionary.org</a> CC-BY-SA</div>'
$definition_body.html html
+connector_width = 11
+connector_radius = 4
+connector_slant = 12
+add_connector = (tile, horiz, vert) ->
+ style = {}
+ switch horiz
+ when 'left'
+ style.left = -9
+ when 'mid'
+ style.left = 21 - connector_radius
+ when 'right'
+ style.right = -9
+ switch vert
+ when 'top'
+ style.top = -9
+ when 'up'
+ style.top = 21 - connector_radius - connector_slant
+ when 'down'
+ style.top = 21 - connector_radius + connector_slant
+ when 'bot'
+ style.bottom = -9
+ tile.connector = $("<div class=\"connector\"></div>").css style
+ tile.dom.append tile.connector
select_tile = (tile) ->
selected.push tile
+ if selected.length > 1
+ prev = selected[selected.length - 2]
+ if prev.space.top_px < tile.space.top_px
+ if prev.space.left_px < tile.space.left_px
+ add_connector tile, 'left', 'up'
+ else if prev.space.left_px is tile.space.left_px
+ add_connector tile, 'mid', 'top'
+ else
+ add_connector tile, 'right', 'up'
+ else
+ if prev.space.left_px < tile.space.left_px
+ add_connector tile, 'left', 'down'
+ else if prev.space.left_px is tile.space.left_px
+ add_connector tile, 'mid', 'bot'
+ else
+ add_connector tile, 'right', 'down'
update_selection_display()
new_tile = (space, y) ->
look_up_definition = (word) ->
$definition_body.html "Looking up definition for \"#{word}\"..."
$.ajax({
- url: "http://en.wiktionary.org/w/api.php?action=parse&format=json&page=#{word}"
+ url: "https://en.wiktionary.org/w/api.php?action=parse&format=json&page=#{word}"
jsonpCallback: "lud_#{word}" # always use the same callback for the same word so it's cacheable
dataType: 'jsonp'
cache: true