diff --git a/client/css/bigcards.css b/client/css/bigcards.css index 885601c..fceed9a 100644 --- a/client/css/bigcards.css +++ b/client/css/bigcards.css @@ -1,20 +1,20 @@ -.card { +.card { width: 230px; height: 152px; xpadding: 5px; float: left; xmargin: 0 10px 10px 0; font-size: .9em; - + overflow: hidden; - + position: absolute; z-index: 10; - + top: 460px; left: 0px; - + display: block; } @@ -40,30 +40,36 @@ z-index: -1000; } -.content { +.content { overflow: hidden; display: block; - width: 158px; + width: 158px; height: 88px; margin: 5px 23px 0px 34px; - + font-family: 'Covered By Your Grace',"Arial Rounded MT Bold", arial, serif; font-size: 18px; - letter-spacing: 0px; - + letter-spacing: 0px; + xtext-shadow: 0px 0px 1px #444; - + opacity: 1; - + color: black; text-align: center; padding-top: 18px; xline-height: 16px; - + xopacity: .8; - + +} + +.filler { + margin-right: 34px; + margin-bottom: 42px; + margin-left: 25px; } .stickertarget { position: absolute; -} \ No newline at end of file +} diff --git a/client/css/smallcards.css b/client/css/smallcards.css index c8c93cf..e3c0613 100644 --- a/client/css/smallcards.css +++ b/client/css/smallcards.css @@ -1,20 +1,20 @@ -.card { +.card { width: 115px; height: 76px; xpadding: 5px; float: left; xmargin: 0 10px 10px 0; font-size: .9em; - + overflow: hidden; - + position: absolute; z-index: 10; - + top: 460px; left: 0px; - + display: block; } @@ -41,45 +41,52 @@ z-index: -1000; } -.content { +.content { overflow: hidden; display: block; - width: 79px; + width: 79px; height: 45px; margin: 1px 10px 0px 19px; - + font-family: "Arial Rounded MT Bold" , arial, serif; font-size: 10px; letter-spacing: 0px; - line-height: 9px; - + line-height: 9px; + xtext-shadow: 0px 0px 1px #444; - + opacity: 1; - + color: #333; text-align: center; padding-top: 8px; } -.xcontent { +.filler { + margin-right: 12px; + margin-bottom: 19px; + margin-left: 19px; +} + + +.xcontent { overflow: hidden; display: block; - width: 79px; + width: 79px; height: 45px; margin: 0px 10px 0px 19px; - + font-family: "Arial Rounded MT Bold", "Arial" , arial, serif; xfont-size: 10px; letter-spacing: 0px; - line-height: 8px; + line-height: 8px; xtext-shadow: 0px 0px 1px #444; - + opacity: 1; - + color: #333; text-align: center; padding-top: 8px; -} \ No newline at end of file +} diff --git a/client/css/style.css b/client/css/style.css index 2cad129..008a695 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -362,7 +362,7 @@ xopacity: .5; top: 1px; } -.sticker-red { +/*.sticker-red { background-image: url('/images/stickers/sticker-red.png'); background-repeat: no-repeat; background-position: right bottom; @@ -432,7 +432,7 @@ xopacity: .5; background-image: url('/images/stickers/sticker-purple.png'); background-repeat: no-repeat; background-position: right bottom; -} +}*/ @@ -540,6 +540,10 @@ input:hover { background-color: rgba(128, 128, 256,0.1) } +/*img ~ .card-hover-draggable { + -webkit-filter: hue-rotate(180deg); +}*/ + .config { position: fixed; right: 18px; @@ -557,7 +561,15 @@ input:hover { - +.filler { + xwidth: 100%; + xbackground-color: rgba(255,0,0,0.1); + xheight: 100%; + right: 0; + bottom: 0; + position: absolute; + text-align: right; +} diff --git a/client/script.js b/client/script.js index 52626e2..e21fa5a 100644 --- a/client/script.js +++ b/client/script.js @@ -168,7 +168,7 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) \ \
' + - text + '
\ + text + '\ '; var card = $(h); @@ -295,7 +295,7 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) //add applicable sticker if (sticker !== null) - $("#" + id).children('.content').addClass( sticker ); + addSticker( id, sticker ); } @@ -314,21 +314,27 @@ function moveCard(card, position) { function addSticker ( cardId , stickerId ) { - cardContent = $('#' + cardId).children('.content'); + stickerContainer = $('#' + cardId + ' .filler'); - cardContent.removeClass("sticker-red"); - cardContent.removeClass("sticker-blue"); - cardContent.removeClass("sticker-green"); - cardContent.removeClass("sticker-yellow"); - cardContent.removeClass("sticker-gold"); - cardContent.removeClass("sticker-silverstar"); - cardContent.removeClass("sticker-bluestar"); - cardContent.removeClass("sticker-redstar"); - cardContent.removeClass("sticker-orange"); - cardContent.removeClass("sticker-pink"); - cardContent.removeClass("sticker-purple"); - cardContent.removeClass("sticker-lightblue"); - cardContent.addClass( stickerId ); + if (stickerId === "nosticker") + { + stickerContainer.html(""); + return; + } + + + if ( Array.isArray( stickerId ) ) + { + for (var i in stickerId) + { + stickerContainer.prepend(''); + } + } + else + { + if ( stickerContainer.html().indexOf(stickerId) < 0 ) + stickerContainer.prepend(''); + } } diff --git a/lib/data/redis.js b/lib/data/redis.js index a9b1e90..134224d 100644 --- a/lib/data/redis.js +++ b/lib/data/redis.js @@ -4,6 +4,7 @@ var redis = require("redis"), redisClient = null; //redis.createClient(); var async = require("async"); +var sets = require('simplesets'); // If you want Memory Store instead... // var MemoryStore = require('connect/middleware/session/memory'); @@ -14,16 +15,16 @@ var REDIS_PREFIX = '#scrumblr#'; //For Redis Debugging -var db = function(callback) { +var db = function(callback) { redisClient = redis.createClient(); redisClient.on("connect", function (err) { callback(); }); - + redisClient.on("error", function (err) { console.log("Redis error: " + err); }); - + } db.prototype = { @@ -48,7 +49,7 @@ db.prototype = { // Column commands createColumn: function(room, name, callback) { - redisClient.rpush(REDIS_PREFIX + '-room:' + room + '-columns', name, + redisClient.rpush(REDIS_PREFIX + '-room:' + room + '-columns', name, function (err, res) { if (typeof callback != "undefined" && callback !== null) callback(); } @@ -72,8 +73,8 @@ db.prototype = { async.forEachSeries( columns, function( item, callback ) { - //console.log('rpush: ' + REDIS_PREFIX + '-room:' + room + '-columns' + ' -- ' + item); - redisClient.rpush(REDIS_PREFIX + '-room:' + room + '-columns', item, + //console.log('rpush: ' + REDIS_PREFIX + '-room:' + room + '-columns' + ' -- ' + item); + redisClient.rpush(REDIS_PREFIX + '-room:' + room + '-columns', item, function (err, res) { callback(); } @@ -98,14 +99,14 @@ db.prototype = { getAllCards: function(room, callback) { redisClient.hgetall(REDIS_PREFIX + '-room:' + room + '-cards', function (err, res) { - + var cards = []; - + for (i in res) { cards.push( JSON.parse(res[i]) ); } //console.dir(cards); - + callback(cards); }); }, @@ -142,21 +143,39 @@ db.prototype = { redisClient.hget(REDIS_PREFIX + '-room:' + room + '-cards', cardId, function(err, res) { var card = JSON.parse(res); if (card !== null) { - card.sticker = stickerId; - redisClient.hset(REDIS_PREFIX + '-room:' + room + '-cards', cardId, JSON.stringify(card)); + if (stickerId === "nosticker") + { + card.sticker = null; + + redisClient.hset(REDIS_PREFIX + '-room:' + room + '-cards', cardId, JSON.stringify(card)); + } + else + { + if (card.sticker !== null) + stickerSet = new sets.Set( card.sticker ); + else + stickerSet = new sets.Set(); + + stickerSet.add(stickerId); + + card.sticker = stickerSet.array(); + + redisClient.hset(REDIS_PREFIX + '-room:' + room + '-cards', cardId, JSON.stringify(card)); + } + } }); }, - + setBoardSize: function(room, size) { redisClient.set(REDIS_PREFIX + '-room:' + room + '-size', JSON.stringify(size)); }, - + getBoardSize: function(room, callback) { redisClient.get(REDIS_PREFIX + '-room:' + room + '-size', function (err, res) { callback(JSON.parse(res)); - }); + }); } - + }; exports.db = db;