user.on for itemstore popup, as per switz's suggestion

This commit is contained in:
Tyler Renelle 2013-01-25 16:16:28 -05:00
parent e1913d6929
commit cf81339f7a
2 changed files with 13 additions and 12 deletions

View file

@ -95,6 +95,19 @@ module.exports.setupGrowlNotifications = (model) ->
allow_dismiss: true
stackup_spacing: 10 # spacing between consecutive stacecked growls.
user.on 'set', 'items.itemsEnabled', (captures, args) ->
return unless captures == true
$('ul.items').popover
title: content.items.unlockedMessage.title
placement: 'left'
trigger: 'manual'
html: true
content: "<div class='item-store-popover'>
<img src='/img/BrowserQuest/chest.png' />
#{content.items.unlockedMessage.content} <a href='#' onClick=\"$('ul.items').popover('hide');return false;\">[Close]</a>
</div>"
$('ul.items').popover 'show'
# Setup listeners which trigger notifications
user.on 'set', 'stats.hp', (captures, args) ->
num = captures - args

View file

@ -98,18 +98,6 @@ updateStats = (newStats, update) ->
userSet 'stats.hp', 50, update
if !userObj.items.itemsEnabled and newStats.exp >=15
userSet 'items.itemsEnabled', true, update
if ($?) #can't run this on the server
$('ul.items').popover
title: content.items.unlockedMessage.title
placement: 'left'
trigger: 'manual'
html: true
content: "<div class='item-store-popover'>\
<img src='/img/BrowserQuest/chest.png' />\
#{content.items.unlockedMessage.content} <a href='#' onClick=\"$('ul.items').popover('hide');return false;\">[Close]</a>\
</div>"
$('ul.items').popover 'show'
userSet 'stats.exp', newStats.exp, update
if newStats.money?