change spacing
This commit is contained in:
parent
29bca82aa9
commit
557703e0d8
1 changed files with 541 additions and 581 deletions
370
client/script.js
370
client/script.js
|
@ -9,8 +9,7 @@ var socket = io.connect();
|
|||
|
||||
//an action has happened, send it to the
|
||||
//server
|
||||
function sendAction(a, d)
|
||||
{
|
||||
function sendAction(a, d) {
|
||||
//console.log('--> ' + a);
|
||||
|
||||
var message = {
|
||||
|
@ -18,10 +17,10 @@ function sendAction(a, d)
|
|||
data: d
|
||||
};
|
||||
|
||||
socket.json.send ( message );
|
||||
socket.json.send(message);
|
||||
}
|
||||
|
||||
socket.on('connect', function(){
|
||||
socket.on('connect', function() {
|
||||
//console.log('successful socket.io connect');
|
||||
|
||||
//let the path be the room name
|
||||
|
@ -31,22 +30,20 @@ socket.on('connect', function(){
|
|||
sendAction('joinRoom', path);
|
||||
});
|
||||
|
||||
socket.on('disconnect', function(){
|
||||
socket.on('disconnect', function() {
|
||||
blockUI("Server disconnected. Refresh page to try and reconnect...");
|
||||
//$('.blockOverlay').click($.unblockUI);
|
||||
});
|
||||
|
||||
socket.on('message', function(data){
|
||||
socket.on('message', function(data) {
|
||||
getMessage(data);
|
||||
});
|
||||
|
||||
function unblockUI()
|
||||
{
|
||||
function unblockUI() {
|
||||
$.unblockUI();
|
||||
}
|
||||
|
||||
function blockUI(message)
|
||||
{
|
||||
function blockUI(message) {
|
||||
message = message || 'Waiting...';
|
||||
|
||||
$.blockUI({
|
||||
|
@ -66,16 +63,14 @@ function blockUI(message)
|
|||
}
|
||||
|
||||
//respond to an action event
|
||||
function getMessage( m )
|
||||
{
|
||||
function getMessage(m) {
|
||||
var message = m; //JSON.parse(m);
|
||||
var action = message.action;
|
||||
var data = message.data;
|
||||
|
||||
//console.log('<-- ' + action);
|
||||
|
||||
switch (action)
|
||||
{
|
||||
switch (action) {
|
||||
case 'roomAccept':
|
||||
//okay we're accepted, then request initialization
|
||||
//(this is a bit of unnessary back and forth but that's okay for now)
|
||||
|
@ -96,12 +91,15 @@ function getMessage( m )
|
|||
|
||||
case 'createCard':
|
||||
//console.log(data);
|
||||
drawNewCard(data.id, data.text, data.x, data.y, data.rot, data.colour, null);
|
||||
drawNewCard(data.id, data.text, data.x, data.y, data.rot, data.colour,
|
||||
null);
|
||||
break;
|
||||
|
||||
case 'deleteCard':
|
||||
$("#" + data.id).fadeOut(500,
|
||||
function() {$(this).remove();}
|
||||
function() {
|
||||
$(this).remove();
|
||||
}
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -134,15 +132,15 @@ function getMessage( m )
|
|||
break;
|
||||
|
||||
case 'nameChangeAnnounce':
|
||||
updateName( message.data.sid, message.data.user_name );
|
||||
updateName(message.data.sid, message.data.user_name);
|
||||
break;
|
||||
|
||||
case 'addSticker':
|
||||
addSticker( message.data.cardId, message.data.stickerId );
|
||||
addSticker(message.data.cardId, message.data.stickerId);
|
||||
break;
|
||||
|
||||
case 'setBoardSize':
|
||||
resizeBoard( message.data );
|
||||
resizeBoard(message.data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -158,16 +156,18 @@ $(document).bind('keyup', function(event) {
|
|||
keyTrap = event.which;
|
||||
});
|
||||
|
||||
function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed)
|
||||
{
|
||||
function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) {
|
||||
//cards[id] = {id: id, text: text, x: x, y: y, rot: rot, colour: colour};
|
||||
|
||||
var h = '<div id="' + id + '" class="card ' + colour +
|
||||
' draggable" style="-webkit-transform:rotate(' + rot + 'deg);\
|
||||
' draggable" style="-webkit-transform:rotate(' + rot +
|
||||
'deg);\
|
||||
">\
|
||||
<img src="/images/icons/token/Xion.png" class="card-icon delete-card-icon" />\
|
||||
<img class="card-image" src="/images/' + colour + '-card.png">\
|
||||
<div id="content:' + id + '" class="content stickertarget droppable">' +
|
||||
<img class="card-image" src="/images/' +
|
||||
colour + '-card.png">\
|
||||
<div id="content:' + id +
|
||||
'" class="content stickertarget droppable">' +
|
||||
text + '</div><span class="filler"></span>\
|
||||
</div>';
|
||||
|
||||
|
@ -185,26 +185,24 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed)
|
|||
// $(this).focus();
|
||||
// } );
|
||||
|
||||
card.draggable(
|
||||
{
|
||||
card.draggable({
|
||||
snap: false,
|
||||
snapTolerance: 5,
|
||||
containment: [0,0,2000,2000],
|
||||
containment: [0, 0, 2000, 2000],
|
||||
stack: ".card",
|
||||
start: function (event, ui) {
|
||||
start: function(event, ui) {
|
||||
keyTrap = null;
|
||||
},
|
||||
drag: function (event, ui) {
|
||||
drag: function(event, ui) {
|
||||
if (keyTrap == 27) {
|
||||
ui.helper.css(ui.originalPosition);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
//After a drag:
|
||||
card.bind( "dragstop", function(event, ui) {
|
||||
card.bind("dragstop", function(event, ui) {
|
||||
if (keyTrap == 27) {
|
||||
keyTrap = null;
|
||||
return;
|
||||
|
@ -219,16 +217,18 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed)
|
|||
sendAction('moveCard', data);
|
||||
});
|
||||
|
||||
card.children(".droppable").droppable(
|
||||
{
|
||||
card.children(".droppable").droppable({
|
||||
accept: '.sticker',
|
||||
drop: function( event, ui ) {
|
||||
drop: function(event, ui) {
|
||||
var stickerId = ui.draggable.attr("id");
|
||||
var cardId = $(this).parent().attr('id');
|
||||
|
||||
addSticker( cardId, stickerId );
|
||||
addSticker(cardId, stickerId);
|
||||
|
||||
var data = { cardId: cardId, stickerId: stickerId };
|
||||
var data = {
|
||||
cardId: cardId,
|
||||
stickerId: stickerId
|
||||
};
|
||||
sendAction('addSticker', data);
|
||||
|
||||
//remove hover state to everything on the board to prevent
|
||||
|
@ -236,16 +236,15 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed)
|
|||
$('.card-hover-draggable').removeClass('card-hover-draggable');
|
||||
},
|
||||
hoverClass: 'card-hover-draggable'
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
var speed = Math.floor(Math.random() * 1000);
|
||||
if (typeof(animationspeed) != 'undefined') speed = animationspeed;
|
||||
|
||||
var startPosition = $("#create-card").position();
|
||||
|
||||
card.css( 'top' , startPosition.top - card.height() * 0.5 );
|
||||
card.css('left', startPosition.left - card.width() * 0.5 );
|
||||
card.css('top', startPosition.top - card.height() * 0.5);
|
||||
card.css('left', startPosition.left - card.width() * 0.5);
|
||||
|
||||
card.animate({
|
||||
left: x + "px",
|
||||
|
@ -253,87 +252,87 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed)
|
|||
}, speed);
|
||||
|
||||
card.hover(
|
||||
function(){
|
||||
function() {
|
||||
$(this).addClass('hover');
|
||||
$(this).children('.card-icon').fadeIn(10);
|
||||
},
|
||||
function(){
|
||||
function() {
|
||||
$(this).removeClass('hover');
|
||||
$(this).children('.card-icon').fadeOut(150);
|
||||
}
|
||||
);
|
||||
|
||||
card.children('.card-icon').hover(
|
||||
function(){
|
||||
function() {
|
||||
$(this).addClass('card-icon-hover');
|
||||
},
|
||||
function(){
|
||||
function() {
|
||||
$(this).removeClass('card-icon-hover');
|
||||
}
|
||||
);
|
||||
|
||||
card.children('.delete-card-icon').click(
|
||||
function(){
|
||||
function() {
|
||||
$("#" + id).remove();
|
||||
//notify server of delete
|
||||
sendAction( 'deleteCard' , { 'id': id });
|
||||
sendAction('deleteCard', {
|
||||
'id': id
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
card.children('.content').editable(function(value, settings) {
|
||||
onCardChange( id, value );
|
||||
return(value);
|
||||
onCardChange(id, value);
|
||||
return (value);
|
||||
}, {
|
||||
type : 'textarea',
|
||||
submit : 'OK',
|
||||
style : 'inherit',
|
||||
cssclass : 'card-edit-form',
|
||||
placeholder : 'Double Click to Edit.',
|
||||
type: 'textarea',
|
||||
submit: 'OK',
|
||||
style: 'inherit',
|
||||
cssclass: 'card-edit-form',
|
||||
placeholder: 'Double Click to Edit.',
|
||||
onblur: 'submit',
|
||||
event: 'dblclick', //event: 'mouseover'
|
||||
});
|
||||
|
||||
//add applicable sticker
|
||||
if (sticker !== null)
|
||||
addSticker( id, sticker );
|
||||
addSticker(id, sticker);
|
||||
}
|
||||
|
||||
|
||||
function onCardChange( id, text )
|
||||
{
|
||||
sendAction('editCard', { id: id, value: text });
|
||||
function onCardChange(id, text) {
|
||||
sendAction('editCard', {
|
||||
id: id,
|
||||
value: text
|
||||
});
|
||||
}
|
||||
|
||||
function moveCard(card, position) {
|
||||
card.animate({
|
||||
left: position.left+"px",
|
||||
top: position.top+"px"
|
||||
left: position.left + "px",
|
||||
top: position.top + "px"
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function addSticker ( cardId , stickerId )
|
||||
{
|
||||
function addSticker(cardId, stickerId) {
|
||||
|
||||
stickerContainer = $('#' + cardId + ' .filler');
|
||||
|
||||
if (stickerId === "nosticker")
|
||||
{
|
||||
if (stickerId === "nosticker") {
|
||||
stickerContainer.html("");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( Array.isArray( stickerId ) )
|
||||
{
|
||||
for (var i in stickerId)
|
||||
{
|
||||
stickerContainer.prepend('<img src="images/stickers/' + stickerId[i] + '.png">');
|
||||
if (Array.isArray(stickerId)) {
|
||||
for (var i in stickerId) {
|
||||
stickerContainer.prepend('<img src="images/stickers/' + stickerId[i] +
|
||||
'.png">');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( stickerContainer.html().indexOf(stickerId) < 0 )
|
||||
stickerContainer.prepend('<img src="images/stickers/' + stickerId + '.png">');
|
||||
} else {
|
||||
if (stickerContainer.html().indexOf(stickerId) < 0)
|
||||
stickerContainer.prepend('<img src="images/stickers/' + stickerId +
|
||||
'.png">');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -342,8 +341,7 @@ function addSticker ( cardId , stickerId )
|
|||
//----------------------------------
|
||||
// cards
|
||||
//----------------------------------
|
||||
function createCard( id, text, x, y, rot, colour )
|
||||
{
|
||||
function createCard(id, text, x, y, rot, colour) {
|
||||
drawNewCard(id, text, x, y, rot, colour, null);
|
||||
|
||||
var action = "createCard";
|
||||
|
@ -361,8 +359,7 @@ function createCard( id, text, x, y, rot, colour )
|
|||
|
||||
}
|
||||
|
||||
function randomCardColour()
|
||||
{
|
||||
function randomCardColour() {
|
||||
var colours = ['yellow', 'green', 'blue', 'white'];
|
||||
|
||||
var i = Math.floor(Math.random() * colours.length);
|
||||
|
@ -371,15 +368,13 @@ function randomCardColour()
|
|||
}
|
||||
|
||||
|
||||
function initCards( cardArray )
|
||||
{
|
||||
function initCards(cardArray) {
|
||||
//first delete any cards that exist
|
||||
$('.card').remove();
|
||||
|
||||
cards = cardArray;
|
||||
|
||||
for (var i in cardArray)
|
||||
{
|
||||
for (var i in cardArray) {
|
||||
card = cardArray[i];
|
||||
|
||||
drawNewCard(
|
||||
|
@ -402,24 +397,24 @@ function initCards( cardArray )
|
|||
// cols
|
||||
//----------------------------------
|
||||
|
||||
function drawNewColumn (columnName)
|
||||
{
|
||||
function drawNewColumn(columnName) {
|
||||
var cls = "col";
|
||||
if (totalcolumns === 0)
|
||||
{
|
||||
if (totalcolumns === 0) {
|
||||
cls = "col first";
|
||||
}
|
||||
|
||||
$('#icon-col').before('<td class="' + cls + '" width="10%" style="display:none"><h2 id="col-' + (totalcolumns+1) + '" class="editable">' + columnName + '</h2></td>');
|
||||
$('#icon-col').before('<td class="' + cls +
|
||||
'" width="10%" style="display:none"><h2 id="col-' + (totalcolumns + 1) +
|
||||
'" class="editable">' + columnName + '</h2></td>');
|
||||
|
||||
$('.editable').editable(function(value, settings) {
|
||||
onColumnChange( this.id, value );
|
||||
return(value);
|
||||
onColumnChange(this.id, value);
|
||||
return (value);
|
||||
}, {
|
||||
style : 'inherit',
|
||||
cssclass : 'card-edit-form',
|
||||
type : 'textarea',
|
||||
placeholder : 'New',
|
||||
style: 'inherit',
|
||||
cssclass: 'card-edit-form',
|
||||
type: 'textarea',
|
||||
placeholder: 'New',
|
||||
onblur: 'submit',
|
||||
width: '',
|
||||
height: '',
|
||||
|
@ -429,11 +424,10 @@ function drawNewColumn (columnName)
|
|||
|
||||
$('.col:last').fadeIn(1500);
|
||||
|
||||
totalcolumns ++;
|
||||
totalcolumns++;
|
||||
}
|
||||
|
||||
function onColumnChange( id, text )
|
||||
{
|
||||
function onColumnChange(id, text) {
|
||||
var names = Array();
|
||||
|
||||
//console.log(id + " " + text );
|
||||
|
@ -444,13 +438,10 @@ function onColumnChange( id, text )
|
|||
//get ID of current column we are traversing over
|
||||
var thisID = $(this).children("h2").attr('id');
|
||||
|
||||
if (id == thisID)
|
||||
{
|
||||
names.push( text );
|
||||
}
|
||||
else
|
||||
{
|
||||
names.push( $(this).text() );
|
||||
if (id == thisID) {
|
||||
names.push(text);
|
||||
} else {
|
||||
names.push($(this).text());
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -458,24 +449,22 @@ function onColumnChange( id, text )
|
|||
updateColumns(names);
|
||||
}
|
||||
|
||||
function displayRemoveColumn()
|
||||
{
|
||||
function displayRemoveColumn() {
|
||||
if (totalcolumns <= 0) return false;
|
||||
|
||||
$('.col:last').fadeOut( 150,
|
||||
$('.col:last').fadeOut(150,
|
||||
function() {
|
||||
$(this).remove();
|
||||
}
|
||||
);
|
||||
|
||||
totalcolumns --;
|
||||
totalcolumns--;
|
||||
}
|
||||
|
||||
function createColumn( name )
|
||||
{
|
||||
function createColumn(name) {
|
||||
if (totalcolumns >= 8) return false;
|
||||
|
||||
drawNewColumn( name );
|
||||
drawNewColumn(name);
|
||||
columns.push(name);
|
||||
|
||||
var action = "updateColumns";
|
||||
|
@ -485,8 +474,7 @@ function createColumn( name )
|
|||
sendAction(action, data);
|
||||
}
|
||||
|
||||
function deleteColumn()
|
||||
{
|
||||
function deleteColumn() {
|
||||
if (totalcolumns <= 0) return false;
|
||||
|
||||
displayRemoveColumn();
|
||||
|
@ -499,8 +487,7 @@ function deleteColumn()
|
|||
sendAction(action, data);
|
||||
}
|
||||
|
||||
function updateColumns( c )
|
||||
{
|
||||
function updateColumns(c) {
|
||||
columns = c;
|
||||
|
||||
var action = "updateColumns";
|
||||
|
@ -510,21 +497,18 @@ function updateColumns( c )
|
|||
sendAction(action, data);
|
||||
}
|
||||
|
||||
function deleteColumns( next )
|
||||
{
|
||||
function deleteColumns(next) {
|
||||
//delete all existing columns:
|
||||
$('.col').fadeOut( 'slow', next() );
|
||||
$('.col').fadeOut('slow', next());
|
||||
}
|
||||
|
||||
function initColumns( columnArray )
|
||||
{
|
||||
function initColumns(columnArray) {
|
||||
totalcolumns = 0;
|
||||
columns = columnArray;
|
||||
|
||||
$('.col').remove();
|
||||
|
||||
for (var i in columnArray)
|
||||
{
|
||||
for (var i in columnArray) {
|
||||
column = columnArray[i];
|
||||
|
||||
drawNewColumn(
|
||||
|
@ -534,8 +518,7 @@ function initColumns( columnArray )
|
|||
}
|
||||
|
||||
|
||||
function changeThemeTo( theme )
|
||||
{
|
||||
function changeThemeTo(theme) {
|
||||
currentTheme = theme;
|
||||
$("link[title=cardsize]").attr("href", "/css/" + theme + ".css");
|
||||
}
|
||||
|
@ -547,60 +530,52 @@ function changeThemeTo( theme )
|
|||
|
||||
|
||||
|
||||
function setCookie(c_name,value,exdays)
|
||||
{
|
||||
var exdate=new Date();
|
||||
function setCookie(c_name, value, exdays) {
|
||||
var exdate = new Date();
|
||||
exdate.setDate(exdate.getDate() + exdays);
|
||||
var c_value=escape(value) + ((exdays===null) ? "" : "; expires="+exdate.toUTCString());
|
||||
document.cookie=c_name + "=" + c_value;
|
||||
var c_value = escape(value) + ((exdays === null) ? "" : "; expires=" +
|
||||
exdate.toUTCString());
|
||||
document.cookie = c_name + "=" + c_value;
|
||||
}
|
||||
|
||||
function getCookie(c_name)
|
||||
{
|
||||
var i,x,y,ARRcookies=document.cookie.split(";");
|
||||
for (i=0;i<ARRcookies.length;i++)
|
||||
{
|
||||
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
|
||||
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
|
||||
x=x.replace(/^\s+|\s+$/g,"");
|
||||
if (x==c_name)
|
||||
{
|
||||
function getCookie(c_name) {
|
||||
var i, x, y, ARRcookies = document.cookie.split(";");
|
||||
for (i = 0; i < ARRcookies.length; i++) {
|
||||
x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
|
||||
y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
|
||||
x = x.replace(/^\s+|\s+$/g, "");
|
||||
if (x == c_name) {
|
||||
return unescape(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function setName( name )
|
||||
{
|
||||
sendAction( 'setUserName', name );
|
||||
function setName(name) {
|
||||
sendAction('setUserName', name);
|
||||
|
||||
setCookie('scrumscrum-username', name, 365);
|
||||
}
|
||||
|
||||
function displayInitialUsers (users)
|
||||
{
|
||||
for (var i in users)
|
||||
{
|
||||
function displayInitialUsers(users) {
|
||||
for (var i in users) {
|
||||
//console.log(users);
|
||||
displayUserJoined(users[i].sid, users[i].user_name);
|
||||
}
|
||||
}
|
||||
|
||||
function displayUserJoined ( sid, user_name )
|
||||
{
|
||||
function displayUserJoined(sid, user_name) {
|
||||
name = '';
|
||||
if (user_name)
|
||||
name = user_name;
|
||||
else
|
||||
name = sid.substring(0,5);
|
||||
name = sid.substring(0, 5);
|
||||
|
||||
|
||||
$('#names-ul').append('<li id="user-' + sid + '">' + name + '</li>');
|
||||
}
|
||||
|
||||
function displayUserLeft ( sid )
|
||||
{
|
||||
function displayUserLeft(sid) {
|
||||
name = '';
|
||||
if (name)
|
||||
name = user_name;
|
||||
|
@ -609,34 +584,32 @@ function displayUserLeft ( sid )
|
|||
|
||||
var id = '#user-' + sid.toString();
|
||||
|
||||
$('#names-ul').children(id).fadeOut( 1000 , function() {
|
||||
$('#names-ul').children(id).fadeOut(1000, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function updateName ( sid, name )
|
||||
{
|
||||
function updateName(sid, name) {
|
||||
var id = '#user-' + sid.toString();
|
||||
|
||||
$('#names-ul').children(id).text( name );
|
||||
$('#names-ul').children(id).text(name);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
function boardResizeHappened(event, ui)
|
||||
{
|
||||
function boardResizeHappened(event, ui) {
|
||||
var newsize = ui.size;
|
||||
|
||||
sendAction( 'setBoardSize', newsize);
|
||||
sendAction('setBoardSize', newsize);
|
||||
}
|
||||
|
||||
function resizeBoard (size) {
|
||||
$( ".board-outline" ).animate( {
|
||||
function resizeBoard(size) {
|
||||
$(".board-outline").animate({
|
||||
height: size.height,
|
||||
width: size.width
|
||||
} );
|
||||
});
|
||||
}
|
||||
//////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////
|
||||
|
@ -647,10 +620,11 @@ function calcCardOffset() {
|
|||
var card = $(this);
|
||||
$(".col").each(function(i) {
|
||||
var col = $(this);
|
||||
if(col.offset().left + col.outerWidth() > card.offset().left + card.outerWidth() || i === $(".col").size() - 1) {
|
||||
if (col.offset().left + col.outerWidth() > card.offset().left +
|
||||
card.outerWidth() || i === $(".col").size() - 1) {
|
||||
offsets[card.attr('id')] = {
|
||||
col: col,
|
||||
x: ( (card.offset().left - col.offset().left) / col.outerWidth() )
|
||||
x: ((card.offset().left - col.offset().left) / col.outerWidth())
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
@ -707,30 +681,26 @@ $(function() {
|
|||
//setTimeout($.unblockUI, 2000);
|
||||
|
||||
|
||||
$( "#create-card" )
|
||||
$("#create-card")
|
||||
.click(function() {
|
||||
var rotation = Math.random() * 10 - 5; //add a bit of random rotation (+/- 10deg)
|
||||
uniqueID = Math.round(Math.random()*99999999); //is this big enough to assure uniqueness?
|
||||
uniqueID = Math.round(Math.random() * 99999999); //is this big enough to assure uniqueness?
|
||||
//alert(uniqueID);
|
||||
createCard(
|
||||
'card' + uniqueID,
|
||||
'',
|
||||
58, $('div.board-outline').height(),// hack - not a great way to get the new card coordinates, but most consistant ATM
|
||||
58, $('div.board-outline').height(), // hack - not a great way to get the new card coordinates, but most consistant ATM
|
||||
rotation,
|
||||
randomCardColour());
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// Style changer
|
||||
$("#smallify").click(function(){
|
||||
if (currentTheme == "bigcards")
|
||||
{
|
||||
$("#smallify").click(function() {
|
||||
if (currentTheme == "bigcards") {
|
||||
changeThemeTo('smallcards');
|
||||
}
|
||||
else if (currentTheme == "smallcards")
|
||||
{
|
||||
} else if (currentTheme == "smallcards") {
|
||||
changeThemeTo('bigcards');
|
||||
}
|
||||
/*else if (currentTheme == "nocards")
|
||||
|
@ -757,14 +727,14 @@ $(function() {
|
|||
);
|
||||
|
||||
$('#add-col').click(
|
||||
function(){
|
||||
function() {
|
||||
createColumn('New');
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
$('#delete-col').click(
|
||||
function(){
|
||||
function() {
|
||||
deleteColumn();
|
||||
return false;
|
||||
}
|
||||
|
@ -785,10 +755,8 @@ $(function() {
|
|||
|
||||
|
||||
|
||||
$("#yourname-input").focus(function()
|
||||
{
|
||||
if ($(this).val() == 'unknown')
|
||||
{
|
||||
$("#yourname-input").focus(function() {
|
||||
if ($(this).val() == 'unknown') {
|
||||
$(this).val("");
|
||||
}
|
||||
|
||||
|
@ -796,10 +764,8 @@ $(function() {
|
|||
|
||||
});
|
||||
|
||||
$("#yourname-input").blur(function()
|
||||
{
|
||||
if ($(this).val() === "")
|
||||
{
|
||||
$("#yourname-input").blur(function() {
|
||||
if ($(this).val() === "") {
|
||||
$(this).val('unknown');
|
||||
}
|
||||
$(this).removeClass('focused');
|
||||
|
@ -812,33 +778,31 @@ $(function() {
|
|||
|
||||
$("#yourname-li").hide();
|
||||
|
||||
$("#yourname-input").keypress(function(e)
|
||||
{
|
||||
code= (e.keyCode ? e.keyCode : e.which);
|
||||
if (code == 10 || code == 13)
|
||||
{
|
||||
$("#yourname-input").keypress(function(e) {
|
||||
code = (e.keyCode ? e.keyCode : e.which);
|
||||
if (code == 10 || code == 13) {
|
||||
$(this).blur();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$( ".sticker" ).draggable({
|
||||
$(".sticker").draggable({
|
||||
revert: true,
|
||||
zIndex: 1000
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$( ".board-outline" ).resizable( {
|
||||
$(".board-outline").resizable({
|
||||
ghost: false,
|
||||
minWidth: 700,
|
||||
minHeight: 400 ,
|
||||
minHeight: 400,
|
||||
maxWidth: 3200,
|
||||
maxHeight: 1800,
|
||||
} );
|
||||
});
|
||||
|
||||
//A new scope for precalculating
|
||||
(function() {
|
||||
//A new scope for precalculating
|
||||
(function() {
|
||||
var offsets;
|
||||
|
||||
$(".board-outline").bind("resizestart", function() {
|
||||
|
@ -851,26 +815,22 @@ $( ".board-outline" ).resizable( {
|
|||
boardResizeHappened(event, ui);
|
||||
adjustCard(offsets, true);
|
||||
});
|
||||
})();
|
||||
})();
|
||||
|
||||
|
||||
|
||||
$('#marker').draggable(
|
||||
{
|
||||
$('#marker').draggable({
|
||||
axis: 'x',
|
||||
containment: 'parent'
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('#eraser').draggable(
|
||||
{
|
||||
$('#eraser').draggable({
|
||||
axis: 'x',
|
||||
containment: 'parent'
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
//disable image dragging
|
||||
//window.ondragstart = function() { return false; };
|
||||
//disable image dragging
|
||||
//window.ondragstart = function() { return false; };
|
||||
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue