From e78cb66f9c27a3fbc7fb3d458128a7d55683bd95 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 1 Sep 2012 16:25:22 -0400 Subject: [PATCH] add icons to the notifications --- lib/app/scoring.js | 16 ++++++++-------- src/app/scoring.coffee | 17 +++++++++-------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/app/scoring.js b/lib/app/scoring.js index 040d22de4d..bdaccb4d56 100644 --- a/lib/app/scoring.js +++ b/lib/app/scoring.js @@ -3,13 +3,13 @@ var content, expModifier, hpModifier, score, statsNotification, updateStats; content = require('./content'); -statsNotification = function(html, type, number) { +statsNotification = function(html, type) { return $.bootstrapGrowl(html, { type: type, top_offset: 20, align: 'center', width: 250, - delay: 4000, + delay: 3000, allow_dismiss: true, stackup_spacing: 10 }); @@ -85,11 +85,11 @@ module.exports.score = score = function(spec) { modified = expModifier(user, 1); money += modified; exp += modified; - statsNotification("Exp,GP +" + (modified.toFixed(2)), 'success'); + statsNotification("Exp,GP +" + (modified.toFixed(2)), 'success'); } else { modified = hpModifier(user, 1); hp -= modified; - statsNotification("HP " + (modified.toFixed(2)), 'error'); + statsNotification("HP " + (modified.toFixed(2)), 'error'); } updateStats(user, { hp: hp, @@ -122,11 +122,11 @@ module.exports.score = score = function(spec) { if (type === 'reward') { money -= task.get('value'); num = task.get('value').toFixed(2); - statsNotification("GP -" + num, 'success'); + statsNotification("GP -" + num, 'success'); if (money < 0) { diff = hp + money; hp = diff; - statsNotification("HP -" + (diff.toFixed(2)), 'error'); + statsNotification("HP -" + (diff.toFixed(2)), 'error'); money = 0; } } @@ -134,11 +134,11 @@ module.exports.score = score = function(spec) { modified = expModifier(user, delta); exp += modified; money += modified; - statsNotification("Exp,GP +" + (modified.toFixed(2)), 'success'); + statsNotification("Exp,GP +" + (modified.toFixed(2)), 'success'); } else if (type !== 'reward' && type !== 'todo') { modified = hpModifier(user, delta); hp += modified; - statsNotification("HP " + (modified.toFixed(2)), 'error'); + statsNotification("HP " + (modified.toFixed(2)), 'error'); } updateStats(user, { hp: hp, diff --git a/src/app/scoring.coffee b/src/app/scoring.coffee index ed4308e9dd..6caedb8fc1 100644 --- a/src/app/scoring.coffee +++ b/src/app/scoring.coffee @@ -1,12 +1,13 @@ content = require('./content') -statsNotification = (html, type, number) -> +statsNotification = (html, type) -> + $.bootstrapGrowl html, { type: type # (null, 'info', 'error', 'success') top_offset: 20 align: 'center' # ('left', 'right', or 'center') width: 250 # (integer, or 'auto') - delay: 4000 + delay: 3000 allow_dismiss: true stackup_spacing: 10 # spacing between consecutive stacecked growls. } @@ -71,11 +72,11 @@ module.exports.score = score = (spec = {user:null, task:null, direction:null, cr modified = expModifier(user, 1) money += modified exp += modified - statsNotification "Exp,GP +#{modified.toFixed(2)}", 'success' + statsNotification "Exp,GP +#{modified.toFixed(2)}", 'success' else modified = hpModifier(user, 1) hp -= modified - statsNotification "HP #{modified.toFixed(2)}", 'error' + statsNotification "HP #{modified.toFixed(2)}", 'error' updateStats(user, {hp: hp, exp: exp, money: money}) return @@ -107,12 +108,12 @@ module.exports.score = score = (spec = {user:null, task:null, direction:null, cr # purchase item money -= task.get('value') num = task.get('value').toFixed(2) - statsNotification "GP -#{num}", 'success' + statsNotification "GP -#{num}", 'success' # if too expensive, reduce health & zero money if money < 0 diff = hp + money # hp - money difference hp = diff - statsNotification "HP -#{diff.toFixed(2)}", 'error' + statsNotification "HP -#{diff.toFixed(2)}", 'error' money = 0 # Add points to exp & money if positive delta @@ -121,12 +122,12 @@ module.exports.score = score = (spec = {user:null, task:null, direction:null, cr modified = expModifier(user, delta) exp += modified money += modified - statsNotification "Exp,GP +#{modified.toFixed(2)}", 'success' + statsNotification "Exp,GP +#{modified.toFixed(2)}", 'success' # Deduct from health (rewards case handled above) else unless type in ['reward', 'todo'] modified = hpModifier(user, delta) hp += modified - statsNotification "HP #{modified.toFixed(2)}", 'error' + statsNotification "HP #{modified.toFixed(2)}", 'error' updateStats(user, {hp: hp, exp: exp, money: money})